mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
basevideoencoder: Add ::reset vfunc and handle ::reset/::finish the same way as in the decoder
This commit is contained in:
parent
92643716e4
commit
159093cd6a
2 changed files with 24 additions and 4 deletions
|
@ -239,9 +239,9 @@ gst_base_video_encoder_drain (GstBaseVideoEncoder * enc)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (enc_class->finish) {
|
||||
if (enc_class->reset) {
|
||||
GST_DEBUG_OBJECT (enc, "requesting subclass to finish");
|
||||
ret = enc_class->finish (enc);
|
||||
ret = enc_class->reset (enc);
|
||||
}
|
||||
/* everything should be away now */
|
||||
if (codec->frames) {
|
||||
|
@ -366,13 +366,26 @@ static gboolean
|
|||
gst_base_video_encoder_sink_eventfunc (GstBaseVideoEncoder * base_video_encoder,
|
||||
GstEvent * event)
|
||||
{
|
||||
GstBaseVideoEncoderClass *base_video_encoder_class;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
base_video_encoder_class =
|
||||
GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder);
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
{
|
||||
GstFlowReturn flow_ret;
|
||||
|
||||
base_video_encoder->a.at_eos = TRUE;
|
||||
gst_base_video_encoder_drain (base_video_encoder);
|
||||
|
||||
if (base_video_encoder_class->finish) {
|
||||
flow_ret = base_video_encoder_class->finish (base_video_encoder);
|
||||
} else {
|
||||
flow_ret = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
ret = (flow_ret == GST_BASE_VIDEO_ENCODER_FLOW_DROPPED);
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_NEWSEGMENT:
|
||||
|
|
|
@ -58,6 +58,12 @@ G_BEGIN_DECLS
|
|||
*/
|
||||
#define GST_BASE_VIDEO_ENCODER_SRC_NAME "src"
|
||||
|
||||
/**
|
||||
* GST_BASE_VIDEO_ENCODER_FLOW_DROPPED:
|
||||
*
|
||||
* Returned when the event/buffer should be dropped.
|
||||
*/
|
||||
#define GST_BASE_VIDEO_ENCODER_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS_1
|
||||
|
||||
typedef struct _GstBaseVideoEncoder GstBaseVideoEncoder;
|
||||
typedef struct _GstBaseVideoEncoderClass GstBaseVideoEncoderClass;
|
||||
|
@ -148,7 +154,8 @@ struct _GstBaseVideoEncoderClass
|
|||
GstFlowReturn (*handle_frame) (GstBaseVideoEncoder *coder,
|
||||
GstVideoFrame *frame);
|
||||
|
||||
gboolean (*finish) (GstBaseVideoEncoder *coder);
|
||||
gboolean (*reset) (GstBaseVideoEncoder *coder);
|
||||
GstFlowReturn (*finish) (GstBaseVideoEncoder *coder);
|
||||
|
||||
GstFlowReturn (*shape_output) (GstBaseVideoEncoder *coder,
|
||||
GstVideoFrame *frame);
|
||||
|
|
Loading…
Reference in a new issue