[vlc-commits] mediacodec: refactor

Thomas Guillem git at videolan.org
Thu Mar 30 15:10:18 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 30 14:13:25 2017 +0200| [558e7a9d10d5127478846ca9307e793aef50451e] | committer: Thomas Guillem

mediacodec: refactor

Rename ParseVideoExtra to ParseExtra and handle CSD for every ES.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=558e7a9d10d5127478846ca9307e793aef50451e
---

 modules/codec/omxil/mediacodec.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 78f81ca..2407583 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -385,7 +385,7 @@ static int ParseVideoExtraWmv3(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
     return CSDDup(p_dec, p_data, sizeof(p_data));
 }
 
-static int ParseVideoExtra(decoder_t *p_dec)
+static int ParseExtra(decoder_t *p_dec)
 {
     uint8_t *p_extra = p_dec->fmt_in.p_extra;
     int i_extra = p_dec->fmt_in.i_extra;
@@ -401,7 +401,11 @@ static int ParseVideoExtra(decoder_t *p_dec)
     case VLC_CODEC_VC1:
         return ParseVideoExtraVc1(p_dec, p_extra, i_extra);
     default:
-        return VLC_SUCCESS;
+        /* Set default CSD */
+        if (p_dec->fmt_in.i_extra)
+            return CSDDup(p_dec, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra);
+        else
+            return VLC_SUCCESS;
     }
 }
 
@@ -704,14 +708,8 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
         }
     }
 
-    /* Try first to configure specific Video CSD */
-    if (p_dec->fmt_in.i_cat == VIDEO_ES)
-        if (ParseVideoExtra(p_dec) != VLC_SUCCESS)
-            goto bailout;
-
-    /* Set default CSD if ParseVideoExtra failed to configure one */
-    if (!p_sys->i_csd_count && p_dec->fmt_in.i_extra
-     && CSDDup(p_dec, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra) != VLC_SUCCESS)
+    /* Try first to configure CSD */
+    if (ParseExtra(p_dec) != VLC_SUCCESS)
         goto bailout;
 
     i_ret = StartMediaCodec(p_dec);



More information about the vlc-commits mailing list