X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=libhb%2Fdecavcodec.c;h=abf7ed179f8cee5a86ca44e56d4d414f8fcf6271;hb=4b72a63eb61a01275493c4bfb51ba02152d1c5e1;hp=09f15ecd839360f2cfc721bf440dfa815e63e413;hpb=0bad63d01d0544aa881cb2c2e17b38fe0f8fbdc1;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 09f15ecd..abf7ed17 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -533,7 +533,12 @@ static int reget_frame_buf( AVCodecContext *context, AVFrame *frame ) 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, @@ -648,6 +653,17 @@ static int decodeFrame( hb_work_private_t *pv, uint8_t *data, int size, int sequ 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; @@ -687,7 +703,7 @@ static int decodeFrame( hb_work_private_t *pv, uint8_t *data, int size, int sequ 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 ); } @@ -961,10 +977,11 @@ static int decavcodecvInfo( hb_work_object_t *w, hb_work_info_t *info ) 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