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