[vlc-commits] [Git][videolan/vlc][master] 14 commits: demux: mp3: set fourcc to layer

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon May 29 08:42:57 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
c9c65f47 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
demux: mp3: set fourcc to layer

- - - - -
b1015796 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
packetizer: mpegaudio: set fourcc to source

- - - - -
ff6bd8f2 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
packetizer: mpegaudio: add layer 2 as input

currently can be output by mp4.
mp4->sout

- - - - -
f8bc4734 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
codec: mad: handle MP2 fourcc

- - - - -
463b4d92 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
codec: mpg123: handle MP2 fourcc

- - - - -
acedf1b0 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
codec: shine: handle MP2 fourcc

- - - - -
6fe6385c by Francois Cartegnie at 2023-05-29T07:54:41+00:00
codec: spdif: handle layer 2

- - - - -
b4b88178 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
mux: asf: handle mpeg layer 2

- - - - -
292da5cc by Francois Cartegnie at 2023-05-29T07:54:41+00:00
mux: avi: handle lower mpeg audio layers

- - - - -
3611c3e8 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
mux: mp4: handle MP2 fourcc

- - - - -
f280ac02 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
mux: ts: handle MP2 fourcc

- - - - -
5f3170c2 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
sout: chromecast:

- - - - -
8aa667ee by Francois Cartegnie at 2023-05-29T07:54:41+00:00
sout: chromecast: use switch for codecs list

- - - - -
ea800869 by Francois Cartegnie at 2023-05-29T07:54:41+00:00
sout: chromecast: handle MP2/MPGA fourcc

- - - - -


11 changed files:

- modules/codec/mad.c
- modules/codec/mpg123.c
- modules/codec/shine.c
- modules/codec/spdif.c
- modules/demux/mpeg/es.c
- modules/mux/asf.c
- modules/mux/avi.c
- modules/mux/mp4/libmp4mux.c
- modules/mux/mpeg/ts.c
- modules/packetizer/mpegaudio.c
- modules/stream_out/chromecast/cast.cpp


Changes:

