{"id":2121,"date":"2020-11-08T15:27:04","date_gmt":"2020-11-08T13:27:04","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=2121"},"modified":"2020-11-08T15:27:04","modified_gmt":"2020-11-08T13:27:04","slug":"gstreamer-media-foundation","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/2121","title":{"rendered":"GStreamer &#038; Media Foundation"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">More of unusual stuff: mix of Media Foundation pipeline, with a custom media source specifically, with <a href=\"https:\/\/gstreamer.freedesktop.org\/\">GStreamer<\/a> pipeline. It appears that with all bulkiness of GStreamer runtime, the framework remains open for integrations and flexible for a mix of pre-built and custom components.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PoC push source plugin on top of Media Foundation media session and media source is reasonably small, and is mixed in pipeline in a pretty straightforward way.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nauto const Registry = gst_registry_get();\r\nstd::string PluginDirectory = \"D:\\\\gstreamer\\\\1.18\\\\1.0\\\\msvc_x86_64\\\\lib\\\\gstreamer-1.0\";\r\nfor(auto&amp;&amp; FileName: { \"gstopenh264.dll\", \"gstopengl.dll\" })\r\n{\r\n\tCHAR Path&#91;MAX_PATH];\r\n\tPathCombineA(Path, PluginDirectory.c_str(), FileName);\r\n\tG::Error Error;\r\n\tGstPlugin* Plugin = gst_plugin_load_file(Path, &amp;Error);\r\n\tassert(!Error);\r\n\tassert(Plugin);\r\n\tauto const Result = gst_registry_add_plugin(Registry, Plugin);\r\n\tassert(Result);\r\n}\r\nGST_PLUGIN_STATIC_REGISTER(customsrc); \n#pragma endregion \r\n{\r\n\tG::Error Error;\r\n\tGst::Element const Pipeline { gst_parse_launch(\"customsrc ! openh264dec ! glimagesink\", &amp;Error) };\r\n\tassert(!Error);\r\n\tgst_element_set_state(Pipeline.get(), GST_STATE_PLAYING);\r\n...<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"467\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/11\/image-800x467.png\" alt=\"\" class=\"wp-image-2122\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/11\/image-800x467.png 800w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/11\/image-320x187.png 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/11\/image-768x448.png 768w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/11\/image-1536x897.png 1536w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/11\/image-2048x1196.png 2048w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/11\/image-600x350.png 600w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/11\/image-1040x607.png 1040w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption>Media Foundation Media Source with Direct3D 11 rendering and Direct2D graphics is being played through GStreamer pipeline to OpenGL sink<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As codebase and plugin development environment GStreamer is closer to DirectShow rather than Media Foundation: there is a structure of base classes for reuse, implemented, however, in C (not even C++) with, respectively, a mere amount of chaos inside. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Still, GStreamer looks cool overall and over years accumulated a bunch of useful plugins. Long list includes multiple integrations and implementation of MPEG stuff of sorts, and RTP related pieces in particular. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>More of unusual stuff: mix of Media Foundation pipeline, with a custom media source specifically, with GStreamer pipeline. It appears that with all bulkiness of GStreamer runtime, the framework remains open for integrations and flexible for a mix of pre-built and custom components. PoC push source plugin on top of Media Foundation media session and&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/2121\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[613,424,486],"class_list":["post-2121","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-gstreamer","tag-media-foundation","tag-video"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=2121"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2121\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=2121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=2121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=2121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}