mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
On a still-frame begin message, drain out the decoder and send it.
Fixes still frame handling on DVDs
This commit is contained in:
parent
acadc94279
commit
041c16b47d
1 changed files with 25 additions and 8 deletions
|
@ -296,6 +296,7 @@
|
||||||
#include "gstvideodecoder.h"
|
#include "gstvideodecoder.h"
|
||||||
#include "gstvideoutils.h"
|
#include "gstvideoutils.h"
|
||||||
|
|
||||||
|
#include <gst/video/video-event.h>
|
||||||
#include <gst/video/gstvideopool.h>
|
#include <gst/video/gstvideopool.h>
|
||||||
#include <gst/video/gstvideometa.h>
|
#include <gst/video/gstvideometa.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -893,7 +894,7 @@ gst_video_decoder_push_event (GstVideoDecoder * decoder, GstEvent * event)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_video_decoder_handle_eos (GstVideoDecoder * dec)
|
gst_video_decoder_drain_out (GstVideoDecoder * dec, gboolean at_eos)
|
||||||
{
|
{
|
||||||
GstVideoDecoderClass *decoder_class = GST_VIDEO_DECODER_GET_CLASS (dec);
|
GstVideoDecoderClass *decoder_class = GST_VIDEO_DECODER_GET_CLASS (dec);
|
||||||
GstVideoDecoderPrivate *priv = dec->priv;
|
GstVideoDecoderPrivate *priv = dec->priv;
|
||||||
|
@ -918,8 +919,10 @@ gst_video_decoder_handle_eos (GstVideoDecoder * dec)
|
||||||
ret = gst_video_decoder_flush_parse (dec, TRUE);
|
ret = gst_video_decoder_flush_parse (dec, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (at_eos) {
|
||||||
if (decoder_class->finish)
|
if (decoder_class->finish)
|
||||||
ret = decoder_class->finish (dec);
|
ret = decoder_class->finish (dec);
|
||||||
|
}
|
||||||
|
|
||||||
GST_VIDEO_DECODER_STREAM_UNLOCK (dec);
|
GST_VIDEO_DECODER_STREAM_UNLOCK (dec);
|
||||||
|
|
||||||
|
@ -932,6 +935,7 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder,
|
||||||
{
|
{
|
||||||
GstVideoDecoderPrivate *priv;
|
GstVideoDecoderPrivate *priv;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
gboolean forward_immediate = FALSE;
|
||||||
|
|
||||||
priv = decoder->priv;
|
priv = decoder->priv;
|
||||||
|
|
||||||
|
@ -951,11 +955,25 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder,
|
||||||
{
|
{
|
||||||
GstFlowReturn flow_ret = GST_FLOW_OK;
|
GstFlowReturn flow_ret = GST_FLOW_OK;
|
||||||
|
|
||||||
flow_ret = gst_video_decoder_handle_eos (decoder);
|
flow_ret = gst_video_decoder_drain_out (decoder, TRUE);
|
||||||
ret = (flow_ret == GST_FLOW_OK);
|
ret = (flow_ret == GST_FLOW_OK);
|
||||||
|
forward_immediate = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_EVENT_CUSTOM_DOWNSTREAM_OOB:
|
||||||
|
{
|
||||||
|
gboolean in_still;
|
||||||
|
GstFlowReturn flow_ret = GST_FLOW_OK;
|
||||||
|
|
||||||
|
if (gst_video_event_parse_still_frame (event, &in_still)) {
|
||||||
|
if (in_still) {
|
||||||
|
flow_ret = gst_video_decoder_drain_out (decoder, FALSE);
|
||||||
|
ret = (flow_ret == GST_FLOW_OK);
|
||||||
|
forward_immediate = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case GST_EVENT_SEGMENT:
|
case GST_EVENT_SEGMENT:
|
||||||
{
|
{
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
|
@ -1012,6 +1030,7 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder,
|
||||||
/* well, this is kind of worse than a DISCONT */
|
/* well, this is kind of worse than a DISCONT */
|
||||||
gst_video_decoder_flush (decoder, TRUE);
|
gst_video_decoder_flush (decoder, TRUE);
|
||||||
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
|
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
|
||||||
|
forward_immediate = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_EVENT_TAG:
|
case GST_EVENT_TAG:
|
||||||
|
@ -1044,9 +1063,7 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder,
|
||||||
* to be forwarded immediately and no buffers are queued anyway.
|
* to be forwarded immediately and no buffers are queued anyway.
|
||||||
*/
|
*/
|
||||||
if (event) {
|
if (event) {
|
||||||
if (!GST_EVENT_IS_SERIALIZED (event)
|
if (!GST_EVENT_IS_SERIALIZED (event) || forward_immediate) {
|
||||||
|| GST_EVENT_TYPE (event) == GST_EVENT_EOS
|
|
||||||
|| GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
|
|
||||||
ret = gst_video_decoder_push_event (decoder, event);
|
ret = gst_video_decoder_push_event (decoder, event);
|
||||||
} else {
|
} else {
|
||||||
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
|
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
|
||||||
|
|
Loading…
Reference in a new issue