Top | ![]() |
![]() |
![]() |
![]() |
The GstDiscoverer is a utility object which allows to get as much information as possible from one or many URIs.
It provides two APIs, allowing usage in blocking or non-blocking mode.
The blocking mode just requires calling gst_discoverer_discover_uri()
with the URI one wishes to discover.
The non-blocking mode requires a running GMainLoop in the default
GMainContext, where one connects to the various signals, appends the
URIs to be processed (through gst_discoverer_discover_uri_async()
) and then
asks for the discovery to begin (through gst_discoverer_start()
).
All the information is returned in a GstDiscovererInfo structure.
GstDiscoverer * gst_discoverer_new (GstClockTime timeout
,GError **err
);
Creates a new GstDiscoverer with the provided timeout.
timeout |
timeout per file, in nanoseconds. Allowed are values between one second (GST_SECOND) and one hour (3600 * GST_SECOND) |
|
err |
The new GstDiscoverer.
If an error occurred when creating the discoverer, err
will be set
accordingly and NULL
will be returned. If err
is set, the caller must
free it when no longer needed using g_error_free()
.
[transfer full]
Since 0.10.31
void
gst_discoverer_start (GstDiscoverer *discoverer
);
Allow asynchronous discovering of URIs to take place. A GMainLoop must be available for GstDiscoverer to properly work in asynchronous mode.
Since 0.10.31
void
gst_discoverer_stop (GstDiscoverer *discoverer
);
Stop the discovery of any pending URIs and clears the list of pending URIS (if any).
Since 0.10.31
GstDiscovererInfo * gst_discoverer_discover_uri (GstDiscoverer *discoverer
,const gchar *uri
,GError **err
);
Synchronously discovers the given uri
.
A copy of uri
will be made internally, so the caller can safely g_free()
afterwards.
discoverer |
||
uri |
The URI to run on. |
|
err |
If an error occurred, this field will be filled in. |
[out][allow-none] |
Since 0.10.31
gboolean gst_discoverer_discover_uri_async (GstDiscoverer *discoverer
,const gchar *uri
);
Appends the given uri
to the list of URIs to discoverer. The actual
discovery of the uri
will only take place if gst_discoverer_start()
has
been called.
A copy of uri
will be made internally, so the caller can safely g_free()
afterwards.
Since 0.10.31
GstClockTime
gst_discoverer_info_get_duration (const GstDiscovererInfo *info
);
Since 0.10.31
const GstStructure *
gst_discoverer_info_get_misc (const GstDiscovererInfo *info
);
Miscellaneous information stored as a GstStructure
(for example: information about missing plugins). If you wish to use the
GstStructure after the life-time of info
, you will need to copy it.
[transfer none]
Since 0.10.31
GstDiscovererResult
gst_discoverer_info_get_result (const GstDiscovererInfo *info
);
Since 0.10.31
GstDiscovererStreamInfo *
gst_discoverer_info_get_stream_info (GstDiscovererInfo *info
);
the structure (or topology) of the URI as a
GstDiscovererStreamInfo.
This structure can be traversed to see the original hierarchy. Unref with
gst_discoverer_stream_info_unref()
after usage.
[transfer full]
Since 0.10.31
GList *
gst_discoverer_info_get_stream_list (GstDiscovererInfo *info
);
the list of
all streams contained in the info. Free after usage
with gst_discoverer_stream_info_list_free()
.
[transfer full][element-type Gst.DiscovererStreamInfo]
Since 0.10.31
const GstTagList *
gst_discoverer_info_get_tags (const GstDiscovererInfo *info
);
all tags contained in the URI. If you wish to use
the tags after the life-time of info
, you will need to copy them.
[transfer none]
Since 0.10.31
const gchar *
gst_discoverer_info_get_uri (const GstDiscovererInfo *info
);
the URI to which this information corresponds to.
Copy it if you wish to use it after the life-time of info
.
[transfer none]
Since 0.10.31
gboolean
gst_discoverer_info_get_seekable (const GstDiscovererInfo *info
);
Since 0.10.32
#define gst_discoverer_info_ref(info) (gst_mini_object_ref((GstMiniObject*)info))
Increments the reference count of info
.
Since 0.10.31
#define gst_discoverer_info_unref(info) (gst_mini_object_unref((GstMiniObject*)info))
Decrements the reference count of info
.
Since 0.10.31
GstCaps *
gst_discoverer_stream_info_get_caps (GstDiscovererStreamInfo *info
);
Since 0.10.31
const GstStructure *
gst_discoverer_stream_info_get_misc (GstDiscovererStreamInfo *info
);
additional information regarding the stream (for
example codec version, profile, etc..). If you wish to use the GstStructure
after the life-time of info
you will need to copy it.
[transfer none]
Since 0.10.31
GstDiscovererStreamInfo *
gst_discoverer_stream_info_get_next (GstDiscovererStreamInfo *info
);
the next GstDiscovererStreamInfo in a chain. NULL
for final streams.
Unref with gst_discoverer_stream_info_unref after usage.
[transfer full]
Since 0.10.31
GstDiscovererStreamInfo *
gst_discoverer_stream_info_get_previous
(GstDiscovererStreamInfo *info
);
the previous GstDiscovererStreamInfo in a chain.
NULL
for starting points. Unref with gst_discoverer_stream_info_unref
after usage.
[transfer full]
Since 0.10.31
const GstTagList *
gst_discoverer_stream_info_get_tags (GstDiscovererStreamInfo *info
);
the tags contained in this stream. If you wish to
use the tags after the life-time of info
you will need to copy them.
[transfer none]
Since 0.10.31
#define gst_discoverer_stream_info_ref(info) ((GstDiscovererStreamInfo*) gst_mini_object_ref((GstMiniObject*) info))
Increments the reference count of info
.
Since 0.10.31
#define gst_discoverer_stream_info_unref(info) (gst_mini_object_unref((GstMiniObject*) info))
Decrements the reference count of info
.
Since 0.10.31
void
gst_discoverer_stream_info_list_free (GList *infos
);
Decrements the reference count of all contained GstDiscovererStreamInfo and fress the GList.
const gchar *
gst_discoverer_stream_info_get_stream_type_nick
(GstDiscovererStreamInfo *info
);
a human readable name for the stream type of the given info
(ex : "audio",
"container",...).
Since 0.10.31
GList *
gst_discoverer_info_get_audio_streams (GstDiscovererInfo *info
);
Finds all the GstDiscovererAudioInfo contained in info
A GList of
matching GstDiscovererStreamInfo. The caller should free it with
gst_discoverer_stream_info_list_free()
.
[transfer full][element-type Gst.DiscovererStreamInfo]
Since 0.10.31
GList *
gst_discoverer_info_get_container_streams
(GstDiscovererInfo *info
);
Finds all the GstDiscovererContainerInfo contained in info
A GList of
matching GstDiscovererStreamInfo. The caller should free it with
gst_discoverer_stream_info_list_free()
.
[transfer full][element-type Gst.DiscovererStreamInfo]
Since 0.10.31
GList * gst_discoverer_info_get_streams (GstDiscovererInfo *info
,GType streamtype
);
Finds the GstDiscovererStreamInfo contained in info
that match the
given streamtype
.
A GList of
matching GstDiscovererStreamInfo. The caller should free it with
gst_discoverer_stream_info_list_free()
.
[transfer full][element-type Gst.DiscovererStreamInfo]
Since 0.10.31
GList *
gst_discoverer_info_get_subtitle_streams
(GstDiscovererInfo *info
);
Finds all the GstDiscovererSubtitleInfo contained in info
A GList of
matching GstDiscovererStreamInfo. The caller should free it with
gst_discoverer_stream_info_list_free()
.
[transfer full][element-type Gst.DiscovererStreamInfo]
Since 0.10.36
GList *
gst_discoverer_info_get_video_streams (GstDiscovererInfo *info
);
Finds all the GstDiscovererVideoInfo contained in info
A GList of
matching GstDiscovererStreamInfo. The caller should free it with
gst_discoverer_stream_info_list_free()
.
[transfer full][element-type Gst.DiscovererStreamInfo]
Since 0.10.31
guint
gst_discoverer_audio_info_get_bitrate (const GstDiscovererAudioInfo *info
);
Since 0.10.31
guint
gst_discoverer_audio_info_get_channels
(const GstDiscovererAudioInfo *info
);
Since 0.10.31
guint
gst_discoverer_audio_info_get_depth (const GstDiscovererAudioInfo *info
);
Since 0.10.31
const gchar *
gst_discoverer_audio_info_get_language
(const GstDiscovererAudioInfo *info
);
Since 0.10.36
guint
gst_discoverer_audio_info_get_max_bitrate
(const GstDiscovererAudioInfo *info
);
Since 0.10.31
guint
gst_discoverer_audio_info_get_sample_rate
(const GstDiscovererAudioInfo *info
);
Since 0.10.31
GList *
gst_discoverer_container_info_get_streams
(GstDiscovererContainerInfo *info
);
the list of
GstDiscovererStreamInfo this container stream offers.
Free with gst_discoverer_stream_info_list_free()
after usage.
[transfer full][element-type Gst.DiscovererStreamInfo]
Since 0.10.31
const gchar *
gst_discoverer_subtitle_info_get_language
(const GstDiscovererSubtitleInfo *info
);
Since 0.10.36
guint
gst_discoverer_video_info_get_bitrate (const GstDiscovererVideoInfo *info
);
Since 0.10.31
guint
gst_discoverer_video_info_get_depth (const GstDiscovererVideoInfo *info
);
Since 0.10.31
guint
gst_discoverer_video_info_get_framerate_denom
(const GstDiscovererVideoInfo *info
);
Since 0.10.31
guint
gst_discoverer_video_info_get_framerate_num
(const GstDiscovererVideoInfo *info
);
Since 0.10.31
guint
gst_discoverer_video_info_get_height (const GstDiscovererVideoInfo *info
);
Since 0.10.31
gboolean
gst_discoverer_video_info_is_interlaced
(const GstDiscovererVideoInfo *info
);
Since 0.10.31
gboolean
gst_discoverer_video_info_is_image (const GstDiscovererVideoInfo *info
);
Since 0.10.31
guint
gst_discoverer_video_info_get_max_bitrate
(const GstDiscovererVideoInfo *info
);
Since 0.10.31
guint
gst_discoverer_video_info_get_par_denom
(const GstDiscovererVideoInfo *info
);
Since 0.10.31
guint
gst_discoverer_video_info_get_par_num (const GstDiscovererVideoInfo *info
);
Since 0.10.31
guint
gst_discoverer_video_info_get_width (const GstDiscovererVideoInfo *info
);
Since 0.10.31
typedef struct _GstDiscovererInfo GstDiscovererInfo;
Structure containing the information of a URI analyzed by GstDiscoverer.
Since 0.10.31
Result values for the discovery process.
The discovery was successful |
||
the URI is invalid |
||
an error happened and the GError is set |
||
the discovery timed-out |
||
the discoverer was already discovering a file |
||
Some plugins are missing for full discovery |
Since 0.10.31
typedef struct _GstDiscovererStreamInfo GstDiscovererStreamInfo;
Base structure for information concerning a media stream. Depending on the stream type, one can find more media-specific information in GstDiscovererAudioInfo, GstDiscovererVideoInfo, and GstDiscovererContainerInfo.
The GstDiscovererStreamInfo represents the topology of the stream. Siblings
can be iterated over with gst_discoverer_stream_info_get_next()
and
gst_discoverer_stream_info_get_previous()
. Children (sub-streams) of a
stream can be accessed using the GstDiscovererContainerInfo API.
As a simple example, if you run GstDiscoverer on an AVI file with one audio and one video stream, you will get a GstDiscovererContainerInfo corresponding to the AVI container, which in turn will have a GstDiscovererAudioInfo sub-stream and a GstDiscovererVideoInfo sub-stream for the audio and video streams respectively.
Since 0.10.31
typedef struct _GstDiscovererContainerInfo GstDiscovererContainerInfo;
GstDiscovererStreamInfo specific to container streams.
Since 0.10.31
typedef struct _GstDiscovererAudioInfo GstDiscovererAudioInfo;
GstDiscovererStreamInfo specific to audio streams.
Since 0.10.31
typedef struct _GstDiscovererVideoInfo GstDiscovererVideoInfo;
GstDiscovererStreamInfo specific to video streams (this includes images).
Since 0.10.31
typedef struct _GstDiscovererSubtitleInfo GstDiscovererSubtitleInfo;
GstDiscovererStreamInfo specific to subtitle streams (this includes text and image based ones).
Since 0.10.36
“timeout”
property “timeout” guint64
The duration (in nanoseconds) after which the discovery of an individual URI will timeout.
If the discovery of a URI times out, the GST_DISCOVERER_TIMEOUT
will be
set on the result flags.
Flags: Read / Write / Construct
Allowed values: [1000000000,3600000000000]
Default value: 15000000000
“discovered”
signalvoid user_function (GstDiscoverer *discoverer, GstDiscovererInfo *info, GError *error, gpointer user_data)
Will be emitted when all information on a URI could be discovered.
discoverer |
the GstDiscoverer |
|
info |
the results GstDiscovererInfo |
|
error |
GError, which will be non-NULL if an error occurred during discovery. |
[type GLib.Error] |
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“finished”
signalvoid user_function (GstDiscoverer *discoverer, gpointer user_data)
Will be emitted when all pending URIs have been processed.
discoverer |
the GstDiscoverer |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“starting”
signalvoid user_function (GstDiscoverer *discoverer, gpointer user_data)
Will be emitted when the discover starts analyzing the pending URIs
discoverer |
the GstDiscoverer |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last