[gst-devel] How to tell if gstreamer can play a file

Michael Smith msmith at xiph.org
Tue Jul 15 23:20:36 CEST 2008


On Tue, Jul 15, 2008 at 2:04 PM, Danilo Freire <xharada at gmail.com> wrote:
> Hi,
>
> I dont know exaclty if exists a "isPlayable" method, but I know that is
> possible to browse all the available plugins using the GSTRegistry, them,
> check all available mimetypes. You can save this mimetypes and compare with
> your uri.
>
> Look at the GMediaRenderer project, it checks the mimetypes in the
> initialization of the application.
>
> After you have a list of the supported mimetypes, you can use a typefind in
> you URI and compare with your list.

Of course, that doesn't actually tell you anything about whether
gstreamer can play the file - it's very common for a user to have a
demuxer appropriate for some format, but no decoder available.

The recommended way is to set up a simple test pipeline - with a
source, decodebin, and fakesinks - and set the pipeline to PAUSED. If
it gets to PAUSED, the file is playable.

You should have a timeout, so that if it doesn't preroll OR error out,
you'll be able to stop the pipeline and decide that it's not playable.

Mike




More information about the gstreamer-devel mailing list