avaudenc: Implement flush vfunc properly

This commit is contained in:
Sebastian Dröge 2012-11-20 11:45:34 +01:00
parent 9456fb86c7
commit e281493f29

View file

@ -67,6 +67,7 @@ static gboolean gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder,
static GstFlowReturn gst_ffmpegaudenc_handle_frame (GstAudioEncoder * encoder,
GstBuffer * inbuf);
static gboolean gst_ffmpegaudenc_stop (GstAudioEncoder * encoder);
static void gst_ffmpegaudenc_flush (GstAudioEncoder * encoder);
static void gst_ffmpegaudenc_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
@ -155,6 +156,7 @@ gst_ffmpegaudenc_class_init (GstFFMpegAudEncClass * klass)
gstaudioencoder_class->stop = GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_stop);
gstaudioencoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_getcaps);
gstaudioencoder_class->flush = GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_flush);
gstaudioencoder_class->set_format =
GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_set_format);
gstaudioencoder_class->handle_frame =
@ -196,6 +198,16 @@ gst_ffmpegaudenc_stop (GstAudioEncoder * encoder)
return TRUE;
}
static void
gst_ffmpegaudenc_flush (GstAudioEncoder * encoder)
{
GstFFMpegAudEnc *ffmpegauddec = (GstFFMpegAudEnc *) encoder;
if (ffmpegauddec->opened) {
avcodec_flush_buffers (ffmpegauddec->context);
}
}
static GstCaps *
gst_ffmpegaudenc_getcaps (GstAudioEncoder * encoder, GstCaps * filter)
{