mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
basevideo: remove gst_base_video_state_from_caps
This commit is contained in:
parent
b67706b584
commit
af7ae41646
3 changed files with 27 additions and 34 deletions
|
@ -97,6 +97,8 @@ gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
{
|
||||
GstBaseVideoEncoder *base_video_encoder;
|
||||
GstBaseVideoEncoderClass *base_video_encoder_class;
|
||||
GstStructure *structure;
|
||||
GstVideoState *state;
|
||||
gboolean ret;
|
||||
|
||||
base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad));
|
||||
|
@ -105,7 +107,31 @@ gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
|
||||
GST_DEBUG ("setcaps");
|
||||
|
||||
gst_base_video_state_from_caps (&base_video_encoder->state, caps);
|
||||
state = &base_video_encoder->state;
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
gst_video_format_parse_caps (caps, &state->format,
|
||||
&state->width, &state->height);
|
||||
|
||||
state->fps_n = 0;
|
||||
state->fps_d = 1;
|
||||
gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d);
|
||||
if (state->fps_d == 0) {
|
||||
state->fps_n = 0;
|
||||
state->fps_d = 1;
|
||||
}
|
||||
|
||||
state->par_n = 1;
|
||||
state->par_d = 1;
|
||||
gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d);
|
||||
|
||||
state->have_interlaced = gst_structure_get_boolean (structure,
|
||||
"interlaced", &state->interlaced);
|
||||
|
||||
state->clean_width = state->width;
|
||||
state->clean_height = state->height;
|
||||
state->clean_offset_left = 0;
|
||||
state->clean_offset_top = 0;
|
||||
|
||||
ret = base_video_encoder_class->set_format (base_video_encoder,
|
||||
&base_video_encoder->state);
|
||||
|
|
|
@ -121,35 +121,6 @@ gst_base_video_encoded_video_convert (GstVideoState * state,
|
|||
return res;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_base_video_state_from_caps (GstVideoState * state, GstCaps * caps)
|
||||
{
|
||||
|
||||
gst_video_format_parse_caps (caps, &state->format,
|
||||
&state->width, &state->height);
|
||||
|
||||
if (!gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d))
|
||||
return FALSE;
|
||||
|
||||
state->par_n = 1;
|
||||
state->par_d = 1;
|
||||
gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d);
|
||||
|
||||
{
|
||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||
state->interlaced = FALSE;
|
||||
gst_structure_get_boolean (structure, "interlaced", &state->interlaced);
|
||||
}
|
||||
|
||||
state->clean_width = state->width;
|
||||
state->clean_height = state->height;
|
||||
state->clean_offset_left = 0;
|
||||
state->clean_offset_top = 0;
|
||||
|
||||
/* FIXME need better error handling */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GstClockTime
|
||||
gst_video_state_get_timestamp (const GstVideoState * state,
|
||||
GstSegment * segment, int frame_number)
|
||||
|
@ -164,4 +135,3 @@ gst_video_state_get_timestamp (const GstVideoState * state,
|
|||
state->fps_d * GST_SECOND, state->fps_n);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,9 +87,6 @@ gboolean gst_base_video_encoded_video_convert (GstVideoState *state,
|
|||
GstFormat src_format, gint64 src_value,
|
||||
GstFormat * dest_format, gint64 *dest_value);
|
||||
|
||||
gboolean gst_base_video_state_from_caps (GstVideoState *state,
|
||||
GstCaps *caps);
|
||||
|
||||
GstClockTime gst_video_state_get_timestamp (const GstVideoState *state,
|
||||
GstSegment *segment, int frame_number);
|
||||
|
||||
|
|
Loading…
Reference in a new issue