{"id":191,"date":"2014-08-03T18:08:46","date_gmt":"2014-08-03T16:08:46","guid":{"rendered":"https:\/\/coaxion.net\/blog\/?p=191"},"modified":"2014-08-05T13:36:55","modified_gmt":"2014-08-05T11:36:55","slug":"gstreamer-playback-api","status":"publish","type":"post","link":"https:\/\/coaxion.net\/blog\/2014\/08\/gstreamer-playback-api\/","title":{"rendered":"GStreamer Playback API"},"content":{"rendered":"<p><strong>Update: <\/strong> the code is now also available on <a href=\"https:\/\/github.com\/sdroege\/gst-player\" title=\"GitHub GstPlayer\" target=\"_blank\">GitHub<\/a> which probably makes it easier for a few people to use it and contribute. Just send pull requests or create issues in the issue tracker of GitHub.<\/p>\n<p>Over the last years I noticed that I was copying too much code to create simple <a title=\"GStreamer\" href=\"http:\/\/gstreamer.freedesktop.org\/\" target=\"_blank\">GStreamer<\/a> based playback applications. After talking to other people at <a title=\"GUADEC\" href=\"http:\/\/blogs.gnome.org\/edwardrv\/2014\/07\/28\/guadec-2014\/\" target=\"_blank\">GUADEC<\/a> this year it was clear that this wasn&#8217;t only a problem on my side but a general problem. So here it is, a convenience API for creating GStreamer based playback applications: <a title=\"GstPlayer\" href=\"http:\/\/cgit.freedesktop.org\/~slomo\/gst-player\" target=\"_blank\">GstPlayer<\/a>.<\/p>\n<p>The <a title=\"GstPlayer API\" href=\"https:\/\/coaxion.net\/~slomo\/gst-player\/docs\/gst-player-gstplayer.html\" target=\"_blank\">API<\/a> is really simple but is still <a title=\"gstplayer.c\" href=\"http:\/\/cgit.freedesktop.org\/~slomo\/gst-player\/tree\/lib\/gst\/player\/gstplayer.c#n27\" target=\"_blank\">missing many features<\/a>:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-title=\"\">GstPlayer *  gst_player_new       (void);\r\n\r\nvoid         gst_player_play      (GstPlayer * player);\r\nvoid         gst_player_pause     (GstPlayer * player);\r\nvoid         gst_player_stop      (GstPlayer * player);\r\nvoid         gst_player_seek      (GstPlayer * player, GstClockTime position);\r\nvoid         gst_player_set_uri   (GstPlayer * player, const gchar * uri);\r\n...\r\n<\/pre>\n<p>Additionally to that there are a few other properties (which are not only exposed as setters\/getters but also as GObject properties), and signals to be notified about position changes, errors, end-of-stream and other useful information. You can find the complete API documentation <a href=\"https:\/\/coaxion.net\/~slomo\/gst-player\/docs\/gst-player-gstplayer.html\" title=\"GstPlayer API\" target=\"_blank\">here<\/a>. In general the API is modeled similar to other existing APIs like Android&#8217;s <a href=\"https:\/\/developer.android.com\/reference\/android\/media\/MediaPlayer.html\" title=\"MediaPlayer\" target=\"_blank\">MediaPlayer<\/a> and iOS&#8217; <a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/AVFoundation\/Reference\/AVPlayer_Class\/Chapters\/Reference.html\" title=\"AVPlayer\" target=\"_blank\">AVPlayer<\/a>.<\/p>\n<p>Included are also some very, very simple <a href=\"http:\/\/cgit.freedesktop.org\/~slomo\/gst-player\/tree\/gst-play\" title=\"gst-play\" target=\"_blank\">commandline<\/a>, <a href=\"http:\/\/cgit.freedesktop.org\/~slomo\/gst-player\/tree\/gtk\" title=\"GTK+\" target=\"_blank\">GTK+<\/a>, <a href=\"http:\/\/cgit.freedesktop.org\/~slomo\/gst-player\/tree\/android\" title=\"Android\" target=\"_blank\">Android<\/a> (including <a href=\"http:\/\/cgit.freedesktop.org\/~slomo\/gst-player\/tree\/android\/src\/org\/freedesktop\/gstreamer\/Player.java\" title=\"Player\" target=\"_blank\">nice Java bindings<\/a>) and <a href=\"http:\/\/cgit.freedesktop.org\/~slomo\/gst-player\/tree\/ios\" title=\"iOS\" target=\"_blank\">iOS<\/a> apps. An APK for the Android app can also be found <a href=\"https:\/\/coaxion.net\/~slomo\/gst-player\/android\/gst-play-debug.apk\" title=\"gst-play-debug.apk\" target=\"_blank\">here<\/a>. It provides no way to start a player, but whenever there is a video or audio file to be played it will be proposed as a possible application via the Android intent system.<\/p>\n<p>In the end the goal is to have a replacement for most of the GStreamer code in e.g. <a title=\"GNOME\" href=\"http:\/\/www.gnome.org\/\" target=\"_blank\">GNOME<\/a>&#8216;s <a title=\"Totem\" href=\"https:\/\/wiki.gnome.org\/Apps\/Videos\/\" target=\"_blank\">Totem<\/a> video player, <a title=\"Enlightenment\" href=\"http:\/\/enlightenment.org\/\" target=\"_blank\">Enlightenment<\/a>&#8216;s <a title=\"Emotion GStreamer1 Module\" href=\"https:\/\/git.enlightenment.org\/core\/efl.git\/tree\/src\/modules\/emotion\/gstreamer1\" target=\"_blank\">Emotion<\/a> or really any other playback application, and then have it integrated in a gst-plugins-base library (or a separate module with other convenience APIs).<\/p>\n<p>While this is all clearly only the start, I hope that people already take a look at this and consider using it for their projects, provide patches, or help making the included sample apps really useful and nice-looking. Apps for other platforms (e.g. a <a href=\"http:\/\/qt-project.org\/\" title=\"Qt\" target=\"_blank\">Qt<\/a> app, or one written in other languages like C# or Python) would also be nice to have. And if you&#8217;re an Android or iOS or Qt developer and have no idea about GStreamer you can still help by creating an awesome user interface \ud83d\ude42 Ideally I would like to get the Android and iOS app into such a good shape that we can upload them to the app stores as useful GStreamer playback applications, which we could then also use to point people to a good demo.<\/p>\n<p>If you&#8217;re interested and have some time to work on it or try it, please get in contact with me.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: the code is now also available on GitHub which probably makes it easier for a few people to use it and contribute. Just send pull requests or create issues in the issue tracker of GitHub. Over the last years I noticed that I was copying too much code to create simple GStreamer based playback &hellip; <a href=\"https:\/\/coaxion.net\/blog\/2014\/08\/gstreamer-playback-api\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">GStreamer Playback API<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,6,5],"tags":[],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-free-software","category-gnome","category-gstreamer"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":22,"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"predecessor-version":[{"id":214,"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions\/214"}],"wp:attachment":[{"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coaxion.net\/blog\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}