[vlc-commits] [Git][videolan/vlc][master] 18 commits: omxil: remove always NULL parameter in GetOmxChromaFormat()

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Oct 23 03:47:11 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1b615f2e by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: remove always NULL parameter in GetOmxChromaFormat()

- - - - -
d7278126 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: remove always NULL parameter in GetOmxVideoFormat()

- - - - -
9b419021 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: remove always NULL parameter in GetOmxAudioFormat()

- - - - -
efc95a4b by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: get the codec name locally in PrintOmx()

- - - - -
04f2688c by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: remove always NULL parameter in OmxToVlcAudioFormat()

- - - - -
707e3946 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: remove always NULL parameter in GetVlcVideoFormat()

- - - - -
2537c6e9 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: get the codec name locally in Video_ProcessOutput()

- - - - -
7b3a7931 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: remove always NULL parameter in GetVlcChromaFormat()

- - - - -
8923aded by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: return the VLC FourCC directly in GetVlcChromaFormat()

- - - - -
5f404c90 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: return the VLC FourCC directly in GetVlcVideoFormat()

- - - - -
1d24386d by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: return the VLC FourCC directly in OmxToVlcAudioFormat()

- - - - -
bdc100f0 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: return the OMX_VIDEO_CODINGTYPE directly in GetOmxVideoFormat()

Or OMX_VIDEO_CodingUnused.

- - - - -
9f0482eb by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: return the OMX_AUDIO_CODINGTYPE directly in GetOmxAudioFormat()

Or OMX_AUDIO_CodingUnused.

- - - - -
f7498dac by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: return the OMX_COLOR_FORMATTYPE directly in GetOmxChromaFormat()

Or OMX_COLOR_FormatUnused.

- - - - -
0da00a27 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: don't store a dummy element at the end of chroma table

And return an error early the codec is not known.

- - - - -
8c96fc2d by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: don't store a dummy element at the end of video format table

- - - - -
9679c98d by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: don't store a dummy element at the end of audio format table

- - - - -
97e504e0 by Steve Lhomme at 2023-10-22T14:02:12+00:00
omxil: pass a es_format_t to GetOmxRole()

- - - - -


4 changed files:

- modules/codec/omxil/mediacodec.c
- modules/codec/omxil/omxil.c
- modules/codec/omxil/omxil_utils.h
- modules/codec/omxil/utils.c


Changes:

=====================================
modules/codec/omxil/mediacodec.c
=====================================
@@ -1172,15 +1172,19 @@ static int Video_ProcessOutput(decoder_t *p_dec, mc_api_out *p_out,
         assert(p_out->type == MC_OUT_TYPE_CONF);
         p_sys->video.i_pixel_format = p_out->conf.video.pixel_format;
 
-        const char *name = "unknown";
+        const char *name;
         if (!p_sys->api.b_direct_rendering
-         && !GetVlcChromaFormat(p_sys->video.i_pixel_format,
-                                &p_dec->fmt_out.i_codec, &name))
+         && (p_dec->fmt_out.i_codec =
+             GetVlcChromaFormat(p_sys->video.i_pixel_format)) == 0)
         {
             msg_Err(p_dec, "color-format not recognized");
             return -1;
         }
 
