tomwij      14/07/13 19:56:14

  Added:                mplayer2-2.0_p20131009_support_libav10.patch
  Log:
  Added patch from Debian by Reinhard Tartler (siretart) to support Libav 10; 
fixes bug #509298, proxied commit for Nikoli.
  
  (Portage version: 2.2.10_p125/cvs/Linux x86_64, signed Manifest commit with 
key 6D34E57D)

Revision  Changes    Path
1.1                  
media-video/mplayer2/files/mplayer2-2.0_p20131009_support_libav10.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/mplayer2/files/mplayer2-2.0_p20131009_support_libav10.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/mplayer2/files/mplayer2-2.0_p20131009_support_libav10.patch?rev=1.1&content-type=text/plain

Index: mplayer2-2.0_p20131009_support_libav10.patch
===================================================================
Description: Fix compilation against libav10
 Patch based on work by Anton Khirnov, rebasing on mplayer2 revision
 2c378c7 allowed great simplification.
Author: Reinhard Tartler <siret...@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) *




Reply via email to