validate: Handle buffer pts/dts/duration in the appsrc-push action

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3052>
This commit is contained in:
Thibault Saunier 2022-09-14 15:36:41 -03:00 committed by GStreamer Marge Bot
parent d2b4e7a38e
commit e290e7913c
2 changed files with 60 additions and 3 deletions

View file

@ -1080,12 +1080,16 @@ appsrc-push,
file-name=(string),
target-element-name=(string),
[caps=(caps)],
[dts=(GstClockTime)],
[duration=(GstClockTime)],
[offset=(uint64)],
[pts=(GstClockTime)],
[segment=((GstStructure)segment,[start=(GstClockTime)][stop=(GstClockTime)][base=(GstClockTime)][offset=(GstClockTime)][time=(GstClockTime)][postion=(GstClockTime)][duration=(GstClockTime)])],
[size=(uint64)],
[playback-time=(double,string)];
```
Queues a buffer in an appsrc. If the pipeline state allows flow of buffers, the next action is not run until the buffer has been pushed.
Queues a sample in an appsrc. If the pipeline state allows flow of buffers, the next action is not run until the buffer has been pushed.
* Implementer namespace: core
### Parameters
@ -1104,12 +1108,36 @@ Queues a buffer in an appsrc. If the pipeline state allows flow of buffers, the
Default: (null)
* `dts`:(optional): Buffer DTS
Possible types: `GstClockTime`
Default: (null)
* `duration`:(optional): Buffer duration
Possible types: `GstClockTime`
Default: (null)
* `offset`:(optional): Offset within the file where the buffer will start
Possible types: `uint64`
Default: (null)
* `pts`:(optional): Buffer PTS
Possible types: `GstClockTime`
Default: (null)
* `segment`:(optional): The GstSegment to configure as part of the sample
Possible types: `(GstStructure)segment,[start=(GstClockTime)][stop=(GstClockTime)][base=(GstClockTime)][offset=(GstClockTime)][time=(GstClockTime)][postion=(GstClockTime)][duration=(GstClockTime)]`
Default: (null)
* `size`:(optional): Number of bytes from the file that will be pushed as a buffer
Possible types: `uint64`

View file

@ -3621,7 +3621,7 @@ _execute_appsrc_push (GstValidateScenario * scenario,
GstBuffer *buffer;
guint64 offset = 0;
guint64 size = 0, read;
gint push_buffer_ret;
gint push_sample_ret;
gboolean wait;
GFileInfo *finfo = NULL;
GFile *f = NULL;
@ -3629,6 +3629,9 @@ _execute_appsrc_push (GstValidateScenario * scenario,
GstPad *peer_pad = NULL;
GInputStream *stream = NULL;
GstValidateExecuteActionReturn res;
GstSegment segment;
GstCaps *caps = NULL;
GstSample *sample;
/* We will only wait for the the buffer to be pushed if we are in a state
* that allows flow of buffers (>=PAUSED). Otherwise the buffer will just
@ -3675,7 +3678,15 @@ _execute_appsrc_push (GstValidateScenario * scenario,
"Could read enough data, only read: %" G_GUINT64_FORMAT, read);
buffer = gst_buffer_new_wrapped (file_contents, size);
file_contents = NULL;
gst_validate_action_get_clocktime (scenario,
action, "pts", &GST_BUFFER_PTS (buffer)
);
gst_validate_action_get_clocktime (scenario,
action, "dts", &GST_BUFFER_DTS (buffer)
);
gst_validate_action_get_clocktime (scenario,
action, "duration", &GST_BUFFER_DURATION (buffer)
);
{
const GValue *caps_value;
@ -7263,6 +7274,24 @@ register_action_types (void)
.mandatory = FALSE,
.types = "caps"
},
{
.name = "pts",
.description = "Buffer PTS",
.mandatory = FALSE,
.types = "GstClockTime"
},
{
.name = "dts",
.description = "Buffer DTS",
.mandatory = FALSE,
.types = "GstClockTime"
},
{
.name = "duration",
.description = "Buffer duration",
.mandatory = FALSE,
.types = "GstClockTime"
},
{NULL}
}),
"Queues a buffer in an appsrc. If the pipeline state allows flow of buffers, the next action is not run until the buffer has been pushed.",