[SCM] mplayer packaging branch, ubuntu, updated. debian/1.0.rc3+svn20090426-1ubuntu14-3-g6efdb03

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sat Mar 27 21:24:26 UTC 2010


The following commit has been merged in the ubuntu branch:
commit cce126e960a859578256851c48e852502956d558
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Wed Mar 17 13:38:55 2010 +0100

    backport newer libx264 wrapper, LP: #539555
    
    the API has changed more than intiially expected, so a more
    sophisticated backport is required. this change backports
    libmpcodecs/ve_x264.c from trunk and reverts a cosmetic change to allow
    it build in mplayer rc3.

diff --git a/debian/control b/debian/control
index f1d7028..1592314 100644
--- a/debian/control
+++ b/debian/control
@@ -59,7 +59,7 @@ Build-Depends: debhelper (>= 7),
                libvorbis-dev,
                libvorbisidec-dev,
                libx11-dev,
-               libx264-dev,
+               libx264-dev (>= 2:0.85.1442),
                libxext-dev,
                libxinerama-dev,
                libxv-dev,
diff --git a/debian/patches/60_backport_x264_wrapper.patch b/debian/patches/60_backport_x264_wrapper.patch
new file mode 100644
index 0000000..b4c34ac
--- /dev/null
+++ b/debian/patches/60_backport_x264_wrapper.patch
@@ -0,0 +1,152 @@
+From: Reinhard Tartler <siretart at tauware.de>
+Subject: Backport libmpcodecs/ve_x264.c from trunk
+Bug: https://bugs.launchpad.net/bugs/539555
+
+--- a/libmpcodecs/ve_x264.c
++++ b/libmpcodecs/ve_x264.c
+@@ -59,20 +59,6 @@ static int turbo = 0;
+ static x264_param_t param;
+ static int parse_error = 0;
+ 
+-static int encode_nals(uint8_t *buf, int size, x264_nal_t *nals, int nnal){
+-    uint8_t *p = buf;
+-    int i;
+-
+-    for(i = 0; i < nnal; i++){
+-        int s = x264_nal_encode(p, &size, 1, nals + i);
+-        if(s < 0)
+-            return -1;
+-        p += s;
+-    }
+-
+-    return p - buf;
+-}
+-
+ static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts);
+ static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in);
+ 
+@@ -148,7 +134,7 @@ void x264enc_set_param(const m_option_t*
+     }
+ }
+ 
+-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) {
++static int config(struct vf_instance_s *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) {
+     h264_module_t *mod=(h264_module_t*)vf->priv;
+ 
+     if(parse_error)
+@@ -158,7 +144,7 @@ static int config(struct vf_instance_s* 
+     mod->mux->bih->biHeight = height;
+     mod->mux->bih->biSizeImage = width * height * 3;
+     mod->mux->aspect = (float)d_width/d_height;
+-    
++
+     // make sure param is initialized
+     x264enc_set_param(NULL, "");
+     param.i_width = width;
+@@ -181,7 +167,7 @@ static int config(struct vf_instance_s* 
+         mp_msg(MSGT_MENCODER, MSGL_ERR, "Wrong colorspace.\n");
+         return 0;
+     }
+-    
++
+     mod->x264 = x264_encoder_open(&param);
+     if(!mod->x264) {
+         mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n");
+@@ -189,46 +175,38 @@ static int config(struct vf_instance_s* 
+     }
+ 
+     if(!param.b_repeat_headers){
+-        uint8_t *extradata;
+         x264_nal_t *nal;
+-        int extradata_size, nnal, i, s = 0;
++        int extradata_size, nnal;
+ 
+-        x264_encoder_headers(mod->x264, &nal, &nnal);
+-
+-        /* 5 bytes NAL header + worst case escaping */
+-        for(i = 0; i < nnal; i++)
+-            s += 5 + nal[i].i_payload * 4 / 3;
+-
+-        extradata = malloc(s);
+-        extradata_size = encode_nals(extradata, s, nal, nnal);
++        extradata_size = x264_encoder_headers(mod->x264, &nal, &nnal);
+ 
+         mod->mux->bih= realloc(mod->mux->bih, sizeof(BITMAPINFOHEADER) + extradata_size);
+-        memcpy(mod->mux->bih + 1, extradata, extradata_size);
++        memcpy(mod->mux->bih + 1, nal->p_payload, extradata_size);
+         mod->mux->bih->biSize= sizeof(BITMAPINFOHEADER) + extradata_size;
+     }
+-    
+-    if (param.i_bframe > 1 && param.b_bframe_pyramid)
++
++    if (param.i_bframe > 1 && param.i_bframe_pyramid)
+         mod->mux->decoder_delay = 2;
+     else
+         mod->mux->decoder_delay = param.i_bframe ? 1 : 0;
+-    
++
+     return 1;
+ }
+ 
+-static int control(struct vf_instance_s* vf, int request, void *data)
++static int control(struct vf_instance_s *vf, int request, void *data)
+ {
+     h264_module_t *mod=(h264_module_t*)vf->priv;
+     switch(request){
+         case VFCTRL_FLUSH_FRAMES:
+-            if(param.i_bframe)
+-                while(encode_frame(vf, NULL) > 0);
++            while (x264_encoder_delayed_frames(mod->x264) > 0)
++                encode_frame(vf, NULL);
+             return CONTROL_TRUE;
+         default:
+             return CONTROL_UNKNOWN;
+     }
+ }
+ 
+-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
++static int query_format(struct vf_instance_s *vf, unsigned int fmt)
+ {
+     switch(fmt) {
+     case IMGFMT_I420:
+@@ -251,7 +229,7 @@ static int put_image(struct vf_instance_
+ {
+     h264_module_t *mod=(h264_module_t*)vf->priv;
+     int i;
+-    
++
+     memset(&mod->pic, 0, sizeof(x264_picture_t));
+     mod->pic.img.i_csp=param.i_csp;
+     mod->pic.img.i_plane=3;
+@@ -271,24 +249,18 @@ static int encode_frame(struct vf_instan
+     x264_picture_t pic_out;
+     x264_nal_t *nal;
+     int i_nal;
+-    int i_size = 0;
+-    int i;
++    int i_size;
+ 
+-    if(x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out) < 0) {
++    i_size = x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out);
++
++    if(i_size<0) {
+         mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n");
+         return -1;
+     }
+-    
+-    for(i=0; i < i_nal; i++) {
+-        int i_data = mod->mux->buffer_size - i_size;
+-        i_size += x264_nal_encode(mod->mux->buffer + i_size, &i_data, 1, &nal[i]);
+-    }
+     if(i_size>0) {
+-        int keyframe = (pic_out.i_type == X264_TYPE_IDR) ||
+-                       (pic_out.i_type == X264_TYPE_I
+-                        && param.i_frame_reference == 1
+-                        && !param.i_bframe);
+-        muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
++        int keyframe = pic_out.b_keyframe;
++        memcpy(mod->mux->buffer, nal->p_payload, i_size);
++        muxer_write_chunk(mod->mux, i_size, keyframe?AVIIF_KEYFRAME:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
+     }
+     else
+         ++mod->mux->encoder_delay;
diff --git a/debian/patches/80_allow_compilation_with_newer_x264.patch b/debian/patches/80_allow_compilation_with_newer_x264.patch
deleted file mode 100644
index 78e6365..0000000
--- a/debian/patches/80_allow_compilation_with_newer_x264.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Author: Reinhard Tartler <siretart at tauware.de>
-Subject: allow compilation with newer x264
-
-diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c
-index 04d0bd3..c4287af 100644
---- a/libmpcodecs/ve_x264.c
-+++ b/libmpcodecs/ve_x264.c
-@@ -207,7 +207,11 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
-         mod->mux->bih->biSize= sizeof(BITMAPINFOHEADER) + extradata_size;
-     }
-     
-+#if X264_BUILD >= 78
-+    if (param.i_bframe > 1 && param.i_bframe_pyramid)
-+#else
-     if (param.i_bframe > 1 && param.b_bframe_pyramid)
-+#endif
-         mod->mux->decoder_delay = 2;
-     else
-         mod->mux->decoder_delay = param.i_bframe ? 1 : 0;
-
diff --git a/debian/patches/series b/debian/patches/series
index 3940ba6..3901c1b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,4 +7,4 @@
 41_fix_forcedsubsonly.patch
 50_fix_initial_volume_setting_pulse_output.patch
 50_fix_crashes_with_invalid_SDPs.patch
-80_allow_compilation_with_newer_x264.patch
+60_backport_x264_wrapper.patch

-- 
mplayer packaging



More information about the pkg-multimedia-commits mailing list