newby help

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

newby help

James Linder
G’day

I tease my mate “windows is so simple” only a fool can use it.

I feel like that about gstreamer.

I have a command that works.

gst-launch-1.0  v4l2src device=$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

The tutorials say:

Please note that gst-launch is primarily a debugging tool for developers and users. You should not build applications on top of it. For applications, use the gst_parse_launch() function of the GStreamer API as an easy way to construct pipelines from pipeline descriptions.

WHY?

I’m trying to build a pipeline based on the above, but I do not understand the whole linking bit

in particular I think that linking the tee to each queue should be all that is required, but core-dump says I’m wrong.

Why the gst-launch above is that I need to have the sink windows have no decoration. I’ve made suitable canvases but I now need to reparent the xv window in a window of size and position I declare ie in my canvases. Any suggestions are welcome.

A while after instantiation the windows are called ‘gst-launch-1.0’ and I can manipilate them. But I often miss. I can catch them as “*” but I dont want ALL windows having no decoration, just the XV windows.

Please, a few moments to lead an ignorant soal out the swamp.

James
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

gotsring
gst-launch is good for testing pipelines, but it lacks the ability to do any
monitoring, live changes, error-handling, etc. Building pipelines in code
takes getting used to, but it allows much more flexibility and robustness.

For basic pipelines, you can use gst_parse_launch to run a pipeline similar
to how you would use gst-launch

For example, a simple pipeline with a tee can be started from the shell
using:
    gst-launch-1.0 videotestsrc ! tee name=t \
     t. ! queue ! videoconvert ! autovideosink \
     t. ! queue ! videoconvert ! autovideosink

or in C code using gst_parse_launch:
        GError* err = NULL;
        GstElement* pipeline = gst_parse_launch(
                "videotestsrc ! tee name=t "
                "t. ! queue ! videoconvert ! autovideosink "
                "t. ! queue ! videoconvert ! autovideosink"
                , &err);
        gst_element_set_state(pipeline, GST_STATE_PLAYING); // Play it


You can swap out my test pipeline for whatever you want.

Not quite sure what you're trying to do in terms of a GUI, but maybe use
GTK? Check out basic tutorial 5:
https://gstreamer.freedesktop.org/documentation/tutorials/basic/toolkit-integration.html?gi-language=c




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

James Linder


> On 29 Mar 2021, at 10:50 pm, gotsring <[hidden email]> wrote:
>
> gst-launch is good for testing pipelines, but it lacks the ability to do any
> monitoring, live changes, error-handling, etc. Building pipelines in code
> takes getting used to, but it allows much more flexibility and robustness.
>
> For basic pipelines, you can use gst_parse_launch to run a pipeline similar
> to how you would use gst-launch
>
> For example, a simple pipeline with a tee can be started from the shell
> using:
>    gst-launch-1.0 videotestsrc ! tee name=t \
>     t. ! queue ! videoconvert ! autovideosink \
>     t. ! queue ! videoconvert ! autovideosink
>
> or in C code using gst_parse_launch:
> GError* err = NULL;
> GstElement* pipeline = gst_parse_launch(
> "videotestsrc ! tee name=t "
> "t. ! queue ! videoconvert ! autovideosink "
> "t. ! queue ! videoconvert ! autovideosink"
> , &err);
> gst_element_set_state(pipeline, GST_STATE_PLAYING); // Play it
>
>
> You can swap out my test pipeline for whatever you want.
>
> Not quite sure what you're trying to do in terms of a GUI, but maybe use
> GTK? Check out basic tutorial 5:
> https://gstreamer.freedesktop.org/documentation/tutorials/basic/toolkit-integration.html?gi-language=c

Thanks.
I put my exact working command into the gst-parse-launch where it failed with core dump I think. I've done so much wading around in the basic_tutorial 7 and 8 I don't remember exactly.

What I've done is to explicitly link the tee pads. Now I'm just trying to track down 2 gstreamer-CRITICAL  errors before  a core dump.
I find the whole toolkit rather nice, just oh so complex and I see my original question of how do I code this pipeline is extremely non-trivial

James
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

James Linder
In reply to this post by gotsring


> On 29 Mar 2021, at 10:50 pm, gotsring <[hidden email]> wrote:
>
> gst-launch is good for testing pipelines, but it lacks the ability to do any
> monitoring, live changes, error-handling, etc. Building pipelines in code
> takes getting used to, but it allows much more flexibility and robustness.
>
> For basic pipelines, you can use gst_parse_launch to run a pipeline similar
> to how you would use gst-launch
>
> For example, a simple pipeline with a tee can be started from the shell
> using:
>    gst-launch-1.0 videotestsrc ! tee name=t \
>     t. ! queue ! videoconvert ! autovideosink \
>     t. ! queue ! videoconvert ! autovideosink
>
> or in C code using gst_parse_launch:
> GError* err = NULL;
> GstElement* pipeline = gst_parse_launch(
> "videotestsrc ! tee name=t "
> "t. ! queue ! videoconvert ! autovideosink "
> "t. ! queue ! videoconvert ! autovideosink"
> , &err);
> gst_element_set_state(pipeline, GST_STATE_PLAYING); // Play it
>
>
> You can swap out my test pipeline for whatever you want.
>
> Not quite sure what you're trying to do in terms of a GUI, but maybe use
> GTK? Check out basic tutorial 5:
> https://gstreamer.freedesktop.org/documentation/tutorials/basic/toolkit-integration.html?gi-language=c


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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

mkonstapel
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);

HTH,
Michiel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

James Linder


> On 30 Mar 2021, at 3:32 pm, Michiel Konstapel <[hidden email]> 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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

gotsring
In this case, I don't think you need to iterate over all the elements
manually. You're just trying to grab references to the xvimagesink, correct?
If so, use gst_bin_get_by_name(), which returns a reference to the element
in question (or NULL). You can name your elements in gst_parse_launch to
make them easier to find.

Something like:
// Name the xvimagesinks in the parse string (just add "name=custom_name")
char cmdline[1024];
snprintf(
   cmdline, 1024,
   "v4l2src device=%s ! tee name=t "
   "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
   "videoconvert ! xvimagesink name=sink1 force-aspect-ratio=false "
   "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
   "videoconvert ! xvimagesink name=sink2 force-aspect-ratio=false",
   argv[1]
);
pipeline = gst_parse_launch(cmdline, NULL);

// Get references to the xvimagesink elements, we called them sink1 and
sink2
GstElement* sink1 = gst_bin_get_by_name(GST_BIN(pipeline), "sink1");
GstElement* sink2 = gst_bin_get_by_name(GST_BIN(pipeline), "sink2");






--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

James Linder


> On 30 Mar 2021, at 10:23 pm, gotsring <[hidden email]> wrote:
>
> In this case, I don't think you need to iterate over all the elements
> manually. You're just trying to grab references to the xvimagesink, correct?
> If so, use gst_bin_get_by_name(), which returns a reference to the element
> in question (or NULL). You can name your elements in gst_parse_launch to
> make them easier to find.
>
> Something like:
> // Name the xvimagesinks in the parse string (just add "name=custom_name")
> char cmdline[1024];
> snprintf(
>   cmdline, 1024,
>   "v4l2src device=%s ! tee name=t "
>   "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
>   "videoconvert ! xvimagesink name=sink1 force-aspect-ratio=false "
>   "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
>   "videoconvert ! xvimagesink name=sink2 force-aspect-ratio=false",
>   argv[1]
> );
> pipeline = gst_parse_launch(cmdline, NULL);
>
> // Get references to the xvimagesink elements, we called them sink1 and
> sink2
> GstElement* sink1 = gst_bin_get_by_name(GST_BIN(pipeline), "sink1");
> GstElement* sink2 = gst_bin_get_by_name(GST_BIN(pipeline), "sink2");

Thank you lots

James
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

James Linder


On 31 Mar 2021, at 7:20 am, James <[hidden email]> wrote:



On 30 Mar 2021, at 10:23 pm, gotsring <[hidden email]> wrote:

In this case, I don't think you need to iterate over all the elements
manually. You're just trying to grab references to the xvimagesink, correct?
If so, use gst_bin_get_by_name(), which returns a reference to the element
in question (or NULL). You can name your elements in gst_parse_launch to
make them easier to find.

Something like:
// Name the xvimagesinks in the parse string (just add "name=custom_name")
char cmdline[1024];
snprintf(
 cmdline, 1024,
 "v4l2src device=%s ! tee name=t "
 "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
 "videoconvert ! xvimagesink name=sink1 force-aspect-ratio=false "
 "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
 "videoconvert ! xvimagesink name=sink2 force-aspect-ratio=false",
 argv[1]
);
pipeline = gst_parse_launch(cmdline, NULL);

// Get references to the xvimagesink elements, we called them sink1 and
sink2
GstElement* sink1 = gst_bin_get_by_name(GST_BIN(pipeline), "sink1");
GstElement* sink2 = gst_bin_get_by_name(GST_BIN(pipeline), "sink2");

Thank you lots

I want to re-parent a window.
The only gooled results I can find are old and use depreciated apis.

I tried

    GstVideoOverlay* ov1 = (GstVideoOverlay*) sink1;
    GstVideoOverlay* ov2 = (GstVideoOverlay*) sink2;

    gst_video_overlay_set_window_handle (ov1, (guintptr)  preview1Wid);

based on


but was rewarded with

gcc myalt.c -o myalt `pkg-config --cflags --libs gstreamer-1.0`
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /tmp/ccT1P5wY.o: in function `main':
myalt.c:(.text+0x316): undefined reference to `gst_video_overlay_set_window_handle'
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: myalt] Error 1

Anybody please
James

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

gotsring
Linker error? Just add the gtk+3.0 libs to the pkg-config list and I think
you'll be good.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: newby help

James Linder


> On 2 Apr 2021, at 12:44 am, gotsring <[hidden email]> wrote:
>
> Linker error? Just add the gtk+3.0 libs to the pkg-config list and I think
> you'll be good.

Almost :-)
basic_tutorial-5.c shows the pkg-config to get the correct libs.
Then it works.
James
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel