diff --git a/configure.ac b/configure.ac index 44211f8d..d36ef2fa 100755 --- a/configure.ac +++ b/configure.ac @@ -375,6 +375,7 @@ fi # # Check for libavcodec and libavformat from ffmpeg # + FFMPEG_DIR="yes" FFMPEG_OK="no_found" FFMPEG_OBJ="" @@ -556,47 +557,6 @@ if test "${FFMPEG_OK}" = "found"; then FFMPEG_OBJ="ffmpeg.o" AC_SUBST(FFMPEG_OBJ) - AC_MSG_CHECKING(avformat version 55) - AC_RUN_IFELSE([AC_LANG_SOURCE([ - [ - #include <${AVFORMAT_DIR}> - int main(void){ - if (LIBAVFORMAT_VERSION_MAJOR >= 55) return -1; - return 0; - } - ]])], - [ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(avformat version 53/54) - AC_RUN_IFELSE([AC_LANG_SOURCE([ - [ - #include <${AVFORMAT_DIR}> - int main(void){ - if ((LIBAVFORMAT_VERSION_MAJOR = 53) || (LIBAVFORMAT_VERSION_MAJOR = 54)) return -1; - return 0; - } - ]])], - [AC_MSG_RESULT(no)], - [ - AC_MSG_RESULT(yes) - TEMP_CFLAGS="${TEMP_CFLAGS} -DAVFMT_V53" - RTPS_OBJ="netcam_rtsp.o" - AC_SUBST(RTPS_OBJ) - ] - ) - ], - [ - AC_MSG_RESULT( yes version 55 or higher) - TEMP_CFLAGS="${TEMP_CFLAGS} -DFFMPEG_V55" - RTPS_OBJ="netcam_rtsp.o" - AC_SUBST(RTPS_OBJ) - ] - ) - - - - - AC_MSG_CHECKING([file_protocol is defined in ffmpeg ?]) saved_CFLAGS=$CFLAGS saved_LIBS=$LIBS @@ -625,6 +585,11 @@ if test "${FFMPEG_OK}" = "found"; then fi fi +# Revised RTSP module so that it can be included +# whether or not FFMPEG is found. + + RTPS_OBJ="netcam_rtsp.o" + AC_SUBST(RTPS_OBJ) # # Check SQLITE3 diff --git a/netcam.h b/netcam.h index 6062edff..ec198206 100644 --- a/netcam.h +++ b/netcam.h @@ -297,5 +297,6 @@ int netcam_start (struct context *); int netcam_next (struct context *, unsigned char *); void netcam_cleanup (struct netcam_context *, int); ssize_t netcam_recv(netcam_context_ptr, void *, size_t); +void netcam_url_free(struct url_t *parse_url); #endif diff --git a/netcam_rtsp.h b/netcam_rtsp.h index a1770ed0..876b21eb 100644 --- a/netcam_rtsp.h +++ b/netcam_rtsp.h @@ -1,11 +1,13 @@ #include "netcam.h" + +#ifdef HAVE_FFMPEG + #include #include #include #include #include - struct rtsp_context { AVFormatContext* format_context; AVCodecContext* codec_context; @@ -18,8 +20,21 @@ struct rtsp_context { int connected; struct timeval startreadtime; }; +#else +/**************************************** + * Dummy context for when no FFMPEG/Libav + * is on machine. These need to be primitive + * data types + *****************************************/ +struct rtsp_context { + int* format_context; + int readingframe; + int connected; +}; +#endif struct rtsp_context *rtsp_new_context(void); void netcam_shutdown_rtsp(netcam_context_ptr netcam); -int rtsp_connect(netcam_context_ptr netcam); +int netcam_connect_rtsp(netcam_context_ptr netcam); int netcam_read_rtsp_image(netcam_context_ptr netcam); +int netcam_setup_rtsp(netcam_context_ptr netcam, struct url_t *url);