avvidenc: Implement reset vfunc

This commit is contained in:
Sebastian Dröge 2012-11-20 11:56:57 +01:00
parent d3f8c5f0cc
commit 4132a73f0e
2 changed files with 18 additions and 3 deletions

View file

@ -201,10 +201,10 @@ gst_ffmpegaudenc_stop (GstAudioEncoder * encoder)
static void
gst_ffmpegaudenc_flush (GstAudioEncoder * encoder)
{
GstFFMpegAudEnc *ffmpegauddec = (GstFFMpegAudEnc *) encoder;
GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) encoder;
if (ffmpegauddec->opened) {
avcodec_flush_buffers (ffmpegauddec->context);
if (ffmpegaudenc->opened) {
avcodec_flush_buffers (ffmpegaudenc->context);
}
}

View file

@ -98,6 +98,8 @@ static gboolean gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
GstVideoCodecState * state);
static gboolean gst_ffmpegvidenc_propose_allocation (GstVideoEncoder * encoder,
GstQuery * query);
static gboolean gst_ffmpegvidenc_reset (GstVideoEncoder * encoder,
gboolean hard);
static GstCaps *gst_ffmpegvidenc_getcaps (GstVideoEncoder * encoder,
GstCaps * filter);
@ -209,6 +211,7 @@ gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass)
venc_class->getcaps = gst_ffmpegvidenc_getcaps;
venc_class->set_format = gst_ffmpegvidenc_set_format;
venc_class->propose_allocation = gst_ffmpegvidenc_propose_allocation;
venc_class->reset = gst_ffmpegvidenc_reset;
gobject_class->finalize = gst_ffmpegvidenc_finalize;
}
@ -884,6 +887,18 @@ gst_ffmpegvidenc_get_property (GObject * object,
}
}
static gboolean
gst_ffmpegvidenc_reset (GstVideoEncoder * encoder, gboolean hard)
{
GstFFMpegVidEnc *ffmpegenc = (GstFFMpegVidEnc *) encoder;
if (ffmpegenc->opened) {
avcodec_flush_buffers (ffmpegenc->context);
}
return TRUE;
}
static gboolean
gst_ffmpegvidenc_stop (GstVideoEncoder * encoder)
{