From: Reynaldo H. Verdejo Pinochet Date: Thu, 11 Sep 2014 16:48:44 +0000 (-0300) Subject: isomp4: fix wrong DAR calculation for PAR <= 1 X-Git-Tag: 1.19.3~509^2~4162 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e655d47dfce1652630fe8ff5fb6be56370087004;p=platform%2Fupstream%2Fgstreamer.git isomp4: fix wrong DAR calculation for PAR <= 1 CID #1226452 https://bugzilla.gnome.org/show_bug.cgi?id=736396 --- diff --git a/gst/isomp4/atoms.c b/gst/isomp4/atoms.c index 3f1051c..f8bf050 100644 --- a/gst/isomp4/atoms.c +++ b/gst/isomp4/atoms.c @@ -48,6 +48,7 @@ #include #include #include +#include /** * Creates a new AtomsContext for the given flavor. @@ -3483,7 +3484,7 @@ atom_trak_set_video_type (AtomTRAK * trak, AtomsContext * context, VisualSampleEntry * entry, guint32 scale, GList * ext_atoms_list) { SampleTableEntryMP4V *ste; - gint dwidth, dheight; + guint dwidth, dheight; gint par_n = 0, par_d = 0; if ((entry->par_n != 1 || entry->par_d != 1) && @@ -3497,12 +3498,10 @@ atom_trak_set_video_type (AtomTRAK * trak, AtomsContext * context, /* ISO file spec says track header w/h indicates track's visual presentation * (so this together with pixels w/h implicitly defines PAR) */ if (par_n && (context->flavor != ATOMS_TREE_FLAVOR_MOV)) { - if (par_n > par_d) { - dwidth = entry->width * par_n / par_d; - dheight = entry->height; - } else { - dwidth = entry->width * par_n / par_d; - dheight = entry->height; + /* Assumes square pixels display */ + if (!gst_video_calculate_display_ratio (&dwidth, &dheight, entry->width, + entry->height, par_n, par_d, 1, 1)) { + GST_WARNING ("Could not calculate display ratio"); } }