h263parse: add pixel-aspect-ratio if upstream doesn't provide one

This commit is contained in:
Tim-Philipp Müller 2013-07-15 22:57:06 +01:00
parent ec630db32f
commit 79249be0aa
3 changed files with 25 additions and 2 deletions

View file

@ -180,9 +180,9 @@ static void
gst_h263_parse_set_src_caps (GstH263Parse * h263parse,
const H263Params * params)
{
GstStructure *st;
GstStructure *st = NULL;
GstCaps *caps, *sink_caps;
gint fr_num, fr_denom;
gint fr_num, fr_denom, par_num, par_denom;
g_assert (h263parse->state == PASSTHROUGH || h263parse->state == GOT_HEADER);
@ -211,6 +211,18 @@ gst_h263_parse_set_src_caps (GstH263Parse * h263parse,
gst_caps_set_simple (caps, "width", G_TYPE_INT, params->width,
"height", G_TYPE_INT, params->height, NULL);
if (st != NULL
&& gst_structure_get_fraction (st, "pixel-aspect-ratio", &par_num,
&par_denom)) {
/* Got it in caps - nothing more to do */
GST_DEBUG_OBJECT (h263parse, "sink caps override PAR");
} else {
/* Caps didn't have the framerate - get it from params */
gst_h263_parse_get_par (params, &par_num, &par_denom);
}
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
par_num, par_denom, NULL);
if (h263parse->state == GOT_HEADER) {
gst_caps_set_simple (caps,
"annex-d", G_TYPE_BOOLEAN, (params->features & H263_OPTION_UMV_MODE),

View file

@ -668,3 +668,10 @@ gst_h263_parse_get_framerate (const H263Params * params, gint * num,
*num = params->pcfnum;
*denom = params->pcfdenom;
}
void
gst_h263_parse_get_par (const H263Params * params, gint * num, gint * denom)
{
*num = params->parnum;
*denom = params->pardenom;
}

View file

@ -141,6 +141,10 @@ void gst_h263_parse_get_framerate (const H263Params * params,
gint * num,
gint * denom);
void gst_h263_parse_get_par (const H263Params * params,
gint * num,
gint * denom);
gint gst_h263_parse_get_profile (const H263Params * params);
gint gst_h263_parse_get_level (const H263Params * params,