klass->reset (dec, hard);
}
- /* FIXME make some more distinction between hard and soft,
- * but subclass may not be prepared for that */
- /* FIXME perhaps also clear pending frames ?,
- * but again, subclass may still come up with one of those */
- if (!hard) {
- /* TODO ? finish/drain some stuff */
- } else {
+ if (klass->flush) {
+ klass->flush (dec);
+ }
+
+ if (hard) {
gst_segment_init (&dec->input_segment, GST_FORMAT_UNDEFINED);
gst_segment_init (&dec->output_segment, GST_FORMAT_UNDEFINED);
gst_video_decoder_clear_queues (dec);
* Propose buffer allocation parameters for upstream elements.
* Subclasses should chain up to the parent implementation to
* invoke the default handler.
+ * @flush: Optional.
+ * Flush all remaining data from the decoder without
+ * pushing it downstream. Since: 1.2
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum @handle_frame needs to be overridden, and @set_format
gboolean (*propose_allocation) (GstVideoDecoder *decoder, GstQuery * query);
+ gboolean (*flush) (GstVideoDecoder *decoder);
+
/*< private >*/
- void *padding[GST_PADDING_LARGE];
+ void *padding[GST_PADDING_LARGE-1];
};
GType gst_video_decoder_get_type (void);
static gboolean
gst_video_encoder_reset (GstVideoEncoder * encoder, gboolean hard)
{
- GstVideoEncoderClass *klass = GST_VIDEO_ENCODER_GET_CLASS (encoder);
GstVideoEncoderPrivate *priv = encoder->priv;
gboolean ret = TRUE;
return ret;
}
+/* Always call reset() in one way or another after this */
+static gboolean
+gst_video_encoder_flush (GstVideoEncoder * encoder)
+{
+ GstVideoEncoderClass *klass = GST_VIDEO_ENCODER_GET_CLASS (encoder);
+ gboolean ret = TRUE;
+
+ GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
+ if (klass->flush)
+ ret = klass->flush (encoder);
+
+ GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
+ return ret;
+}
+
static void
gst_video_encoder_init (GstVideoEncoder * encoder, GstVideoEncoderClass * klass)
{
}
case GST_EVENT_FLUSH_STOP:{
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
+ gst_video_encoder_flush (encoder);
gst_segment_init (&encoder->input_segment, GST_FORMAT_TIME);
gst_segment_init (&encoder->output_segment, GST_FORMAT_TIME);
gst_video_encoder_reset (encoder, FALSE);
* Propose buffer allocation parameters for upstream elements.
* Subclasses should chain up to the parent implementation to
* invoke the default handler.
+ * @flush: Optional.
+ * Flush all remaining data from the encoder without
+ * pushing it downstream. Since: 1.2
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum @handle_frame needs to be overridden, and @set_format
gboolean (*propose_allocation) (GstVideoEncoder * encoder,
GstQuery * query);
+ gboolean (*flush) (GstVideoEncoder *encoder);
/*< private >*/
- gpointer _gst_reserved[GST_PADDING_LARGE];
+ gpointer _gst_reserved[GST_PADDING_LARGE-1];
};
GType gst_video_encoder_get_type (void);