Commit 211ea811 authored by jehan's avatar jehan

fix 32 video issue on macosx, enable video build with SWSCALE only

parent 08e53b3a
......@@ -106,12 +106,13 @@ AC_DEFUN([MS_CHECK_VIDEO],[
if test "$ffmpeg" = "true"; then
dnl test for ffmpeg presence
PKG_CHECK_MODULES(FFMPEG, [libavcodec >= 51.0.0 ],ffmpeg_found=yes , ffmpeg_found=no)
if test x$ffmpeg_found = xno ; then
AC_MSG_ERROR([Could not find libavcodec (from ffmpeg) headers and library. This is mandatory for video support])
PKG_CHECK_MODULES(FFMPEG, [libavcodec >= 51.0.0 ],avcodec_found=yes , avcodec_found=no)
if test x$avcodec_found = xno ; then
AC_MSG_WARN([Could not find libavcodec (from ffmpeg) headers and library.])
else
FFMPEG_LIBS="$FFMPEG_LIBS -lavutil"
fi
FFMPEG_LIBS="$FFMPEG_LIBS -lavutil"
PKG_CHECK_MODULES(SWSCALE, [libswscale >= 0.7.0 ],swscale_found=yes , swscale_found=no)
if test x$swscale_found = xno ; then
......@@ -124,11 +125,13 @@ AC_DEFUN([MS_CHECK_VIDEO],[
AC_CHECK_HEADERS(libavcodec/avcodec.h)
CPPFLAGS=$CPPFLAGS_save
LIBS_save=$LIBS
dnl to workaround a bug on debian and ubuntu, check if libavcodec needs -lvorbisenc to compile
AC_CHECK_LIB(avcodec,avcodec_register_all, novorbis=yes , [
LIBS="$LIBS -lvorbisenc"
], $FFMPEG_LIBS )
LIBS=$LIBS_save
dnl when swscale feature is not provided by
dnl libswscale, its features are swallowed by
dnl libavcodec, but without swscale.h and without any
......
......@@ -622,7 +622,8 @@ AM_CONDITIONAL(BUILD_THEORA, test "$have_theora" = "yes")
AM_CONDITIONAL(BUILD_VP8, test "$have_vp8" = "yes")
AM_CONDITIONAL(BUILD_WIN32, test "$mingw_found" = "yes")
AM_CONDITIONAL(BUILD_WIN32_WCE, test "$mingw32ce_found" = "yes")
AM_CONDITIONAL(BUILD_FFMPEG, test "$ffmpeg" = "true")
AM_CONDITIONAL(BUILD_AVCODEC, test x$avcodec_found = xyes)
AM_CONDITIONAL(BUILD_SWSCALE, test x$swscale_found = xyes)
AM_CONDITIONAL(BUILD_SDL,test "$sdl_found" = "true" )
AM_CONDITIONAL(BUILD_X11_XV, test "$enable_xv" = "true" )
AM_CONDITIONAL(BUILD_X11_GL, test "$enable_glx" = "true" )
......
......@@ -203,14 +203,15 @@ if BUILD_VP8
libmediastreamer_voip_la_SOURCES+= videofilters/vp8.c
endif
if BUILD_FFMPEG
if BUILD_AVCODEC
libmediastreamer_voip_la_SOURCES+= videofilters/videoenc.c \
videofilters/videodec.c \
utils/swscale.h \
utils/ffmpeg-priv.h \
utils/ffmpeg-priv.c \
videofilters/h264dec.c \
videofilters/jpegwriter.c
videofilters/jpegwriter.c \
videofilters/nowebcam.c voip/nowebcam.h
endif
if BUILD_SDL
......@@ -234,8 +235,7 @@ libmediastreamer_voip_la_SOURCES+= voip/rfc2429.h \
voip/rfc3984.c \
videofilters/mire.c \
videofilters/extdisplay.c \
voip/layouts.c voip/layouts.h \
videofilters/nowebcam.c voip/nowebcam.h
voip/layouts.c voip/layouts.h
if ORTP_ENABLED
libmediastreamer_voip_la_SOURCES+= voip/videostream.c
......
......@@ -35,24 +35,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* new layout */
# include <libavcodec/avcodec.h>
# include <libavutil/avutil.h>
#else
/* old layout */
# include <ffmpeg/avcodec.h>
# include <ffmpeg/avutil.h>
#endif
#if defined(HAVE_LIBSWSCALE_SWSCALE_H)
/* new layout */
# include <libswscale/swscale.h>
# elif !defined(HAVE_LIBAVCODEC_AVCODEC_H)
/* old layout */
# include <ffmpeg/swscale.h>
#else
/* swscale.h not delivered: use linphone private version */
# include "swscale.h"
#endif
#if HAVE_LIBAVCODEC_AVCODEC_H
#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52,24,0)
/*should work as long as nobody uses avformat.h*/
typedef struct AVPacket{
......@@ -86,4 +76,5 @@ void avcodec_get_context_defaults(AVCodecContext *s);
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
#endif
#endif
#endif /*iHAVE_LIBAVCODEC_AVCODEC_H*/
#endif /* FFMPEG_PRIV_H */
......@@ -31,7 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct v4mState;
// Define != NULL to have QT Framework convert hardware device pixel format to another one.
#if TARGET_CPU_X86 /*for an unknown reason kCVPixelFormatType_420YpCbCr8Planar does not work for 32bits compilation*/
static OSType forcedPixelFormat=kCVPixelFormatType_24RGB;
#else
static OSType forcedPixelFormat=kCVPixelFormatType_420YpCbCr8Planar;
#endif
//static OSType forcedPixelFormat=0;
static MSPixFmt ostype_to_pix_fmt(OSType pixelFormat, bool printFmtName){
......@@ -49,6 +53,9 @@ static MSPixFmt ostype_to_pix_fmt(OSType pixelFormat, bool printFmtName){
case k32RGBAPixelFormat:
if (printFmtName) ms_message("FORMAT = MS_RGBA32");
return MS_RGBA32;
case kCVPixelFormatType_24RGB:
if (printFmtName) ms_message("FORMAT = MS_RGB24");
return MS_RGB24;
default:
if (printFmtName) ms_message("Format unknown: %i", (UInt32) pixelFormat);
return MS_PIX_FMT_UNKNOWN;
......@@ -224,7 +231,7 @@ static MSPixFmt ostype_to_pix_fmt(OSType pixelFormat, bool printFmtName){
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInteger:[[old_dic objectForKey:(id)kCVPixelBufferWidthKey] integerValue]], (id)kCVPixelBufferWidthKey,
[NSNumber numberWithInteger:[[old_dic objectForKey:(id)kCVPixelBufferHeightKey] integerValue]],(id)kCVPixelBufferHeightKey,
[NSNumber numberWithInteger:kCVPixelFormatType_420YpCbCr8Planar], (id)kCVPixelBufferPixelFormatTypeKey,
[NSNumber numberWithUnsignedInteger:kCVPixelFormatType_420YpCbCr8Planar], (id)kCVPixelBufferPixelFormatTypeKey,
nil];
[output setPixelBufferAttributes:dic];
}
......@@ -281,7 +288,7 @@ static MSPixFmt ostype_to_pix_fmt(OSType pixelFormat, bool printFmtName){
dic = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInteger:size.width], (id)kCVPixelBufferWidthKey,
[NSNumber numberWithInteger:size.height],(id)kCVPixelBufferHeightKey,
[NSNumber numberWithInteger:forcedPixelFormat], (id)kCVPixelBufferPixelFormatTypeKey, // force pixel format to plannar
[NSNumber numberWithUnsignedInt:forcedPixelFormat], (id)kCVPixelBufferPixelFormatTypeKey, // force pixel format to plannar
nil];
} else {
dic = [NSDictionary dictionaryWithObjectsAndKeys:
......
......@@ -170,12 +170,11 @@ extern MSWebCamDesc ms_dshow_cam_desc;
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
extern MSWebCamDesc ms_v4m_cam_desc;
#endif
#if HAVE_LIBAVCODEC_AVCODEC_H || TARGET_OS_IPHONE
extern MSWebCamDesc static_image_desc;
#endif
#if !defined(NO_FFMPEG)
extern MSWebCamDesc mire_desc;
#endif
#ifdef ANDROID
extern MSWebCamDesc ms_android_video_capture_desc;
#endif
......@@ -209,10 +208,10 @@ static MSWebCamDesc * ms_web_cam_descs[]={
#if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
&ms_v4ios_cam_desc,
#endif
#if !defined(NO_FFMPEG)
&mire_desc,
#endif
#if HAVE_LIBAVCODEC_AVCODEC_H || TARGET_OS_IPHONE
&static_image_desc,
#endif
#endif /*MS2_FILTERS */
NULL
};
......@@ -242,7 +241,7 @@ void ms_voip_init(){
ms_web_cam_manager_register_desc(wm,ms_web_cam_descs[i]);
}
}
#if defined(MS2_FILTERS) && !defined(NO_FFMPEG)
#if defined(MS2_FILTERS) && !defined(NO_FFMPEG) && defined(HAVE_LIBAVCODEC_AVCODEC_H)
ms_ffmpeg_check_init();
__register_ffmpeg_encoders_if_possible();
#endif
......
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