mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
basevideodecoder: tune parsing sink caps into video state
... to provide subclass with more information w.r.t. original caps.
This commit is contained in:
parent
380a443be4
commit
2f6af91f09
1 changed files with 12 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue