Binary video add-ons?
#1
Is it possible to make a binary video add-on?

I can't seem to find any example code in xbmc/repo-binary-addons

I'm pretty much looking for a hello world type binary video add-on that just tells the media player to play a file

I'm thinking of one for iOS that when activated shows the iOS document picker and lets the user select a file to play directly from another iOS app

This would mainly be for people without a jailbreak (or people with a iOS flash drive) since it would (should) allow direct file playback without making any copies
Install Kodi on iOS without a jailbreak: iOS App Signer — donations are gratefully accepted
Reply
#2
I'm not sure about "native" video addons but CPython which is the reference Python implementation that is used in Kodi for addons provides a Python-C API that allows to write extension modules in C/C++. The raw Python-C API may seem too verbose, but there are convenience tools like Boost-Python that simplify writing binary Python modules. So yes, technically you can write your whole addon in C/C++, leaving only a small "launcher" in pure Python.

Below is a very simple example using Boost-Python:

play.cpp
Code:
#include <boost/python.hpp>

namespace py = boost::python;


void play()
{
    py::object player = py::import("xbmc").attr("Player")();
    player.attr("play")("http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_surround-fix.avi");
}


BOOST_PYTHON_MODULE(my_bin_module)
{
    py::def("play", play);
}

main.py (a launcher):

Code:
from my_bin_module import play

play()

This should play a video in Kodi. As you can see, with Boost-Python a Python module written in C++ is pretty straightforward.

PS. Updated the example so that it plays a video as requested by the OP.
Reply

Logout Mark Read Team Forum Stats Members Help
Binary video add-ons?0