examples: add video upload example

Add an example of a node that makes a video available.
Improve buffer reuse in stream.
Add more video formats
This commit is contained in:
Wim Taymans 2017-04-18 17:57:04 +02:00
parent c7333c46cc
commit db16de85bb
16 changed files with 466 additions and 93 deletions

View file

@ -140,6 +140,19 @@ static const uint32_t *video_format_map[] = {
&type.video_format.P010_10LE,
&type.video_format.IYU2,
&type.video_format.VYUY,
&type.video_format.GBRA,
&type.video_format.GBRA_10BE,
&type.video_format.GBRA_10LE,
&type.video_format.GBR_12BE,
&type.video_format.GBR_12LE,
&type.video_format.GBRA_12BE,
&type.video_format.GBRA_12LE,
&type.video_format.I420_12BE,
&type.video_format.I420_12LE,
&type.video_format.I422_12BE,
&type.video_format.I422_12LE,
&type.video_format.Y444_12BE,
&type.video_format.Y444_12LE,
};
#if __BYTE_ORDER == __BIG_ENDIAN
@ -367,13 +380,16 @@ handle_video_fields (ConvertData *d)
value = gst_structure_get_value (d->cs, "format");
if (value) {
const char *v;
int idx;
for (i = 0; (v = get_nth_string (value, i)); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
type.format_video.format,
get_range_type (value));
spa_pod_builder_id (&d->b, *video_format_map[gst_video_format_from_string (v)]);
idx = gst_video_format_from_string (v);
if (idx < SPA_N_ELEMENTS (video_format_map))
spa_pod_builder_id (&d->b, *video_format_map[idx]);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
@ -424,13 +440,16 @@ handle_audio_fields (ConvertData *d)
value = gst_structure_get_value (d->cs, "format");
if (value) {
const char *v;
int idx;
for (i = 0; (v = get_nth_string (value, i)); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
type.format_audio.format,
get_range_type (value));
spa_pod_builder_id (&d->b, *audio_format_map[gst_audio_format_from_string (v)]);
idx = gst_audio_format_from_string (v);
if (idx < SPA_N_ELEMENTS (audio_format_map))
spa_pod_builder_id (&d->b, *audio_format_map[idx]);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;

View file

@ -777,7 +777,6 @@ gst_pinos_sink_stop (GstBaseSink * basesink)
pinos_thread_main_loop_lock (pinossink->main_loop);
if (pinossink->stream) {
pinos_stream_stop (pinossink->stream);
pinos_stream_disconnect (pinossink->stream);
pinos_stream_destroy (pinossink->stream);
pinossink->stream = NULL;

View file

@ -571,11 +571,8 @@ parse_stream_properties (GstPinosSrc *pinossrc, PinosProperties *props)
static gboolean
gst_pinos_src_stream_start (GstPinosSrc *pinossrc)
{
gboolean res;
pinos_thread_main_loop_lock (pinossrc->main_loop);
GST_DEBUG_OBJECT (pinossrc, "doing stream start");
res = pinos_stream_start (pinossrc->stream);
while (TRUE) {
PinosStreamState state = pinossrc->stream->state;
@ -601,7 +598,7 @@ gst_pinos_src_stream_start (GstPinosSrc *pinossrc)
pinos_thread_main_loop_signal (pinossrc->main_loop, FALSE);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return res;
return TRUE;
start_error:
{