basevideo: Add the caps to the GstVideoState and clean up caps/codec_data properly

This commit is contained in:
Sebastian Dröge 2011-06-27 09:41:40 +02:00
parent 93a675b570
commit aaeff26189
3 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -86,6 +86,7 @@ typedef struct _GstBaseVideoCodecClass GstBaseVideoCodecClass;
struct _GstVideoState
{
GstCaps *caps;
GstVideoFormat format;
int width, height;
int fps_n, fps_d;

View file

@ -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);