From: <jpg...@us...> - 2007-05-09 16:01:24
|
Revision: 976 http://svn.sourceforge.net/iaxclient/?rev=976&view=rev Author: jpgrayson Date: 2007-05-09 09:01:26 -0700 (Wed, 09 May 2007) Log Message: ----------- Modify iaxclient to pass iax timestamp information for audio and video events (iaxc_ev_video and iaxc_ev_audio). These are the timestamps coming from the headers of incoming iax frames. Modified Paths: -------------- trunk/lib/audio_encode.c trunk/lib/iaxclient.h trunk/lib/iaxclient_lib.c trunk/lib/iaxclient_lib.h trunk/lib/video.c Modified: trunk/lib/audio_encode.c =================================================================== --- trunk/lib/audio_encode.c 2007-05-09 15:53:14 UTC (rev 975) +++ trunk/lib/audio_encode.c 2007-05-09 16:01:26 UTC (rev 976) @@ -319,7 +319,7 @@ // Send the encoded audio data back to the app if required // TODO: fix the stupid way in which the encoded audio size is returned if ( iaxc_get_audio_prefs() & IAXC_AUDIO_PREF_RECV_LOCAL_ENCODED ) - iaxc_do_audio_callback(callNo, IAXC_SOURCE_LOCAL, 1, + iaxc_do_audio_callback(callNo, 0, IAXC_SOURCE_LOCAL, 1, call->encoder->format & IAXC_AUDIO_FORMAT_MASK, sizeof(outbuf) - outsize, outbuf); Modified: trunk/lib/iaxclient.h =================================================================== --- trunk/lib/iaxclient.h 2007-05-09 15:53:14 UTC (rev 975) +++ trunk/lib/iaxclient.h 2007-05-09 16:01:26 UTC (rev 976) @@ -216,6 +216,7 @@ struct iaxc_ev_video { int callNo; + unsigned int ts; int format; int width; int height; @@ -227,12 +228,13 @@ struct iaxc_ev_audio { - int callNo; - int format; - int encoded; - int source; - int size; - unsigned char *data; + int callNo; + unsigned int ts; + int format; + int encoded; + int source; + int size; + unsigned char *data; }; struct iaxc_ev_registration { Modified: trunk/lib/iaxclient_lib.c =================================================================== --- trunk/lib/iaxclient_lib.c 2007-05-09 15:53:14 UTC (rev 975) +++ trunk/lib/iaxclient_lib.c 2007-05-09 16:01:26 UTC (rev 976) @@ -342,12 +342,13 @@ iaxc_post_event(e); } -void iaxc_do_audio_callback(int callNo, int source, int encoded, int format, - int size, unsigned char *data) +void iaxc_do_audio_callback(int callNo, unsigned int ts, int source, + int encoded, int format, int size, unsigned char *data) { iaxc_event e; e.type = IAXC_EVENT_AUDIO; + e.ev.audio.ts = ts; e.ev.audio.encoded = encoded; assert(source == IAXC_SOURCE_REMOTE || source == IAXC_SOURCE_LOCAL); e.ev.audio.source = source; @@ -899,7 +900,7 @@ break; if ( audio_prefs & IAXC_AUDIO_PREF_RECV_LOCAL_RAW ) - iaxc_do_audio_callback(selected_call, + iaxc_do_audio_callback(selected_call, 0, IAXC_SOURCE_LOCAL, 0, 0, to_read * 2, (unsigned char *)buf); @@ -1077,8 +1078,8 @@ /* Pass encoded audio back to the app if required */ if ( audio_prefs & IAXC_AUDIO_PREF_RECV_REMOTE_ENCODED ) - iaxc_do_audio_callback(callNo, IAXC_SOURCE_REMOTE, 1, - format & IAXC_AUDIO_FORMAT_MASK, + iaxc_do_audio_callback(callNo, e->ts, IAXC_SOURCE_REMOTE, + 1, format & IAXC_AUDIO_FORMAT_MASK, e->datalen - total_consumed, e->data + total_consumed); @@ -1099,8 +1100,8 @@ // the number to obtain the size in bytes. // format will also be 0 since this is raw audio int size = (fr_samples - samples - mainbuf_delta) * 2; - iaxc_do_audio_callback(callNo, IAXC_SOURCE_REMOTE, 0, 0, - size, (unsigned char *)fr); + iaxc_do_audio_callback(callNo, e->ts, IAXC_SOURCE_REMOTE, + 0, 0, size, (unsigned char *)fr); } if ( iaxc_audio_output_mode != 0 ) @@ -1135,7 +1136,7 @@ if ( call->vformat ) { if ( iaxc_receive_video(call, selected_call, e->data, - e->datalen, call->vformat) < 0 ) + e->datalen, e->ts, call->vformat) < 0 ) { iaxc_usermsg(IAXC_STATUS, "Bad or incomplete video packet. Unable to decode."); Modified: trunk/lib/iaxclient_lib.h =================================================================== --- trunk/lib/iaxclient_lib.h 2007-05-09 15:53:14 UTC (rev 975) +++ trunk/lib/iaxclient_lib.h 2007-05-09 16:01:26 UTC (rev 976) @@ -119,7 +119,8 @@ void os_init(void); void iaxc_usermsg(int type, const char *fmt, ...); void iaxc_do_levels_callback(float input, float output); -void iaxc_do_audio_callback(int callNo, int remote, int encoded, int format, int size, unsigned char *data); +void iaxc_do_audio_callback(int callNo, unsigned int ts, int remote, + int encoded, int format, int size, unsigned char *data); #include "iaxclient.h" @@ -277,7 +278,8 @@ int iaxc_video_initialize(); int iaxc_video_destroy(); int iaxc_receive_video(struct iaxc_call * call, int sel_call, - void * encoded_video, int encoded_video_len, int format); + void * encoded_video, int encoded_video_len, + unsigned int ts, int format); int iaxc_send_video(struct iaxc_call *, int); extern double iaxc_silence_threshold; Modified: trunk/lib/video.c =================================================================== --- trunk/lib/video.c 2007-05-09 15:53:14 UTC (rev 975) +++ trunk/lib/video.c 2007-05-09 16:01:26 UTC (rev 976) @@ -367,12 +367,14 @@ * - encoded - true if data is encoded * - rgb32 - if true, convert data to RGB32 before showing */ -void show_video_frame(char *videobuf, int size, int cn, int source, int encoded, int rgb32) +void show_video_frame(char *videobuf, int size, int cn, int source, int encoded, + unsigned int ts, int rgb32) { iaxc_event e; char * buffer; e.type = IAXC_EVENT_VIDEO; + e.ev.video.ts = ts; if ( size <= 0 ) fprintf(stderr, "WARNING: size %d in show_video_frame\n", size); @@ -429,7 +431,7 @@ // Send the raw frame to the main app, if necessary if ( iaxc_video_prefs & IAXC_VIDEO_PREF_RECV_LOCAL_RAW ) { - show_video_frame(videobuf, inlen, -1, IAXC_SOURCE_LOCAL, 0, + show_video_frame(videobuf, inlen, -1, IAXC_SOURCE_LOCAL, 0, 0, iaxc_video_prefs & IAXC_VIDEO_PREF_RECV_RGB32); } @@ -511,7 +513,7 @@ if ( iaxc_video_prefs & IAXC_VIDEO_PREF_RECV_LOCAL_ENCODED ) { show_video_frame(slice_set.data[i], slice_set.size[i], - -1, IAXC_SOURCE_LOCAL, 1, 0); + -1, IAXC_SOURCE_LOCAL, 1, 0, 0); } if ( !(iaxc_video_prefs & IAXC_VIDEO_PREF_SEND_DISABLE) ) @@ -542,7 +544,8 @@ /* process an incoming video frame */ int iaxc_receive_video(struct iaxc_call *call, int sel_call, - void *encoded_video, int encoded_video_len, int format) + void *encoded_video, int encoded_video_len, + unsigned int ts, int format) { static char videobuf[VIDEO_BUFSIZ]; int outsize = VIDEO_BUFSIZ; @@ -563,7 +566,7 @@ if ( iaxc_video_prefs & IAXC_VIDEO_PREF_RECV_REMOTE_ENCODED ) { show_video_frame((char *)encoded_video, encoded_video_len, -1, - IAXC_SOURCE_REMOTE, 1, 0); + IAXC_SOURCE_REMOTE, 1, ts, 0); } /* destroy vdecoder if it is incorrect type */ @@ -626,7 +629,7 @@ if ( outsize > 0 ) { show_video_frame(videobuf, outsize, sel_call, - IAXC_SOURCE_REMOTE, 0, + IAXC_SOURCE_REMOTE, 0, ts, iaxc_video_prefs & IAXC_VIDEO_PREF_RECV_RGB32); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |