summaryrefslogtreecommitdiffstats
path: root/testing/mplayer2/c33fafd6f1bc2a430c114231cecc6e1c56c1f939.patch
blob: 175bc4f4a91d6a10ad12543592ea4cee7177d1f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
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