[MPlayer-cvslog] r36268 - in trunk: fmt-conversion.c libmpcodecs/ae_lavc.c

reimar subversion at mplayerhq.hu
Mon May 13 21:34:44 CEST 2013


Author: reimar
Date: Mon May 13 21:34:44 2013
New Revision: 36268

Log:
Do not pass random unsupported data to encoder.

Modified:
   trunk/fmt-conversion.c
   trunk/libmpcodecs/ae_lavc.c

Modified: trunk/fmt-conversion.c
==============================================================================
--- trunk/fmt-conversion.c	Mon May 13 21:34:43 2013	(r36267)
+++ trunk/fmt-conversion.c	Mon May 13 21:34:44 2013	(r36268)
@@ -180,7 +180,7 @@ static const struct {
     {AF_FORMAT_S16_NE, AV_SAMPLE_FMT_S16},
     {AF_FORMAT_S32_NE, AV_SAMPLE_FMT_S32},
     {AF_FORMAT_FLOAT_NE, AV_SAMPLE_FMT_FLT},
-    {0, AV_SAMPLE_FMT_NONE}
+    {AF_FORMAT_UNKNOWN, AV_SAMPLE_FMT_NONE}
 };
 
 enum AVSampleFormat affmt2samplefmt(int fmt)
@@ -206,7 +206,7 @@ int samplefmt2affmt(enum AVSampleFormat 
         if (samplefmt_conversion_map[i].sample_fmt == sample_fmt)
             break;
     fmt = samplefmt_conversion_map[i].fmt;
-    if (!fmt)
+    if (fmt == AF_FORMAT_UNKNOWN)
         mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported AVSampleFormat %i\n", sample_fmt);
     return fmt;
 }

Modified: trunk/libmpcodecs/ae_lavc.c
==============================================================================
--- trunk/libmpcodecs/ae_lavc.c	Mon May 13 21:34:43 2013	(r36267)
+++ trunk/libmpcodecs/ae_lavc.c	Mon May 13 21:34:44 2013	(r36268)
@@ -199,6 +199,10 @@ int mpae_init_lavc(audio_encoder_t *enco
 		}
 	}
 	encoder->input_format = samplefmt2affmt(lavc_actx->sample_fmt);
+	if (encoder->input_format == AF_FORMAT_UNKNOWN) {
+            mp_msg(MSGT_MENCODER,MSGL_ERR, "Audio encoder requires unknown or unsupported input format\n");
+            return 0;
+	}
 	lavc_actx->channels = encoder->params.channels;
 	lavc_actx->sample_rate = encoder->params.sample_rate;
 	lavc_actx->time_base.num = 1;


More information about the MPlayer-cvslog mailing list