mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-25 12:23:59 +00:00
passing cc_subtitle in src/avc_functions.c
This commit is contained in:
parent
4d11a727d9
commit
da8d4a290c
@ -12,7 +12,7 @@ static void sei_rbsp (unsigned char *seibuf, unsigned char *seiend);
|
|||||||
static unsigned char *sei_message (unsigned char *seibuf, unsigned char *seiend);
|
static unsigned char *sei_message (unsigned char *seibuf, unsigned char *seiend);
|
||||||
static void user_data_registered_itu_t_t35 (unsigned char *userbuf, unsigned char *userend);
|
static void user_data_registered_itu_t_t35 (unsigned char *userbuf, unsigned char *userend);
|
||||||
static void seq_parameter_set_rbsp (unsigned char *seqbuf, unsigned char *seqend);
|
static void seq_parameter_set_rbsp (unsigned char *seqbuf, unsigned char *seqend);
|
||||||
static void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_type);
|
static void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_type, struct cc_subtitle *sub);
|
||||||
|
|
||||||
static unsigned char cc_count;
|
static unsigned char cc_count;
|
||||||
// buffer to hold cc data
|
// buffer to hold cc data
|
||||||
@ -44,7 +44,7 @@ void init_avc(void)
|
|||||||
cc_data = (unsigned char*)malloc(1024);
|
cc_data = (unsigned char*)malloc(1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_NAL (unsigned char *NALstart, LLONG NAL_length)
|
void do_NAL (unsigned char *NALstart, LLONG NAL_length, struct cc_subtitle *sub)
|
||||||
{
|
{
|
||||||
unsigned char *NALstop;
|
unsigned char *NALstop;
|
||||||
unsigned nal_unit_type = *NALstart & 0x1F;
|
unsigned nal_unit_type = *NALstart & 0x1F;
|
||||||
@ -76,7 +76,7 @@ void do_NAL (unsigned char *NALstart, LLONG NAL_length)
|
|||||||
// Found coded slice of a non-IDR picture
|
// Found coded slice of a non-IDR picture
|
||||||
// We only need the slice header data, no need to implement
|
// We only need the slice header data, no need to implement
|
||||||
// slice_layer_without_partitioning_rbsp( );
|
// slice_layer_without_partitioning_rbsp( );
|
||||||
slice_header(NALstart+1, NALstop, nal_unit_type);
|
slice_header(NALstart+1, NALstop, nal_unit_type, sub);
|
||||||
}
|
}
|
||||||
else if ( got_seq_para && nal_unit_type == CCX_NAL_TYPE_SEI )
|
else if ( got_seq_para && nal_unit_type == CCX_NAL_TYPE_SEI )
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ void do_NAL (unsigned char *NALstart, LLONG NAL_length)
|
|||||||
|
|
||||||
// Process inbuf bytes in buffer holding and AVC (H.264) video stream.
|
// Process inbuf bytes in buffer holding and AVC (H.264) video stream.
|
||||||
// The number of processed bytes is returned.
|
// The number of processed bytes is returned.
|
||||||
LLONG process_avc (unsigned char *avcbuf, LLONG avcbuflen)
|
LLONG process_avc (unsigned char *avcbuf, LLONG avcbuflen ,struct cc_subtitle *sub)
|
||||||
{
|
{
|
||||||
unsigned char *bpos = avcbuf;
|
unsigned char *bpos = avcbuf;
|
||||||
unsigned char *NALstart;
|
unsigned char *NALstart;
|
||||||
@ -203,7 +203,7 @@ LLONG process_avc (unsigned char *avcbuf, LLONG avcbuflen)
|
|||||||
dvprint("BEGIN NAL unit type: %d length %d zeros: %d ref_idc: %d - Buffered captions before: %d\n",
|
dvprint("BEGIN NAL unit type: %d length %d zeros: %d ref_idc: %d - Buffered captions before: %d\n",
|
||||||
nal_unit_type, NALstop-NALstart-1, zeropad, nal_ref_idc, !cc_buffer_saved);
|
nal_unit_type, NALstop-NALstart-1, zeropad, nal_ref_idc, !cc_buffer_saved);
|
||||||
|
|
||||||
do_NAL (NALstart, NALstop-NALstart);
|
do_NAL (NALstart, NALstop-NALstart, sub);
|
||||||
|
|
||||||
dvprint("END NAL unit type: %d length %d zeros: %d ref_idc: %d - Buffered captions after: %d\n",
|
dvprint("END NAL unit type: %d length %d zeros: %d ref_idc: %d - Buffered captions after: %d\n",
|
||||||
nal_unit_type, NALstop-NALstart-1, zeropad, nal_ref_idc, !cc_buffer_saved);
|
nal_unit_type, NALstop-NALstart-1, zeropad, nal_ref_idc, !cc_buffer_saved);
|
||||||
@ -745,7 +745,7 @@ void seq_parameter_set_rbsp (unsigned char *seqbuf, unsigned char *seqend)
|
|||||||
|
|
||||||
|
|
||||||
// Process slice header in AVC data.
|
// Process slice header in AVC data.
|
||||||
void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_type)
|
void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_type, struct cc_subtitle *sub)
|
||||||
{
|
{
|
||||||
LLONG tmp;
|
LLONG tmp;
|
||||||
struct bitstream q1;
|
struct bitstream q1;
|
||||||
@ -910,7 +910,7 @@ void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_ty
|
|||||||
// Flush buffered cc blocks before doing the housekeeping
|
// Flush buffered cc blocks before doing the housekeeping
|
||||||
if (has_ccdata_buffered)
|
if (has_ccdata_buffered)
|
||||||
{
|
{
|
||||||
process_hdcc();
|
process_hdcc(sub);
|
||||||
}
|
}
|
||||||
last_gop_length = frames_since_last_gop;
|
last_gop_length = frames_since_last_gop;
|
||||||
frames_since_last_gop=0;
|
frames_since_last_gop=0;
|
||||||
@ -1042,11 +1042,9 @@ void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_ty
|
|||||||
total_frames_count++;
|
total_frames_count++;
|
||||||
frames_since_last_gop++;
|
frames_since_last_gop++;
|
||||||
|
|
||||||
store_hdcc(cc_data, cc_count, curridx, fts_now);
|
store_hdcc(cc_data, cc_count, curridx, fts_now, sub);
|
||||||
cc_buffer_saved=1; // CFS: store_hdcc supposedly saves the CC buffer to a sequence buffer
|
cc_buffer_saved=1; // CFS: store_hdcc supposedly saves the CC buffer to a sequence buffer
|
||||||
cc_count=0;
|
cc_count=0;
|
||||||
|
|
||||||
//exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// max_dec_frame_buffering .. Max frames in buffer
|
// max_dec_frame_buffering .. Max frames in buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user