[vlc-commits] [Git][videolan/vlc][3.0.x] 3 commits: packetizer: hxxx_common: rename function pointer

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jul 30 05:19:16 UTC 2024



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
4a39d480 by François Cartegnie at 2024-07-26T17:48:02+07:00
packetizer: hxxx_common: rename function pointer

(cherry picked from commit 6e7b32f64db918b3aa2deefe885571b734d32f53)

- - - - -
f661f8f3 by François Cartegnie at 2024-07-29T11:54:23+07:00
packetizer: hxxx: pass opaque to callbacks instead of decoder

(cherry picked from commit 09655dea51c0d383cc86c0f5020e3bea160c69bf)

- - - - -
45ecb60b by François Cartegnie at 2024-07-29T11:56:29+07:00
packetizer: hxxx: add missing drain for non annexb content

(cherry picked from commit 4f0a39ada1bd9314601e80d7f48855462524d1fc)

- - - - -


4 changed files:

- modules/packetizer/h264.c
- modules/packetizer/hevc.c
- modules/packetizer/hxxx_common.c
- modules/packetizer/hxxx_common.h


Changes:

=====================================
modules/packetizer/h264.c
=====================================
@@ -152,6 +152,10 @@ static int PacketizeValidate( void *p_private, block_t * );
 static block_t * PacketizeDrain( void *p_private );
 
 static block_t *ParseNALBlock( decoder_t *, bool *pb_ts_used, block_t * );
+static inline block_t *ParseNALBlockW( void *opaque, bool *pb_ts_used, block_t *p_frag )
+{
+    return ParseNALBlock( (decoder_t *) opaque, pb_ts_used, p_frag );
+}
 
 static block_t *OutputPicture( decoder_t *p_dec );
 static void PutSPS( decoder_t *p_dec, block_t *p_frag );
@@ -530,8 +534,9 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    return PacketizeXXC1( p_dec, p_sys->i_avcC_length_size,
-                          pp_block, ParseNALBlock );
+    return PacketizeXXC1( p_dec, VLC_OBJECT(p_dec),
+                          p_sys->i_avcC_length_size, pp_block,
+                          ParseNALBlockW, PacketizeDrain );
 }
 
 /*****************************************************************************


=====================================
modules/packetizer/hevc.c
=====================================
@@ -69,6 +69,10 @@ static void PacketizeFlush( decoder_t * );
 static void PacketizeReset(void *p_private, bool b_broken);
 static block_t *PacketizeParse(void *p_private, bool *pb_ts_used, block_t *);
 static block_t *ParseNALBlock(decoder_t *, bool *pb_ts_used, block_t *);
+static inline block_t *ParseNALBlockW( void *opaque, bool *pb_ts_used, block_t *p_frag )
+{
+    return ParseNALBlock( (decoder_t *) opaque, pb_ts_used, p_frag );
+}
 static int PacketizeValidate(void *p_private, block_t *);
 static block_t * PacketizeDrain(void *);
 static bool ParseSEICallback( const hxxx_sei_data_t *, void * );
@@ -297,8 +301,9 @@ static block_t *PacketizeHVC1(decoder_t *p_dec, block_t **pp_block)
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    return PacketizeXXC1( p_dec, p_sys->i_nal_length_size,
-                          pp_block, ParseNALBlock );
+    return PacketizeXXC1( p_dec, VLC_OBJECT(p_dec),
+                          p_sys->i_nal_length_size, pp_block,
+                          ParseNALBlockW, PacketizeDrain );
 }
 
 static block_t *PacketizeAnnexB(decoder_t *p_dec, block_t **pp_block)


=====================================
modules/packetizer/hxxx_common.c
=====================================
@@ -110,14 +110,19 @@ block_t * cc_storage_get_current( cc_storage_t *p_ccs, decoder_cc_desc_t *p_desc
  * Will always use 4 byte 0 0 0 1 startcodes
  * Will prepend a SPS and PPS before each keyframe
  ****************************************************************************/
-block_t *PacketizeXXC1( decoder_t *p_dec, uint8_t i_nal_length_size,
-                        block_t **pp_block, pf_annexb_nal_packetizer pf_nal_parser )
+block_t *PacketizeXXC1( void *p_private, vlc_object_t *p_obj,
+                        uint8_t i_nal_length_size, block_t **pp_block,
+                        pf_annexb_nal_parse pf_nal_parser,
+                        pf_annexb_nal_drain pf_nal_drain )
 {
     block_t       *p_block;
     block_t       *p_ret = NULL;
     uint8_t       *p;
 
-    if( !pp_block || !*pp_block )
+    if( !pp_block )
+        return pf_nal_drain ? pf_nal_drain( p_private ) : NULL;
+
+    if( !*pp_block )
         return NULL;
     if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
     {
@@ -145,7 +150,7 @@ block_t *PacketizeXXC1( decoder_t *p_dec, uint8_t i_nal_length_size,
         if( i_size <= 0 ||
             i_size > ( p_block->p_buffer + p_block->i_buffer - p ) )
         {
-            msg_Err( p_dec, "Broken frame : size %d is too big", i_size );
+            msg_Err( p_obj, "Broken frame : size %d is too big", i_size );
             break;
         }
 
@@ -184,7 +189,7 @@ block_t *PacketizeXXC1( decoder_t *p_dec, uint8_t i_nal_length_size,
 
         /* Parse the NAL */
         block_t *p_pic;
-        if( ( p_pic = pf_nal_parser( p_dec, &b_dummy, p_nal ) ) )
+        if( ( p_pic = pf_nal_parser( p_private, &b_dummy, p_nal ) ) )
         {
             block_ChainAppend( &p_ret, p_pic );
         }


=====================================
modules/packetizer/hxxx_common.h
=====================================
@@ -37,8 +37,11 @@ block_t * cc_storage_get_current( cc_storage_t *p_ccs, decoder_cc_desc_t * );
 
 /* */
 
-typedef block_t * (*pf_annexb_nal_packetizer)(decoder_t *, bool *, block_t *);
-block_t *PacketizeXXC1( decoder_t *, uint8_t, block_t **, pf_annexb_nal_packetizer );
+typedef block_t * (*pf_annexb_nal_parse)(void *, bool *, block_t *);
+typedef block_t * (*pf_annexb_nal_drain)(void *);
+block_t *PacketizeXXC1( void *, vlc_object_t *obj,
+                       uint8_t, block_t **,
+                       pf_annexb_nal_parse, pf_annexb_nal_drain );
 
 #endif // HXXX_COMMON_H
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/890c81a87124970d0492dbd22ae0c4ef01507824...45ecb60b539d8ffd520e58798afd7d2b115f7763

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/890c81a87124970d0492dbd22ae0c4ef01507824...45ecb60b539d8ffd520e58798afd7d2b115f7763
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