diff options
author | Michael Smith <msmith@songbirdnest.com> | 2009-02-10 12:28:58 -0800 |
---|---|---|
committer | Michael Smith <msmith@songbirdnest.com> | 2009-02-10 12:28:58 -0800 |
commit | 35a0e4d88968bcdb22a0bb86af1450aa50736010 (patch) | |
tree | e252c9a13739f032210804e5de44e68eb43cb721 | |
parent | d8d1d234717c1bd8e7cfc0ebcd87ead2582eed49 (diff) | |
download | gst-plugins-bad-35a0e4d88968bcdb22a0bb86af1450aa50736010.tar.gz gst-plugins-bad-35a0e4d88968bcdb22a0bb86af1450aa50736010.tar.bz2 gst-plugins-bad-35a0e4d88968bcdb22a0bb86af1450aa50736010.zip |
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.
-rw-r--r-- | sys/dshowdecwrapper/gstdshowvideodec.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dshowdecwrapper/gstdshowvideodec.cpp b/sys/dshowdecwrapper/gstdshowvideodec.cpp index 600bfa81..71b15101 100644 --- a/sys/dshowdecwrapper/gstdshowvideodec.cpp +++ b/sys/dshowdecwrapper/gstdshowvideodec.cpp @@ -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, |