while( !fs->eof() ) {
/* Get section type */
int section_type = fs->read_uint32();
-//zmsgs("section_type=%d position="_LX"\n", section_type, fs->tell());
+//zmsgs("section_type=%d position=%jx\n", section_type, fs->tell());
switch( section_type ) {
case toc_FILE_TYPE_PROGRAM:
file_type = FT_PROGRAM_STREAM;
concat_path(string2, fs->path, string);
source_date = fs->read_uint64();
int64_t current_date = calculate_source_date(string2);
-//zmsgs("zsrc=%s source_date="_LD" current_date="_LD"\n",
+//zmsgs("zsrc=%s source_date=%jd current_date=%jd\n",
// string2, source_date, current_date);
if( current_date != source_date ) {
- zerrs("date mismatch "_LX" (should be "_LX")\n",
+ zerrs("date mismatch %jx (should be %jx)\n",
current_date, source_date);
return ERR_TOC_DATE_MISMATCH;
}
video_eof[i] = fs->read_uint64();
total_frame_offsets[i] = fs->read_uint32();
frame_offsets[i] = new int64_t[total_frame_offsets[i]];
- if( debug ) zmsgs("62 %d "_LX" "_LX"\n",
+ if( debug ) zmsgs("62 %d %jx %jx\n",
total_frame_offsets[i], fs->tell(), fs->ztotal_bytes());
for( j=0; j < total_frame_offsets[i]; ++j ) {
frame_offsets[i][j] = fs->read_uint64();
char string[STRLEN];
fs->read_data((uint8_t*)string, STRLEN);
/* Detect Blu-Ray */
- if( debug ) printf("11 position="_LX"\n", fs->tell());
+ if( debug ) printf("11 position=%jx\n", fs->tell());
char *ext = strrchr(string, '.');
if( ext ) {
if( !strncasecmp(ext, ".m2ts", 5) ||
cell->cell_time = cell_time.d;
cell->cell_no = fs->read_uint32();
cell->discontinuity = fs->read_uint32();
-//zmsgs("50 %"_LX"-"_LX" "_LX"-_LX" %d %d\n",
+//zmsgs("50 %jx-%jx %jx-%jx %d %d\n",
// cell->title_start, cell->title_end, cell->program_start,
// cell->program_end, cell->cell_no, cell->discontinuity);
}
if( pts_padding <= 0 ) return;
int discon = cell ? cell->discontinuity : 0;
-//zmsgs("cell %d cell_time=%f pos="_LX" discon %d\n",
+//zmsgs("cell %d cell_time=%f pos=%jx discon %d\n",
// cell_no, cell_time, !cell? -1 : cell->program_start, discon);
if( !discon ) return;
// nudge audio to align timestamps
while( elems ) {
ep = elems; elems = elems->next;
-//zmsgs("v/atrk %d/%d, dist " _LD "\n", ep->vtrk, ep->atrk, ep->pts_dist);
+//zmsgs("v/atrk %d/%d, dist %jd\n", ep->vtrk, ep->atrk, ep->pts_dist);
//zmsgs(" v/apts %f/%f, nudge %f\n", ep->vpts, ep->apts, ep->pts_nudge);
//zmsgs(" v/aorg %f/%f, nudge %f\n",
// vtrack[ep->vtrk]->pts_origin, atrack[ep->atrk]->pts_origin,
if( !result ) {
int idx = 0;
/* Find current PID in tracks. */
- int custom_id = demuxer->custom_id;
/* Got subtitle */
if( demuxer->got_subtitle )
handle_subtitle();
if( is_transport_stream() )
- dvb.atsc_tables(demuxer, custom_id);
+ dvb.atsc_tables(demuxer, demuxer->custom_id);
/* In a transport stream the audio or video is determined by the PID. */
/* In other streams the data type is determined by stream ID. */
- if( demuxer->got_audio || is_transport_stream() || is_audio_stream() ) {
+ if( demuxer->got_audio >= 0 || is_transport_stream() || is_audio_stream() ) {
+ int audio_pid = is_transport_stream() ? demuxer->custom_id : demuxer->got_audio;
atrack_t *atrk = 0;
for( idx=0; idx < total_atracks; ++idx ) {
- if( atrack[idx]->pid == custom_id ) { /* Update an audio track */
+ if( atrack[idx]->pid == audio_pid ) { /* Update an audio track */
atrk = atrack[idx];
break;
}
}
if( !atrk ) {
if( is_audio_stream() ||
- (demuxer->got_audio && demuxer->astream_table[custom_id]) ) {
- int format = demuxer->astream_table[custom_id];
- atrk = new_atrack_t(custom_id, format, demuxer, total_atracks);
+ (audio_pid >= 0 && demuxer->astream_table[audio_pid]) ) {
+ int format = demuxer->astream_table[audio_pid];
+ atrk = new_atrack_t(audio_pid, format, demuxer, total_atracks);
if( atrk ) {
atrack[idx=total_atracks++] = atrk;
atrk->prev_offset = start_byte;
atrk->handle_audio(idx);
}
}
- if( demuxer->got_video || is_transport_stream() || is_video_stream() ) {
+ if( demuxer->got_video >= 0 || is_transport_stream() || is_video_stream() ) {
+ int video_pid = is_transport_stream() ? demuxer->custom_id : demuxer->got_video;
vtrack_t *vtrk = 0;
for( idx=0; idx < total_vtracks; ++idx ) {
- if( vtrack[idx]->pid == custom_id ) { /* Update a video track */
+ if( vtrack[idx]->pid == video_pid ) { /* Update a video track */
vtrk = vtrack[idx];
break;
}
}
if( !vtrk ) {
if( is_video_stream() ||
- (demuxer->got_video && demuxer->vstream_table[custom_id]) ) {
- vtrk = new_vtrack_t(custom_id, demuxer, total_vtracks);
+ (video_pid >= 0 && demuxer->vstream_table[video_pid]) ) {
+ vtrk = new_vtrack_t(video_pid, demuxer, total_vtracks);
/* Make the first offset correspond to the */
/* start of the first packet. */
if( vtrk ) {
}
/* Make user value independant of data type in packet */
*bytes_processed = demuxer->tell_byte();
-//zmsgs("1000 "_LX"\n", *bytes_processed);
+//zmsgs("1000 %jx\n", *bytes_processed);
return 0;
}
fs->read_data((uint8_t*)&string[0],STRLEN);
concat_path(string2, fs->path, string);
int64_t sdate = fs->read_uint64();
- zmsgs("zsrc=%s source_date="_LD"\n", string2, sdate);
+ zmsgs("zsrc=%s source_date=%jd\n", string2, sdate);
break; }
case toc_STREAM_AUDIO: {
int nudge = fs->read_uint32();
int total_sample_offsets = fs->read_uint32();
int64_t total_samples = fs->read_uint64();
- zmsgs(" audio %d, eof=0x" _LXv(012) " ch=%d, offsets=%d samples=" _LD " nudge=%d\n",
+ zmsgs(" audio %d, eof=0x%012jx ch=%d, offsets=%d samples=%jd nudge=%d\n",
i, eof, channels, total_sample_offsets, total_samples, nudge);
if( flags & show_toc_SAMPLE_OFFSETS ) {
for( j=0; j < total_sample_offsets; ) {
if( !(j&7) ) zmsgs(" %8d: ",j*AUDIO_CHUNKSIZE);
- printf(" " _LXv(08), fs->read_uint64());
+ printf(" %08jx", fs->read_uint64());
if( !(++j&7) ) printf("\n");
}
if( (j&7) ) printf("\n");
frame_offsets[k] = fs->read_uint64();
}
int total_keyframes = fs->read_uint32();
- zmsgs(" video %d, eof=0x" _LXv(012) " offsets=%d keyframes=%d\n",
+ zmsgs(" video %d, eof=0x%012jx offsets=%d keyframes=%d\n",
i, eof, total_frame_offsets, total_keyframes);
int *keyframe_numbers = new int[total_keyframes];
for( j=0; j<total_keyframes; ++j ) {
}
else
printf(" ");
- printf(_LXv(08),frame_offsets[k]);
+ printf("%08jx",frame_offsets[k]);
if( !(++k&7) ) printf("\n");
}
if( (k&7) ) printf("\n");
else {
fs->seek_relative(sizeof(int64_t) * total_frame_offsets);
int total_keyframes = fs->read_uint32();
- zmsgs(" video %d, eof=0x" _LXv(012) " offsets=%d keyframes=%d\n",
+ zmsgs(" video %d, eof=0x%012jx offsets=%d keyframes=%d\n",
i, eof, total_frame_offsets, total_keyframes);
fs->seek_relative(sizeof(int) * total_keyframes);
}
int64_t end_byte = start_byte + total_bytes;
current_byte = end_byte;
zmsgs("title %s,\n", &string[0]);
- zmsgs(" bytes=0x" _LXv(012) ", start=0x" _LXv(012) ", end=0x" _LXv(012) "\n",
+ zmsgs(" bytes=0x%012jx, start=0x%012jx, end=0x%012jx\n",
total_bytes, start_byte, end_byte);
int cell_table_size = fs->read_uint32();
for( i=0; i < cell_table_size; ++i ) {
cell_time.u = fs->read_uint64();
int cell_no = fs->read_uint32();
int discontinuity = fs->read_uint32();
- zmsgs(" cell[%2d], title 0x" _LXv(012) "-0x" _LXv(012) ", cell_no %2d, cell_time %5.3f\n",
+ zmsgs(" cell[%2d], title 0x%012jx-0x%012jx, cell_no %2d, cell_time %5.3f\n",
i, title_start, title_end, cell_no, cell_time.d);
- zmsgs(" discon %d program 0x" _LXv(012) "-0x" _LXv(012) "\n",
+ zmsgs(" discon %d program 0x%012jx-0x%012jx\n",
discontinuity, program_start, program_end);
}
break; }
int cell_id = fs->read_uint32();
int inlv = fs->read_uint32();
int discon = fs->read_uint32();
- zmsgs(" cell[%2d], start=0x" _LXv(012) ", end=0x" _LXv(012) " discon %d\n",
+ zmsgs(" cell[%2d], start=0x%012jx, end=0x%012jx discon %d\n",
i, start_byte, end_byte, discon);
zmsgs(" vob_id %d, cell_id %d, inlv %d\n",
vob_id, cell_id, inlv);