mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
basevideo: Add the caps to the GstVideoState and clean up caps/codec_data properly
Having access to the caps in ::set_format can be useful if non-standard caps fields like the h264 alignment must be accessed.
This commit is contained in:
parent
fc93c66d3b
commit
525875727a
3 changed files with 8 additions and 0 deletions
|
@ -114,6 +114,9 @@ gst_base_video_codec_reset (GstBaseVideoCodec * base_video_codec)
|
|||
|
||||
base_video_codec->bytes = 0;
|
||||
base_video_codec->time = 0;
|
||||
|
||||
gst_buffer_replace (&base_video_codec->state.codec_data, NULL);
|
||||
gst_caps_replace (&base_video_codec->state.caps, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -86,6 +86,7 @@ typedef struct _GstBaseVideoCodecClass GstBaseVideoCodecClass;
|
|||
|
||||
struct _GstVideoState
|
||||
{
|
||||
GstCaps *caps;
|
||||
GstVideoFormat format;
|
||||
int width, height;
|
||||
int fps_n, fps_d;
|
||||
|
|
|
@ -255,8 +255,12 @@ gst_base_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
|
||||
state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state;
|
||||
|
||||
gst_buffer_replace (&state->codec_data, NULL);
|
||||
gst_caps_replace (&state->caps, NULL);
|
||||
memset (state, 0, sizeof (GstVideoState));
|
||||
|
||||
state->caps = gst_caps_ref (caps);
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
gst_video_format_parse_caps (caps, NULL, &state->width, &state->height);
|
||||
|
|
Loading…
Reference in a new issue