gst/playback/: Make caps explicitely available. Makes testing for unsupported types possible. Improves error reporting.
Original commit message from CVS: * gst/playback/gstplaybasebin.c: (unknown_type), (add_element_stream), (new_decoded_pad), (gst_play_base_bin_change_state): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init), (gst_stream_info_init), (gst_stream_info_new), (gst_stream_info_dispose), (gst_stream_info_get_property): * gst/playback/gststreaminfo.h: Make caps explicitely available. Makes testing for unsupported types possible. Improves error reporting.
This commit is contained in:
parent
b463251864
commit
2070a88585
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2004-10-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
|
* gst/playback/gstplaybasebin.c: (unknown_type),
|
||||||
|
(add_element_stream), (new_decoded_pad),
|
||||||
|
(gst_play_base_bin_change_state):
|
||||||
|
* gst/playback/gststreaminfo.c: (gst_stream_info_class_init),
|
||||||
|
(gst_stream_info_init), (gst_stream_info_new),
|
||||||
|
(gst_stream_info_dispose), (gst_stream_info_get_property):
|
||||||
|
* gst/playback/gststreaminfo.h:
|
||||||
|
Make caps explicitely available. Makes testing for unsupported
|
||||||
|
types possible. Improves error reporting.
|
||||||
|
|
||||||
2004-10-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
2004-10-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* gst/audioconvert/gstaudioconvert.c:
|
* gst/audioconvert/gstaudioconvert.c:
|
||||||
|
@ -280,7 +280,8 @@ unknown_type (GstElement * element, GstPad * pad, GstCaps * caps,
|
|||||||
g_warning ("don't know how to handle %s", capsstr);
|
g_warning ("don't know how to handle %s", capsstr);
|
||||||
|
|
||||||
/* add the stream to the list */
|
/* add the stream to the list */
|
||||||
info = gst_stream_info_new (GST_OBJECT (pad), GST_STREAM_TYPE_UNKNOWN, NULL);
|
info = gst_stream_info_new (GST_OBJECT (pad), GST_STREAM_TYPE_UNKNOWN,
|
||||||
|
NULL, caps);
|
||||||
play_base_bin->streaminfo = g_list_append (play_base_bin->streaminfo, info);
|
play_base_bin->streaminfo = g_list_append (play_base_bin->streaminfo, info);
|
||||||
|
|
||||||
g_free (capsstr);
|
g_free (capsstr);
|
||||||
@ -298,7 +299,8 @@ add_element_stream (GstElement * element, GstPlayBaseBin * play_base_bin)
|
|||||||
|
|
||||||
/* add the stream to the list */
|
/* add the stream to the list */
|
||||||
info =
|
info =
|
||||||
gst_stream_info_new (GST_OBJECT (element), GST_STREAM_TYPE_ELEMENT, NULL);
|
gst_stream_info_new (GST_OBJECT (element), GST_STREAM_TYPE_ELEMENT,
|
||||||
|
NULL, NULL);
|
||||||
play_base_bin->streaminfo = g_list_append (play_base_bin->streaminfo, info);
|
play_base_bin->streaminfo = g_list_append (play_base_bin->streaminfo, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +392,7 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* add the stream to the list */
|
/* add the stream to the list */
|
||||||
info = gst_stream_info_new (GST_OBJECT (srcpad), type, NULL);
|
info = gst_stream_info_new (GST_OBJECT (srcpad), type, NULL, caps);
|
||||||
play_base_bin->streaminfo = g_list_append (play_base_bin->streaminfo, info);
|
play_base_bin->streaminfo = g_list_append (play_base_bin->streaminfo, info);
|
||||||
|
|
||||||
/* signal the no more pads after adding the stream */
|
/* signal the no more pads after adding the stream */
|
||||||
@ -756,20 +758,17 @@ gst_play_base_bin_change_state (GstElement * element)
|
|||||||
/* We're no audio/video and the only stream... We could
|
/* We're no audio/video and the only stream... We could
|
||||||
* be something not-media that's detected because then our
|
* be something not-media that's detected because then our
|
||||||
* typefind doesn't mess up with mp3 (bz2, gz, elf, ...) */
|
* typefind doesn't mess up with mp3 (bz2, gz, elf, ...) */
|
||||||
if (GST_IS_PAD (info->object)) {
|
if (info->caps) {
|
||||||
const GstCaps *caps = GST_PAD_CAPS (GST_PAD (info->object));
|
const gchar *mime =
|
||||||
|
gst_structure_get_name (gst_caps_get_structure (info->caps,
|
||||||
|
0));
|
||||||
|
|
||||||
if (caps) {
|
if (!strcmp (mime, "application/x-executable") ||
|
||||||
const gchar *mime =
|
!strcmp (mime, "application/x-bzip") ||
|
||||||
gst_structure_get_name (gst_caps_get_structure (caps, 0));
|
!strcmp (mime, "application/x-gzip") ||
|
||||||
|
!strcmp (mime, "application/zip") ||
|
||||||
if (!strcmp (mime, "application/x-executable") ||
|
!strcmp (mime, "application/x-compress")) {
|
||||||
!strcmp (mime, "application/x-bzip") ||
|
no_media = TRUE;
|
||||||
!strcmp (mime, "application/x-gzip") ||
|
|
||||||
!strcmp (mime, "application/zip") ||
|
|
||||||
!strcmp (mime, "application/x-compress")) {
|
|
||||||
no_media = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ enum
|
|||||||
ARG_TYPE,
|
ARG_TYPE,
|
||||||
ARG_DECODER,
|
ARG_DECODER,
|
||||||
ARG_MUTE,
|
ARG_MUTE,
|
||||||
|
ARG_CAPS
|
||||||
};
|
};
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
@ -55,7 +56,7 @@ gst_stream_type_get_type (void)
|
|||||||
{GST_STREAM_TYPE_VIDEO, "GST_STREAM_TYPE_VIDEO", "Video stream"},
|
{GST_STREAM_TYPE_VIDEO, "GST_STREAM_TYPE_VIDEO", "Video stream"},
|
||||||
{GST_STREAM_TYPE_TEXT, "GST_STREAM_TYPE_TEXT", "Text stream"},
|
{GST_STREAM_TYPE_TEXT, "GST_STREAM_TYPE_TEXT", "Text stream"},
|
||||||
{GST_STREAM_TYPE_ELEMENT, "GST_STREAM_TYPE_ELEMENT",
|
{GST_STREAM_TYPE_ELEMENT, "GST_STREAM_TYPE_ELEMENT",
|
||||||
"Stream handled by element"},
|
"Stream handled by element"},
|
||||||
{0, NULL, NULL},
|
{0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -128,6 +129,10 @@ gst_stream_info_class_init (GstStreamInfoClass * klass)
|
|||||||
g_object_class_install_property (gobject_klass, ARG_MUTE,
|
g_object_class_install_property (gobject_klass, ARG_MUTE,
|
||||||
g_param_spec_boolean ("mute", "Mute", "Mute or unmute this stream", FALSE,
|
g_param_spec_boolean ("mute", "Mute", "Mute or unmute this stream", FALSE,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (gobject_klass, ARG_CAPS,
|
||||||
|
g_param_spec_boxed ("caps", "Capabilities",
|
||||||
|
"Capabilities (or type) of this stream", GST_TYPE_CAPS,
|
||||||
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
gst_stream_info_signals[SIGNAL_MUTED] =
|
gst_stream_info_signals[SIGNAL_MUTED] =
|
||||||
g_signal_new ("muted", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
g_signal_new ("muted", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||||
@ -145,10 +150,12 @@ gst_stream_info_init (GstStreamInfo * stream_info)
|
|||||||
stream_info->type = GST_STREAM_TYPE_UNKNOWN;
|
stream_info->type = GST_STREAM_TYPE_UNKNOWN;
|
||||||
stream_info->decoder = NULL;
|
stream_info->decoder = NULL;
|
||||||
stream_info->mute = FALSE;
|
stream_info->mute = FALSE;
|
||||||
|
stream_info->caps = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstStreamInfo *
|
GstStreamInfo *
|
||||||
gst_stream_info_new (GstObject * object, GstStreamType type, gchar * decoder)
|
gst_stream_info_new (GstObject * object,
|
||||||
|
GstStreamType type, const gchar * decoder, const GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstStreamInfo *info;
|
GstStreamInfo *info;
|
||||||
|
|
||||||
@ -158,6 +165,9 @@ gst_stream_info_new (GstObject * object, GstStreamType type, gchar * decoder)
|
|||||||
info->object = object;
|
info->object = object;
|
||||||
info->type = type;
|
info->type = type;
|
||||||
info->decoder = g_strdup (decoder);
|
info->decoder = g_strdup (decoder);
|
||||||
|
if (caps) {
|
||||||
|
info->caps = gst_caps_copy (caps);
|
||||||
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@ -173,6 +183,11 @@ gst_stream_info_dispose (GObject * object)
|
|||||||
stream_info->object = NULL;
|
stream_info->object = NULL;
|
||||||
stream_info->type = GST_STREAM_TYPE_UNKNOWN;
|
stream_info->type = GST_STREAM_TYPE_UNKNOWN;
|
||||||
g_free (stream_info->decoder);
|
g_free (stream_info->decoder);
|
||||||
|
stream_info->decoder = NULL;
|
||||||
|
if (stream_info->caps) {
|
||||||
|
gst_caps_free (stream_info->caps);
|
||||||
|
stream_info->caps = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (parent_class)->dispose) {
|
if (G_OBJECT_CLASS (parent_class)->dispose) {
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
@ -268,6 +283,9 @@ gst_stream_info_get_property (GObject * object, guint prop_id, GValue * value,
|
|||||||
case ARG_MUTE:
|
case ARG_MUTE:
|
||||||
g_value_set_boolean (value, stream_info->mute);
|
g_value_set_boolean (value, stream_info->mute);
|
||||||
break;
|
break;
|
||||||
|
case ARG_CAPS:
|
||||||
|
g_value_set_boxed (value, stream_info->caps);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -49,6 +49,7 @@ struct _GstStreamInfo {
|
|||||||
GstStreamType type;
|
GstStreamType type;
|
||||||
gchar *decoder;
|
gchar *decoder;
|
||||||
gboolean mute;
|
gboolean mute;
|
||||||
|
GstCaps *caps;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstStreamInfoClass {
|
struct _GstStreamInfoClass {
|
||||||
@ -60,7 +61,10 @@ struct _GstStreamInfoClass {
|
|||||||
|
|
||||||
GType gst_stream_info_get_type (void);
|
GType gst_stream_info_get_type (void);
|
||||||
|
|
||||||
GstStreamInfo* gst_stream_info_new (GstObject *object, GstStreamType type, gchar *decoder);
|
GstStreamInfo* gst_stream_info_new (GstObject *object,
|
||||||
|
GstStreamType type,
|
||||||
|
const gchar *decoder,
|
||||||
|
const GstCaps *caps);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user