Metadata-Version: 2.0
Name: python-librtmp
Version: 0.1.2
Summary: Python bindings for librtmp, built with cffi
Home-page: https://github.com/chrippa/python-librtmp
Author: Christopher Rosell
Author-email: chrippa@tanuki.se
License: Simplified BSD
Keywords: python-librtmp
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Requires-Dist: cffi (>=0.6)
Requires-Dist: singledispatch

===============================
python-librtmp
===============================

.. image:: https://badge.fury.io/py/python-librtmp.png
    :target: http://badge.fury.io/py/python-librtmp

.. image:: https://travis-ci.org/chrippa/python-librtmp.png?branch=master
        :target: https://travis-ci.org/chrippa/python-librtmp

.. image:: https://pypip.in/d/python-librtmp/badge.png
        :target: https://crate.io/packages/python-librtmp?version=latest


python-librtmp is a Python interface to librtmp.
It uses `cffi <http://cffi.readthedocs.org/>`_ to interface with
the C library `librtmp <http://rtmpdump.mplayerhq.hu/librtmp.3.html>`_.

* Free software: BSD license
* Documentation: http://pythonhosted.org/python-librtmp


Installation
------------

The latest stable version is available to install using `pip <http://www.pip-installer.org/>`_:

.. code-block:: console

    # pip install cffi
    # pip install python-librtmp

But you can also get the development version using `Git <http://git-scm.com/>`_:

.. code-block:: console

    $ git clone git://github.com/chrippa/python-librtmp.git
    $ cd python-librtmp
    # pip install cffi
    # python setup.py install


Dependencies
^^^^^^^^^^^^

- a compiler, e.g `gcc`
- librtmp: The library including it's headers (`librtmp-dev`)
- cffi: The setup.py script currently depends on cffi being installed.
  Therefore you need to install it before installing this library.
  cffi also depends on libffi and it's headers (`libffi-dev`)


Features
--------

Streaming
^^^^^^^^^

The most common use case of RTMP is to read a video stream from
a server.

.. code-block:: python

    import librtmp

    # Create a connection
    conn = librtmp.RTMP("rtmp://your.server.net/app/playpath", live=True)
    # Attempt to connect
    conn.connect()
    # Get a file-like object to access to the stream
    stream = conn.create_stream()
    # Read 1024 bytes of data
    data = stream.read(1024)



Remote function calls
^^^^^^^^^^^^^^^^^^^^^

Here is a example of creating a Python function that can be used to call
remote functions:

.. code-block:: python

    my_remote_function = conn.remote_function("MyRemoteMethod", block=True)
    result = my_remote_function("some argument")

Waiting for the server to call our function:

.. code-block:: python

    # This will automatically name the function after it's Python name
    @conn.invoke_handler
    def my_add(a, b):
        return a + b

    # Start waiting for calls
    conn.process_packets()

You can also use custom function name instead:


.. code-block:: python

    @conn.invoke_handler("MyMath.MyAdd")

Instead of blocking forever when waiting for a call you can specify to wait
only for a specific invoke and then stop blocking:

.. code-block:: python

    conn.process_packets(invoked_method="MyMath.MyAdd", timeout=30)






History
-------

0.1.2 (2013-10-08)
^^^^^^^^^^^^^^^^^^

* Fixed compilation issue on some platforms.
* Fixed AMF issue on older librtmp versions. (#1)

0.1.1 (2013-09-25)
^^^^^^^^^^^^^^^^^^

* Fixed packaging issues.

0.1.0 (2013-09-23)
^^^^^^^^^^^^^^^^^^

* First release on PyPI.


