Jingle: farsight bindings started
This commit is contained in:
parent
fdf9d42e57
commit
d6e626799c
|
@ -0,0 +1,19 @@
|
|||
CFLAGS=`pkg-config --cflags farsight-0.1 pygtk-2.0` -I /usr/include/python2.5 -I. -I farsight/
|
||||
LDFLAGS=`pkg-config --libs farsight-0.1`
|
||||
|
||||
farsight.so: farsight.o farsightmodule.o
|
||||
$(CC) $(LDFLAGS) -shared $^ -o $@
|
||||
|
||||
farsight.c: farsight.defs farsight.override
|
||||
pygtk-codegen-2.0 \
|
||||
--prefix farsight \
|
||||
--override farsight.override \
|
||||
--register /usr/share/gst-python/0.10/defs/gst-types.defs \
|
||||
farsight.defs >$@
|
||||
|
||||
farsight.defs:
|
||||
python /usr/share/pygtk/2.0/codegen/h2def.py \
|
||||
farsight/farsight-codec.h \
|
||||
farsight/farsight-session.h \
|
||||
farsight/farsight-stream.h \
|
||||
>$@
|
|
@ -0,0 +1,3 @@
|
|||
This directory contains python bindings for farsight, a gstreamer-based
|
||||
library that allows handling different kinds of audio/video conferencing
|
||||
protocols. These bindings are neither official nor finished.
|
|
@ -0,0 +1,530 @@
|
|||
;; -*- scheme -*-
|
||||
; object definitions ...
|
||||
(define-object Session
|
||||
(in-module "Farsight")
|
||||
(parent "GObject")
|
||||
(c-name "FarsightSession")
|
||||
(gtype-id "FARSIGHT_TYPE_SESSION")
|
||||
)
|
||||
|
||||
(define-object Stream
|
||||
(in-module "Farsight")
|
||||
(parent "GObject")
|
||||
(c-name "FarsightStream")
|
||||
(gtype-id "FARSIGHT_TYPE_STREAM")
|
||||
)
|
||||
|
||||
;; Enumerations and flags ...
|
||||
|
||||
;(define-enum MediaType
|
||||
; (in-module "Farsight")
|
||||
; (c-name "FarsightMediaType")
|
||||
; (gtype-id "FARSIGHT_TYPE_MEDIA_TYPE")
|
||||
; (values
|
||||
; '("audio" "FARSIGHT_MEDIA_TYPE_AUDIO")
|
||||
; '("video" "FARSIGHT_MEDIA_TYPE_VIDEO")
|
||||
; '("last" "FARSIGHT_MEDIA_TYPE_LAST")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-enum SessionError
|
||||
; (in-module "Farsight")
|
||||
; (c-name "FarsightSessionError")
|
||||
; (gtype-id "FARSIGHT_TYPE_SESSION_ERROR")
|
||||
; (values
|
||||
; '("n" "ERROR_UNKNOWN")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-enum StreamDirection
|
||||
; (in-module "Farsight")
|
||||
; (c-name "FarsightStreamDirection")
|
||||
; (gtype-id "FARSIGHT_TYPE_STREAM_DIRECTION")
|
||||
; (values
|
||||
; '("none" "FARSIGHT_STREAM_DIRECTION_NONE")
|
||||
; '("sendonly" "FARSIGHT_STREAM_DIRECTION_SENDONLY")
|
||||
; '("receiveonly" "FARSIGHT_STREAM_DIRECTION_RECEIVEONLY")
|
||||
; '("both" "FARSIGHT_STREAM_DIRECTION_BOTH")
|
||||
; '("last" "FARSIGHT_STREAM_DIRECTION_LAST")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-enum StreamState
|
||||
; (in-module "Farsight")
|
||||
; (c-name "FarsightStreamState")
|
||||
; (gtype-id "FARSIGHT_TYPE_STREAM_STATE")
|
||||
; (values
|
||||
; '("disconnected" "FARSIGHT_STREAM_STATE_DISCONNECTED")
|
||||
; '("connecting" "FARSIGHT_STREAM_STATE_CONNECTING")
|
||||
; '("connected" "FARSIGHT_STREAM_STATE_CONNECTED")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-enum StreamError
|
||||
; (in-module "Farsight")
|
||||
; (c-name "FarsightStreamError")
|
||||
; (gtype-id "FARSIGHT_TYPE_STREAM_ERROR")
|
||||
; (values
|
||||
; '("error-eos" "FARSIGHT_STREAM_ERROR_EOS")
|
||||
; '("unknown-error" "FARSIGHT_STREAM_UNKNOWN_ERROR")
|
||||
; '("error-unknown" "FARSIGHT_STREAM_ERROR_UNKNOWN")
|
||||
; '("error-timeout" "FARSIGHT_STREAM_ERROR_TIMEOUT")
|
||||
; '("error-network" "FARSIGHT_STREAM_ERROR_NETWORK")
|
||||
; '("error-pipeline-setup" "FARSIGHT_STREAM_ERROR_PIPELINE_SETUP")
|
||||
; '("error-resource" "FARSIGHT_STREAM_ERROR_RESOURCE")
|
||||
; '("error-last" "FARSIGHT_STREAM_ERROR_LAST")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-enum StreamDTMFEvent
|
||||
; (in-module "Farsight")
|
||||
; (c-name "FarsightStreamDTMFEvent")
|
||||
; (gtype-id "FARSIGHT_TYPE_STREAM_DTMF_EVENT")
|
||||
; (values
|
||||
; '("0" "FARSIGHT_DTMF_EVENT_0")
|
||||
; '("1" "FARSIGHT_DTMF_EVENT_1")
|
||||
; '("2" "FARSIGHT_DTMF_EVENT_2")
|
||||
; '("3" "FARSIGHT_DTMF_EVENT_3")
|
||||
; '("4" "FARSIGHT_DTMF_EVENT_4")
|
||||
; '("5" "FARSIGHT_DTMF_EVENT_5")
|
||||
; '("6" "FARSIGHT_DTMF_EVENT_6")
|
||||
; '("7" "FARSIGHT_DTMF_EVENT_7")
|
||||
; '("8" "FARSIGHT_DTMF_EVENT_8")
|
||||
; '("9" "FARSIGHT_DTMF_EVENT_9")
|
||||
; '("star" "FARSIGHT_DTMF_EVENT_STAR")
|
||||
; '("pound" "FARSIGHT_DTMF_EVENT_POUND")
|
||||
; '("a" "FARSIGHT_DTMF_EVENT_A")
|
||||
; '("b" "FARSIGHT_DTMF_EVENT_B")
|
||||
; '("c" "FARSIGHT_DTMF_EVENT_C")
|
||||
; '("d" "FARSIGHT_DTMF_EVENT_D")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-enum StreamDTMFMethod
|
||||
; (in-module "Farsight")
|
||||
; (c-name "FarsightStreamDTMFMethod")
|
||||
; (gtype-id "FARSIGHT_TYPE_STREAM_DTMF_METHOD")
|
||||
; (values
|
||||
; '("auto" "FARSIGHT_DTMF_METHOD_AUTO")
|
||||
; '("rtp-rfc4733" "FARSIGHT_DTMF_METHOD_RTP_RFC4733")
|
||||
; '("sound" "FARSIGHT_DTMF_METHOD_SOUND")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
|
||||
;; From farsight-codec.h
|
||||
|
||||
(define-method init
|
||||
(of-object "FarsightCodec")
|
||||
(c-name "farsight_codec_init")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("int" "id")
|
||||
'("const-char*" "encoding_name")
|
||||
'("FarsightMediaType" "media_type")
|
||||
'("guint" "clock_rate")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method destroy
|
||||
(of-object "FarsightCodec")
|
||||
(c-name "farsight_codec_destroy")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-method copy
|
||||
(of-object "FarsightCodec")
|
||||
(c-name "farsight_codec_copy")
|
||||
(return-type "FarsightCodec*")
|
||||
)
|
||||
|
||||
(define-function farsight_codec_list_destroy
|
||||
(c-name "farsight_codec_list_destroy")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GList*" "codec_list")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function farsight_codec_list_copy
|
||||
(c-name "farsight_codec_list_copy")
|
||||
(return-type "GList*")
|
||||
(parameters
|
||||
'("const-GList*" "codec_list")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
;; From farsight-session.h
|
||||
|
||||
(define-function farsight_session_get_type
|
||||
(c-name "farsight_session_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function farsight_session_factory_make
|
||||
(c-name "farsight_session_factory_make")
|
||||
(return-type "FarsightSession*")
|
||||
(parameters
|
||||
'("const-gchar*" "session_id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method destroy
|
||||
(of-object "FarsightSession")
|
||||
(c-name "farsight_session_destroy")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-method create_stream
|
||||
(of-object "FarsightSession")
|
||||
(c-name "farsight_session_create_stream")
|
||||
(return-type "FarsightStream*")
|
||||
(parameters
|
||||
'("FarsightMediaType" "media_type")
|
||||
'("FarsightStreamDirection" "dir")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method list_supported_codecs
|
||||
(of-object "FarsightSession")
|
||||
(c-name "farsight_session_list_supported_codecs")
|
||||
(return-type "const-GList*")
|
||||
)
|
||||
|
||||
|
||||
|
||||
;; From farsight-stream.h
|
||||
|
||||
(define-function farsight_stream_get_type
|
||||
(c-name "farsight_stream_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-method get_media_type
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_media_type")
|
||||
(return-type "FarsightMediaType")
|
||||
)
|
||||
|
||||
(define-method prepare_transports
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_prepare_transports")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-method get_native_candidate_list
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_native_candidate_list")
|
||||
(return-type "const-GList*")
|
||||
)
|
||||
|
||||
(define-method get_native_candidate
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_native_candidate")
|
||||
(return-type "GList*")
|
||||
(parameters
|
||||
'("const-gchar*" "candidate_id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method set_remote_candidate_list
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_remote_candidate_list")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-GList*" "remote_candidates")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method add_remote_candidate
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_add_remote_candidate")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-GList*" "remote_candidate")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method remove_remote_candidate
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_remove_remote_candidate")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-gchar*" "remote_candidate_id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method set_active_candidate_pair
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_active_candidate_pair")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("const-gchar*" "native_candidate_id")
|
||||
'("const-gchar*" "remote_candidate_id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_local_codecs
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_local_codecs")
|
||||
(return-type "const-GList*")
|
||||
)
|
||||
|
||||
(define-method set_remote_codecs
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_remote_codecs")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-GList*" "codecs")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_codec_intersection
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_codec_intersection")
|
||||
(return-type "GList*")
|
||||
)
|
||||
|
||||
(define-method set_codec_preference_list
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_codec_preference_list")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-GArray*" "codec_pref")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method set_active_codec
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_active_codec")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("gint" "id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_active_codec
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_active_codec")
|
||||
(return-type "gint")
|
||||
)
|
||||
|
||||
(define-method set_sink
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_sink")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("GstElement*" "sink")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_sink
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_sink")
|
||||
(return-type "GstElement*")
|
||||
)
|
||||
|
||||
(define-method set_sink_filter
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_sink_filter")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("GstCaps*" "filter")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method set_source
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_source")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("GstElement*" "source")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_source
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_source")
|
||||
(return-type "GstElement*")
|
||||
)
|
||||
|
||||
(define-method set_source_filter
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_source_filter")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("GstCaps*" "filter")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_state
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_state")
|
||||
(return-type "FarsightStreamState")
|
||||
)
|
||||
|
||||
(define-method get_direction
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_direction")
|
||||
(return-type "FarsightStreamDirection")
|
||||
)
|
||||
|
||||
(define-method get_current_direction
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_current_direction")
|
||||
(return-type "FarsightStreamDirection")
|
||||
)
|
||||
|
||||
(define-method get_media_type
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_media_type")
|
||||
(return-type "FarsightMediaType")
|
||||
)
|
||||
|
||||
(define-method get_pipeline
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_get_pipeline")
|
||||
(return-type "GstElement*")
|
||||
)
|
||||
|
||||
(define-method set_pipeline
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_pipeline")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("GstElement*" "pipeline")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method start
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_start")
|
||||
(return-type "gboolean")
|
||||
)
|
||||
|
||||
(define-method stop
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_stop")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-method set_sending
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_set_sending")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("gboolean" "sending")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method signal_error
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_signal_error")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("FarsightStreamError" "err")
|
||||
'("const-gchar*" "mesg")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method signal_native_candidates_prepared
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_signal_native_candidates_prepared")
|
||||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-method signal_new_native_candidate
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_signal_new_native_candidate")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-gchar*" "candidate_id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method signal_new_active_candidate_pair
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_signal_new_active_candidate_pair")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-gchar*" "native_candidate_id")
|
||||
'("const-gchar*" "remote_candidate_id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method signal_codec_changed
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_signal_codec_changed")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("int" "codec_id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method signal_state_changed
|
||||
(of-object "FarsightStream")
|
||||
(c-name "farsight_stream_signal_state_changed")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("FarsightStreamState" "state")
|
||||
'("FarsightStreamDirection" "direction")
|
||||
)
|
||||
)
|
||||
|
||||
;(define-method signal_sink_pad_ready
|
||||
; (of-object "FarsightStream")
|
||||
; (c-name "farsight_stream_signal_sink_pad_ready")
|
||||
; (return-type "none")
|
||||
; (parameters
|
||||
; '("GstPad*" "pad")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-method start_telephony_event
|
||||
; (of-object "FarsightStream")
|
||||
; (c-name "farsight_stream_start_telephony_event")
|
||||
; (return-type "gboolean")
|
||||
; (parameters
|
||||
; '("guint8" "ev")
|
||||
; '("guint8" "volume")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-method stop_telephony_event
|
||||
; (of-object "FarsightStream")
|
||||
; (c-name "farsight_stream_stop_telephony_event")
|
||||
; (return-type "gboolean")
|
||||
;)
|
||||
;
|
||||
;(define-method start_telephony_event_full
|
||||
; (of-object "FarsightStream")
|
||||
; (c-name "farsight_stream_start_telephony_event_full")
|
||||
; (return-type "gboolean")
|
||||
; (parameters
|
||||
; '("guint8" "ev")
|
||||
; '("guint8" "volume")
|
||||
; '("FarsightStreamDTMFMethod" "method")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-method stop_telephony_event_full
|
||||
; (of-object "FarsightStream")
|
||||
; (c-name "farsight_stream_stop_telephony_event_full")
|
||||
; (return-type "gboolean")
|
||||
; (parameters
|
||||
; '("FarsightStreamDTMFMethod" "method")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;(define-method preload_receive_pipeline
|
||||
; (of-object "FarsightStream")
|
||||
; (c-name "farsight_stream_preload_receive_pipeline")
|
||||
; (return-type "gboolean")
|
||||
; (parameters
|
||||
; '("gint" "payload_type")
|
||||
; )
|
||||
;)
|
||||
;
|
||||
;
|
|
@ -0,0 +1,36 @@
|
|||
%%
|
||||
headers
|
||||
#include <Python.h>
|
||||
#include "pygobject.h"
|
||||
#include "farsight.h"
|
||||
%%
|
||||
modulename farsight
|
||||
%%
|
||||
import gtk.Plug as PyGtkPlug_Type
|
||||
import gobject.GObject as PyGObject_Type
|
||||
import gobject.GType as PyGTypeModule_Type
|
||||
import gst.Element as PyGstElement_Type
|
||||
import gst.Pad as PyGstPad_Type
|
||||
%%
|
||||
ignore-glob
|
||||
*_get_type
|
||||
%%
|
||||
override farsight_session_list_supported_codecs noargs
|
||||
static PyObject* _wrap_farsight_session_list_supported_codecs(PyGObject *self)
|
||||
{
|
||||
const GList *list, *tmp;
|
||||
PyObject* ret;
|
||||
|
||||
list=farsight_session_list_supported_codecs(FARSIGHT_SESSION(self->obj));
|
||||
|
||||
ret=PyList_New(0);
|
||||
for (tmp=list; tmp!=NULL; tmp=tmp->next) {
|
||||
FarsightCodec *codec = tmp->data;
|
||||
PyObject *item = pygobject_new((GObject *) codec);
|
||||
|
||||
PyList_Append(ret, item);
|
||||
Py_DECREF(item);
|
||||
}
|
||||
// g_list_free(list); (a const list, we don't free it?)
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#include <pygobject.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void farsight_register_classes (PyObject *d);
|
||||
extern PyMethodDef farsight_functions[];
|
||||
|
||||
DL_EXPORT(void)
|
||||
initfarsight(void)
|
||||
{
|
||||
PyObject *m, *d;
|
||||
|
||||
init_pygobject ();
|
||||
|
||||
m = Py_InitModule ("farsight", farsight_functions);
|
||||
d = PyModule_GetDict (m);
|
||||
|
||||
farsight_register_classes (d);
|
||||
|
||||
// farsight_add_constants(m, 'FARSIGHT_TYPE_');
|
||||
|
||||
if (PyErr_Occurred ()) {
|
||||
PyErr_Print();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue