mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
videorate: factor out gst_video_rate_push_buffer()
No semantic change, just factor out this function from gst_video_rate_flush_prev(). I'm about to use it to change the 'drop-only' code path. https://bugzilla.gnome.org/show_bug.cgi?id=780767
This commit is contained in:
parent
7fb0aeac10
commit
2c2d2a444c
1 changed files with 23 additions and 14 deletions
|
@ -623,25 +623,14 @@ gst_video_rate_init (GstVideoRate * videorate)
|
||||||
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (videorate), TRUE);
|
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (videorate), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flush the oldest buffer */
|
/* @outbuf: (transfer full) needs to be writable */
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate,
|
gst_video_rate_push_buffer (GstVideoRate * videorate, GstBuffer * outbuf,
|
||||||
GstClockTime next_intime)
|
gboolean duplicate, GstClockTime next_intime)
|
||||||
{
|
{
|
||||||
GstFlowReturn res;
|
GstFlowReturn res;
|
||||||
GstBuffer *outbuf;
|
|
||||||
GstClockTime push_ts;
|
GstClockTime push_ts;
|
||||||
|
|
||||||
if (!videorate->prevbuf)
|
|
||||||
goto eos_before_buffers;
|
|
||||||
|
|
||||||
outbuf = gst_buffer_ref (videorate->prevbuf);
|
|
||||||
if (videorate->drop_only)
|
|
||||||
gst_buffer_replace (&videorate->prevbuf, NULL);
|
|
||||||
|
|
||||||
/* make sure we can write to the metadata */
|
|
||||||
outbuf = gst_buffer_make_writable (outbuf);
|
|
||||||
|
|
||||||
GST_BUFFER_OFFSET (outbuf) = videorate->out;
|
GST_BUFFER_OFFSET (outbuf) = videorate->out;
|
||||||
GST_BUFFER_OFFSET_END (outbuf) = videorate->out + 1;
|
GST_BUFFER_OFFSET_END (outbuf) = videorate->out + 1;
|
||||||
|
|
||||||
|
@ -710,6 +699,26 @@ gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate,
|
||||||
res = gst_pad_push (GST_BASE_TRANSFORM_SRC_PAD (videorate), outbuf);
|
res = gst_pad_push (GST_BASE_TRANSFORM_SRC_PAD (videorate), outbuf);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* flush the oldest buffer */
|
||||||
|
static GstFlowReturn
|
||||||
|
gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate,
|
||||||
|
GstClockTime next_intime)
|
||||||
|
{
|
||||||
|
GstBuffer *outbuf;
|
||||||
|
|
||||||
|
if (!videorate->prevbuf)
|
||||||
|
goto eos_before_buffers;
|
||||||
|
|
||||||
|
outbuf = gst_buffer_ref (videorate->prevbuf);
|
||||||
|
if (videorate->drop_only)
|
||||||
|
gst_buffer_replace (&videorate->prevbuf, NULL);
|
||||||
|
|
||||||
|
/* make sure we can write to the metadata */
|
||||||
|
outbuf = gst_buffer_make_writable (outbuf);
|
||||||
|
|
||||||
|
return gst_video_rate_push_buffer (videorate, outbuf, duplicate, next_intime);
|
||||||
|
|
||||||
/* WARNINGS */
|
/* WARNINGS */
|
||||||
eos_before_buffers:
|
eos_before_buffers:
|
||||||
|
|
Loading…
Reference in a new issue