1 |
scarabeus 11/05/01 16:34:44 |
2 |
|
3 |
Added: 2.0-ffmpeg.patch |
4 |
Log: |
5 |
Compile with latest ffmpeg api. |
6 |
|
7 |
(Portage version: 2.2.0_alpha30/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 media-video/mplayer2/files/2.0-ffmpeg.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/mplayer2/files/2.0-ffmpeg.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/mplayer2/files/2.0-ffmpeg.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: 2.0-ffmpeg.patch |
16 |
=================================================================== |
17 |
From c33fafd6f1bc2a430c114231cecc6e1c56c1f939 Mon Sep 17 00:00:00 2001 |
18 |
From: Uoti Urpala <uau@××××××××.org> |
19 |
Date: Tue, 19 Apr 2011 23:59:45 +0000 |
20 |
Subject: Update libav API uses |
21 |
|
22 |
Update various code to use newer alternatives instead of deprecated |
23 |
functions/fields that are being dropped at libav API bump. An |
24 |
exception is avcodec_thread_init() which is being dropped even though |
25 |
it's still _necessary_ with fairly recent libav versions, so there's |
26 |
no good alternative which would work with both those recent versions |
27 |
and latest libavcodec. I think there are grounds to consider the drop |
28 |
premature and revert it for now; if that doesn't happen I'll add a |
29 |
version-test #if check around it later. |
30 |
--- |
31 |
diff --git a/av_log.c b/av_log.c |
32 |
index bd42ce3..bcf1a14 100644 |
33 |
--- a/av_log.c |
34 |
+++ b/av_log.c |
35 |
@@ -57,10 +57,10 @@ static int extract_msg_type_from_ctx(void *ptr) |
36 |
if (!strcmp(avc->class_name, "AVCodecContext")) { |
37 |
AVCodecContext *s = ptr; |
38 |
if (s->codec) { |
39 |
- if (s->codec->type == CODEC_TYPE_AUDIO) { |
40 |
+ if (s->codec->type == AVMEDIA_TYPE_AUDIO) { |
41 |
if (s->codec->decode) |
42 |
return MSGT_DECAUDIO; |
43 |
- } else if (s->codec->type == CODEC_TYPE_VIDEO) { |
44 |
+ } else if (s->codec->type == AVMEDIA_TYPE_VIDEO) { |
45 |
if (s->codec->decode) |
46 |
return MSGT_DECVIDEO; |
47 |
} |
48 |
diff --git a/av_opts.c b/av_opts.c |
49 |
index 452253b..59f47ed 100644 |
50 |
--- a/av_opts.c |
51 |
+++ b/av_opts.c |
52 |
@@ -37,7 +37,7 @@ int parse_avopts(void *v, char *str){ |
53 |
arg = strchr(str, '='); |
54 |
if(arg) *arg++= 0; |
55 |
|
56 |
- if(!av_set_string(v, str, arg)){ |
57 |
+ if (av_set_string3(v, str, arg, 0, NULL) < 0) { |
58 |
free(start); |
59 |
return -1; |
60 |
} |
61 |
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c |
62 |
index ec6a2f7..8f56e71 100644 |
63 |
--- a/libmpcodecs/ad_ffmpeg.c |
64 |
+++ b/libmpcodecs/ad_ffmpeg.c |
65 |
@@ -127,7 +127,7 @@ static int init(sh_audio_t *sh_audio) |
66 |
} |
67 |
lavc_context->request_channels = opts->audio_output_channels; |
68 |
lavc_context->codec_tag = sh_audio->format; //FOURCC |
69 |
- lavc_context->codec_type = CODEC_TYPE_AUDIO; |
70 |
+ lavc_context->codec_type = AVMEDIA_TYPE_AUDIO; |
71 |
lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi |
72 |
|
73 |
/* alloc extra data */ |
74 |
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c |
75 |
index 2424dda..431b5cd 100644 |
76 |
--- a/libmpcodecs/vd_ffmpeg.c |
77 |
+++ b/libmpcodecs/vd_ffmpeg.c |
78 |
@@ -208,7 +208,7 @@ static int init(sh_video_t *sh){ |
79 |
ctx->avctx = avcodec_alloc_context(); |
80 |
avctx = ctx->avctx; |
81 |
avctx->opaque = sh; |
82 |
- avctx->codec_type = CODEC_TYPE_VIDEO; |
83 |
+ avctx->codec_type = AVMEDIA_TYPE_VIDEO; |
84 |
avctx->codec_id = lavc_codec->id; |
85 |
|
86 |
if (lavc_codec->capabilities & CODEC_CAP_HWACCEL // XvMC |
87 |
@@ -541,14 +541,12 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ |
88 |
type = MP_IMGTYPE_STATIC; |
89 |
flags |= MP_IMGFLAG_PRESERVE; |
90 |
} |
91 |
- flags|=(!avctx->hurry_up && ctx->do_slices) ? |
92 |
- MP_IMGFLAG_DRAW_CALLBACK:0; |
93 |
+ flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0; |
94 |
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, type == MP_IMGTYPE_STATIC ? "using STATIC\n" : "using TEMP\n"); |
95 |
} else { |
96 |
if(!pic->reference){ |
97 |
ctx->b_count++; |
98 |
- flags|=(!avctx->hurry_up && ctx->do_slices) ? |
99 |
- MP_IMGFLAG_DRAW_CALLBACK:0; |
100 |
+ flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK:0; |
101 |
}else{ |
102 |
ctx->ip_count++; |
103 |
flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE |
104 |
@@ -787,7 +785,7 @@ static struct mp_image *decode(struct sh_video *sh, void *data, int len, |
105 |
pkt.data = data; |
106 |
pkt.size = len; |
107 |
// HACK: make PNGs decode normally instead of as CorePNG delta frames |
108 |
- pkt.flags = PKT_FLAG_KEY; |
109 |
+ pkt.flags = AV_PKT_FLAG_KEY; |
110 |
// The avcodec opaque field stupidly supports only int64_t type |
111 |
*(double *)&avctx->reordered_opaque = *reordered_pts; |
112 |
ret = avcodec_decode_video2(avctx, pic, &got_picture, &pkt); |
113 |
diff --git a/libmpcodecs/vf_geq.c b/libmpcodecs/vf_geq.c |
114 |
index ed855d1..68a9cf7 100644 |
115 |
--- a/libmpcodecs/vf_geq.c |
116 |
+++ b/libmpcodecs/vf_geq.c |
117 |
@@ -116,7 +116,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ |
118 |
const_values[3]=y; |
119 |
for(x=0; x<w; x++){ |
120 |
const_values[2]=x; |
121 |
- dst[x + y * dst_stride] = av_eval_expr(vf->priv->e[plane], |
122 |
+ dst[x + y * dst_stride] = av_expr_eval(vf->priv->e[plane], |
123 |
const_values, vf); |
124 |
} |
125 |
} |
126 |
@@ -176,7 +176,7 @@ static int vf_open(vf_instance_t *vf, char *args){ |
127 |
plane==0 ? lum : (plane==1 ? cb : cr), |
128 |
NULL |
129 |
}; |
130 |
- res = av_parse_expr(&vf->priv->e[plane], eq[plane], const_names, NULL, NULL, func2_names, func2, 0, NULL); |
131 |
+ res = av_expr_parse(&vf->priv->e[plane], eq[plane], const_names, NULL, NULL, func2_names, func2, 0, NULL); |
132 |
|
133 |
if (res < 0) { |
134 |
mp_msg(MSGT_VFILTER, MSGL_ERR, "geq: error loading equation `%s'\n", eq[plane]); |
135 |
diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c |
136 |
index f3dc4d9..10c4edf 100644 |
137 |
--- a/libmpcodecs/vf_pp.c |
138 |
+++ b/libmpcodecs/vf_pp.c |
139 |
@@ -37,7 +37,7 @@ |
140 |
|
141 |
struct vf_priv_s { |
142 |
int pp; |
143 |
- pp_mode_t *ppMode[PP_QUALITY_MAX+1]; |
144 |
+ pp_mode *ppMode[PP_QUALITY_MAX+1]; |
145 |
void *context; |
146 |
unsigned int outfmt; |
147 |
}; |
148 |
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c |
149 |
index 3aca4b6..0c5b6da 100644 |
150 |
--- a/libmpdemux/demux_lavf.c |
151 |
+++ b/libmpdemux/demux_lavf.c |
152 |
@@ -289,7 +289,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { |
153 |
codec->codec_tag = override_tag; |
154 |
|
155 |
switch(codec->codec_type){ |
156 |
- case CODEC_TYPE_AUDIO:{ |
157 |
+ case AVMEDIA_TYPE_AUDIO:{ |
158 |
WAVEFORMATEX *wf; |
159 |
sh_audio_t* sh_audio; |
160 |
sh_audio = new_sh_audio_aid(demuxer, i, priv->audio_streams); |
161 |
@@ -361,7 +361,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { |
162 |
stream_id = priv->audio_streams++; |
163 |
break; |
164 |
} |
165 |
- case CODEC_TYPE_VIDEO:{ |
166 |
+ case AVMEDIA_TYPE_VIDEO:{ |
167 |
sh_video_t* sh_video; |
168 |
BITMAPINFOHEADER *bih; |
169 |
sh_video=new_sh_video_vid(demuxer, i, priv->video_streams); |
170 |
@@ -433,7 +433,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { |
171 |
stream_id = priv->video_streams++; |
172 |
break; |
173 |
} |
174 |
- case CODEC_TYPE_SUBTITLE:{ |
175 |
+ case AVMEDIA_TYPE_SUBTITLE:{ |
176 |
sh_sub_t* sh_sub; |
177 |
char type; |
178 |
/* only support text subtitles for now */ |
179 |
@@ -476,9 +476,12 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { |
180 |
stream_id = priv->sub_streams++; |
181 |
break; |
182 |
} |
183 |
- case CODEC_TYPE_ATTACHMENT:{ |
184 |
+ case AVMEDIA_TYPE_ATTACHMENT:{ |
185 |
+ AVMetadataTag *ftag = av_metadata_get(st->metadata, "filename", |
186 |
+ NULL, 0); |
187 |
+ char *filename = ftag ? ftag->value : NULL; |
188 |
if (st->codec->codec_id == CODEC_ID_TTF) |
189 |
- demuxer_add_attachment(demuxer, BSTR(st->filename), |
190 |
+ demuxer_add_attachment(demuxer, BSTR(filename), |
191 |
BSTR("application/x-truetype-font"), |
192 |
(struct bstr){codec->extradata, |
193 |
codec->extradata_size}); |
194 |
@@ -755,14 +758,14 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){ |
195 |
if(ts != AV_NOPTS_VALUE){ |
196 |
dp->pts = ts * av_q2d(priv->avfc->streams[id]->time_base); |
197 |
priv->last_pts= dp->pts * AV_TIME_BASE; |
198 |
- // always set duration for subtitles, even if PKT_FLAG_KEY is not set, |
199 |
+ // always set duration for subtitles, even if AV_PKT_FLAG_KEY isn't set, |
200 |
// otherwise they will stay on screen to long if e.g. ASS is demuxed from mkv |
201 |
- if((ds == demux->sub || (pkt.flags & PKT_FLAG_KEY)) && |
202 |
+ if ((ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) && |
203 |
pkt.convergence_duration > 0) |
204 |
dp->duration = pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base); |
205 |
} |
206 |
dp->pos=demux->filepos; |
207 |
- dp->flags= !!(pkt.flags&PKT_FLAG_KEY); |
208 |
+ dp->flags = !!(pkt.flags & AV_PKT_FLAG_KEY); |
209 |
// append packet to DS stream: |
210 |
ds_add_packet(ds,dp); |
211 |
return 1; |
212 |
@@ -922,15 +925,15 @@ redo: |
213 |
{ |
214 |
switch(priv->avfc->streams[program->stream_index[i]]->codec->codec_type) |
215 |
{ |
216 |
- case CODEC_TYPE_VIDEO: |
217 |
+ case AVMEDIA_TYPE_VIDEO: |
218 |
if(prog->vid == -2) |
219 |
prog->vid = program->stream_index[i]; |
220 |
break; |
221 |
- case CODEC_TYPE_AUDIO: |
222 |
+ case AVMEDIA_TYPE_AUDIO: |
223 |
if(prog->aid == -2) |
224 |
prog->aid = program->stream_index[i]; |
225 |
break; |
226 |
- case CODEC_TYPE_SUBTITLE: |
227 |
+ case AVMEDIA_TYPE_SUBTITLE: |
228 |
if(prog->sid == -2 && priv->avfc->streams[program->stream_index[i]]->codec->codec_id == CODEC_ID_TEXT) |
229 |
prog->sid = program->stream_index[i]; |
230 |
break; |
231 |
-- |
232 |
cgit v0.8.3.4 |