mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-30 15:52:32 +00:00
gst/gstformat.c: Don't segfault on invalid formats.
Original commit message from CVS: * gst/gstformat.c: (gst_format_get_name), (gst_format_to_quark): Don't segfault on invalid formats.
This commit is contained in:
parent
9394a81b82
commit
34e8d485cc
2 changed files with 21 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2006-03-14 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/gstformat.c: (gst_format_get_name), (gst_format_to_quark):
|
||||||
|
Don't segfault on invalid formats.
|
||||||
|
|
||||||
2006-03-14 Tim-Philipp Müller <tim at centricular dot net>
|
2006-03-14 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times):
|
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times):
|
||||||
|
|
|
@ -81,16 +81,21 @@ _gst_format_initialize (void)
|
||||||
*
|
*
|
||||||
* Get a printable name for the given format. Do not modify or free.
|
* Get a printable name for the given format. Do not modify or free.
|
||||||
*
|
*
|
||||||
* Returns: a reference to the static name of the format.
|
* Returns: a reference to the static name of the format or NULL if
|
||||||
|
* the format is unknown.
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const gchar *
|
||||||
gst_format_get_name (GstFormat format)
|
gst_format_get_name (GstFormat format)
|
||||||
{
|
{
|
||||||
const GstFormatDefinition *def;
|
const GstFormatDefinition *def;
|
||||||
|
const gchar *result;
|
||||||
|
|
||||||
def = gst_format_get_details (format);
|
if ((def = gst_format_get_details (format)) != NULL)
|
||||||
|
result = def->nick;
|
||||||
|
else
|
||||||
|
result = NULL;
|
||||||
|
|
||||||
return def->nick;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,16 +104,21 @@ gst_format_get_name (GstFormat format)
|
||||||
*
|
*
|
||||||
* Get the unique quark for the given format.
|
* Get the unique quark for the given format.
|
||||||
*
|
*
|
||||||
* Returns: the quark associated with the format
|
* Returns: the quark associated with the format or 0 if the format
|
||||||
|
* is unknown.
|
||||||
*/
|
*/
|
||||||
GQuark
|
GQuark
|
||||||
gst_format_to_quark (GstFormat format)
|
gst_format_to_quark (GstFormat format)
|
||||||
{
|
{
|
||||||
const GstFormatDefinition *def;
|
const GstFormatDefinition *def;
|
||||||
|
GQuark result;
|
||||||
|
|
||||||
def = gst_format_get_details (format);
|
if ((def = gst_format_get_details (format)) != NULL)
|
||||||
|
result = def->quark;
|
||||||
|
else
|
||||||
|
result = 0;
|
||||||
|
|
||||||
return def->quark;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue