static GstDiscovererVideoInfo * get_image_info (GUPnPDLNAGstImageInformation *gst_info) { GUPnPDLNAGstImageInformationPrivate *priv = gst_info->priv; if (!priv->image_info) { GList *iter; if (!priv->stream_list) { priv->stream_list = gst_discoverer_info_get_stream_list (priv->info); if (!priv->stream_list) return NULL; } for (iter = priv->stream_list; iter; iter = iter->next) { GstDiscovererStreamInfo *stream = GST_DISCOVERER_STREAM_INFO (iter->data); GType stream_type = G_TYPE_FROM_INSTANCE (stream); if (stream_type == GST_TYPE_DISCOVERER_VIDEO_INFO) { priv->image_info = GST_DISCOVERER_VIDEO_INFO (stream); break; } } } return priv->image_info; }
static gboolean check_video_profile (GstDiscovererInfo *info, GstEncodingProfile *profile) { GList *i, *stream_list; gboolean found_video = FALSE, found_audio = FALSE;; stream_list = gst_discoverer_info_get_stream_list (info); /* Check video and audio restrictions */ for (i = stream_list; i && !(found_video && found_audio); i = i->next) { GstDiscovererStreamInfo *stream; GType stream_type; GstCaps *caps = NULL; stream = GST_DISCOVERER_STREAM_INFO(i->data); stream_type = G_TYPE_FROM_INSTANCE (stream); if (!found_video && stream_type == GST_TYPE_DISCOVERER_VIDEO_INFO) { caps = caps_from_video_stream_info (stream); if (match_profile (profile, caps, GST_TYPE_ENCODING_VIDEO_PROFILE)) found_video = TRUE; else gupnp_dlna_debug (" Video did not match"); } else if (!found_audio && stream_type == GST_TYPE_DISCOVERER_AUDIO_INFO) { caps = caps_from_audio_stream_info (stream); if (match_profile (profile, caps, GST_TYPE_ENCODING_AUDIO_PROFILE)) found_audio = TRUE; else gupnp_dlna_debug (" Audio did not match"); } if (caps) gst_caps_unref (caps); } gst_discoverer_stream_info_list_free (stream_list); if (!found_video || !found_audio) return FALSE; /* Check container restrictions */ if (!check_container (info, profile)) { gupnp_dlna_debug (" Container did not match"); return FALSE; } return TRUE; }
static gboolean check_audio_profile (GstDiscovererInfo *info, GstEncodingProfile *profile) { GstCaps *caps; GList *i, *stream_list; gboolean found = FALSE; /* Optimisation TODO: this can be pre-computed */ if (is_video_profile (profile)) return FALSE; stream_list = gst_discoverer_info_get_stream_list (info); for (i = stream_list; !found && i; i = i->next) { GstDiscovererStreamInfo *stream = GST_DISCOVERER_STREAM_INFO(i->data); GType stream_type = G_TYPE_FROM_INSTANCE (stream); if (stream_type != GST_TYPE_DISCOVERER_AUDIO_INFO) continue; caps = caps_from_audio_stream_info (stream); if (match_profile (profile, caps, GST_TYPE_ENCODING_AUDIO_PROFILE)) { found = TRUE; break; } gst_caps_unref (caps); } gst_discoverer_stream_info_list_free (stream_list); return found; }