GstDiscovererStreamInfo * parent)
{
GstCaps *caps;
- GstStructure *caps_st, *tags_st;
+ GstStructure *caps_st;
+ GstTagList *tags_st;
const gchar *name;
- int tmp, tmp2;
+ int tmp;
guint utmp;
if (!st || !gst_structure_id_has_field (st, _CAPS_QUARK)) {
GST_WARNING ("Couldn't find caps !");
if (parent)
- return parent;
+ return gst_discoverer_stream_info_ref (parent);
else
return (GstDiscovererStreamInfo *)
- gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
+ g_object_new (GST_TYPE_DISCOVERER_STREAM_INFO, NULL);
}
gst_structure_id_get (st, _CAPS_QUARK, GST_TYPE_CAPS, &caps, NULL);
GstDiscovererAudioInfo *info;
if (parent)
- info = (GstDiscovererAudioInfo *) parent;
+ info = (GstDiscovererAudioInfo *) gst_discoverer_stream_info_ref (parent);
else {
info = (GstDiscovererAudioInfo *)
- gst_mini_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO);
+ g_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO, NULL);
- info->parent.caps = caps;
+ info->parent.caps = gst_caps_ref (caps);
}
if (gst_structure_get_int (caps_st, "rate", &tmp))
} else if (g_str_has_prefix (name, "video/") ||
g_str_has_prefix (name, "image/")) {
GstDiscovererVideoInfo *info;
+ GstVideoInfo vinfo;
if (parent)
- info = (GstDiscovererVideoInfo *) parent;
+ info = (GstDiscovererVideoInfo *) gst_discoverer_stream_info_ref (parent);
else {
info = (GstDiscovererVideoInfo *)
- gst_mini_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO);
+ g_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO, NULL);
- info->parent.caps = caps;
+ info->parent.caps = gst_caps_ref (caps);
}
- if (gst_structure_get_int (caps_st, "width", &tmp) &&
- gst_structure_get_int (caps_st, "height", &tmp2)) {
- info->width = (guint) tmp;
- info->height = (guint) tmp2;
- }
+ /* FIXME : gst_video_info_from_caps only works with raw caps,
+ * wouldn't we want to get all the info below for non-raw caps ?
+ */
+ if (g_str_has_prefix (name, "video/x-raw") &&
+ gst_video_info_from_caps (&vinfo, caps)) {
+ info->width = (guint) vinfo.width;
+ info->height = (guint) vinfo.height;
- if (gst_structure_get_int (caps_st, "depth", &tmp))
- info->depth = (guint) tmp;
+ info->depth = (guint) 0;
- if (gst_structure_get_fraction (caps_st, "pixel-aspect-ratio", &tmp, &tmp2)) {
- info->par_num = tmp;
- info->par_denom = tmp2;
- } else {
- info->par_num = 1;
- info->par_denom = 1;
- }
+ info->par_num = vinfo.par_n;
+ info->par_denom = vinfo.par_d;
- if (gst_structure_get_fraction (caps_st, "framerate", &tmp, &tmp2)) {
- info->framerate_num = tmp;
- info->framerate_denom = tmp2;
- }
+ info->framerate_num = vinfo.fps_n;
+ info->framerate_denom = vinfo.fps_d;
- if (!gst_structure_get_boolean (caps_st, "interlaced", &info->interlaced))
- info->interlaced = FALSE;
+ info->interlaced = (vinfo.flags & GST_VIDEO_FLAG_INTERLACED) != 0;
+ }
if (gst_structure_id_has_field (st, _TAGS_QUARK)) {
- gst_structure_id_get (st, _TAGS_QUARK,
- GST_TYPE_STRUCTURE, &tags_st, NULL);
+ gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL);
if (gst_structure_get_uint (tags_st, GST_TAG_BITRATE, &utmp) ||
gst_structure_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp))
info->bitrate = utmp;
GstDiscovererSubtitleInfo *info;
if (parent)
- info = (GstDiscovererSubtitleInfo *) parent;
+ info =
+ (GstDiscovererSubtitleInfo *) gst_discoverer_stream_info_ref (parent);
else {
info = (GstDiscovererSubtitleInfo *)
- gst_mini_object_new (GST_TYPE_DISCOVERER_SUBTITLE_INFO);
+ g_object_new (GST_TYPE_DISCOVERER_SUBTITLE_INFO, NULL);
- info->parent.caps = caps;
+ info->parent.caps = gst_caps_ref (caps);
}
if (gst_structure_id_has_field (st, _TAGS_QUARK)) {
GstDiscovererStreamInfo *info;
if (parent)
- info = parent;
+ info = gst_discoverer_stream_info_ref (parent);
else {
info = (GstDiscovererStreamInfo *)
- gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
+ g_object_new (GST_TYPE_DISCOVERER_STREAM_INFO, NULL);
- info->caps = caps;
+ info->caps = gst_caps_ref (caps);
}
if (gst_structure_id_get (st, _TAGS_QUARK,
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg),
"Setting result to MISSING_PLUGINS");
dc->priv->current_info->result = GST_DISCOVERER_MISSING_PLUGINS;
- dc->priv->current_info->misc = gst_structure_copy (msg->structure);
+ if (dc->priv->current_info->misc)
+ gst_structure_free (dc->priv->current_info->misc);
+ dc->priv->current_info->misc = gst_structure_copy (structure);
} else if (sttype == _STREAM_TOPOLOGY_QUARK) {
- dc->priv->current_topology = gst_structure_copy (msg->structure);
+ if (dc->priv->current_topology)
+ gst_structure_free (dc->priv->current_topology);
+ dc->priv->current_topology = gst_structure_copy (structure);
}
}
break;