Commit 7a58421b authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Really fix compilation with PCAP.

parent 07779d3e
...@@ -717,13 +717,6 @@ fi ...@@ -717,13 +717,6 @@ fi
AC_PATH_PROG(PCAP,pcap-config,false) AC_PATH_PROG(PCAP,pcap-config,false)
AM_CONDITIONAL(HAVE_PCAP, test $PCAP != false) AM_CONDITIONAL(HAVE_PCAP, test $PCAP != false)
if test $PCAP != false ; then
PCAP_LIBS=`pcap-config --libs`
PCAP_CFLAGS=`pcap-config --cflags`
PCAP_CFLAGS="$PCAP_CFLAGS -DHAVE_PCAP"
AC_SUBST(PCAP_LIBS)
AC_SUBST(PCAP_CFLAGS)
fi
AC_ARG_ENABLE(pcap, AC_ARG_ENABLE(pcap,
[AS_HELP_STRING([--enable-pcap], [Enable pcap library (default=no)])], [AS_HELP_STRING([--enable-pcap], [Enable pcap library (default=no)])],
[case "${enableval}" in [case "${enableval}" in
...@@ -733,7 +726,13 @@ AC_ARG_ENABLE(pcap, ...@@ -733,7 +726,13 @@ AC_ARG_ENABLE(pcap,
esac], [enable_pcap=no]) esac], [enable_pcap=no])
AM_CONDITIONAL(ENABLE_PCAP, test x$enable_pcap = xyes) AM_CONDITIONAL(ENABLE_PCAP, test x$enable_pcap = xyes)
if test x$enable_pcap == xyes ; then if test x$enable_pcap == xyes ; then
PCAP_CFLAGS="$PCAP_CFLAGS -DENABLE_PCAP" if test $PCAP != false ; then
PCAP_LIBS=`pcap-config --libs`
PCAP_CFLAGS=`pcap-config --cflags`
PCAP_CFLAGS="$PCAP_CFLAGS -DHAVE_PCAP"
AC_SUBST(PCAP_LIBS)
AC_SUBST(PCAP_CFLAGS)
fi
fi fi
......
...@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/waveheader.h" #include "mediastreamer2/waveheader.h"
#include "mediastreamer2/msticker.h" #include "mediastreamer2/msticker.h"
#if defined(HAVE_PCAP) && defined(ENABLE_PCAP) #ifdef HAVE_PCAP
#include <pcap/pcap.h> #include <pcap/pcap.h>
#endif #endif
...@@ -44,7 +44,7 @@ struct _PlayerData{ ...@@ -44,7 +44,7 @@ struct _PlayerData{
int samplesize; int samplesize;
uint32_t ts; uint32_t ts;
bool_t swap; bool_t swap;
#if defined(HAVE_PCAP) && defined(ENABLE_PCAP) #ifdef HAVE_PCAP
pcap_t *pcap; pcap_t *pcap;
struct pcap_pkthdr *pcap_hdr; struct pcap_pkthdr *pcap_hdr;
const u_char *pcap_data; const u_char *pcap_data;
...@@ -69,7 +69,7 @@ static void player_init(MSFilter *f){ ...@@ -69,7 +69,7 @@ static void player_init(MSFilter *f){
d->pause_time=0; d->pause_time=0;
d->count=0; d->count=0;
d->ts=0; d->ts=0;
#if defined(HAVE_PCAP) && defined(ENABLE_PCAP) #ifdef HAVE_PCAP
d->pcap = NULL; d->pcap = NULL;
d->pcap_hdr = NULL; d->pcap_hdr = NULL;
d->pcap_data = NULL; d->pcap_data = NULL;
...@@ -166,7 +166,7 @@ static int player_open(MSFilter *f, void *arg){ ...@@ -166,7 +166,7 @@ static int player_open(MSFilter *f, void *arg){
d->state=MSPlayerPaused; d->state=MSPlayerPaused;
d->fd=fd; d->fd=fd;
d->ts=0; d->ts=0;
#if defined(HAVE_PCAP) && defined(ENABLE_PCAP) #ifdef HAVE_PCAP
d->pcap = NULL; d->pcap = NULL;
d->pcap_started = FALSE; d->pcap_started = FALSE;
if (strstr(file, ".pcap")) { if (strstr(file, ".pcap")) {
...@@ -217,7 +217,7 @@ static int player_pause(MSFilter *f, void *arg){ ...@@ -217,7 +217,7 @@ static int player_pause(MSFilter *f, void *arg){
static int player_close(MSFilter *f, void *arg){ static int player_close(MSFilter *f, void *arg){
PlayerData *d=(PlayerData*)f->data; PlayerData *d=(PlayerData*)f->data;
player_stop(f,NULL); player_stop(f,NULL);
#if defined(HAVE_PCAP) && defined(ENABLE_PCAP) #ifdef HAVE_PCAP
if (d->pcap) pcap_close(d->pcap); if (d->pcap) pcap_close(d->pcap);
#endif #endif
if (d->fd>=0) close(d->fd); if (d->fd>=0) close(d->fd);
...@@ -265,7 +265,7 @@ static void player_process(MSFilter *f){ ...@@ -265,7 +265,7 @@ static void player_process(MSFilter *f){
d->count++; d->count++;
ms_filter_lock(f); ms_filter_lock(f);
if (d->state==MSPlayerPlaying){ if (d->state==MSPlayerPlaying){
#if defined(HAVE_PCAP) && defined(ENABLE_PCAP) #ifdef HAVE_PCAP
if (d->pcap) { if (d->pcap) {
int res; int res;
bool_t cont = TRUE; bool_t cont = TRUE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment