PyJRTPlib

This is the sourceforge homepage for PyJRTPlib, which is a python wrapper to the excellent C++ library JRTPlib. Which is made by Jori. Since I am not a cracker jack programmer like Jori i decided to wrap it in python so that way I could use it.

I used the boost python library for python. I have used Swig previously to wrap C routines, but i think for C++ boost seems to do a better job, plus i also wanted to check it out.

It is not a complete wrapping at this point in time. I only wrapped the functions which I required. As I require more functions I will wrap more of them ;).

I am not sure if I wrapped the funtions that require data transfer correctly. If someone has experience wrapping these sorts of functions please let me know.

IE

The functions that require the passing and returning of Strings or data. For when data is required I have it returning as a numarray. To pass the data back and forth from a num array structure I am using numarray's native struction

object GetPayLoad(RTPPacket &rtppacket) {
unsigned char* payload_ptr=rtppacket.GetPayload();
int payload_len=rtppacket.GetPayloadLength();

numeric::array obj=numeric::array(make_tuple(1),"UInt8");
obj.resize(payload_len);

char* data_ptr=((PyArrayObject*)obj.ptr())->data;
memcpy(data_ptr,payload_ptr,payload_len);

return obj;
}

It appears to work, but maybe it is dangerous and cause memory leak I am uncertain.

Requirements :

Visual C++ : I was too lazy and unable to figure out how to use the boost library JAM files. If anyone knows how to make one please send it to me. I am using VC++ 6.

JRTPLib : I have included a copy of that on

Numarray : To run and compile the library this is required. I used version 0.5.

Python.Boost : which can be found here.

Building :

Basically all i did was follow the instructions here.

Notes.

Using :

Included is a directory called examples.

The only difference from jrtplib is that pyjrtplib has to be initialized and shutdown. This is mainly for windows to handle WSAStartup.

Obtaining

All of the releases are distributed here.