static void guess_audio_profile (GstDiscovererInfo *info, gchar **name, gchar **mime, GList *profiles) { GList *i; GUPnPDLNAProfile *profile; GstEncodingProfile *enc_profile; for (i = profiles; i; i = i->next) { profile = (GUPnPDLNAProfile *)(i->data); enc_profile = gupnp_dlna_profile_get_encoding_profile (profile); gupnp_dlna_debug ("Checking DLNA profile %s", gupnp_dlna_profile_get_name (profile)); if (!check_audio_profile (info, enc_profile)) gupnp_dlna_debug (" Audio did not match"); else if (!check_container (info, enc_profile)) gupnp_dlna_debug (" Container did not match"); else { *name = g_strdup (gupnp_dlna_profile_get_name (profile)); *mime = g_strdup (gupnp_dlna_profile_get_mime (profile)); break; } } }
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; }
bool operator==(const this_type& rhs) const { bool ret = i == rhs.i; ret &= db == rhs.db; ret &= check_container(vec, rhs.vec); ret &= check_container_pr(vec_str, rhs.vec_str, &check_container<std::string>); ret &= std::equal(&arr[0], &arr[0] + sizeof(arr) / sizeof(int), &rhs.arr[0]); ret &= std::equal(&arr_str[0], &arr_str[0] + sizeof(arr_str) / sizeof(std::wstring) , &rhs.arr_str[0], &check_container<std::wstring>); typedef boost::function<bool(V1 const&, V1 const&)> PrV1; typedef boost::function<bool(V2 const&, V2 const&)> PrV2; PrV1 pr_v1 = boost::bind(&check_container<V1>, _1, _2); PrV2 pr_v2 = boost::bind(&check_container_pr<V2, PrV1>, _1, _2, pr_v1); ret &= check_container_pr(vec3, rhs.vec3, pr_v2); return ret; }
int check_container(object ob) { object *inv; int i; inv = all_inventory(ob); for(i=0; i<sizeof(inv); i++) { if(inv[i]->query("weapon_prop")) return 1; if(inv[i]->query("food_remaining") != 0) return 1; if(inv[i]->query("liquid/remaining") !=0) return 1; if(inv[i]->is_container()) if(check_container(inv[i])) return 1; } return 0; }