+        name = vlc_fourcc_GetDescription( VIDEO_ES,p_dec->fmt_out.i_codec );
+        if (name == NULL)
+            name = "unknown";
+
         msg_Err(p_dec, "output: %d %s, %dx%d stride %d %d, crop %d %d %d %d",
                 p_sys->video.i_pixel_format, name,
                 p_out->conf.video.width, p_out->conf.video.height,


=====================================
modules/codec/omxil/omxil.c
=====================================
@@ -133,8 +133,7 @@ static OMX_ERRORTYPE ImplementationSpecificWorkarounds(decoder_t *p_dec,
         {
             /* I420 xvideo is slow on OMAP */
             def->format.video.eColorFormat = OMX_COLOR_FormatCbYCrY;
-            GetVlcChromaFormat( def->format.video.eColorFormat,
-                                &p_fmt->i_codec, 0 );
+            p_fmt->i_codec = GetVlcChromaFormat( def->format.video.eColorFormat );
             GetVlcChromaSizes( p_fmt->i_codec,
                                def->format.video.nFrameWidth,
                                def->format.video.nFrameHeight,
@@ -211,11 +210,11 @@ static OMX_ERRORTYPE SetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
                   def->format.video.nFrameHeight * 2;
             p_port->i_frame_size = def->nBufferSize;
 
-            if(!GetOmxVideoFormat(p_fmt->i_codec,
-                                  &def->format.video.eCompressionFormat, 0) )
+            def->format.video.eCompressionFormat = GetOmxVideoFormat(p_fmt->i_codec);
+            if( def->format.video.eCompressionFormat == OMX_VIDEO_CodingUnused)
             {
-                if(!GetOmxChromaFormat(p_fmt->i_codec,
-                                       &def->format.video.eColorFormat, 0) )
+                def->format.video.eColorFormat = GetOmxChromaFormat(p_fmt->i_codec);
+                if( def->format.video.eColorFormat == OMX_COLOR_FormatUnused)
                 {
                     omx_error = OMX_ErrorNotImplemented;
                     CHECK_ERROR(omx_error, "codec %4.4s doesn't match any OMX format",
@@ -232,8 +231,8 @@ static OMX_ERRORTYPE SetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
         }
         else
         {
-            if( !GetVlcChromaFormat( def->format.video.eColorFormat,
-                                     &p_fmt->i_codec, 0 ) )
+            p_fmt->i_codec = GetVlcChromaFormat( def->format.video.eColorFormat );
+            if( p_fmt->i_codec == 0 )
             {
                 omx_error = OMX_ErrorNotImplemented;
                 CHECK_ERROR(omx_error, "OMX color format %i not supported",
@@ -254,8 +253,8 @@ static OMX_ERRORTYPE SetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
         p_port->i_frame_size = def->nBufferSize;
         if(def->eDir == OMX_DirInput)
         {
-            if(!GetOmxAudioFormat(p_fmt->i_codec,
-                                  &def->format.audio.eEncoding, 0) )
+            def->format.audio.eEncoding = GetOmxAudioFormat(p_fmt->i_codec );
+            if ( def->format.audio.eEncoding == OMX_AUDIO_CodingUnused )
             {
                 omx_error = OMX_ErrorNotImplemented;
                 CHECK_ERROR(omx_error, "codec %4.4s doesn't match any OMX format",
@@ -264,8 +263,8 @@ static OMX_ERRORTYPE SetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
         }
         else
         {
-            if( !OmxToVlcAudioFormat(def->format.audio.eEncoding,
-                                   &p_fmt->i_codec, 0 ) )
+            p_fmt->i_codec = OmxToVlcAudioFormat(def->format.audio.eEncoding );
+            if( p_fmt->i_codec == 0 )
             {
                 omx_error = OMX_ErrorNotImplemented;
                 CHECK_ERROR(omx_error, "OMX audio encoding %i not supported",
@@ -542,11 +541,11 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
             def->format.video.nStride = p_fmt->video.i_width;
         }
 
-        if(!GetVlcVideoFormat( def->format.video.eCompressionFormat,
-                               &p_fmt->i_codec, 0 ) )
+        p_fmt->i_codec = GetVlcVideoFormat( def->format.video.eCompressionFormat );
+        if( p_fmt->i_codec == 0 )
         {
-            if( !GetVlcChromaFormat( def->format.video.eColorFormat,
-                                     &p_fmt->i_codec, 0 ) )
+            p_fmt->i_codec = GetVlcChromaFormat( def->format.video.eColorFormat );
+            if( p_fmt->i_codec == 0 )
             {
                 omx_error = OMX_ErrorNotImplemented;
                 CHECK_ERROR(omx_error, "OMX color format %i not supported",
@@ -570,8 +569,8 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
         break;
 
     case AUDIO_ES:
-        if( !OmxToVlcAudioFormat( def->format.audio.eEncoding,
-                                &p_fmt->i_codec, 0 ) )
+        p_fmt->i_codec = OmxToVlcAudioFormat( def->format.audio.eEncoding );
+        if( p_fmt->i_codec == 0 )
         {
             omx_error = OMX_ErrorNotImplemented;
             CHECK_ERROR(omx_error, "OMX audio format %i not supported",
@@ -732,8 +731,8 @@ static OMX_ERRORTYPE InitialiseComponent(decoder_t *p_dec,
     /* Set component role */
     OMX_INIT_STRUCTURE(role);
     strcpy((char*)role.cRole,
-           GetOmxRole(p_sys->b_enc ? p_dec->fmt_out.i_codec : p_dec->fmt_in->i_codec,
-                      p_dec->fmt_in->i_cat, p_sys->b_enc));
+           GetOmxRole(p_sys->b_enc ? &p_dec->fmt_out : p_dec->fmt_in,
+                      p_sys->b_enc));
 
     omx_error = OMX_SetParameter(omx_handle, OMX_IndexParamStandardComponentRole,
                                  &role);
@@ -878,7 +877,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     int status;
 
-    if( 0 || !GetOmxRole(p_dec->fmt_in->i_codec, p_dec->fmt_in->i_cat, false) )
+    if( 0 || !GetOmxRole(p_dec->fmt_in, false) )
         return VLC_EGENERIC;
 
     status = OpenGeneric( p_this, false );
@@ -908,7 +907,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t*)p_this;
     int status;
 
-    if( !GetOmxRole(p_enc->fmt_out.i_codec, p_enc->fmt_in.i_cat, true) )
+    if( !GetOmxRole(&p_enc->fmt_out, true) )
         return VLC_EGENERIC;
 
     status = OpenGeneric( p_this, true );
@@ -979,8 +978,7 @@ static int OpenGeneric( vlc_object_t *p_this, bool b_encode )
     /* Enumerate components and build a list of the one we want to try */
     p_sys->components =
         CreateComponentsList(p_this,
-             GetOmxRole(p_sys->b_enc ? p_dec->fmt_out.i_codec :
-                        p_dec->fmt_in->i_codec, p_dec->fmt_in->i_cat,
+             GetOmxRole(p_sys->b_enc ? &p_dec->fmt_out : p_dec->fmt_in,
                         p_sys->b_enc), p_sys->ppsz_components);
     if( !p_sys->components )
     {


=====================================
modules/codec/omxil/omxil_utils.h
=====================================
@@ -225,23 +225,14 @@ int OMXCodec_GetQuirks( enum es_format_category_e i_cat, vlc_fourcc_t i_codec,
 /*****************************************************************************
  * fourcc -> omx id mapping
  *****************************************************************************/
-int GetOmxVideoFormat( vlc_fourcc_t i_fourcc,
-                       OMX_VIDEO_CODINGTYPE *pi_omx_codec,
-                       const char **ppsz_name );
-int GetVlcVideoFormat( OMX_VIDEO_CODINGTYPE i_omx_codec,
-                       vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
-int GetOmxAudioFormat( vlc_fourcc_t i_fourcc,
-                       OMX_AUDIO_CODINGTYPE *pi_omx_codec,
-                       const char **ppsz_name );
-int OmxToVlcAudioFormat( OMX_AUDIO_CODINGTYPE i_omx_codec,
-                       vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
-const char *GetOmxRole( vlc_fourcc_t i_fourcc, enum es_format_category_e i_cat,
+OMX_VIDEO_CODINGTYPE GetOmxVideoFormat( vlc_fourcc_t i_fourcc );
+vlc_fourcc_t GetVlcVideoFormat( OMX_VIDEO_CODINGTYPE i_omx_codec );
+OMX_AUDIO_CODINGTYPE GetOmxAudioFormat( vlc_fourcc_t i_fourcc );
+vlc_fourcc_t OmxToVlcAudioFormat( OMX_AUDIO_CODINGTYPE i_omx_codec );
+const char *GetOmxRole( const es_format_t *,
                         bool b_enc );
-int GetOmxChromaFormat( vlc_fourcc_t i_fourcc,
-                        OMX_COLOR_FORMATTYPE *pi_omx_codec,
-                        const char **ppsz_name );
-int GetVlcChromaFormat( OMX_COLOR_FORMATTYPE i_omx_codec,
-                        vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
+OMX_COLOR_FORMATTYPE GetOmxChromaFormat( vlc_fourcc_t i_fourcc );
+vlc_fourcc_t GetVlcChromaFormat( OMX_COLOR_FORMATTYPE i_omx_codec );
 int GetVlcChromaSizes( vlc_fourcc_t i_fourcc,
                        unsigned int width, unsigned int height,
                        unsigned int *size, unsigned int *pitch,


=====================================
modules/codec/omxil/utils.c
=====================================
@@ -510,7 +510,6 @@ static const struct
     { VLC_CODEC_RV40, OMX_VIDEO_CodingRV,    "video_decoder.rv"    },
     { VLC_CODEC_VP8,  OMX_VIDEO_CodingAutoDetect, "video_decoder.vp8" },
     { VLC_CODEC_VP9,  OMX_VIDEO_CodingAutoDetect, "video_decoder.vp9" },
-    { 0, 0, 0 }
 };
 
 static const struct
@@ -526,7 +525,6 @@ static const struct
     { VLC_CODEC_MP4A,   OMX_AUDIO_CodingAAC, "audio_decoder.aac" },
     { VLC_CODEC_S16N,   OMX_AUDIO_CodingPCM, "audio_decoder.pcm" },
     { VLC_CODEC_MP3,    OMX_AUDIO_CodingMP3, "audio_decoder.mp3" },
-    { 0, 0, 0 }
 };
 
 static const struct
@@ -588,49 +586,37 @@ static const struct
     { VLC_CODEC_YVYU, OMX_COLOR_FormatYCrYCb, 4, 2, 0 },
     { VLC_CODEC_UYVY, OMX_COLOR_FormatCbYCrY, 4, 2, 0 },
     { VLC_CODEC_VYUY, OMX_COLOR_FormatCrYCbY, 4, 2, 0 },
-    { 0, 0, 0, 0, 0 }
 };
 
-int GetOmxVideoFormat( vlc_fourcc_t i_fourcc,
-                       OMX_VIDEO_CODINGTYPE *pi_omx_codec,
-                       const char **ppsz_name )
+OMX_VIDEO_CODINGTYPE GetOmxVideoFormat( vlc_fourcc_t i_fourcc )
 {
-    unsigned int i;
-
     i_fourcc = vlc_fourcc_GetCodec( VIDEO_ES, i_fourcc );
 
-    for( i = 0; video_format_table[i].i_codec != 0; i++ )
-        if( video_format_table[i].i_fourcc == i_fourcc ) break;
+    for( size_t i = 0; i < ARRAY_SIZE(video_format_table); i++ )
+        if( video_format_table[i].i_fourcc == i_fourcc )
+            return video_format_table[i].i_codec;
 
-    if( pi_omx_codec ) *pi_omx_codec = video_format_table[i].i_codec;
-    if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( VIDEO_ES, i_fourcc );
-    return !!video_format_table[i].i_codec;
+    return OMX_VIDEO_CodingUnused;
 }
 
-int GetVlcVideoFormat( OMX_VIDEO_CODINGTYPE i_omx_codec,
-                       vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
+vlc_fourcc_t GetVlcVideoFormat( OMX_VIDEO_CODINGTYPE i_omx_codec )
 {
-    unsigned int i;
-
-    for( i = 0; video_format_table[i].i_codec != 0; i++ )
-        if( video_format_table[i].i_codec == i_omx_codec ) break;
+    for( size_t i = 0; i < ARRAY_SIZE(video_format_table); i++ )
+        if( video_format_table[i].i_codec == i_omx_codec )
+            return video_format_table[i].i_fourcc;
 
-    if( pi_fourcc ) *pi_fourcc = video_format_table[i].i_fourcc;
-    if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( VIDEO_ES,
-                                     video_format_table[i].i_fourcc );
-    return !!video_format_table[i].i_fourcc;
+    return 0;
 }
 
 static const char *GetOmxVideoRole( vlc_fourcc_t i_fourcc )
 {
-    unsigned int i;
-
     i_fourcc = vlc_fourcc_GetCodec( VIDEO_ES, i_fourcc );
 
-    for( i = 0; video_format_table[i].i_codec != 0; i++ )
-        if( video_format_table[i].i_fourcc == i_fourcc ) break;
+    for( size_t i = 0; i < ARRAY_SIZE(video_format_table); i++ )
+        if( video_format_table[i].i_fourcc == i_fourcc )
+            return video_format_table[i].psz_role;
 
-    return video_format_table[i].psz_role;
+    return NULL;
 }
 
 static const char *GetOmxVideoEncRole( vlc_fourcc_t i_fourcc )
@@ -645,46 +631,35 @@ static const char *GetOmxVideoEncRole( vlc_fourcc_t i_fourcc )
     return video_enc_format_table[i].psz_role;
 }
 
-int GetOmxAudioFormat( vlc_fourcc_t i_fourcc,
-                       OMX_AUDIO_CODINGTYPE *pi_omx_codec,
-                       const char **ppsz_name )
+OMX_AUDIO_CODINGTYPE GetOmxAudioFormat( vlc_fourcc_t i_fourcc )
 {
-    unsigned int i;
-
     i_fourcc = vlc_fourcc_GetCodec( AUDIO_ES, i_fourcc );
 
-    for( i = 0; audio_format_table[i].i_codec != 0; i++ )
-        if( audio_format_table[i].i_fourcc == i_fourcc ) break;
+    for( size_t i = 0; i < ARRAY_SIZE(audio_format_table); i++ )
+        if( audio_format_table[i].i_fourcc == i_fourcc )
+            return audio_format_table[i].i_codec;
 
-    if( pi_omx_codec ) *pi_omx_codec = audio_format_table[i].i_codec;
-    if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( AUDIO_ES, i_fourcc );
-    return !!audio_format_table[i].i_codec;
+    return OMX_AUDIO_CodingUnused;
 }
 
-int OmxToVlcAudioFormat( OMX_AUDIO_CODINGTYPE i_omx_codec,
-                       vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
+vlc_fourcc_t OmxToVlcAudioFormat( OMX_AUDIO_CODINGTYPE i_omx_codec )
 {
-    unsigned int i;
-
-    for( i = 0; audio_format_table[i].i_codec != 0; i++ )
-        if( audio_format_table[i].i_codec == i_omx_codec ) break;
+    for( size_t i = 0; i < ARRAY_SIZE(audio_format_table); i++ )
+        if( audio_format_table[i].i_codec == i_omx_codec )
+            return audio_format_table[i].i_fourcc;
 
-    if( pi_fourcc ) *pi_fourcc = audio_format_table[i].i_fourcc;
-    if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( AUDIO_ES,
-                                     audio_format_table[i].i_fourcc );
-    return !!audio_format_table[i].i_fourcc;
+    return 0;
 }
 
 static const char *GetOmxAudioRole( vlc_fourcc_t i_fourcc )
 {
-    unsigned int i;
-
     i_fourcc = vlc_fourcc_GetCodec( AUDIO_ES, i_fourcc );
 
-    for( i = 0; audio_format_table[i].i_codec != 0; i++ )
-        if( audio_format_table[i].i_fourcc == i_fourcc ) break;
+    for( size_t i = 0; i < ARRAY_SIZE(audio_format_table); i++ )
+        if( audio_format_table[i].i_fourcc == i_fourcc )
+            return audio_format_table[i].psz_role;
 
-    return audio_format_table[i].psz_role;
+    return NULL;
 }
 
 static const char *GetOmxAudioEncRole( vlc_fourcc_t i_fourcc )
@@ -699,45 +674,35 @@ static const char *GetOmxAudioEncRole( vlc_fourcc_t i_fourcc )
     return audio_enc_format_table[i].psz_role;
 }
 
-const char *GetOmxRole( vlc_fourcc_t i_fourcc, enum es_format_category_e i_cat,
+const char *GetOmxRole( const es_format_t *es,
                         bool b_enc )
 {
     if(b_enc)
-        return i_cat == VIDEO_ES ?
-            GetOmxVideoEncRole( i_fourcc ) : GetOmxAudioEncRole( i_fourcc );
-    else
-        return i_cat == VIDEO_ES ?
-            GetOmxVideoRole( i_fourcc ) : GetOmxAudioRole( i_fourcc );
+        return es->i_cat == VIDEO_ES ?
+            GetOmxVideoEncRole( es->i_codec ) : GetOmxAudioEncRole( es->i_codec );
+
+    return es->i_cat == VIDEO_ES ?
+        GetOmxVideoRole( es->i_codec ) : GetOmxAudioRole( es->i_codec );
 }
 
-int GetOmxChromaFormat( vlc_fourcc_t i_fourcc,
-                        OMX_COLOR_FORMATTYPE *pi_omx_codec,
-                        const char **ppsz_name )
+OMX_COLOR_FORMATTYPE GetOmxChromaFormat( vlc_fourcc_t i_fourcc )
 {
-    unsigned int i;
-
     i_fourcc = vlc_fourcc_GetCodec( VIDEO_ES, i_fourcc );
 
-    for( i = 0; chroma_format_table[i].i_codec != 0; i++ )
-        if( chroma_format_table[i].i_fourcc == i_fourcc ) break;
+    for( size_t i = 0; i < ARRAY_SIZE(chroma_format_table); i++ )
+        if( chroma_format_table[i].i_fourcc == i_fourcc )
+            return chroma_format_table[i].i_codec;
 
-    if( pi_omx_codec ) *pi_omx_codec = chroma_format_table[i].i_codec;
-    if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( VIDEO_ES, i_fourcc );
-    return !!chroma_format_table[i].i_codec;
+    return OMX_COLOR_FormatUnused;
 }
 
-int GetVlcChromaFormat( OMX_COLOR_FORMATTYPE i_omx_codec,
-                        vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
+vlc_fourcc_t GetVlcChromaFormat( OMX_COLOR_FORMATTYPE i_omx_codec )
 {
-    unsigned int i;
-
-    for( i = 0; chroma_format_table[i].i_codec != 0; i++ )
-        if( chroma_format_table[i].i_codec == i_omx_codec ) break;
+    for( size_t i = 0; i < ARRAY_SIZE(chroma_format_table); i++ )
+        if( chroma_format_table[i].i_codec == i_omx_codec )
+            return chroma_format_table[i].i_fourcc;
 
-    if( pi_fourcc ) *pi_fourcc = chroma_format_table[i].i_fourcc;
-    if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( VIDEO_ES,
-                                     chroma_format_table[i].i_fourcc );
-    return !!chroma_format_table[i].i_fourcc;
+    return 0;
 }
 
 int GetVlcChromaSizes( vlc_fourcc_t i_fourcc,
@@ -745,12 +710,14 @@ int GetVlcChromaSizes( vlc_fourcc_t i_fourcc,
                        unsigned int *size, unsigned int *pitch,
                        unsigned int *chroma_pitch_div )
 {
-    unsigned int i;
+    size_t i;
 
     i_fourcc = vlc_fourcc_GetCodec( VIDEO_ES, i_fourcc );
 
-    for( i = 0; chroma_format_table[i].i_codec != 0; i++ )
+    for( i = 0; i < ARRAY_SIZE(chroma_format_table); i++ )
         if( chroma_format_table[i].i_fourcc == i_fourcc ) break;
+    if (i == ARRAY_SIZE(chroma_format_table))
+        return 0;
 
     /* Align on macroblock boundary */
     width = (width + 15) & ~0xF;
@@ -1097,11 +1064,9 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port)
             case OMX_PortDomainVideo:
 
                 if(definition.format.video.eCompressionFormat)
-                    GetVlcVideoFormat( definition.format.video.eCompressionFormat,
-                                       &i_fourcc, &psz_name );
+                    i_fourcc = GetVlcVideoFormat( definition.format.video.eCompressionFormat );
                 else
-                    GetVlcChromaFormat( definition.format.video.eColorFormat,
-                                        &i_fourcc, &psz_name );
+                    i_fourcc = GetVlcChromaFormat( definition.format.video.eColorFormat );
 
                 OMX_INIT_STRUCTURE(crop_rect);
                 crop_rect.nPortIndex = definition.nPortIndex;
@@ -1113,6 +1078,8 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port)
                     crop_rect.nHeight = definition.format.video.nFrameHeight;
                 }
 
+                psz_name = vlc_fourcc_GetDescription( VIDEO_ES, i_fourcc );
+
                 msg_Dbg( p_dec, "  -> video %s %ix%i@%.2f (%i,%i) (%i,%i) (%i,%i,%i,%i)", psz_name,
                          (int)definition.format.video.nFrameWidth,
                          (int)definition.format.video.nFrameHeight,
@@ -1127,8 +1094,7 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port)
 
             case OMX_PortDomainAudio:
 
-                OmxToVlcAudioFormat( definition.format.audio.eEncoding,
-                                   &i_fourcc, &psz_name );
+                i_fourcc = OmxToVlcAudioFormat( definition.format.audio.eEncoding );
 
                 GetAudioParameters(omx_handle, &format_param,
                                    definition.nPortIndex,
@@ -1136,6 +1102,8 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port)
                                    &i_channels, &i_samplerate, &i_bitrate,
                                    &i_bitspersample, &i_blockalign);
 
+                psz_name = vlc_fourcc_GetDescription( AUDIO_ES, i_fourcc );
+
                 msg_Dbg( p_dec, "  -> audio %s (%i) %i,%i,%i,%i,%i", psz_name,
                          (int)definition.format.audio.eEncoding,
                          i_channels, i_samplerate, i_bitrate, i_bitspersample,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1035ce7dd43e0b18b7a03d0ba52146687a684710...97e504e0e94fbb335648a6fb9c2885b92b204ad0

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1035ce7dd43e0b18b7a03d0ba52146687a684710...97e504e0e94fbb335648a6fb9c2885b92b204ad0
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list