[vlc-commits] packetizer: hxxx: store generic reference in SEI callback

Francois Cartegnie git at videolan.org
Fri Oct 7 16:33:30 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Oct  6 14:33:08 2016 +0200| [fb0c9c6d6c6b807e844e09dd04746667644456fb] | committer: Francois Cartegnie

packetizer: hxxx: store generic reference in SEI callback

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb0c9c6d6c6b807e844e09dd04746667644456fb
---

 modules/packetizer/h264.c     |  8 +++++---
 modules/packetizer/hxxx_sei.c | 16 ++++++++--------
 modules/packetizer/hxxx_sei.h |  6 +++---
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index e175567..f011a93 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -167,7 +167,7 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag );
 static void PutPPS( decoder_t *p_dec, block_t *p_frag );
 static bool ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice,
                         int i_nal_ref_idc, int i_nal_type, const block_t *p_frag );
-static void ParseSeiCallback( decoder_t *p_dec, const hxxx_sei_data_t * );
+static void ParseSeiCallback( const hxxx_sei_data_t *, void * );
 
 
 static const uint8_t p_h264_startcode[3] = { 0x00, 0x00, 0x01 };
@@ -532,7 +532,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
         /* Parse SEI for CC support */
         if( i_nal_type == H264_NAL_SEI )
         {
-            HxxxParseSEI( p_dec, p_frag->p_buffer, p_frag->i_buffer, 1, ParseSeiCallback );
+            HxxxParse_AnnexB_SEI( p_frag->p_buffer, p_frag->i_buffer,
+                                  1 /* nal header */, ParseSeiCallback, p_dec );
         }
         else if( i_nal_type == H264_NAL_AU_DELIMITER )
         {
@@ -949,8 +950,9 @@ static bool ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice
     return true;
 }
 
-static void ParseSeiCallback( decoder_t *p_dec, const hxxx_sei_data_t *p_sei_data )
+static void ParseSeiCallback( const hxxx_sei_data_t *p_sei_data, void *cbdata )
 {
+    decoder_t *p_dec = (decoder_t *) cbdata;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     switch( p_sei_data->i_type )
diff --git a/modules/packetizer/hxxx_sei.c b/modules/packetizer/hxxx_sei.c
index 2236ddd..c0238ce 100644
--- a/modules/packetizer/hxxx_sei.c
+++ b/modules/packetizer/hxxx_sei.c
@@ -28,15 +28,15 @@
 #include "hxxx_sei.h"
 #include "hxxx_nal.h"
 
-void HxxxParse_AnnexB_SEI(decoder_t *p_dec, const uint8_t *p_buf, size_t i_buf,
-                          uint8_t i_header, pf_hxxx_sei_callback cb)
+void HxxxParse_AnnexB_SEI(const uint8_t *p_buf, size_t i_buf,
+                          uint8_t i_header, pf_hxxx_sei_callback cb, void *cbdata)
 {
     if( hxxx_strip_AnnexB_startcode( &p_buf, &i_buf ) )
-        HxxxParseSEI(p_dec, p_buf, i_buf, i_header, cb);
+        HxxxParseSEI(p_buf, i_buf, i_header, cb, cbdata);
 }
 
-void HxxxParseSEI(decoder_t *p_dec, const uint8_t *p_buf, size_t i_buf,
-                  uint8_t i_header, pf_hxxx_sei_callback pf_callback)
+void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
+                  uint8_t i_header, pf_hxxx_sei_callback pf_callback, void *cbdata)
 {
     bs_t s;
     unsigned i_bitflow = 0;
@@ -85,7 +85,7 @@ void HxxxParseSEI(decoder_t *p_dec, const uint8_t *p_buf, size_t i_buf,
             case HXXX_SEI_PIC_TIMING:
             {
                 sei_data.p_bs = &s;
-                pf_callback( p_dec, &sei_data );
+                pf_callback( &sei_data, cbdata );
             } break;
 
             /* Look for user_data_registered_itu_t_t35 */
@@ -120,7 +120,7 @@ void HxxxParseSEI(decoder_t *p_dec, const uint8_t *p_buf, size_t i_buf,
                 {
                     sei_data.itu_t35.i_cc = i_t35 - 3;
                     sei_data.itu_t35.p_cc = &p_t35[3];
-                    pf_callback( p_dec, &sei_data );
+                    pf_callback( &sei_data, cbdata );
                 }
 
                 free( p_t35 );
@@ -133,7 +133,7 @@ void HxxxParseSEI(decoder_t *p_dec, const uint8_t *p_buf, size_t i_buf,
                 //bool b_exact_match = bs_read( &s, 1 );
                 //bool b_broken_link = bs_read( &s, 1 );
                 //int i_changing_slice_group = bs_read( &s, 2 );
-                pf_callback( p_dec, &sei_data );
+                pf_callback( &sei_data, cbdata );
             } break;
 
             default:
diff --git a/modules/packetizer/hxxx_sei.h b/modules/packetizer/hxxx_sei.h
index b0bf2bb..a51d6e2 100644
--- a/modules/packetizer/hxxx_sei.h
+++ b/modules/packetizer/hxxx_sei.h
@@ -46,8 +46,8 @@ typedef struct
     };
 } hxxx_sei_data_t;
 
-typedef void (*pf_hxxx_sei_callback)(decoder_t *, const hxxx_sei_data_t *);
-void HxxxParseSEI(decoder_t *, const uint8_t *, size_t, uint8_t, pf_hxxx_sei_callback);
-void HxxxParse_AnnexB_SEI(decoder_t *, const uint8_t *, size_t, uint8_t, pf_hxxx_sei_callback);
+typedef void (*pf_hxxx_sei_callback)(const hxxx_sei_data_t *, void *);
+void HxxxParseSEI(const uint8_t *, size_t, uint8_t, pf_hxxx_sei_callback, void *);
+void HxxxParse_AnnexB_SEI(const uint8_t *, size_t, uint8_t, pf_hxxx_sei_callback, void *);
 
 #endif



More information about the vlc-commits mailing list