//zmsgs("get_transport_pes_packet %x\n", pid);
/* AC3 audio */
stream_id = 0x0;
- got_audio = 1;
- custom_id = pid;
+ custom_id = got_audio = pid;
if( read_all ) astream_table[custom_id] = afmt_AC3;
if( astream == -1 ) astream = custom_id;
}
else if( (stream_id >> 4) == 0x0c || (stream_id >> 4) == 0x0d ) {
/* MPEG audio */
- custom_id = pid;
- got_audio = 1;
+ custom_id = got_audio = pid;
/* Just pick the first available stream if no ID is set */
if( read_all ) astream_table[custom_id] = afmt_MPEG;
if( astream == -1 ) astream = custom_id;
}
else if( (stream_id >> 4) == 0x0e ) {
/* Video */
- custom_id = pid;
- got_video = 1;
+ custom_id = got_video = pid;
/* Just pick the first available stream if no ID is set */
if( read_all )
if( dump ) zmsgs(" 0x%x bytes elementary data\n", raw_size-raw_offset);
// if( pid == 0x1100 ) zmsgs("get_payload 1 0x%x\n", audio_pid);
if( pid == audio_pid && (do_audio || read_all) ) {
- if( do_audio ) got_audio = 1;
+ if( do_audio ) got_audio = audio_pid;
if( dump ) {
zmsgs(" offset=0x%jx 0x%x bytes AC3 pid=0x%x\n",
absolute_position(), raw_size-raw_offset, pid);
get_transport_payload(1, 0);
}
else if( pid == video_pid && (do_video || read_all) ) {
- if( do_video ) got_video = 1;
+ if( do_video ) got_video = video_pid;
get_transport_payload(0, 1);
}
else {
raw_size = src->packet_size;
raw_offset = 0;
stream_id = 0;
- got_audio = 0;
- got_video = 0;
+ got_audio = -1;
+ got_video = -1;
custom_id = -1;
//zerrs("read transport 1 %jx %jx\n", title->fs->current_byte, title->fs->total_bytes);
/* Audio data */
/* Take first stream ID if -1 */
pes_packet_length -= absolute_position() - pes_packet_start;
- got_audio = 1;
- custom_id = stream_id & 0x0f;
+ custom_id = got_audio = stream_id & 0x0f;
if( read_all )
astream_table[custom_id] = afmt_MPEG;
else if( astream == -1 )
/* Video data */
/* Take first stream ID if -1 */
pes_packet_length -= absolute_position() - pes_packet_start;
- got_video = 1;
- custom_id = stream_id & 0x0f;
+ custom_id = got_video = stream_id & 0x0f;
if( read_all ) {
vstream_table[custom_id] = 1;
} else if( vstream == -1 )
/* only 8 streams, counting from 0x80 */
custom_id = stream_id & 0x87;
if( astream_table[custom_id] >= 0 ) {
- got_audio = 1;
+ got_audio = custom_id;
/* Take first stream ID if not building TOC. */
if( read_all )
astream_table[custom_id] = format;
int pack_count = 0;
const int debug = 0;
- got_audio = 0;
- got_video = 0;
- stream_id = 0;
+ got_audio = -1;
+ got_video = -1;
+ stream_id = -1;
custom_id = -1;
got_subtitle = 0;
void zdemuxer_t::
set_audio_pts(uint64_t pts, const double denom)
{
- if( pts ) {
+ if( pts && pes_audio_time < 0 ) {
pes_audio_pid = custom_id;
pes_audio_time = pts / denom;
//zmsgs("pid 0x%03x, pts %f @0x%jx\n",pes_audio_pid, pes_audio_time,
void zdemuxer_t::
set_video_pts(uint64_t pts, const double denom)
{
- if( pts ) {
+ if( pts && pes_video_time < 0 ) {
pes_video_pid = custom_id;
pes_video_time = pts / denom;
//zmsgs("pid 0x%03x, pts %f @0x%jx\n",pes_video_pid, pes_video_time,