newby help

James Linder jam at tigger.ws
Tue Mar 30 11:41:31 UTC 2021



> On 30 Mar 2021, at 3:32 pm, Michiel Konstapel <michiel at aanmelder.nl> wrote:
> 
> On 30-03-2021 08:22, James wrote:
>> OK perhaps a different track:
>> I compiled basic_tutorial12.c
>> The executable runs, pretty picture etc
>> 
>> I changed
>> 
>> pipeline = gst_parse_launch ("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm", NULL);
>> 
>> for
>> pipeline = gst_parse_launch ("v4l2src device=argv[1] ! tee name=t "
>>                     "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
>>                      "videoconvert ! xvimagesink force-aspect-ratio=false "
>>                      " t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
>>                      "videoconvert ! xvimagesink force-aspect-ratio=false", NULL);
>> 
>> Now running gives me
>> 
>> Unable to set the pipeline to the playing state.
>> 
>> My 'get_parse_lauch' is wrong. Why? Where?
>> 
>> Thanks
>> James
> 
> Do you literally have "v4l2src device=argv[1]" in there? That's not going to work :)
> 
> If it's C, you'll have to use something like snprintf() to put the argument into the parse_launch string. My C is quite rusty, but something like
> 
> char cmdline[1024];
> snprintf(
>   cmdline, 1024,
>   "v4l2src device=%s ! tee name=t "
>   "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
>   "videoconvert ! xvimagesink force-aspect-ratio=false "
>   "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
>   "videoconvert ! xvimagesink force-aspect-ratio=false",
>   argv[1]
> );
> pipeline = gst_parse_launch(cmdline, NULL);

Of course! silly moi. My very last dumb question, I promise.
I need to fiddle with the elements in the pipeline (to reparent the window). So the printf solution or g_object_set (..)
so I’m trying to list items in pipeline (which was made with gst_parse_launch)

   // walk the pipeline

GstIterator *iter = gst_bin_iterate_elements (pipeline);
GValue item = G_VALUE_INIT;
gboolean done = FALSE;
  while (!done) {
    switch (gst_iterator_next (iter, &item)) {
      case GST_ITERATOR_OK:
        //...get/use/change item here...
       gst_element_get_name (&item);
        g_value_reset (&item);
        break;
      case GST_ITERATOR_RESYNC:
        //...rollback changes to items...
        gst_iterator_resync (iter);
        break;
      case GST_ITERATOR_ERROR:
        //...wrong parameters were given...
        done = TRUE;
        break;
      case GST_ITERATOR_DONE:
        done = TRUE;
        break;
    }
  }
  g_value_unset (&item);
  gst_iterator_free (iter);

 //—————————————————————

Which fails asserting item is not an object.
Again stuff I don’t understand, despite lots of reading
James



More information about the gstreamer-devel mailing list