[vlc-commits] [Git][videolan/vlc][master] 3 commits: packetizer: hxxx_common: rename function pointer

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jul 17 14:20:50 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6e7b32f6 by François Cartegnie at 2024-07-17T13:51:05+00:00
packetizer: hxxx_common: rename function pointer

- - - - -
09655dea by François Cartegnie at 2024-07-17T13:51:05+00:00
packetizer: hxxx: pass opaque to callbacks instead of decoder

- - - - -
4f0a39ad by François Cartegnie at 2024-07-17T13:51:05+00:00
packetizer: hxxx: add missing drain for non annexb content

- - - - -


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
=====================================
@@ -149,6 +149,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 ReleaseXPS( decoder_sys_t *p_sys );
@@ -478,8 +482,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, p_dec->obj.logger,
+                          p_sys->i_avcC_length_size, pp_block,
+                          ParseNALBlockW, PacketizeDrain );
 }
 
 /*****************************************************************************


=====================================
modules/packetizer/hevc.c
=====================================
@@ -112,6 +112,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 * );
@@ -327,8 +331,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, p_dec->obj.logger,
+                          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, struct vlc_logger *logger,
+                        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 );
+            vlc_error( logger, "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 *, struct vlc_logger *,
+                       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/ec5ddbeb66ab9c6b9200bdae0762a1e787fdf411...4f0a39ada1bd9314601e80d7f48855462524d1fc

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ec5ddbeb66ab9c6b9200bdae0762a1e787fdf411...4f0a39ada1bd9314601e80d7f48855462524d1fc
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