mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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:
parent
d8d1d23471
commit
35a0e4d889
1 changed files with 14 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue