Package: mplayer2 / 2.0-728-g2c378c7-4

ftbfs-libav10.patch Patch series | download
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
Description: Fix compilation against libav10
 Patch based on work by Anton Khirnov, rebasing on mplayer2 revision
 2c378c7 allowed great simplification.
Author: Reinhard Tartler <siretart@tauware.de>
Origin: debian
Bug-Debian: http://bugs.debian.org/739337
Last-Update: 2014-03-08

--- mplayer2-2.0-728-g2c378c7.orig/Makefile
+++ mplayer2-2.0-728-g2c378c7/Makefile
@@ -301,7 +301,6 @@ SRCS_COMMON = asxparser.c \
               libmpcodecs/vf_ilpack.c \
               libmpcodecs/vf_ivtc.c \
               libmpcodecs/vf_kerndeint.c \
-              libmpcodecs/vf_lavc.c \
               libmpcodecs/vf_lavcdeint.c \
               libmpcodecs/vf_mirror.c \
               libmpcodecs/vf_noformat.c \
--- mplayer2-2.0-728-g2c378c7.orig/screenshot.c
+++ mplayer2-2.0-728-g2c378c7/screenshot.c
@@ -82,6 +82,7 @@ static int write_png(screenshot_ctx *ctx
     FILE *fp = NULL;
     void *outbuffer = NULL;
     int success = 0;
+    int got_output;
 
     struct AVCodec *png_codec = avcodec_find_encoder(AV_CODEC_ID_PNG);
     AVCodecContext *avctx = NULL;
@@ -104,10 +105,8 @@ static int write_png(screenshot_ctx *ctx
         goto error_exit;
     }
 
+    AVPacket pkt = { 0 };
     size_t outbuffer_size = image->width * image->height * 3 * 2;
-    outbuffer = malloc(outbuffer_size);
-    if (!outbuffer)
-        goto error_exit;
 
     AVFrame *pic = ctx->pic;
     avcodec_get_frame_defaults(pic);
@@ -115,8 +114,8 @@ static int write_png(screenshot_ctx *ctx
         pic->data[n] = image->planes[n];
         pic->linesize[n] = image->stride[n];
     }
-    int size = avcodec_encode_video(avctx, outbuffer, outbuffer_size, pic);
-    if (size < 1)
+    int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output);
+    if (ret < 0 || !got_output)
         goto error_exit;
 
     fp = fopen(fname, "wb");
@@ -126,8 +125,9 @@ static int write_png(screenshot_ctx *ctx
         goto error_exit;
     }
 
-    fwrite(outbuffer, size, 1, fp);
+    fwrite(pkt.data, pkt.size, 1, fp);
     fflush(fp);
+    av_free_packet(&pkt);
 
     if (ferror(fp))
         goto error_exit;
@@ -139,7 +139,6 @@ error_exit:
     av_free(avctx);
     if (fp)
         fclose(fp);
-    free(outbuffer);
     return success;
 }
 
--- mplayer2-2.0-728-g2c378c7.orig/libmpcodecs/vf.c
+++ mplayer2-2.0-728-g2c378c7/libmpcodecs/vf.c
@@ -48,7 +48,7 @@ extern const vf_info_t vf_info_flip;
 extern const vf_info_t vf_info_rotate;
 extern const vf_info_t vf_info_mirror;
 extern const vf_info_t vf_info_palette;
-extern const vf_info_t vf_info_lavc;
+//extern const vf_info_t vf_info_lavc;
 extern const vf_info_t vf_info_dvbscale;
 extern const vf_info_t vf_info_cropdetect;
 extern const vf_info_t vf_info_test;
@@ -131,7 +131,7 @@ static const vf_info_t *const filter_lis
 #ifdef CONFIG_LIBPOSTPROC
     &vf_info_pp,
 #endif
-    &vf_info_lavc,
+    //&vf_info_lavc,
     &vf_info_lavcdeint,
     &vf_info_screenshot,
     &vf_info_fspp,
--- mplayer2-2.0-728-g2c378c7.orig/libvo/vo_png.c
+++ mplayer2-2.0-728-g2c378c7/libvo/vo_png.c
@@ -52,8 +52,6 @@ static int z_compression;
 static int framenum;
 static int use_alpha;
 static AVCodecContext *avctx;
-static uint8_t *outbuffer;
-int outbuffer_size;
 
 static int
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
@@ -87,9 +85,10 @@ config(uint32_t width, uint32_t height,
 
 
 static uint32_t draw_image(mp_image_t* mpi){
+    AVPacket pkt = { 0 };
     AVFrame pic;
     int buffersize;
-    int res;
+    int res, got_output;
     char buf[100];
     FILE *outfile;
 
@@ -105,22 +104,18 @@ static uint32_t draw_image(mp_image_t* m
 
     pic.data[0] = mpi->planes[0];
     pic.linesize[0] = mpi->stride[0];
-    buffersize = mpi->w * mpi->h * 8;
-    if (outbuffer_size < buffersize) {
-        av_freep(&outbuffer);
-        outbuffer = av_malloc(buffersize);
-        outbuffer_size = buffersize;
-    }
-    res = avcodec_encode_video(avctx, outbuffer, outbuffer_size, &pic);
 
-    if(res < 0){
+    res = avcodec_encode_video2(avctx, &pkt, &pic, &got_output);
+
+    if(res < 0 || !got_output){
  	    mp_msg(MSGT_VO,MSGL_WARN, "[VO_PNG] Error in create_png.\n");
             fclose(outfile);
 	    return 1;
     }
 
-    fwrite(outbuffer, res, 1, outfile);
+    fwrite(pkt.data, pkt.size, 1, outfile);
     fclose(outfile);
+    av_free_packet(&pkt);
 
     return VO_TRUE;
 }
@@ -157,8 +152,6 @@ static void uninit(void)
     if (avctx)
         avcodec_close(avctx);
     av_freep(&avctx);
-    av_freep(&outbuffer);
-    outbuffer_size = 0;
 }
 
 static void check_events(void){}
--- mplayer2-2.0-728-g2c378c7.orig/libmpdemux/demux_lavf.c
+++ mplayer2-2.0-728-g2c378c7/libmpdemux/demux_lavf.c
@@ -422,8 +422,8 @@ static void handle_stream(demuxer_t *dem
          * heuristic makes up works with subtitles in practice.
          */
         double fps;
-        if (st->r_frame_rate.num)
-            fps = av_q2d(st->r_frame_rate);
+        if (st->avg_frame_rate.num)
+            fps = av_q2d(st->avg_frame_rate);
         else
             fps = 1.0 / FFMAX(av_q2d(st->time_base),
                               av_q2d(st->codec->time_base) *