/** * AccessibleStreamableContent_open: * @obj: a pointer to the #AccessibleStreamableContent implementor on which to operate. * @content_type: a string specifying the content type to retrieve (should match one * of the return strings from #AccessibleStreamableContent_getContentTypes ()). * * Open a streaming connection to an AccessibleStreamableContent implementor, * of a particular content type. Note that a client may only have one * open stream per streamable interface instance in the current * implementation. * * @Since: AT-SPI 1.4 * * Returns: #TRUE if successful, #FALSE if unsuccessful. * **/ SPIBoolean AccessibleStreamableContent_open (AccessibleStreamableContent *obj, const char *content_type) { Accessibility_ContentStream stream; struct StreamCacheItem *cache; stream = Accessibility_StreamableContent_getStream (CSPI_OBJREF (obj), content_type, cspi_ev ()); cspi_return_val_if_ev ("getContent", FALSE); if (stream != CORBA_OBJECT_NIL) { cache = g_new0 (struct StreamCacheItem, 1); cache->stream = stream; cache->mimetype = CORBA_string_dup (content_type); g_hash_table_replace (get_streams (), CSPI_OBJREF (obj), cache); /* FIXME * This limits us to one concurrent stream per streamable interface * for a given client. * It might be reasonable for a client to open more than one stream * to content, in different mime-types, at the same time. */ return TRUE; }
stream_profile get_stream(rs2_stream stream_type, int stream_index = -1) const { for (auto&& s : get_streams()) { if (s.stream_type() == stream_type && (stream_index == -1 || s.stream_index() == stream_index)) { return s; } } throw std::runtime_error("Profile does not contain the requested stream"); }