matroskademux: fix pixel-aspect-ratio if header has only one display variable

Current matroska demux calculates the pixel aspect ratio only if both
DisplayHeight and DisplayWidth are set, but it is legal to use only
one variable if the other is equal to PixelWidth or PixelHeight, at
least the mkclean utility is doing that. So this makse mkcleaned
files play correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=654744
This commit is contained in:
Alexey Fisher 2011-07-16 19:38:51 +02:00 committed by Tim-Philipp Müller
parent df3cee6606
commit 69c14012c9

View file

@ -4873,16 +4873,20 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
/* pixel width and height are the w and h of the video in pixels */ /* pixel width and height are the w and h of the video in pixels */
if (videocontext->pixel_width > 0 && videocontext->pixel_height > 0) { if (videocontext->pixel_width > 0 && videocontext->pixel_height > 0) {
gint w = videocontext->pixel_width; gint w = videocontext->pixel_width;
gint h = videocontext->pixel_height; gint h = videocontext->pixel_height;
gst_structure_set (structure, gst_structure_set (structure,
"width", G_TYPE_INT, w, "height", G_TYPE_INT, h, NULL); "width", G_TYPE_INT, w, "height", G_TYPE_INT, h, NULL);
} }
if (videocontext->display_width > 0 && videocontext->display_height > 0) { if (videocontext->display_width > 0 || videocontext->display_height > 0) {
int n, d; int n, d;
if (videocontext->display_width <= 0)
videocontext->display_width = videocontext->pixel_width;
if (videocontext->display_height <= 0)
videocontext->display_height = videocontext->pixel_height;
/* calculate the pixel aspect ratio using the display and pixel w/h */ /* calculate the pixel aspect ratio using the display and pixel w/h */
n = videocontext->display_width * videocontext->pixel_height; n = videocontext->display_width * videocontext->pixel_height;
d = videocontext->display_height * videocontext->pixel_width; d = videocontext->display_height * videocontext->pixel_width;