mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
pngdec: Wait for segment event before checking it
The heuristic to choose between packetise or not was changed to use the segment format. The problem is that this change is reading the segment during the caps event handling. The segment event will only be sent after. That prevented the decoder to go in packetize mode, and avoid useless parsing. https://bugzilla.gnome.org/show_bug.cgi?id=736252
This commit is contained in:
parent
a6008fde65
commit
7af9271c85
1 changed files with 22 additions and 5 deletions
|
@ -56,6 +56,8 @@ static GstFlowReturn gst_pngdec_handle_frame (GstVideoDecoder * decoder,
|
|||
GstVideoCodecFrame * frame);
|
||||
static gboolean gst_pngdec_decide_allocation (GstVideoDecoder * decoder,
|
||||
GstQuery * query);
|
||||
static gboolean gst_pngdec_sink_event (GstVideoDecoder * bdec,
|
||||
GstEvent * event);
|
||||
|
||||
#define parent_class gst_pngdec_parent_class
|
||||
G_DEFINE_TYPE (GstPngDec, gst_pngdec, GST_TYPE_VIDEO_DECODER);
|
||||
|
@ -96,6 +98,7 @@ gst_pngdec_class_init (GstPngDecClass * klass)
|
|||
vdec_class->parse = gst_pngdec_parse;
|
||||
vdec_class->handle_frame = gst_pngdec_handle_frame;
|
||||
vdec_class->decide_allocation = gst_pngdec_decide_allocation;
|
||||
vdec_class->sink_event = gst_pngdec_sink_event;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (pngdec_debug, "pngdec", 0, "PNG image decoder");
|
||||
}
|
||||
|
@ -164,11 +167,6 @@ gst_pngdec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
|
|||
gst_video_codec_state_unref (pngdec->input_state);
|
||||
pngdec->input_state = gst_video_codec_state_ref (state);
|
||||
|
||||
if (decoder->input_segment.format == GST_FORMAT_TIME)
|
||||
gst_video_decoder_set_packetized (decoder, TRUE);
|
||||
else
|
||||
gst_video_decoder_set_packetized (decoder, FALSE);
|
||||
|
||||
/* We'll set format later on */
|
||||
|
||||
return TRUE;
|
||||
|
@ -529,6 +527,25 @@ gst_pngdec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_pngdec_sink_event (GstVideoDecoder * bdec, GstEvent * event)
|
||||
{
|
||||
const GstSegment *segment;
|
||||
|
||||
if (GST_EVENT_TYPE (event) != GST_EVENT_SEGMENT)
|
||||
goto done;
|
||||
|
||||
gst_event_parse_segment (event, &segment);
|
||||
|
||||
if (segment->format == GST_FORMAT_TIME)
|
||||
gst_video_decoder_set_packetized (bdec, TRUE);
|
||||
else
|
||||
gst_video_decoder_set_packetized (bdec, FALSE);
|
||||
|
||||
done:
|
||||
return GST_VIDEO_DECODER_CLASS (parent_class)->sink_event (bdec, event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_pngdec_libpng_init (GstPngDec * pngdec)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue