[vlc-commits] [Git][videolan/vlc][3.0.x] 5 commits: input: es_out: refactor codec info

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Dec 3 08:34:16 UTC 2025



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
767e95da by François Cartegnie at 2025-12-03T09:16:30+01:00
input: es_out: refactor codec info

cherry-picked from d89a93356dbf4617614898b5ce0cbfe17b48219f

- - - - -
aa2ec8f5 by François Cartegnie at 2025-12-03T09:16:30+01:00
input: es_out: differentiate decoded & source audio formats

Because users can't get it. Too many invalid bugs.

cherry-picked from 8009135e0dcf28f24c34ee5d8251fa2c10488722

- - - - -
557873e2 by François Cartegnie at 2025-12-03T09:16:30+01:00
es_out: use EMPTY_STR macro

cherry-picked from a13c388cc25e2ecc45792a0a68367fc90176bf40

- - - - -
f5527c09 by François Cartegnie at 2025-12-03T09:16:30+01:00
es_out: make use of initial es description

cherry-picked from 977b8e38a1dc35ce84ce5f99a699b34cda0720aa

- - - - -
6d049d67 by François Cartegnie at 2025-12-03T09:16:30+01:00
es_out: bitrate info is valid for any ES

cherry-picked from d568e3d8a4254f3b40ee7af02c1b655d77fe3d0d

- - - - -


1 changed file:

- src/input/es_out.c


Changes:

=====================================
src/input/es_out.c
=====================================
@@ -3073,6 +3073,19 @@ static int LanguageArrayIndex( char **ppsz_langs, const char *psz_lang )
     return -1;
 }
 
+static void info_category_AddCodecInfo( info_category_t* p_cat,
+                                        const char *psz_info,
+                                        vlc_fourcc_t i_fourcc,
+                                        const char *psz_description )
+{
+    const char *ps_fcc = (const char*)&i_fourcc;
+    if( psz_description && *psz_description )
+        info_category_AddInfo( p_cat, psz_info, "%s (%.4s)",
+                               psz_description, ps_fcc );
+    else if ( i_fourcc != VLC_FOURCC(0,0,0,0) )
+        info_category_AddInfo( p_cat, psz_info, "%.4s", ps_fcc );
+}
+
 /****************************************************************************
  * EsOutUpdateInfo:
  * - add meta info to the playlist item
@@ -3140,51 +3153,80 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
                                p_fmt_es->i_original_fourcc : p_fmt_es->i_codec;
     const char *psz_codec_description =
         vlc_fourcc_GetDescription( p_fmt_es->i_cat, i_codec_fourcc );
-    if( psz_codec_description && *psz_codec_description )
-        info_category_AddInfo( p_cat, _("Codec"), "%s (%.4s)",
-                               psz_codec_description, (char*)&i_codec_fourcc );
-    else if ( i_codec_fourcc != VLC_FOURCC(0,0,0,0) )
-        info_category_AddInfo( p_cat, _("Codec"), "%.4s",
-                               (char*)&i_codec_fourcc );
-
-    if( es->psz_language && *es->psz_language )
+    info_category_AddCodecInfo( p_cat, _("Codec"),
+                                i_codec_fourcc, psz_codec_description );
+
+    if( !EMPTY_STR(es->psz_language) )
         info_category_AddInfo( p_cat, _("Language"), "%s",
                                es->psz_language );
-    if( fmt->psz_description && *fmt->psz_description )
+    if( !EMPTY_STR(fmt->psz_description) || !EMPTY_STR(p_fmt_es->psz_description) )
         info_category_AddInfo( p_cat, _("Description"), "%s",
-                               fmt->psz_description );
+                               EMPTY_STR(fmt->psz_description) ? p_fmt_es->psz_description
+                                                               : fmt->psz_description );
+
+    if( p_fmt_es->i_bitrate > 0 )
+        info_category_AddInfo( p_cat, _("Bitrate"), _("%u kb/s"),
+                               p_fmt_es->i_bitrate / 1000 );
 
     switch( fmt->i_cat )
     {
     case AUDIO_ES:
         info_category_AddInfo( p_cat, _("Type"), _("Audio") );
 
-        if( fmt->audio.i_physical_channels )
+        if( p_fmt_es->audio.i_physical_channels )
             info_category_AddInfo( p_cat, _("Channels"), "%s",
-                                   _( aout_FormatPrintChannels( &fmt->audio ) ) );
+                vlc_gettext( aout_FormatPrintChannels( &p_fmt_es->audio ) ) );
 
-        if( fmt->audio.i_rate != 0 )
+        if( p_fmt_es->audio.i_rate )
         {
             info_category_AddInfo( p_cat, _("Sample rate"), _("%u Hz"),
-                                   fmt->audio.i_rate );
+                                   p_fmt_es->audio.i_rate );
             /* FIXME that should be removed or improved ! (used by text/strings.c) */
