this is how we want to do this in the future hopefully ;)

Original commit message from CVS:
this is how we want to do this in the future hopefully ;)
This commit is contained in:
Thomas Vander Stichele 2002-11-10 00:38:57 +00:00
parent 3cee2f17bd
commit 76164a4be8

View file

@ -59,7 +59,7 @@ struct _VorbisFile {
guint64 offset; guint64 offset;
GstCaps *metadata; GstCaps *metadata;
GstCaps *tags; GstCaps *streaminfo;
}; };
struct _VorbisFileClass { struct _VorbisFileClass {
@ -94,7 +94,7 @@ enum
{ {
ARG_0, ARG_0,
ARG_METADATA, ARG_METADATA,
ARG_TAGS ARG_STREAMINFO
}; };
static void static void
@ -175,12 +175,12 @@ gst_vorbisfile_class_init (VorbisFileClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (gobject_class, ARG_TAGS,
g_param_spec_boxed ("tags", "Tags", "(logical) Stream tags",
GST_TYPE_CAPS, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_METADATA, g_object_class_install_property (gobject_class, ARG_METADATA,
g_param_spec_boxed ("metadata", "Metadata", "(logical) Stream metadata", g_param_spec_boxed ("metadata", "Metadata", "(logical) Stream metadata",
GST_TYPE_CAPS, G_PARAM_READABLE)); GST_TYPE_CAPS, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
g_param_spec_boxed ("streaminfo", "stream", "(logical) Stream information",
GST_TYPE_CAPS, G_PARAM_READABLE));
gobject_class->get_property = gst_vorbisfile_get_property; gobject_class->get_property = gst_vorbisfile_get_property;
gobject_class->set_property = gst_vorbisfile_set_property; gobject_class->set_property = gst_vorbisfile_set_property;
@ -215,7 +215,7 @@ gst_vorbisfile_init (VorbisFile * vorbisfile)
vorbisfile->seek_pending = 0; vorbisfile->seek_pending = 0;
vorbisfile->need_discont = FALSE; vorbisfile->need_discont = FALSE;
vorbisfile->metadata = NULL; vorbisfile->metadata = NULL;
vorbisfile->tags = NULL; vorbisfile->streaminfo = NULL;
vorbisfile->current_link = -1; vorbisfile->current_link = -1;
} }
@ -351,11 +351,11 @@ ov_callbacks vorbisfile_ov_callbacks =
gst_vorbisfile_tell, gst_vorbisfile_tell,
}; };
/* retrieve the comment field (or tags) and put in tags GstCaps /* retrieve the comment field (or tags) and put in metadata GstCaps
* returns TRUE if caps could be set, * returns TRUE if caps could be set,
* FALSE if they couldn't be read somehow */ * FALSE if they couldn't be read somehow */
static gboolean static gboolean
gst_vorbisfile_update_tags (VorbisFile *vorbisfile, gint link) gst_vorbisfile_update_metadata (VorbisFile *vorbisfile, gint link)
{ {
OggVorbis_File *vf = &vorbisfile->vf; OggVorbis_File *vf = &vorbisfile->vf;
gchar **ptr; gchar **ptr;
@ -365,15 +365,14 @@ gst_vorbisfile_update_tags (VorbisFile *vorbisfile, gint link)
gchar *name, *value; gchar *name, *value;
/* clear old one */ /* clear old one */
if (vorbisfile->tags) { if (vorbisfile->metadata) {
gst_caps_unref (vorbisfile->tags); gst_caps_unref (vorbisfile->metadata);
vorbisfile->tags = NULL; vorbisfile->metadata = NULL;
} }
/* create props to hold the key/value pairs */ /* create props to hold the key/value pairs */
props = gst_props_empty_new (); props = gst_props_empty_new ();
/* first, grab the comments */
vc = ov_comment (vf, link); vc = ov_comment (vf, link);
ptr = vc->user_comments; ptr = vc->user_comments;
while (*ptr) { while (*ptr) {
@ -385,20 +384,20 @@ gst_vorbisfile_update_tags (VorbisFile *vorbisfile, gint link)
} }
ptr++; ptr++;
} }
vorbisfile->tags = gst_caps_new ("vorbisfile_tags", vorbisfile->metadata = gst_caps_new ("vorbisfile_metadata",
"application/x-gst-tags", "application/x-gst-metadata",
props); props);
g_object_notify (G_OBJECT (vorbisfile), "tags"); g_object_notify (G_OBJECT (vorbisfile), "metadata");
return TRUE; return TRUE;
} }
/* retrieve logical stream properties and put them in metadata GstCaps /* retrieve logical stream properties and put them in streaminfo GstCaps
* returns TRUE if caps could be set, * returns TRUE if caps could be set,
* FALSE if they couldn't be read somehow */ * FALSE if they couldn't be read somehow */
static gboolean static gboolean
gst_vorbisfile_update_metadata (VorbisFile *vorbisfile, gint link) gst_vorbisfile_update_streaminfo (VorbisFile *vorbisfile, gint link)
{ {
OggVorbis_File *vf = &vorbisfile->vf; OggVorbis_File *vf = &vorbisfile->vf;
vorbis_info *vi; vorbis_info *vi;
@ -406,9 +405,9 @@ gst_vorbisfile_update_metadata (VorbisFile *vorbisfile, gint link)
GstPropsEntry *entry; GstPropsEntry *entry;
/* clear old one */ /* clear old one */
if (vorbisfile->metadata) { if (vorbisfile->streaminfo) {
gst_caps_unref (vorbisfile->metadata); gst_caps_unref (vorbisfile->streaminfo);
vorbisfile->metadata = NULL; vorbisfile->streaminfo = NULL;
} }
/* create props to hold the key/value pairs */ /* create props to hold the key/value pairs */
@ -426,7 +425,6 @@ gst_vorbisfile_update_metadata (VorbisFile *vorbisfile, gint link)
entry = gst_props_entry_new ("bitrate_lower", GST_PROPS_INT_TYPE, entry = gst_props_entry_new ("bitrate_lower", GST_PROPS_INT_TYPE,
vi->bitrate_lower); vi->bitrate_lower);
gst_props_add_entry (props, (GstPropsEntry *) entry); gst_props_add_entry (props, (GstPropsEntry *) entry);
entry = gst_props_entry_new ("serial", GST_PROPS_INT_TYPE, entry = gst_props_entry_new ("serial", GST_PROPS_INT_TYPE,
ov_serialnumber (vf, link)); ov_serialnumber (vf, link));
gst_props_add_entry (props, (GstPropsEntry *) entry); gst_props_add_entry (props, (GstPropsEntry *) entry);
@ -434,11 +432,11 @@ gst_vorbisfile_update_metadata (VorbisFile *vorbisfile, gint link)
ov_bitrate (vf, link)); ov_bitrate (vf, link));
gst_props_add_entry (props, (GstPropsEntry *) entry); gst_props_add_entry (props, (GstPropsEntry *) entry);
vorbisfile->metadata = gst_caps_new ("vorbisfile_metadata", vorbisfile->streaminfo = gst_caps_new ("vorbisfile_streaminfo",
"application/x-gst-metadata", "application/x-gst-streaminfo",
props); props);
g_object_notify (G_OBJECT (vorbisfile), "metadata"); g_object_notify (G_OBJECT (vorbisfile), "streaminfo");
return TRUE; return TRUE;
} }
@ -452,7 +450,7 @@ gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link)
vorbisfile->current_link = link; vorbisfile->current_link = link;
gst_vorbisfile_update_metadata (vorbisfile, link); gst_vorbisfile_update_metadata (vorbisfile, link);
gst_vorbisfile_update_tags (vorbisfile, link); gst_vorbisfile_update_streaminfo (vorbisfile, link);
if (gst_pad_try_set_caps (vorbisfile->srcpad, if (gst_pad_try_set_caps (vorbisfile->srcpad,
GST_CAPS_NEW ("vorbisdec_src", GST_CAPS_NEW ("vorbisdec_src",
@ -1052,8 +1050,8 @@ gst_vorbisfile_get_property (GObject *object, guint prop_id,
case ARG_METADATA: case ARG_METADATA:
g_value_set_boxed (value, vorbisfile->metadata); g_value_set_boxed (value, vorbisfile->metadata);
break; break;
case ARG_TAGS: case ARG_STREAMINFO:
g_value_set_boxed (value, vorbisfile->tags); g_value_set_boxed (value, vorbisfile->streaminfo);
break; break;
default: default:
g_warning ("Unknown property id\n"); g_warning ("Unknown property id\n");