=====================================
modules/codec/mad.c
=====================================
@@ -260,6 +260,7 @@ static int Open( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
 
     if( ( p_dec->fmt_in->i_codec != VLC_CODEC_MPGA
+     && p_dec->fmt_in->i_codec != VLC_CODEC_MP2
      && p_dec->fmt_in->i_codec != VLC_CODEC_MP3
      && p_dec->fmt_in->i_codec != VLC_FOURCC('m','p','g','3') )
      || p_dec->fmt_in->audio.i_rate == 0


=====================================
modules/codec/mpg123.c
=====================================
@@ -382,6 +382,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
 
     if( p_dec->fmt_in->i_codec != VLC_CODEC_MPGA &&
+        p_dec->fmt_in->i_codec != VLC_CODEC_MP2 &&
         p_dec->fmt_in->i_codec != VLC_CODEC_MP3 )
         return VLC_EGENERIC;
 


=====================================
modules/codec/shine.c
=====================================
@@ -75,7 +75,9 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_sys_t *p_sys;
 
     /* shine is an 'MP3' encoder */
-    if( (p_enc->fmt_out.i_codec != VLC_CODEC_MP3 && p_enc->fmt_out.i_codec != VLC_CODEC_MPGA) ||
+    if( (p_enc->fmt_out.i_codec != VLC_CODEC_MP3 &&
+         p_enc->fmt_out.i_codec != VLC_CODEC_MP2 &&
+         p_enc->fmt_out.i_codec != VLC_CODEC_MPGA) ||
         p_enc->fmt_out.audio.i_channels > 2 )
         return VLC_EGENERIC;
 


=====================================
modules/codec/spdif.c
=====================================
@@ -53,6 +53,7 @@ OpenDecoder(vlc_object_t *p_this)
     switch (p_dec->fmt_in->i_codec)
     {
     case VLC_CODEC_MPGA:
+    case VLC_CODEC_MP2:
     case VLC_CODEC_MP3:
         /* Disabled by default */
         if (!p_dec->obj.force)


=====================================
modules/demux/mpeg/es.c
=====================================
@@ -1368,6 +1368,9 @@ static int MpgaInit( demux_t *p_demux )
     if( !MpgaCheckSync( p_peek ) || mpga_decode_frameheader( header, &p_sys->mpgah ) )
         return VLC_SUCCESS;
 
+    if( p_sys->mpgah.i_layer == 3 )
+        p_sys->codec.i_codec = VLC_CODEC_MP3;
+
     /* Xing header */
     int i_skip;
 


=====================================
modules/mux/asf.c
=====================================
@@ -373,6 +373,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
                     i_blockalign = 1;
                     i_extra = 12;
                     break;
+                case VLC_CODEC_MP2:
                 case VLC_CODEC_MPGA:
                     tk->psz_name = "MPEG Audio Layer 1/2";
                     tk->i_tag = WAVE_FORMAT_MPEG;


=====================================
modules/mux/avi.c
=====================================
@@ -352,6 +352,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
                     p_wf->wFormatTag = WAVE_FORMAT_MPEGLAYER3;
                     p_wf->nBlockAlign= 1;
                     break;
+                case VLC_CODEC_MPGA:
+                case VLC_CODEC_MP2:
+                    p_wf->wFormatTag = WAVE_FORMAT_MPEG;
+                    p_wf->nBlockAlign= 1;
+                    break;
                 case VLC_CODEC_WMA1:
                     p_wf->wFormatTag = WAVE_FORMAT_WMA1;
                     break;


=====================================
modules/mux/mp4/libmp4mux.c
=====================================
@@ -100,6 +100,7 @@ static void mp4mux_AddExtraBrandForFormat(mp4mux_handle_t *h, const es_format_t
             mp4mux_AddExtraBrand(h, BRAND_iso6);
             break;
         case VLC_CODEC_MP3:
+        case VLC_CODEC_MP2:
         case VLC_CODEC_MPGA:
         case VLC_CODEC_MP4V:
         case VLC_CODEC_DIV1:
@@ -638,6 +639,7 @@ static bo_t *GetESDS(mp4mux_trackinfo_t *p_track)
         i_object_profile_indication = 0x40; /* Audio 14496-3 */
         break;
     case VLC_CODEC_MP3:
+    case VLC_CODEC_MP2:
     case VLC_CODEC_MPGA:
         i_object_profile_indication =
             p_track->fmt.audio.i_rate < 32000 ? 0x69 /* Audio 13818-3 */
@@ -1182,6 +1184,7 @@ static bo_t *GetSounBox(vlc_object_t *p_obj, mp4mux_trackinfo_t *p_track, bool b
             } else b_descr = true;
             break;
         case VLC_CODEC_MPGA:
+        case VLC_CODEC_MP2:
         case VLC_CODEC_MP3:
             if (b_mov) {
                 /* mpeg audio in mov */
@@ -2326,6 +2329,7 @@ bool mp4mux_CanMux(vlc_object_t *p_obj, const es_format_t *p_fmt,
     case VLC_CODEC_MP4A:
     case VLC_CODEC_MP4V:
     case VLC_CODEC_MPGA:
+    case VLC_CODEC_MP2:
     case VLC_CODEC_MP3:
     case VLC_CODEC_MPGV:
     case VLC_CODEC_MP2V:


=====================================
modules/mux/mpeg/ts.c
=====================================
@@ -1208,8 +1208,9 @@ static bool MuxStreams(sout_mux_t *p_mux )
 
         block_t *p_data;
         if( p_stream == p_pcr_stream || p_sys->b_data_alignment
-             || ((p_input->p_fmt->i_codec != VLC_CODEC_MPGA ) &&
-                 (p_input->p_fmt->i_codec != VLC_CODEC_MP3) ) )
+             || (p_input->p_fmt->i_codec != VLC_CODEC_MPGA &&
+                 p_input->p_fmt->i_codec != VLC_CODEC_MP2 &&
+                 p_input->p_fmt->i_codec != VLC_CODEC_MP3 ) )
         {
             p_data = block_FifoGet( p_input->p_fifo );
             if( p_data->i_dts == VLC_TICK_INVALID )


=====================================
modules/packetizer/mpegaudio.c
=====================================
@@ -464,8 +464,9 @@ static int Open( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if(( p_dec->fmt_in->i_codec != VLC_CODEC_MPGA ) &&
-       ( p_dec->fmt_in->i_codec != VLC_CODEC_MP3 ) )
+    if( p_dec->fmt_in->i_codec != VLC_CODEC_MPGA &&
+        p_dec->fmt_in->i_codec != VLC_CODEC_MP2 &&
+        p_dec->fmt_in->i_codec != VLC_CODEC_MP3 )
     {
         return VLC_EGENERIC;
     }
@@ -485,7 +486,7 @@ static int Open( vlc_object_t *p_this )
     memset(&p_sys->header, 0, sizeof(p_sys->header));
 
     /* Set output properties */
-    p_dec->fmt_out.i_codec = VLC_CODEC_MPGA;
+    p_dec->fmt_out.i_codec = p_dec->fmt_in->i_codec;
     p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
 
     /* Set callback */


=====================================
modules/stream_out/chromecast/cast.cpp
=====================================
@@ -760,8 +760,16 @@ bool sout_stream_sys_t::canDecodeVideo( vlc_fourcc_t i_codec ) const
 {
     if( transcoding_state & TRANSCODING_VIDEO )
         return false;
-    return i_codec == VLC_CODEC_H264 || i_codec == VLC_CODEC_HEVC
-        || i_codec == VLC_CODEC_VP8 || i_codec == VLC_CODEC_VP9;
+    switch( i_codec )
+    {
+        case VLC_CODEC_H264:
+        case VLC_CODEC_HEVC:
+        case VLC_CODEC_VP8:
+        case VLC_CODEC_VP9:
+            return true;
+        default:
+            return false;
+    }
 }
 
 bool sout_stream_sys_t::canDecodeAudio( sout_stream_t *p_stream,
@@ -770,19 +778,25 @@ bool sout_stream_sys_t::canDecodeAudio( sout_stream_t *p_stream,
 {
     if( transcoding_state & TRANSCODING_AUDIO )
         return false;
-    if ( i_codec == VLC_CODEC_A52 || i_codec == VLC_CODEC_EAC3 )
+    switch( i_codec )
     {
-        return var_InheritBool( p_stream, SOUT_CFG_PREFIX "audio-passthrough" );
-    }
-    if ( i_codec == VLC_FOURCC('h', 'a', 'a', 'c') ||
-            i_codec == VLC_FOURCC('l', 'a', 'a', 'c') ||
-            i_codec == VLC_FOURCC('s', 'a', 'a', 'c') ||
-            i_codec == VLC_CODEC_MP4A )
-    {
-        return p_fmt->i_channels <= 2;
+        case VLC_CODEC_A52:
+        case VLC_CODEC_EAC3:
+            return var_InheritBool( p_stream, SOUT_CFG_PREFIX "audio-passthrough" );
+        case VLC_FOURCC('h', 'a', 'a', 'c'):
+        case VLC_FOURCC('l', 'a', 'a', 'c'):
+        case VLC_FOURCC('s', 'a', 'a', 'c'):
+        case VLC_CODEC_MP4A:
+            return p_fmt->i_channels <= 2;
+        case VLC_CODEC_VORBIS:
+        case VLC_CODEC_OPUS:
+        case VLC_CODEC_MP3:
+        case VLC_CODEC_MP2:
+        case VLC_CODEC_MPGA:
+            return true;
+        default:
+            return false;
     }
-    return i_codec == VLC_CODEC_VORBIS || i_codec == VLC_CODEC_OPUS ||
-           i_codec == VLC_CODEC_MP3;
 }
 
 void sout_stream_sys_t::stopSoutChain(sout_stream_t *p_stream)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5b59f2e5ec35a4903fc7d0722667a151e704962e...ea80086999670e30fc2785e9de64e698f9ba4f92

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5b59f2e5ec35a4903fc7d0722667a151e704962e...ea80086999670e30fc2785e9de64e698f9ba4f92
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