X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=libhb%2Fdecavcodec.c;h=9d1474b3455ed6eed040fd028d9215ce4fac5f7e;hb=5d42c76946bc07b78a15aabcc6ebd5b68c07cc12;hp=71f72fe81d87e8878569cb6dc537e5bf6def2193;hpb=a76bb25f2f99cc7b6851ab02053a2f1b2a9e2f70;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 71f72fe8..9d1474b3 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -525,12 +525,12 @@ 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 ); if ( c && c->title ) { - hb_log( "%s: \"%s\" (%d) at frame %u time %lld", + hb_log( "%s: \"%s\" (%d) at frame %u time %"PRId64, pv->context->codec->name, c->title, chap_num, pv->nframes, pts ); } else { - hb_log( "%s: Chapter %d at frame %u time %lld", + hb_log( "%s: Chapter %d at frame %u time %"PRId64, pv->context->codec->name, chap_num, pv->nframes, pts ); } } @@ -919,13 +919,22 @@ static int decavcodecvInfo( hb_work_object_t *w, hb_work_info_t *info ) info->rate_base *= context->ticks_per_frame; } - /* Sometimes there's no pixel aspect set in the source. In that case, - assume a 1:1 PAR. Otherwise, preserve the source PAR. */ - info->pixel_aspect_width = context->sample_aspect_ratio.num ? - context->sample_aspect_ratio.num : 1; - info->pixel_aspect_height = context->sample_aspect_ratio.den ? - context->sample_aspect_ratio.den : 1; - + info->pixel_aspect_width = context->sample_aspect_ratio.num; + info->pixel_aspect_height = context->sample_aspect_ratio.den; + + /* Sometimes there's no pixel aspect set in the source ffmpeg context + * which appears to come from the video stream. In that case, + * try the pixel aspect in AVStream (which appears to come from + * the container). Else assume a 1:1 PAR. */ + if ( info->pixel_aspect_width == 0 || + info->pixel_aspect_height == 0 ) + { + 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 ? + st->sample_aspect_ratio.den : 1; + } /* ffmpeg returns the Pixel Aspect Ratio (PAR). Handbrake wants the * Display Aspect Ratio so we convert by scaling by the Storage * Aspect Ratio (w/h). We do the calc in floating point to get the