/* GstVideoDecoder base class method */
static gboolean gst_mpeg2dec_open (GstVideoDecoder * decoder);
static gboolean gst_mpeg2dec_close (GstVideoDecoder * decoder);
+static gboolean gst_mpeg2dec_start (GstVideoDecoder * decoder);
+static gboolean gst_mpeg2dec_stop (GstVideoDecoder * decoder);
static gboolean gst_mpeg2dec_set_format (GstVideoDecoder * decoder,
GstVideoCodecState * state);
-static gboolean gst_mpeg2dec_reset (GstVideoDecoder * decoder, gboolean hard);
+static gboolean gst_mpeg2dec_flush (GstVideoDecoder * decoder);
static GstFlowReturn gst_mpeg2dec_finish (GstVideoDecoder * decoder);
static GstFlowReturn gst_mpeg2dec_handle_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame);
video_decoder_class->open = GST_DEBUG_FUNCPTR (gst_mpeg2dec_open);
video_decoder_class->close = GST_DEBUG_FUNCPTR (gst_mpeg2dec_close);
- video_decoder_class->reset = GST_DEBUG_FUNCPTR (gst_mpeg2dec_reset);
+ video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_mpeg2dec_start);
+ video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_mpeg2dec_stop);
+ video_decoder_class->flush = GST_DEBUG_FUNCPTR (gst_mpeg2dec_flush);
video_decoder_class->set_format = GST_DEBUG_FUNCPTR (gst_mpeg2dec_set_format);
video_decoder_class->handle_frame =
GST_DEBUG_FUNCPTR (gst_mpeg2dec_handle_frame);
}
static gboolean
-gst_mpeg2dec_reset (GstVideoDecoder * decoder, gboolean hard)
+gst_mpeg2dec_start (GstVideoDecoder * decoder)
{
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
- GST_DEBUG_OBJECT (mpeg2dec, "%s", hard ? "hard" : "soft");
+ mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
+
+ return TRUE;
+}
+
+static gboolean
+gst_mpeg2dec_stop (GstVideoDecoder * decoder)
+{
+ GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
+
+ mpeg2_reset (mpeg2dec->decoder, 1);
+ mpeg2_skip (mpeg2dec->decoder, 1);
+
+ gst_mpeg2dec_clear_buffers (mpeg2dec);
+
+ if (mpeg2dec->input_state)
+ gst_video_codec_state_unref (mpeg2dec->input_state);
+ mpeg2dec->input_state = NULL;
+
+ return TRUE;
+}
+
+static gboolean
+gst_mpeg2dec_flush (GstVideoDecoder * decoder)
+{
+ GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
/* reset the initial video state */
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
- mpeg2_reset (mpeg2dec->decoder, hard ? 0 : 1);
+ mpeg2_reset (mpeg2dec->decoder, 0);
mpeg2_skip (mpeg2dec->decoder, 1);
gst_mpeg2dec_clear_buffers (mpeg2dec);
- if (hard) {
- if (mpeg2dec->input_state) {
- gst_video_codec_state_unref (mpeg2dec->input_state);
- mpeg2dec->input_state = NULL;
- }
- }
-
return TRUE;
}
GST_VIDEO_DECODER_ERROR (decoder, 1, STREAM, DECODE,
("decoding error"), ("Bad sequence header"), ret);
gst_video_decoder_drop_frame (decoder, frame);
- gst_mpeg2dec_reset (decoder, FALSE);
+ gst_mpeg2dec_flush (decoder);
goto done;
}
break;
);
static void gst_x264_enc_finalize (GObject * object);
-static gboolean gst_x264_enc_reset (GstVideoEncoder * encoder, gboolean hard);
+static gboolean gst_x264_enc_start (GstVideoEncoder * encoder);
+static gboolean gst_x264_enc_stop (GstVideoEncoder * encoder);
+static gboolean gst_x264_enc_flush (GstVideoEncoder * encoder);
static gboolean gst_x264_enc_init_encoder (GstX264Enc * encoder);
static void gst_x264_enc_close_encoder (GstX264Enc * encoder);
gstencoder_class->set_format = GST_DEBUG_FUNCPTR (gst_x264_enc_set_format);
gstencoder_class->handle_frame =
GST_DEBUG_FUNCPTR (gst_x264_enc_handle_frame);
- gstencoder_class->reset = GST_DEBUG_FUNCPTR (gst_x264_enc_reset);
+ gstencoder_class->start = GST_DEBUG_FUNCPTR (gst_x264_enc_start);
+ gstencoder_class->stop = GST_DEBUG_FUNCPTR (gst_x264_enc_stop);
+ gstencoder_class->flush = GST_DEBUG_FUNCPTR (gst_x264_enc_flush);
gstencoder_class->finish = GST_DEBUG_FUNCPTR (gst_x264_enc_finish);
gstencoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_x264_enc_sink_getcaps);
gstencoder_class->propose_allocation =
}
static gboolean
-gst_x264_enc_reset (GstVideoEncoder * encoder, gboolean hard)
+gst_x264_enc_start (GstVideoEncoder * encoder)
+{
+ GstX264Enc *x264enc = GST_X264_ENC (encoder);
+
+ x264enc->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY;
+
+ return TRUE;
+}
+
+static gboolean
+gst_x264_enc_stop (GstVideoEncoder * encoder)
{
GstX264Enc *x264enc = GST_X264_ENC (encoder);
gst_x264_enc_flush_frames (x264enc, FALSE);
gst_x264_enc_close_encoder (x264enc);
+ gst_x264_enc_dequeue_all_frames (x264enc);
- if (hard) {
- if (x264enc->input_state)
- gst_video_codec_state_unref (x264enc->input_state);
- x264enc->input_state = NULL;
- x264enc->current_byte_stream = GST_X264_ENC_STREAM_FORMAT_FROM_PROPERTY;
- } else {
- gst_x264_enc_init_encoder (x264enc);
- }
+ if (x264enc->input_state)
+ gst_video_codec_state_unref (x264enc->input_state);
+ x264enc->input_state = NULL;
+ return TRUE;
+}
+
+
+static gboolean
+gst_x264_enc_flush (GstVideoEncoder * encoder)
+{
+ GstX264Enc *x264enc = GST_X264_ENC (encoder);
+
+ gst_x264_enc_flush_frames (x264enc, FALSE);
+ gst_x264_enc_close_encoder (x264enc);
gst_x264_enc_dequeue_all_frames (x264enc);
+ gst_x264_enc_init_encoder (x264enc);
+
return TRUE;
}