-            var_SetInteger( p_input, "sample-rate", fmt->audio.i_rate );
+            var_SetInteger( p_input, "sample-rate", p_fmt_es->audio.i_rate );
         }
 
-        unsigned int i_bitspersample = fmt->audio.i_bitspersample;
-        if( i_bitspersample == 0 )
-            i_bitspersample = aout_BitsPerSample( p_fmt_es->i_codec );
-        if( i_bitspersample != 0 )
+        unsigned int i_orgbps = p_fmt_es->audio.i_bitspersample;
+        if( i_orgbps == 0 )
+            i_orgbps = aout_BitsPerSample( p_fmt_es->i_codec );
+        if( i_orgbps != 0 )
             info_category_AddInfo( p_cat, _("Bits per sample"), "%u",
-                                   i_bitspersample );
+                                   i_orgbps );
+
+        if( fmt->audio.i_format &&
+            fmt->audio.i_format != p_fmt_es->i_codec )
+        {
+            psz_codec_description = vlc_fourcc_GetDescription( AUDIO_ES,
+                                                               fmt->audio.i_format );
+            info_category_AddCodecInfo( p_cat, _("Decoded format"),
+                                        fmt->audio.i_format,
+                                        psz_codec_description );
+        }
 
-        if( fmt->i_bitrate != 0 )
+        if( fmt->audio.i_physical_channels &&
+            fmt->audio.i_physical_channels != p_fmt_es->audio.i_physical_channels )
+            info_category_AddInfo( p_cat, _("Decoded channels"), "%s",
+                vlc_gettext( aout_FormatPrintChannels( &fmt->audio ) ) );
+
+        if( fmt->audio.i_rate &&
+            fmt->audio.i_rate != p_fmt_es->audio.i_rate )
+            info_category_AddInfo( p_cat, _("Decoded sample rate"), _("%u Hz"),
+                                   fmt->audio.i_rate );
+
+        unsigned i_outbps = fmt->audio.i_bitspersample;
+        if( i_outbps == 0 )
+            i_outbps = aout_BitsPerSample( fmt->i_codec );
+        if( i_outbps != 0 && i_outbps != i_orgbps )
+            info_category_AddInfo( p_cat, _("Decoded bits per sample"), "%u",
+                                   i_outbps );
+
+        if( fmt->i_bitrate > 0 )
         {
-            info_category_AddInfo( p_cat, _("Bitrate"), _("%u kb/s"),
+            info_category_AddInfo( p_cat, _("Decoded Bitrate"), _("%u kb/s"),
                                    fmt->i_bitrate / 1000 );
             /* FIXME that should be removed or improved ! (used by text/strings.c) */
             var_SetInteger( p_input, "bit-rate", fmt->i_bitrate );
         }
+
         for( int i = 0; i < AUDIO_REPLAY_GAIN_MAX; i++ )
         {
             const audio_replay_gain_t *p_rg = &fmt->audio_replay_gain;
@@ -3228,11 +3270,11 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
        }
        if( fmt->i_codec != p_fmt_es->i_codec )
        {
-           const char *psz_chroma_description =
-                vlc_fourcc_GetDescription( VIDEO_ES, fmt->i_codec );
-           if( psz_chroma_description )
-               info_category_AddInfo( p_cat, _("Decoded format"), "%s",
-                                      psz_chroma_description );
+           psz_codec_description = vlc_fourcc_GetDescription( VIDEO_ES,
+                                                              fmt->i_codec );
+           info_category_AddCodecInfo( p_cat, _("Decoded format"),
+                                       fmt->i_codec,
+                                       psz_codec_description );
        }
        {
            static const char orient_names[][13] = {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/911d96778808be91bc76cd3590ae950906a78e5b...6d049d6702c6ffc3d0faa53bb169e223af55e4ba

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/911d96778808be91bc76cd3590ae950906a78e5b...6d049d6702c6ffc3d0faa53bb169e223af55e4ba
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