Finding out if a file is an (image|audio|video)?

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

Finding out if a file is an (image|audio|video)?

Stefan Westerfeld
   Hi!

I'm working on gst123, a media player based on gstreamer. One function is to
shuffle play all files in a directory. Usually it could be used on a directory
containing music files. I use playbin2 for the actual playback. Now the problem

  http://code.google.com/p/gst123/issues/detail?id=1

is that if that directory also contains images (for instance album covers),
these will be briefly shown, before the next music file starts. This is probably
not what the user wants.

I could blacklist some extensions (*.jpg, *.png, ...) to avoid this. But it
would be a lot more elegant if I could use some GStreamer API functions to find
out whether something is an image, an audio file or a video file, and simply
skip those files that are images. Can GStreamer tell me what type a file has?

   Cu... Stefan
--
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Finding out if a file is an (image|audio|video)?

Tim-Philipp Müller-2
On Sat, 2012-04-07 at 17:12 +0200, Stefan Westerfeld wrote:

Hi Stefan,

> I'm working on gst123, a media player based on gstreamer. One function is to
> shuffle play all files in a directory. Usually it could be used on a directory
> containing music files. I use playbin2 for the actual playback. Now the problem
>
>   http://code.google.com/p/gst123/issues/detail?id=1
>
> is that if that directory also contains images (for instance album covers),
> these will be briefly shown, before the next music file starts. This is probably
> not what the user wants.
>
> I could blacklist some extensions (*.jpg, *.png, ...) to avoid this. But it
> would be a lot more elegant if I could use some GStreamer API functions to find
> out whether something is an image, an audio file or a video file, and simply
> skip those files that are images. Can GStreamer tell me what type a file has?

You could use gst-discoverer (or a simple filesrc ! typefind).

Cheers
 -Tim

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