New configure and isolation of RTSP

This commit is contained in:
Dave
2014-06-27 22:36:47 -06:00
parent 05f915c261
commit b9b4ef6b4d
3 changed files with 24 additions and 43 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1,11 +1,13 @@
#include "netcam.h"
#ifdef HAVE_FFMPEG
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libavutil/avutil.h>
#include <libavutil/imgutils.h>
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);