static void log_chapter( hb_work_private_t *pv, int chap_num, int64_t pts )
{
- hb_chapter_t *c = hb_list_item( pv->job->title->list_chapter, chap_num - 1 );
+ hb_chapter_t *c;
+
+ if ( !pv->job )
+ return;
+
+ c = hb_list_item( pv->job->title->list_chapter, chap_num - 1 );
if ( c && c->title )
{
hb_log( "%s: \"%s\" (%d) at frame %u time %"PRId64,
buf = copy_frame( pv, &frame );
buf->start = pts;
buf->sequence = sequence;
+ if ( pv->new_chap && buf->start >= pv->chap_time )
+ {
+ buf->new_chap = pv->new_chap;
+ pv->new_chap = 0;
+ pv->chap_time = 0;
+ log_chapter( pv, buf->new_chap, buf->start );
+ }
+ else if ( pv->nframes == 0 && pv->job )
+ {
+ log_chapter( pv, pv->job->chapter_start, buf->start );
+ }
hb_list_add( pv->list, buf );
++pv->nframes;
return got_picture;
pv->chap_time = 0;
log_chapter( pv, buf->new_chap, buf->start );
}
- else if ( pv->nframes == 0 )
+ else if ( pv->nframes == 0 && pv->job )
{
log_chapter( pv, pv->job->chapter_start, buf->start );
}
if ( info->pixel_aspect_width == 0 ||
info->pixel_aspect_height == 0 )
{
+ // There will not be an ffmpeg stream if the file is TS
AVStream *st = hb_ffmpeg_avstream( w->codec_param );
- info->pixel_aspect_width = st->sample_aspect_ratio.num ?
- st->sample_aspect_ratio.num : 1;
- info->pixel_aspect_height = st->sample_aspect_ratio.den ?
+ info->pixel_aspect_width = st && st->sample_aspect_ratio.num ?
+ st->sample_aspect_ratio.num : 1;
+ info->pixel_aspect_height = st && st->sample_aspect_ratio.den ?
st->sample_aspect_ratio.den : 1;
}
/* ffmpeg returns the Pixel Aspect Ratio (PAR). Handbrake wants the