basevideodecoder: tune parsing sink caps into video state

... to provide subclass with more information w.r.t. original caps.
This commit is contained in:
Mark Nauwelaerts 2011-04-01 22:12:30 +02:00
parent 380a443be4
commit 2f6af91f09

View file

@ -252,8 +252,18 @@ gst_base_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps)
structure = gst_caps_get_structure (caps, 0);
gst_video_format_parse_caps (caps, NULL, &state->width, &state->height);
gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d);
gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d);
/* this one fails if no framerate in caps */
if (!gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d)) {
state->fps_n = 0;
state->fps_d = 1;
}
/* but the p-a-r sets 1/1 instead, which is not quite informative ... */
if (!gst_structure_has_field (structure, "pixel-aspect-ratio") ||
!gst_video_parse_caps_pixel_aspect_ratio (caps,
&state->par_n, &state->par_d)) {
state->par_n = 0;
state->par_d = 1;
}
state->have_interlaced =
gst_video_format_parse_caps_interlaced (caps, &state->interlaced);