dshowdecwrapper: Pass pixel aspect through from demuxers, if supplied.

If the incoming caps have a pixel-aspect-ratio, ensure it's set on the
output. Corrects PAR for many (but probably not all) files.
This commit is contained in:
Michael Smith 2009-02-10 12:28:58 -08:00
parent d8d1d23471
commit 35a0e4d889

View file

@ -529,7 +529,7 @@ gst_dshowvideodec_sink_setcaps (GstPad * pad, GstCaps * caps)
CComPtr<IPin> input_pin;
IBaseFilter *srcfilter = NULL;
IBaseFilter *sinkfilter = NULL;
const GValue *fps;
const GValue *fps, *par;
/* read data */
if (!gst_structure_get_int (s, "width", &vdec->width) ||
@ -550,6 +550,15 @@ gst_dshowvideodec_sink_setcaps (GstPad * pad, GstCaps * caps)
vdec->fps_d = 1;
}
par = gst_structure_get_value (s, "pixel-aspect-ratio");
if (par) {
vdec->par_n = gst_value_get_fraction_numerator (par);
vdec->par_d = gst_value_get_fraction_denominator (par);
}
else {
vdec->par_n = vdec->par_d = 1;
}
if ((v = gst_structure_get_value (s, "codec_data")))
extradata = gst_value_get_buffer (v);
@ -697,10 +706,13 @@ gst_dshowvideodec_sink_setcaps (GstPad * pad, GstCaps * caps)
"height", G_TYPE_INT, vdec->height, NULL);
if (vdec->fps_n && vdec->fps_d) {
gst_caps_set_simple (caps_out,
gst_caps_set_simple (caps_out,
"framerate", GST_TYPE_FRACTION, vdec->fps_n, vdec->fps_d, NULL);
}
gst_caps_set_simple (caps_out,
"pixel-aspect-ratio", GST_TYPE_FRACTION, vdec->par_n, vdec->par_d, NULL);
if (!gst_pad_set_caps (vdec->srcpad, caps_out)) {
gst_caps_unref (caps_out);
GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION,