Best way to use typefind in a custom player

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

Best way to use typefind in a custom player

gimmeamilk
Hi,

I'm making a simple player that can detect and play a few container and codec types. Decodebin etc is a little heavyweight for my needs for the time being, so I want to make my own autoplugger using typefind. I have a small look-up table of caps strings and suitable elements for both the containers and the codecs, eg

containers[] = {
{ "video/quicktime", {"qtdemux",NULL} },
...

codecs[] = {
{ "video/h264", {"queue","h264parse","mysinkplugin",NULL },

..etc

What's the best method to construct the final pipeline? I've been following the typefind example, and can detect the container using a source!typefind!fakesink pipeline and my look-up table, but how do I then "remove" the typefind/sink from the pipeline and insert the demuxer without losing any stream data? (I assume if I unlink and remove the typefind element, any stream data it had pulled during the typefinding will be lost?)


Reply | Threaded
Open this post in threaded view
|

Re: Best way to use typefind in a custom player

Paul d'AUBIGNY
Typefind element generates signals, one is typefound when a type has been found. So let's imagine you connected the upstream elements to typefind sink pad but didn't connect its src pad yet as you don't know which demuxer to use, when receiving the typefound signal, it will call your callback function where you can update your pipeline: add the selected demuxer and linked the remaining elements which were not linked before.
You can add a handler to the typefound signal using g_signal_connect ().
Furthermore, you don't need to remove typefind element, just connect its source pad to the demuxer sink pad and data will just pass through and you'll not loose anything.
For your information, you were speaking about decodebin being a bit heavyweight  but if you just want to use it to select a demuxer or a parser or whatever, you can use the property caps where you'll specify what kind of caps you want on decodebin src pad.

Cheers,


Paul


2012/12/11 gimmeamilk <[hidden email]>
Hi,

I'm making a simple player that can detect and play a few container and
codec types. Decodebin etc is a little heavyweight for my needs for the time
being, so I want to make my own autoplugger using typefind. I have a small
look-up table of caps strings and suitable elements for both the containers
and the codecs, eg

containers[] = {
{ "video/quicktime", {"qtdemux",NULL} },
...

codecs[] = {
{ "video/h264", {"queue","h264parse","mysinkplugin",NULL },

..etc

What's the best method to construct the final pipeline? I've been following
the typefind example, and can detect the container using a
source!typefind!fakesink pipeline and my look-up table, but how do I then
"remove" the typefind/sink from the pipeline and insert the demuxer without
losing any stream data? (I assume if I unlink and remove the typefind
element, any stream data it had pulled during the typefinding will be lost?)






--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Best-way-to-use-typefind-in-a-custom-player-tp4657367.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


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

Re: Best way to use typefind in a custom player

Tim-Philipp Müller-2
In reply to this post by gimmeamilk
On Tue, 2012-12-11 at 08:10 -0800, gimmeamilk wrote:

Hi,

> I'm making a simple player that can detect and play a few container and
> codec types. Decodebin etc is a little heavyweight for my needs for the time
> being, so I want to make my own autoplugger using typefind. I have a small
> look-up table of caps strings and suitable elements for both the containers
> and the codecs, eg (snip)

Out of curiosity, which aspect of uridecodebin/decodebin2 did you found
to be "a little heavyweight" ?

You should at least use multiqueue instead normal "queue" elements if
you do this yourself, unless you have huge ES buffers inside your sink.

 Cheers
  -Tim

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

Re: Best way to use typefind in a custom player

gimmeamilk
I should explain - "heavyweight" in the sense that it's a lot for me to take in while I'm trying to learn the fundamentals of GStreamer's structure. I was hoping to start with some simple typefinding and inserting plugins based on my own decision-making, before diving into decodebin etc.
In principle, is it ok to have multiple typefind elements in the final pipeline? Thanks.

Tim-Philipp Müller-2 wrote
On Tue, 2012-12-11 at 08:10 -0800, gimmeamilk wrote:

Out of curiosity, which aspect of uridecodebin/decodebin2 did you found
to be "a little heavyweight" ?

You should at least use multiqueue instead normal "queue" elements if
you do this yourself, unless you have huge ES buffers inside your sink.

 Cheers
  -Tim

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