[vlc-commits] [Git][videolan/vlc][master] 2 commits: demux: keep the bits per sample in i_level when available

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Sep 12 17:06:34 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
ca92617c by Steve Lhomme at 2023-09-12T16:44:24+00:00
demux: keep the bits per sample in i_level when available

This might be needed by some decoders when it's not known from the codec ID.

- - - - -
3e5f2e5d by Steve Lhomme at 2023-09-12T16:44:24+00:00
codec: use the i_level as a bits per pixel when i_profile is -1

Some decoders may need that information to decode properly. The information
is provided by a few demuxers.

- - - - -


5 changed files:

- modules/codec/avcodec/video.c
- modules/codec/dmo/dmo.c
- modules/demux/avformat/demux.c
- modules/demux/mp4/essetup.c
- modules/demux/ogg.c


Changes:

=====================================
modules/codec/avcodec/video.c
=====================================
@@ -419,6 +419,10 @@ static int OpenVideoCodec( decoder_t *p_dec )
     }
 
     ctx->bits_per_coded_sample = vlc_fourcc_GetChromaBPP(p_dec->fmt_in->video.i_chroma);
+    if ( ctx->bits_per_coded_sample == 0 &&
+         p_dec->fmt_in->i_profile == -1 && p_dec->fmt_in->i_level != -1 )
+        // HACK: the bits per sample was stored in the i_level
+        ctx->bits_per_coded_sample = p_dec->fmt_in->i_level;
     p_sys->pix_fmt = AV_PIX_FMT_NONE;
     cc_Init( &p_sys->cc );
 


=====================================
modules/codec/dmo/dmo.c
=====================================
@@ -369,6 +369,10 @@ static int DecOpen( decoder_t *p_dec )
         p_bih->biWidth = p_dec->fmt_in->video.i_width;
         p_bih->biHeight = p_dec->fmt_in->video.i_height;
         p_bih->biBitCount = vlc_fourcc_GetChromaBPP(fcc);
+        if ( p_bih->biBitCount == 0 &&
+             p_dec->fmt_in->i_profile == -1 && p_dec->fmt_in->i_level != -1 )
+            // HACK: the bits per sample was stored in the i_level
+            p_bih->biBitCount = p_dec->fmt_in->i_level;
         p_bih->biPlanes = 1;
         p_bih->biSize = i_size - sizeof(VIDEOINFOHEADER) + sizeof(*p_bih);
 


=====================================
modules/demux/avformat/demux.c
=====================================
@@ -493,6 +493,8 @@ int avformat_OpenDemux( vlc_object_t *p_this )
             es_format_Init( &es_fmt, VIDEO_ES, fcc );
             es_fmt.i_original_fourcc = CodecTagToFourcc( cp->codec_tag );
 
+            // HACK: keep the bits per sample, will be lost if i_level is used.
+            es_fmt.i_level = cp->bits_per_coded_sample;
             /* Special case for raw video data */
             if( cp->codec_id == AV_CODEC_ID_RAWVIDEO )
             {


=====================================
modules/demux/mp4/essetup.c
=====================================
@@ -722,6 +722,9 @@ int SetupVideoES( demux_t *p_demux, const mp4_track_t *p_track, const MP4_Box_t
                 }
 
                 p_fmt->video.color_range = p_data->i_fullrange ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
+                if (p_fmt->i_profile == -1 && p_fmt->i_level == -1)
+                    // HACK: keep the bits per sample in i_level
+                    p_fmt->i_level = p_data->i_bit_depth;
 
                 CopyExtradata( p_data->p_codec_init_data,
                                p_data->i_codec_init_datasize,


=====================================
modules/demux/ogg.c
=====================================
@@ -1867,6 +1867,9 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                         p_stream->fmt.video.i_frame_rate_base = den;
                         date_Init( &p_stream->dts, num, den );
                         unsigned bpp = GetWLE((oggpacket.packet+182));
+                        if (p_stream->fmt.i_profile == -1 && p_stream->fmt.i_level == -1)
+                            // HACK: keep the bits per sample, will be lost if i_level is used.
+                            p_stream->fmt.i_level = bpp;
                         p_stream->fmt.video.i_width =
                             GetDWLE((oggpacket.packet+176));
                         p_stream->fmt.video.i_height =



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/122ad196f74dc0d5148fc142eb706a7433203dc9...3e5f2e5d208ac66126cda01f05b2ca3cffd3a9ee

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/122ad196f74dc0d5148fc142eb706a7433203dc9...3e5f2e5d208ac66126cda01f05b2ca3cffd3a9ee
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