From: <jpg...@us...> - 2007-09-03 19:05:46
|
Revision: 1112 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1112&view=rev Author: jpgrayson Date: 2007-09-03 12:05:46 -0700 (Mon, 03 Sep 2007) Log Message: ----------- Apply Michael Magnusson's patch for configurable video support. Modified Paths: -------------- trunk/configure.ac trunk/lib/Makefile.am trunk/lib/iaxclient_lib.c trunk/lib/video.c Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2007-08-28 19:55:45 UTC (rev 1111) +++ trunk/configure.ac 2007-09-03 19:05:46 UTC (rev 1112) @@ -120,6 +120,21 @@ WISH="${with_wish}", with_wish="auto") +AC_ARG_WITH(video, + [AS_HELP_STRING([--without-video], + [Video support])],, + with_video="yes") + +AC_ARG_WITH(ogg, + [AS_HELP_STRING([--without-ogg], + [OGG support])],, + with_ogg="auto") + +AC_ARG_WITH(theora, + [AS_HELP_STRING([--without-theora], + [Theora support])],, + with_theora="auto") + if test ! "x$enable_clients" = "xauto"; then for client in ${enable_clients}; do case "$client" in @@ -174,23 +189,46 @@ AM_PATH_GSM(has_gsm=yes, has_gsm=no) fi -PKG_CHECK_MODULES(OGG, [ogg >= 1.1.3],,AC_MSG_ERROR([ - libogg is required to build this package! - please see http://www.xiph.org/ for how to - obtain a copy. -])) +if test x$with_video = xyes; then + AC_DEFINE(USE_VIDEO, 1, [Define to 1 to enable Video support]) +fi +AM_CONDITIONAL(VIDEO, test x$with_video = xyes) +has_ogg=no +if test ! x$with_ogg = xno; then +PKG_CHECK_MODULES(OGG, [ogg >= 1.1.3],has_ogg=yes) +if test x$has_ogg = xyes; then + AC_DEFINE(USE_OGG, 1, [OGG]) +elif test ! x$with_ogg = xauto ; then + AC_MSG_ERROR([ + libogg is required to build this package! + please see http://www.xiph.org/ for how to + obtain a copy. + ]) +fi +fi +AM_CONDITIONAL(OGG, test x$has_ogg = xyes) + PKG_CHECK_MODULES(SPEEX, [speex >= 1.2],,AC_MSG_ERROR([ speex is required to build this package! please see http://www.xiph.org/ for how to obtain a copy. ])) -PKG_CHECK_MODULES(THEORA, [theora >= 1.0alpha7],,AC_MSG_ERROR([ - libtheora is required to build this package! - please see http://www.xiph.org/ for how to - obtain a copy. -])) +has_teora=no +if test ! x$with_theora = xno; then +PKG_CHECK_MODULES(THEORA, [theora >= 1.0alpha7],has_theora=yes) +if test x$has_theora = xyes; then + AC_DEFINE(USE_THEORA, 1, [THEORA]) +elif test ! x$with_theora = xauto ; then + AC_MSG_ERROR([ + libtheora is required to build this package! + please see http://www.xiph.org/ for how to + obtain a copy. + ]) +fi +fi +AM_CONDITIONAL(THEORA, test x$has_theora = xyes) PKG_CHECK_MODULES(SDL, [sdl >= 1.2], has_sdl=yes, has_sdl=no) PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.0], has_gtk2=yes, has_gtk2=no) @@ -314,7 +352,7 @@ fi fi - if test x$has_sdl = xyes; then + if test x$has_sdl = xyes && test x$with_video = xyes; then clients="$clients vtestcall" fi @@ -334,8 +372,8 @@ CLIENTS="$CLIENTS $client";; vtestcall) - if ! test x$has_sdl = xyes; then - AC_MSG_ERROR([vtestcall requires SDL]) + if test ! x$has_sdl = xyes || test ! x$with_video = xyes ; then + AC_MSG_ERROR([vtestcall requires SDL and video]) fi CLIENTS="$CLIENTS $client";; Modified: trunk/lib/Makefile.am =================================================================== --- trunk/lib/Makefile.am 2007-08-28 19:55:45 UTC (rev 1111) +++ trunk/lib/Makefile.am 2007-09-03 19:05:46 UTC (rev 1112) @@ -6,11 +6,12 @@ libiaxclient_la_SOURCES = $(SRCS) nodist_libiaxclient_la_SOURCES = $(NODIST_SRCS) +AM_CPPFLAGS = \ + -I$(srcdir)/portmixer/px_common + AM_CFLAGS = \ - -I$(srcdir)/portmixer/px_common \ $(PTHREAD_CFLAGS) \ $(SPEEX_CFLAGS) \ - $(THEORA_CFLAGS) \ $(IAX2_CFLAGS) \ $(PORTAUDIO_CFLAGS) @@ -24,9 +25,7 @@ $(PTHREAD_LIBS) \ $(IAX2_LIBS) \ $(PORTAUDIO_LIBS) \ - $(SPEEX_LIBS) \ - $(THEORA_LIBS) \ - $(OGG_LIBS) + $(SPEEX_LIBS) AM_LDFLAGS = \ -no-undefined \ @@ -41,17 +40,33 @@ if WIN32 SRCS += $(SRCS_WIN32) libiaxclient_la_LIBADD += -lwinmm -lwsock32 + +if VIDEO +SRCS += $(SRCS_WIN32_VIDEO) +AM_CPPFLAGS += -I$(srcdir)/videoLib +endif VIDEO endif WIN32 if LINUX SRCS += $(SRCS_LINUX) + +if VIDEO +SRCS += $(SRCS_LINUX_VIDEO) +endif endif LINUX if MACOSX SRCS += $(SRCS_MACOSX) AM_LDFLAGS += -framework Quicktime +if VIDEO +SRCS += $(SRCS_MACOSX_VIDEO) +endif endif MACOSX +if VIDEO +SRCS += $(SRCS_VIDEO) +endif + if USE_LOCAL_GSM SRCS += $(SRCS_LIBGSM) endif @@ -72,6 +87,17 @@ AM_CFLAGS += $(GSM_CFLAGS) endif +if OGG +libiaxclient_la_LIBADD += $(OGG_LIBS) +AM_CFLAGS += $(OGG_CFLAGS) +endif + +if THEORA +SRCS += codec_theora.c codec_theora.h +libiaxclient_la_LIBADD += $(THEORA_LIBS) +AM_CFLAGS += $(THEORA_CFLAGS) +endif + SRCS_LIBGSM= \ gsm/src/add.c \ gsm/src/code.c \ @@ -107,8 +133,6 @@ codec_ilbc.h \ codec_speex.c \ codec_speex.h \ - codec_theora.c \ - codec_theora.h \ codec_ulaw.c \ codec_ulaw.h \ iaxclient_lib.c \ @@ -117,7 +141,9 @@ ringbuffer.h \ portmixer/px_common/portmixer.h \ spandsp/plc.c \ - spandsp/plc.h \ + spandsp/plc.h + +SRCS_VIDEO= \ video.c \ video.h \ videoLib/video_grab.c \ @@ -152,9 +178,14 @@ winfuncs.c \ portmixer/px_win_wmme/px_win_wmme.c +SRCS_WIN32_VIDEO= \ + videoLib/win32/wingrab.cpp + SRCS_LINUX= \ portmixer/px_unix_oss/px_unix_oss.c \ - unixfuncs.c \ + unixfuncs.c + +SRCS_LINUX_VIDEO= \ videoLib/linux/libfg/capture.c \ videoLib/linux/libfg/capture.h \ videoLib/linux/libfg/frame.c \ @@ -164,7 +195,9 @@ SRCS_MACOSX= \ portmixer/px_mac_core/px_mac_core.c \ - unixfuncs.c \ + unixfuncs.c + +SRCS_MACOSX_VIDEO= \ videoLib/macosx/macgrab.c \ videoLib/macosx/vdigGrab.c \ videoLib/macosx/vdigGrab.h Modified: trunk/lib/iaxclient_lib.c =================================================================== --- trunk/lib/iaxclient_lib.c 2007-08-28 19:55:45 UTC (rev 1111) +++ trunk/lib/iaxclient_lib.c 2007-09-03 19:05:46 UTC (rev 1112) @@ -34,7 +34,9 @@ #include "iaxclient_lib.h" #include "audio_portaudio.h" #include "audio_encode.h" +#ifdef USE_VIDEO #include "video.h" +#endif #include "iax-client.h" #include "jitterbuf.h" @@ -114,15 +116,21 @@ static THREAD main_proc_thread; +#ifdef USE_VIDEO static THREAD video_proc_thread; +#endif #if defined(WIN32) || defined(_WIN32_WCE) static THREADID main_proc_thread_id; +#ifdef USE_VIDEO static THREADID video_proc_thread_id; #endif +#endif /* 0 running, 1 should quit, -1 not running */ static int main_proc_thread_flag = -1; +#ifdef USE_VIDEO static int video_proc_thread_flag = -1; +#endif static iaxc_event_callback_t iaxc_event_callback = NULL; @@ -634,11 +642,13 @@ IAXC_FORMAT_SPEEX; audio_format_preferred = IAXC_FORMAT_SPEEX; +#ifdef USE_VIDEO if ( video_initialize() ) { iaxci_usermsg(IAXC_ERROR, "iaxc_initialize: cannot initialize video!\n"); } +#endif return 0; } @@ -650,7 +660,9 @@ get_iaxc_lock(); audio_driver.destroy(&audio_driver); +#ifdef USE_VIDEO video_destroy(); +#endif put_iaxc_lock(); #ifdef WIN32 @@ -759,6 +771,7 @@ return ret; } +#ifdef USE_VIDEO #define VIDEO_STATS_INTERVAL 1000 // In ms static struct timeval video_stats_start; @@ -814,6 +827,7 @@ return 0; } +#endif /* USE_VIDEO */ EXPORT int iaxc_start_processing_thread() { @@ -823,11 +837,13 @@ main_proc_thread_id) == THREADCREATE_ERROR) return -1; +#ifdef USE_VIDEO video_proc_thread_flag = 0; if ( THREADCREATE(video_proc_thread_func, NULL, video_proc_thread, video_proc_thread_id) == THREADCREATE_ERROR) return -1; +#endif return 0; } @@ -840,11 +856,13 @@ THREADJOIN(main_proc_thread); } +#ifdef USE_VIDEO if ( video_proc_thread_flag >= 0 ) { video_proc_thread_flag = 1; THREADJOIN(video_proc_thread); } +#endif return 0; } @@ -1116,6 +1134,7 @@ } while ( total_consumed < e->datalen ); } +#ifdef USE_VIDEO static void handle_video_event(struct iax_event *e, int callNo) { struct iaxc_call *call; @@ -1148,6 +1167,7 @@ } } } +#endif /* USE_VIDEO */ static void iaxc_handle_network_event(struct iax_event *e, int callNo) { @@ -1203,6 +1223,7 @@ callNo); } break; +#ifdef USE_VIDEO case IAX_EVENT_VIDEO: // Mihai: why do we need to lower priority here? // TODO: investigate @@ -1210,6 +1231,7 @@ handle_video_event(e, callNo); //iaxci_prioboostbegin(); break; +#endif case IAX_EVENT_TEXT: handle_text_event(e, callNo); break; @@ -1317,8 +1339,8 @@ EXPORT int iaxc_call(const char * num) { - int video_format_capability; - int video_format_preferred; + int video_format_capability = 0; + int video_format_preferred = 0; int callNo = -1; struct iax_session *newsession; char *ext = strstr(num, "/"); @@ -1377,7 +1399,9 @@ iaxc_note_activity(callNo); calls[callNo].last_ping = calls[callNo].last_activity; +#ifdef USE_VIDEO iaxc_video_format_get_cap(&video_format_preferred, &video_format_capability); +#endif iaxci_usermsg(IAXC_NOTICE, "Originating an %s call", video_format_preferred ? "audio+video" : "audio only"); @@ -1573,8 +1597,10 @@ static void iaxc_handle_connect(struct iax_event * e) { +#ifdef USE_VIDEO int video_format_capability; int video_format_preferred; +#endif int video_format = 0; int format = 0; int callno; @@ -1620,6 +1646,7 @@ return; } +#ifdef USE_VIDEO iaxc_video_format_get_cap(&video_format_preferred, &video_format_capability); @@ -1662,6 +1689,7 @@ return; } } +#endif /* USE_VIDEO */ calls[callno].vformat = video_format; calls[callno].format = format; Modified: trunk/lib/video.c =================================================================== --- trunk/lib/video.c 2007-08-28 19:55:45 UTC (rev 1111) +++ trunk/lib/video.c 2007-09-03 19:05:46 UTC (rev 1112) @@ -23,7 +23,9 @@ #ifdef USE_FFMPEG #include "codec_ffmpeg.h" #endif +#ifdef USE_THEORA #include "codec_theora.h" +#endif #ifdef USE_H264_VSS #include "codec_h264_vss.h" #endif @@ -356,6 +358,7 @@ return NULL; #endif +#ifdef USE_THEORA case IAXC_FORMAT_THEORA: return codec_video_theora_new(format, iaxc_video_width, @@ -363,6 +366,9 @@ iaxc_video_framerate, iaxc_video_bitrate, iaxc_video_fragsize); +#else + return NULL; +#endif } // Must never happen... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |