How to dynamically change filesrc location and gapless playback and loop using C

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

How to dynamically change filesrc location and gapless playback and loop using C

imoni
I'm trying to make an application that plays gapless and loops with  C.

AAA.mp4--> BBB.mp4--> CCC.mp4--> AAA.mp4--> BBB.mp4--> CCC.mp4--> ...

There are a few things I don't understand.

How to dynamically change the next filesrc after playing the first filesrc?
How to dynamically play the next filesrc with gapless?
How to dynamically loop play?
Is it difficult for a beginner to understand these and make an application?

I tried to change the src element for reference Changing elements in a
pipeline
(https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html?gi-language=c#dynamically-changing-the-pipeline),
but it failed. In this example, since it is a filter element, I don't know
what to do in case of src element.



--
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: How to dynamically change filesrc location and gapless playback and loop using C

dabrain34
Hello,

According to your use case, you can give a try to playbin element and its
signal "about-to-finish".

This signal is triggered when the pipeline is out of data.
So you just have to set the playbin "uri" property again when you receive
this signal in your application.

Here is an example on how to use it:

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/blob/master/tools/gst-play.c#L245

Best regards.

Stéphane



--
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: How to dynamically change filesrc location and gapless playback and loop using C

imoni
Thank you for your answer.

I tried the example
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/blob/master/tools/gst-play.c#L245
<https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/blob/master/tools/gst-play.c#L245>  

The build did not succeed.

First of all, #include <gst/gst-i18n-app.h> did not exist, so I downloaded
it from
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/blob/675415bf2ea9ddc75ea5e5b6eae9ae942c19d6dc/gst-libs/gst/gst-i18n-app.h
<https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/blob/675415bf2ea9ddc75ea5e5b6eae9ae942c19d6dc/gst-libs/gst/gst-i18n-app.h>
.
Is this way OK?

Next, I got the following error.What is the cause of this?
pi@raspberrypi:~ $ gcc tools_gst-play.c `pkg-config --cflags --libs gtk+-3.0
gstreamer-1.0`
tools_gst-play.c: In function ‘play_do_seek’:
tools_gst-play.c:963:22: error: ‘GST_SEEK_FLAG_INSTANT_RATE_CHANGE’
undeclared (first use in this function); did you mean
‘G_TYPE_FLAG_INSTANTIATABLE’?
         seek_flags | GST_SEEK_FLAG_INSTANT_RATE_CHANGE,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      G_TYPE_FLAG_INSTANTIATABLE
tools_gst-play.c:963:22: note: each undeclared identifier is reported only
once for each function it appears in
tools_gst-play.c: In function ‘main’:
tools_gst-play.c:1511:29: error: expected ‘)’ before ‘GST_API_VERSION’
   g_set_prgname ("gst-play-" GST_API_VERSION);
                             ^~~~~~~~~~~~~~~~
                             )
tools_gst-play.c:1516:52: error: ‘GETTEXT_PACKAGE’ undeclared (first use in
this function)
   g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
                                                    ^~~~~~~~~~~~~~~
tools_gst-play.c:1532:53: error: ‘PACKAGE_VERSION’ undeclared (first use in
this function); did you mean ‘GST_TAG_VERSION’?
     gst_print ("%s version %s\n", g_get_prgname (), PACKAGE_VERSION);
                                                     ^~~~~~~~~~~~~~~
                                                     GST_TAG_VERSION
tools_gst-play.c:1534:24: error: ‘GST_PACKAGE_ORIGIN’ undeclared (first use
in this function); did you mean ‘GST_PARSE_ERROR_LINK’?
     gst_print ("%s\n", GST_PACKAGE_ORIGIN);
                        ^~~~~~~~~~~~~~~~~~
                        GST_PARSE_ERROR_LINK
tools_gst-play.c:1575:20: error: expected ‘)’ before ‘GST_API_VERSION’
         "gst-play-" GST_API_VERSION);
                    ^~~~~~~~~~~~~~~~
                    )

Thank you and best regards,
imoni




--
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: How to dynamically change filesrc location and gapless playback and loop using C

dabrain34
Helo,

According to your compilation line, you need more than gtk and gstreamer
dependencies to build this example.
You'll need this deps (maybe more than necessary):

tool_deps = glib_deps + [pbutils_dep, audio_dep, video_dep, tag_dep,
gst_dep, gst_base_dep, gmodule_dep]

Another option would be to customize your source code to use playbin element
and connect to the signal "about-to-finish" as demonstrated in the gstplay.c
example.

You can also get in touch with gst-build, the best way to get a suitable
GStreamer development environment.

https://www.collabora.com/news-and-blog/blog/2020/03/19/getting-started-with-gstreamer-gst-build/

Cheers.

Stéphane



--
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: How to dynamically change filesrc location and gapless playback and loop using C

imoni
Thank you for your answer.

I compiled it, so I tried to run it.
$./a.out --playlist playlist_file --gapless

The contents of playlist_file are as follows.
AAA.mp4
BBB.mp4
In this case, the video stopped working without switching from AAA.mp4 to
BBB.mp4. The program no longer exits.


If the contents of playlist_file are as follows,
AAA.mp4
AAA.mp4
In this case, when switching from AAA.mp4 to the next AAA.mp4, the screen
turned green and flashed repeatedly. It seems to be working because the time
is counted internally.

Do I need any other options to play mp4 files gapless?

Thank you and best regards,
imoni




--
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: How to dynamically change filesrc location and gapless playback and loop using C

Cole Bush
How do I get off of this list?  I followed the link and followed the instructions. Please help!

Thanks!


From: gstreamer-devel <[hidden email]> on behalf of imoni <[hidden email]>
Sent: Saturday, August 15, 2020 7:33 AM
To: [hidden email] <[hidden email]>
Subject: Re: How to dynamically change filesrc location and gapless playback and loop using C
 
Thank you for your answer.

I compiled it, so I tried to run it.
$./a.out --playlist playlist_file --gapless

The contents of playlist_file are as follows.
AAA.mp4
BBB.mp4
In this case, the video stopped working without switching from AAA.mp4 to
BBB.mp4. The program no longer exits.


If the contents of playlist_file are as follows,
AAA.mp4
AAA.mp4
In this case, when switching from AAA.mp4 to the next AAA.mp4, the screen
turned green and flashed repeatedly. It seems to be working because the time
is counted internally.

Do I need any other options to play mp4 files gapless?

Thank you and best regards,
imoni




--
Sent from: https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgstreamer-devel.966125.n4.nabble.com%2F&amp;data=02%7C01%7Cbush.c%40northeastern.edu%7Cea682633a64b4911a91a08d841190c08%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637330923132366914&amp;sdata=%2BaISjjCF4X6lNrqPz3TU61ZQFRVz%2B%2FBLwi6Rik4qXcA%3D&amp;reserved=0
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fgstreamer-devel&amp;data=02%7C01%7Cbush.c%40northeastern.edu%7Cea682633a64b4911a91a08d841190c08%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C637330923132366914&amp;sdata=OBowW0UuDuIp%2FpvRYolFxdIiLj1ypMdG5ZTzB4AiFgA%3D&amp;reserved=0

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel