From 24dadf50a3ea4b5a75f066adc00bbf8fd0f10789 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 11:06:04 +0000 Subject: [PATCH 1/9] Remove useless code, QUERY_FORMAT already ensures the requested format is supported. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30562 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_theora.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index 3bf7ab83b9..882f4774bf 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -69,16 +69,6 @@ static int init(sh_video_t *sh){ ogg_packet op; int i; - /* check whether video output format is supported */ - switch(sh->codec->outfmt[sh->outfmtidx]) - { - case IMGFMT_YV12: /* well, this should work... */ break; - default: - mp_msg (MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n", - sh->codec->outfmt[sh->outfmtidx]); - return 0; - } - /* this is not a loop, just a context, from which we can break on error */ do { From fdb18951f1fd03dbe804c55ea4adaf49cba165ec Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 11:09:24 +0000 Subject: [PATCH 2/9] Remove useless casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30563 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_theora.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index 882f4774bf..6f6fb16610 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -131,7 +131,7 @@ static int init(sh_video_t *sh){ */ static void uninit(sh_video_t *sh) { - theora_struct_t *context = (theora_struct_t *)sh->context; + theora_struct_t *context = sh->context; if (context) { @@ -147,7 +147,7 @@ static void uninit(sh_video_t *sh) */ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) { - theora_struct_t *context = (theora_struct_t *)sh->context; + theora_struct_t *context = sh->context; int errorCode = 0; ogg_packet op; yuv_buffer yuv; From 9fefbedb17ed427336200e29ec0a63f04b7cd135 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 14 Feb 2010 11:09:58 +0000 Subject: [PATCH 3/9] Mark uninit() as static; it is only used within the file. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30564 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_remove_logo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c index 7b9c66aeb1..d974ad85c5 100644 --- a/libmpcodecs/vf_remove_logo.c +++ b/libmpcodecs/vf_remove_logo.c @@ -877,7 +877,7 @@ static int open(vf_instance_t * vf, char * args) * * This is called at exit-time. */ -void uninit(vf_instance_t * vf) +static void uninit(vf_instance_t * vf) { /* Destroy our masks and images. */ destroy_pgm(((vf_priv_s *)vf->priv)->filter); From cfcbf57e548ac8c5e77c78378dd7c0c854d89506 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 11:11:49 +0000 Subject: [PATCH 4/9] Return NULL instead of 0 for function returning a pointer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30565 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_theora.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index 6f6fb16610..b63915b23a 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -171,7 +171,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) { mp_msg(MSGT_DEMUX,MSGL_ERR,"Theora decode YUVout failed: %i \n", errorCode); - return 0; + return NULL; } mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, yuv.y_width, yuv.y_height); From 4e9a7e9a6842e5a593728db24ed8f6cc4990dad8 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 14 Feb 2010 11:13:01 +0000 Subject: [PATCH 5/9] QuickTime X supports SAR in H.264. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30566 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/xml/en/encoding-guide.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DOCS/xml/en/encoding-guide.xml b/DOCS/xml/en/encoding-guide.xml index 1c7c5909c5..9309df9df7 100644 --- a/DOCS/xml/en/encoding-guide.xml +++ b/DOCS/xml/en/encoding-guide.xml @@ -4655,7 +4655,8 @@ the codec dialog display before encoding starts. QuickTime 7 does not support SAR (sample aspect ratio) information in MPEG-4 files; it assumes that SAR=1. Read the section on scaling - for a workaround. + for a workaround. QuickTime X no longer has this + limitation. From f2488e85373a6ab1c16174c14342c6f239aeb808 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 11:13:20 +0000 Subject: [PATCH 6/9] Change aspect calculation code to switch to floating point earlier so integer overflows are not possible. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30567 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_theora.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index b63915b23a..8844b3bcf8 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -117,8 +117,8 @@ static int init(sh_video_t *sh){ if(sh->aspect==0.0 && context->inf.aspect_denominator!=0) { - sh->aspect = (float)(context->inf.aspect_numerator * context->inf.frame_width)/ - (context->inf.aspect_denominator * context->inf.frame_height); + sh->aspect = ((double)context->inf.aspect_numerator * context->inf.frame_width)/ + ((double)context->inf.aspect_denominator * context->inf.frame_height); } mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n"); From 270ebbb913a2ab2e2065e57d660e1892091172d7 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 11:17:12 +0000 Subject: [PATCH 7/9] Just use goto instead of reimplementing it badly with a do { } while (0) and break. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30568 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_theora.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index 8844b3bcf8..f1a7db1247 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -64,18 +64,14 @@ typedef struct theora_struct_st { */ static int init(sh_video_t *sh){ theora_struct_t *context = NULL; - int failed = 1; int errorCode = 0; ogg_packet op; int i; - /* this is not a loop, just a context, from which we can break on error */ - do - { context = calloc (sizeof (theora_struct_t), 1); sh->context = context; if (!context) - break; + goto err_out; theora_info_init(&context->inf); theora_comment_init(&context->cc); @@ -88,11 +84,9 @@ static int init(sh_video_t *sh){ if ( (errorCode = theora_decode_header (&context->inf, &context->cc, &op)) ) { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Broken Theora header; errorCode=%i!\n", errorCode); - break; + goto err_out; } } - if (errorCode) - break; /* now init codec */ errorCode = theora_decode_init (&context->st, &context->inf); @@ -100,20 +94,8 @@ static int init(sh_video_t *sh){ { mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode init failed: %i \n", errorCode); - break; + goto err_out; } - failed = 0; - } while (0); - - if (failed) - { - if (context) - { - free (context); - sh->context = NULL; - } - return 0; - } if(sh->aspect==0.0 && context->inf.aspect_denominator!=0) { @@ -124,6 +106,11 @@ static int init(sh_video_t *sh){ mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n"); return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_YV12); + +err_out: + free(context); + sh->context = NULL; + return 0; } /* From 318156ae6b6f8484a8fe8b2d3fc0073ae3bb010e Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 11:19:52 +0000 Subject: [PATCH 8/9] Reindent git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30569 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_theora.c | 45 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index f1a7db1247..35e3edfab8 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -68,34 +68,33 @@ static int init(sh_video_t *sh){ ogg_packet op; int i; - context = calloc (sizeof (theora_struct_t), 1); - sh->context = context; - if (!context) - goto err_out; + context = calloc (sizeof (theora_struct_t), 1); + sh->context = context; + if (!context) + goto err_out; - theora_info_init(&context->inf); - theora_comment_init(&context->cc); + theora_info_init(&context->inf); + theora_comment_init(&context->cc); - /* Read all header packets, pass them to theora_decode_header. */ - for (i = 0; i < THEORA_NUM_HEADER_PACKETS; i++) - { - op.bytes = ds_get_packet (sh->ds, &op.packet); - op.b_o_s = 1; - if ( (errorCode = theora_decode_header (&context->inf, &context->cc, &op)) ) - { + /* Read all header packets, pass them to theora_decode_header. */ + for (i = 0; i < THEORA_NUM_HEADER_PACKETS; i++) + { + op.bytes = ds_get_packet (sh->ds, &op.packet); + op.b_o_s = 1; + if ( (errorCode = theora_decode_header (&context->inf, &context->cc, &op)) ) + { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Broken Theora header; errorCode=%i!\n", errorCode); goto err_out; - } - } + } + } - /* now init codec */ - errorCode = theora_decode_init (&context->st, &context->inf); - if (errorCode) - { - mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode init failed: %i \n", - errorCode); - goto err_out; - } + /* now init codec */ + errorCode = theora_decode_init (&context->st, &context->inf); + if (errorCode) + { + mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode init failed: %i \n", errorCode); + goto err_out; + } if(sh->aspect==0.0 && context->inf.aspect_denominator!=0) { From 2347661b0e50ec56d5c7480f5b4cf5753d2e0278 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 14 Feb 2010 11:57:37 +0000 Subject: [PATCH 9/9] Check that fontconfig version is at least 2.4.2, which is required for the included libass. A more fine-grained check would be possible to e.g. allow older versions if internal libass is disabled, but seems like overkill. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30570 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure b/configure index 6ff675993a..ab3a347746 100755 --- a/configure +++ b/configure @@ -6392,6 +6392,9 @@ if test "$_fontconfig" = auto ; then #include #include #include +#if FC_VERSION < 20402 +#error At least version 2.4.2 of fontconfig required +#endif int main(void) { int err = FcInit(); if (err == FcFalse) {