Commit 4218eb67 authored by Natanael Copa's avatar Natanael Copa

main/mpv: replace mplayer 2 with this new package

parent 1208bf2d
From c33fafd6f1bc2a430c114231cecc6e1c56c1f939 Mon Sep 17 00:00:00 2001
From: Uoti Urpala <uau@mplayer2.org>
Date: Tue, 19 Apr 2011 23:59:45 +0000
Subject: Update libav API uses
Update various code to use newer alternatives instead of deprecated
functions/fields that are being dropped at libav API bump. An
exception is avcodec_thread_init() which is being dropped even though
it's still _necessary_ with fairly recent libav versions, so there's
no good alternative which would work with both those recent versions
and latest libavcodec. I think there are grounds to consider the drop
premature and revert it for now; if that doesn't happen I'll add a
version-test #if check around it later.
---
diff --git a/av_log.c b/av_log.c
index bd42ce3..bcf1a14 100644
--- a/av_log.c
+++ b/av_log.c
@@ -57,10 +57,10 @@ static int extract_msg_type_from_ctx(void *ptr)
if (!strcmp(avc->class_name, "AVCodecContext")) {
AVCodecContext *s = ptr;
if (s->codec) {
- if (s->codec->type == CODEC_TYPE_AUDIO) {
+ if (s->codec->type == AVMEDIA_TYPE_AUDIO) {
if (s->codec->decode)
return MSGT_DECAUDIO;
- } else if (s->codec->type == CODEC_TYPE_VIDEO) {
+ } else if (s->codec->type == AVMEDIA_TYPE_VIDEO) {
if (s->codec->decode)
return MSGT_DECVIDEO;
}
diff --git a/av_opts.c b/av_opts.c
index 452253b..59f47ed 100644
--- a/av_opts.c
+++ b/av_opts.c
@@ -37,7 +37,7 @@ int parse_avopts(void *v, char *str){
arg = strchr(str, '=');
if(arg) *arg++= 0;
- if(!av_set_string(v, str, arg)){
+ if (av_set_string3(v, str, arg, 0, NULL) < 0) {
free(start);
return -1;
}
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index ec6a2f7..8f56e71 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -127,7 +127,7 @@ static int init(sh_audio_t *sh_audio)
}
lavc_context->request_channels = opts->audio_output_channels;
lavc_context->codec_tag = sh_audio->format; //FOURCC
- lavc_context->codec_type = CODEC_TYPE_AUDIO;
+ lavc_context->codec_type = AVMEDIA_TYPE_AUDIO;
lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi
/* alloc extra data */
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 2424dda..431b5cd 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -208,7 +208,7 @@ static int init(sh_video_t *sh){
ctx->avctx = avcodec_alloc_context();
avctx = ctx->avctx;
avctx->opaque = sh;
- avctx->codec_type = CODEC_TYPE_VIDEO;
+ avctx->codec_type = AVMEDIA_TYPE_VIDEO;
avctx->codec_id = lavc_codec->id;
if (lavc_codec->capabilities & CODEC_CAP_HWACCEL // XvMC
@@ -541,14 +541,12 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
type = MP_IMGTYPE_STATIC;
flags |= MP_IMGFLAG_PRESERVE;
}
- flags|=(!avctx->hurry_up && ctx->do_slices) ?
- MP_IMGFLAG_DRAW_CALLBACK:0;
+ flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0;
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, type == MP_IMGTYPE_STATIC ? "using STATIC\n" : "using TEMP\n");
} else {
if(!pic->reference){
ctx->b_count++;
- flags|=(!avctx->hurry_up && ctx->do_slices) ?
- MP_IMGFLAG_DRAW_CALLBACK:0;
+ flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK:0;
}else{
ctx->ip_count++;
flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE
@@ -787,7 +785,7 @@ static struct mp_image *decode(struct sh_video *sh, void *data, int len,
pkt.data = data;
pkt.size = len;
// HACK: make PNGs decode normally instead of as CorePNG delta frames
- pkt.flags = PKT_FLAG_KEY;
+ pkt.flags = AV_PKT_FLAG_KEY;
// The avcodec opaque field stupidly supports only int64_t type
*(double *)&avctx->reordered_opaque = *reordered_pts;
ret = avcodec_decode_video2(avctx, pic, &got_picture, &pkt);
diff --git a/libmpcodecs/vf_geq.c b/libmpcodecs/vf_geq.c
index ed855d1..68a9cf7 100644
--- a/libmpcodecs/vf_geq.c
+++ b/libmpcodecs/vf_geq.c
@@ -116,7 +116,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
const_values[3]=y;
for(x=0; x<w; x++){
const_values[2]=x;
- dst[x + y * dst_stride] = av_eval_expr(vf->priv->e[plane],
+ dst[x + y * dst_stride] = av_expr_eval(vf->priv->e[plane],
const_values, vf);
}
}
@@ -176,7 +176,7 @@ static int vf_open(vf_instance_t *vf, char *args){
plane==0 ? lum : (plane==1 ? cb : cr),
NULL
};
- res = av_parse_expr(&vf->priv->e[plane], eq[plane], const_names, NULL, NULL, func2_names, func2, 0, NULL);
+ res = av_expr_parse(&vf->priv->e[plane], eq[plane], const_names, NULL, NULL, func2_names, func2, 0, NULL);
if (res < 0) {
mp_msg(MSGT_VFILTER, MSGL_ERR, "geq: error loading equation `%s'\n", eq[plane]);
diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c
index f3dc4d9..10c4edf 100644
--- a/libmpcodecs/vf_pp.c
+++ b/libmpcodecs/vf_pp.c
@@ -37,7 +37,7 @@
struct vf_priv_s {
int pp;
- pp_mode_t *ppMode[PP_QUALITY_MAX+1];
+ pp_mode *ppMode[PP_QUALITY_MAX+1];
void *context;
unsigned int outfmt;
};
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 3aca4b6..0c5b6da 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -289,7 +289,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
codec->codec_tag = override_tag;
switch(codec->codec_type){
- case CODEC_TYPE_AUDIO:{
+ case AVMEDIA_TYPE_AUDIO:{
WAVEFORMATEX *wf;
sh_audio_t* sh_audio;
sh_audio = new_sh_audio_aid(demuxer, i, priv->audio_streams);
@@ -361,7 +361,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
stream_id = priv->audio_streams++;
break;
}
- case CODEC_TYPE_VIDEO:{
+ case AVMEDIA_TYPE_VIDEO:{
sh_video_t* sh_video;
BITMAPINFOHEADER *bih;
sh_video=new_sh_video_vid(demuxer, i, priv->video_streams);
@@ -433,7 +433,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
stream_id = priv->video_streams++;
break;
}
- case CODEC_TYPE_SUBTITLE:{
+ case AVMEDIA_TYPE_SUBTITLE:{
sh_sub_t* sh_sub;
char type;
/* only support text subtitles for now */
@@ -476,9 +476,12 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
stream_id = priv->sub_streams++;
break;
}
- case CODEC_TYPE_ATTACHMENT:{
+ case AVMEDIA_TYPE_ATTACHMENT:{
+ AVMetadataTag *ftag = av_metadata_get(st->metadata, "filename",
+ NULL, 0);
+ char *filename = ftag ? ftag->value : NULL;
if (st->codec->codec_id == CODEC_ID_TTF)
- demuxer_add_attachment(demuxer, BSTR(st->filename),
+ demuxer_add_attachment(demuxer, BSTR(filename),
BSTR("application/x-truetype-font"),
(struct bstr){codec->extradata,
codec->extradata_size});
@@ -755,14 +758,14 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
if(ts != AV_NOPTS_VALUE){
dp->pts = ts * av_q2d(priv->avfc->streams[id]->time_base);
priv->last_pts= dp->pts * AV_TIME_BASE;
- // always set duration for subtitles, even if PKT_FLAG_KEY is not set,
+ // always set duration for subtitles, even if AV_PKT_FLAG_KEY isn't set,
// otherwise they will stay on screen to long if e.g. ASS is demuxed from mkv
- if((ds == demux->sub || (pkt.flags & PKT_FLAG_KEY)) &&
+ if ((ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) &&
pkt.convergence_duration > 0)
dp->duration = pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base);
}
dp->pos=demux->filepos;
- dp->flags= !!(pkt.flags&PKT_FLAG_KEY);
+ dp->flags = !!(pkt.flags & AV_PKT_FLAG_KEY);
// append packet to DS stream:
ds_add_packet(ds,dp);
return 1;
@@ -922,15 +925,15 @@ redo:
{
switch(priv->avfc->streams[program->stream_index[i]]->codec->codec_type)
{
- case CODEC_TYPE_VIDEO:
+ case AVMEDIA_TYPE_VIDEO:
if(prog->vid == -2)
prog->vid = program->stream_index[i];
break;
- case CODEC_TYPE_AUDIO:
+ case AVMEDIA_TYPE_AUDIO:
if(prog->aid == -2)
prog->aid = program->stream_index[i];
break;
- case CODEC_TYPE_SUBTITLE:
+ case AVMEDIA_TYPE_SUBTITLE:
if(prog->sid == -2 && priv->avfc->streams[program->stream_index[i]]->codec->codec_id == CODEC_ID_TEXT)
prog->sid = program->stream_index[i];
break;
--
cgit v0.9
Fix broken audio decoding when compiling with gcc-4.6
http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2011-May/068495.html
--- ./mp3lib/dct64_sse.c.orig
+++ ./mp3lib/dct64_sse.c
@@ -113,7 +113,6 @@
}
{
- real *costab = costab_mmx + 24;
int i;
__asm__(
@@ -122,7 +121,7 @@
"movaps %1, %%xmm5\n\t"
"movaps %%xmm5, %%xmm6\n\t"
:
- :"m"(*costab), "m"(*nnnn)
+ :"m"(costab_mmx[24]), "m"(*nnnn)
);
for (i = 0; i < 0x20; i += 8)
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mplayer2
pkgver=2.0
pkgrel=3
pkgdesc="advanced general-purpose video player"
url="http://www.mplayer2.org/"
pkgname=mpv
pkgver=0.2.3
pkgrel=0
pkgdesc="Video player based on MPlayer/mplayer2"
url="http://mpv.io/"
arch="all"
license="GPL"
depends=
makedepends="libxxf86dga-dev libxv-dev libmad-dev lame-dev libao-dev
libtheora-dev xvidcore-dev zlib-dev sdl-dev freetype-dev
x264-dev faac-dev ttf-dejavu libxvmc-dev alsa-lib-dev live-media-dev
mesa-dev ffmpeg-dev"
mesa-dev ffmpeg-dev libass-dev perl clang"
install=""
subpackages="$pkgname-doc"
source="http://ftp.mplayer2.org/pub/release/mplayer2-$pkgver.tar.xz
mplayer-gcc-4.6-audio-fix.patch
c33fafd6f1bc2a430c114231cecc6e1c56c1f939.patch"
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/mpv-player/mpv/archive/v$pkgver.tar.gz
pic.patch"
_builddir="$srcdir"/mplayer2-$pkgver
_builddir="$srcdir"/mpv-$pkgver
prepare() {
local i
cd "$_builddir"
......@@ -31,12 +30,8 @@ prepare() {
build() {
cd "$_builddir"
export GCC_SPECS=/usr/share/gcc/hardenednopie.specs
./configure --prefix=/usr \
--mandir=/usr/share/man \
--datadir=/usr/share/mplayer2 \
--confdir=/etc/mplayer2 \
--enable-runtime-cpudetection \
|| return 1
make || return 1
}
......@@ -44,9 +39,11 @@ build() {
package() {
cd "$_builddir"
make DESTDIR="$pkgdir" install || return 1
mv "$pkgdir"/usr/bin/mplayer "$pkgdir"/usr/bin/mplayer2
}
md5sums="b880ae4be0e5b9693cdecf97c84b74f3 mplayer2-2.0.tar.xz
5f261813c5dfa70ba2378c2535428e5d mplayer-gcc-4.6-audio-fix.patch
8125a2e2d696f6d5af584b01a2d15e78 c33fafd6f1bc2a430c114231cecc6e1c56c1f939.patch"
md5sums="11f25760d7666e6d41d85f06cece8f17 mpv-0.2.3.tar.gz
2b3a2c74be5b1f1a26b4ae7db1abe778 pic.patch"
sha256sums="6a0fe8b889dabdde68011dd0d3694dd36a747fc88d64f9ac9aa1e5c5d51d210c mpv-0.2.3.tar.gz
6fd70c520557dffdbb27fbc1115beea801d55a187268850441091e49fb8794ff pic.patch"
sha512sums="db111172f9c483c07ad79e020d9cf92ccc93b73dcbb05d28be7165a4591ae5c415b7cc4d806f859857263857af96249590076b4ba09eb01b29601bdc20c45846 mpv-0.2.3.tar.gz
06cb0e620609b8a2344f5f28cef90e502949b69d483ddf02d2916c9323df58e3372c974ab4bdba9966a258ca0fe3aee7e70d661b8bd2eda5482dcd8d72e856b2 pic.patch"
diff --git a/video/filter/vf_eq.c b/video/filter/vf_eq.c
index 1bca39b..3cba73b 100644
--- a/video/filter/vf_eq.c
+++ b/video/filter/vf_eq.c
@@ -133,6 +133,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src,
int pel;
short brvec[4];
short contvec[4];
+ unsigned wcount = w >> 3;
// printf("\nmmx: src=%p dst=%p w=%d h=%d ds=%d ss=%d\n",src,dst,w,h,dstride,sstride);
@@ -170,7 +171,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src,
"decl %%eax \n\t"
"jnz 1b \n\t"
: "=r" (src), "=r" (dst)
- : "0" (src), "1" (dst), "r" (w >> 3), "r" (brvec), "r" (contvec)
+ : "0" (src), "1" (dst), "g" (wcount), "r" (brvec), "r" (contvec)
: "%eax"
);
diff --git a/video/filter/vf_gradfun.c b/video/filter/vf_gradfun.c
index f7b39fa..c4955ee 100644
--- a/video/filter/vf_gradfun.c
+++ b/video/filter/vf_gradfun.c
@@ -145,7 +145,7 @@ static void filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc,
"emms \n"
:"+r"(x)
:"r"(dst+width), "r"(src+width), "r"(dc+width/2),
- "rm"(thresh), "m"(*dithers), "m"(*pw_7f)
+ "g"(thresh), "m"(*dithers), "m"(*pw_7f)
:"memory"
);
}
diff --git a/video/filter/vf_noise.c b/video/filter/vf_noise.c
index c81a1d1..d8220be 100644
--- a/video/filter/vf_noise.c
+++ b/video/filter/vf_noise.c
@@ -216,13 +216,16 @@ static inline void lineNoise_C(uint8_t *dst, uint8_t *src, int8_t *noise, int le
#if HAVE_MMX
static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t **shift){
x86_reg mmx_len= len&(~7);
+ uint8_t *src_mmx_len = src+mmx_len;
__asm__ volatile(
+ "pushl %%"REG_BP" \n\t"
+ "mov %0, %%"REG_BP" \n\t"
"mov %5, %%"REG_a" \n\t"
".align 4 \n\t"
"1: \n\t"
"movq (%1, %%"REG_a"), %%mm1 \n\t"
- "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq (%%"REG_BP", %%"REG_a"), %%mm0 \n\t"
"paddb (%2, %%"REG_a"), %%mm1 \n\t"
"paddb (%3, %%"REG_a"), %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
@@ -243,7 +246,9 @@ static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t
"movq %%mm1, (%4, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
" js 1b \n\t"
- :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len),
+ "popl %%"REG_BP" \n\t"
+ :: "g" (src_mmx_len), "r" (shift[0]+mmx_len),
+ "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len),
"r" (dst+mmx_len), "g" (-mmx_len)
: "%"REG_a
);
--- ./video/filter/vf_gradfun.c.orig 2013-11-25 10:55:18.192357135 +0000
+++ ./video/filter/vf_gradfun.c 2013-11-25 11:02:13.784535500 +0000
@@ -202,7 +202,10 @@
#if HAVE_SSE2 && HAVE_6REGS
#define BLURV(load)\
intptr_t x = -2*width;\
+ intptr_t dc_width = dc+width; \
__asm__ volatile(\
+ "pushl %%ebp \n"\
+ "mov %3, %%ebp \n"\
"movdqa %6, %%xmm7 \n"\
"1: \n"\
load" (%4,%0), %%xmm0 \n"\
@@ -220,13 +223,14 @@
"movdqa (%1,%0), %%xmm1 \n"\
"movdqa %%xmm0, (%1,%0) \n"\
"psubw %%xmm1, %%xmm0 \n"\
- "movdqa %%xmm0, (%3,%0) \n"\
+ "movdqa %%xmm0, (%%ebp,%0) \n"\
"add $16, %0 \n"\
"jl 1b \n"\
+ "popl %%ebp \n"\
:"+&r"(x)\
:"r"(buf+width),\
"r"(buf1+width),\
- "r"(dc+width),\
+ "g"(dc_width),\
"r"(src+width*2),\
"r"(src+width*2+sstride),\
"m"(*pw_ff)\
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment