vorbisenc: implement flushing

This commit is contained in:
Alessandro Decina 2013-08-26 08:08:32 +02:00
parent b0e4b5f69a
commit 48b8e61334

View file

@ -115,6 +115,7 @@ static void gst_vorbis_enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static void gst_vorbis_enc_set_property (GObject * object, guint prop_id, static void gst_vorbis_enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_vorbis_enc_flush (GstAudioEncoder * vorbisenc);
#define gst_vorbis_enc_parent_class parent_class #define gst_vorbis_enc_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVorbisEnc, gst_vorbis_enc, G_DEFINE_TYPE_WITH_CODE (GstVorbisEnc, gst_vorbis_enc,
@ -182,6 +183,7 @@ gst_vorbis_enc_class_init (GstVorbisEncClass * klass)
base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_vorbis_enc_handle_frame); base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_vorbis_enc_handle_frame);
base_class->getcaps = GST_DEBUG_FUNCPTR (gst_vorbis_enc_getcaps); base_class->getcaps = GST_DEBUG_FUNCPTR (gst_vorbis_enc_getcaps);
base_class->sink_event = GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_event); base_class->sink_event = GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_event);
base_class->flush = GST_DEBUG_FUNCPTR (gst_vorbis_enc_flush);
} }
static void static void
@ -555,6 +557,16 @@ gst_vorbis_enc_clear (GstVorbisEnc * vorbisenc)
return ret; return ret;
} }
static void
gst_vorbis_enc_flush (GstAudioEncoder * enc)
{
GstVorbisEnc *vorbisenc = GST_VORBISENC (enc);
gst_vorbis_enc_clear (vorbisenc);
vorbisenc->samples_in = 0;
vorbisenc->header_sent = FALSE;
}
static GstBuffer * static GstBuffer *
gst_vorbis_enc_buffer_from_header_packet (GstVorbisEnc * vorbisenc, gst_vorbis_enc_buffer_from_header_packet (GstVorbisEnc * vorbisenc,
ogg_packet * packet) ogg_packet * packet)