summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-08-31 18:49:39 +0000
committerjstebbins <[email protected]>2009-08-31 18:49:39 +0000
commit82d5e3c13cbf365b588036e7f70e1cc5da195349 (patch)
tree8171df96cda45d90906573aab4c09b6bc8a96a74 /libhb
parent361296eabd78560df0faab7a12d1e49823fd1d9d (diff)
libhb: fix PAR issue with DV
For some (maybe all) DV, ffmpeg doesn't give us the sample_aspect_ratio in the context. So when it's missing, try looking it up in the AVStream info. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2797 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/decavcodec.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index e711a5a7f..9d1474b34 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -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