MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_ps_stream_decode

Function hb_ps_stream_decode

libhb/stream.c:3531–3633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3529}
3530
3531static hb_buffer_t * hb_ps_stream_decode( hb_stream_t *stream )
3532{
3533 hb_pes_info_t pes_info;
3534 hb_buffer_t *buf = hb_buffer_init(HB_DVD_READ_BUFFER_SIZE);
3535
3536 while (1)
3537 {
3538 buf->size = 0;
3539 int len = hb_ps_read_packet( stream, buf );
3540 if ( len == 0 )
3541 {
3542 // End of file
3543 hb_buffer_close( &buf );
3544 return buf;
3545 }
3546 if ( !hb_parse_ps( stream, buf->data, buf->size, &pes_info ) )
3547 {
3548 ++stream->errors;
3549 continue;
3550 }
3551 // pack header
3552 if ( pes_info.stream_id == 0xba )
3553 {
3554 stream->pes.found_scr = 1;
3555 stream->ts_flags |= TS_HAS_PCR;
3556 stream->pes.scr = pes_info.scr;
3557 continue;
3558 }
3559
3560 // If we don't have a SCR yet but the stream has SCRs just loop
3561 // so we don't process anything until we have a clock reference.
3562 if ( !stream->pes.found_scr && ( stream->ts_flags & TS_HAS_PCR ) )
3563 {
3564 continue;
3565 }
3566
3567 // system header
3568 if ( pes_info.stream_id == 0xbb )
3569 continue;
3570
3571 int idx;
3572 if ( pes_info.stream_id == 0xbd )
3573 {
3574 idx = index_of_ps_stream( stream, pes_info.stream_id,
3575 pes_info.bd_substream_id );
3576 }
3577 else
3578 {
3579 idx = index_of_ps_stream( stream, pes_info.stream_id,
3580 pes_info.stream_id_ext );
3581 }
3582
3583 // Is this a stream carrying data that we care about?
3584 if ( idx < 0 )
3585 continue;
3586
3587 switch (stream->pes.list[idx].stream_kind)
3588 {

Callers 2

hb_stream_readFunction · 0.85

Calls 7

hb_buffer_initFunction · 0.85
hb_ps_read_packetFunction · 0.85
hb_buffer_closeFunction · 0.85
hb_parse_psFunction · 0.85
index_of_ps_streamFunction · 0.85
isIframeFunction · 0.85
get_idFunction · 0.85

Tested by

no test coverage detected