1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-19 13:21:13 +00:00

cleanup detection of various divx4 versions/alternatives

allows mixing xvid with divx4/5linux libs

basic rule: -vfm odivx/divx4 and -ovc divx4 uses divx4/5linux/opendivx if
available, otherwise uses xvid (if divx4.h is available and xvid has
decore()/encore() functions).

based on patch by Kim Minh Kaplan <kmkaplan@selfoffice.com>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9301 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2003-02-06 20:24:14 +00:00
parent af78689681
commit 705681b0db
7 changed files with 71 additions and 48 deletions

View File

@ -35,7 +35,7 @@ OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB)
AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(XVID_LIB) $(DECORE_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB)
CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB)
COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a $(PP_LIB) postproc/libswscale.a linux/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(STREAMING_LIB) $(WIN32_LIB) $(GIF_LIB)
CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) # -Wall
@ -228,7 +228,7 @@ $(PRG_FIBMAP): fibmap_mplayer.o
ifeq ($(MENCODER),yes)
$(PRG_MENCODER): $(MENCODER_DEP)
./darwinfixlib.sh $(MENCODER_DEP) libmpcodecs/libmpencoders.a
$(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) libmpcodecs/libmpencoders.a $(COMMON_LIBS) $(EXTRA_LIB) $(ENCORE_LIB) $(MLIB_LIB) $(LIRC_LIB) $(ARCH_LIB) -lm
$(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) libmpcodecs/libmpencoders.a $(ENCORE_LIB) $(COMMON_LIBS) $(EXTRA_LIB) $(MLIB_LIB) $(LIRC_LIB) $(ARCH_LIB) -lm
endif
codecs.conf.h: $(PRG_CFG)

View File

@ -73,7 +73,11 @@ struct config ovc_conf[]={
" frameno - special audio-only file for 3-pass encoding, see DOCS!\n"
" rawrgb - uncompressed RGB 24bpp video\n"
#ifdef HAVE_DIVX4ENCORE
" divx4 - using divx4linux/divx5linux or xvid (depends on configuration)\n"
#ifdef ENCORE_XVID
" divx4 - using XviD (divx4linux compat. mode)\n"
#else
" divx4 - using divx4linux/divx5linux lib (depends on configuration)\n"
#endif
#endif
#ifdef USE_LIBAVCODEC
" lavc - using libavcodec codecs - best quality!\n"

65
configure vendored
View File

@ -4141,31 +4141,29 @@ echores "$_bl"
echocheck "XviD"
cat > $TMPC << EOF
#include <xvid.h>
#include <divx4.h>
int main(void) { xvid_init(0, 0, 0, 0); return 0; }
EOF
if test "$_xvid" != no && cc_check -lm "$_xvidcore" ; then
if test "$_xvid" != no && cc_check "$_xvidcore" -lm ; then
_xvid=yes
_ld_xvid="$_xvidcore"
_def_xvid='#define HAVE_XVID 1'
_def_divx4_h='#define HAVE_DIVX4_H 1'
_codecmodules="xvid $_codecmodules"
elif test "$_xvid" != no && cc_check -lm -lxvidcore ; then
elif test "$_xvid" != no && cc_check -lxvidcore -lm ; then
_xvid=yes
_ld_xvid='-lxvidcore'
_def_xvid='#define HAVE_XVID 1'
_def_divx4_h='#define HAVE_DIVX4_H 1'
_codecmodules="xvid $_codecmodules"
else
_xvid=no
_ld_xvid=''
_def_xvid='#undef HAVE_XVID'
_def_divx4_h='#undef HAVE_DIVX4_H'
_nocodecmodules="xvid $_nocodecmodules"
fi
echores "$_xvid"
_xvidcompat=no
_def_decore_xvid='#undef DECORE_XVID'
_def_encore_xvid='#undef ENCORE_XVID'
if test "$_xvid" = yes ; then
echocheck "DivX4 compatibility in XviD"
cat > $TMPC << EOF
@ -4176,16 +4174,7 @@ EOF
echores "$_xvidcompat"
fi
if test "$_xvidcompat" != no ; then
_divx4linux=no
_opendivx=no
_ld_decore=''
_def_decore='#define NEW_DECORE 1'
_def_divx='#define USE_DIVX 1'
_def_divx5='#undef DECORE_DIVX5'
_def_odivx_postprocess='#undef HAVE_ODIVX_POSTPROCESS'
_nocodecmodules="opendivx divx5linux divx4linux $_nocodecmodules"
else
echocheck "DivX4linux/DivX5linux/OpenDivX decore"
# DivX5: DEC_OPT_MEMORY_REQS - DivX4: DEC_OPT_FRAME_311
cat > $TMPC << EOF
@ -4193,7 +4182,6 @@ cat > $TMPC << EOF
int main(void) { (void) decore(0, 0, 0, 0); return DEC_OPT_FRAME_311; }
EOF
if test "$_divx4linux" != no && cc_check -lm -ldivxdecore -lm ; then
_divx4linux=yes
_opendivx=no
_ld_decore='-ldivxdecore'
_def_decore='#define NEW_DECORE 1'
@ -4202,7 +4190,8 @@ if test "$_divx4linux" != no && cc_check -lm -ldivxdecore -lm ; then
_def_odivx_postprocess='#undef HAVE_ODIVX_POSTPROCESS'
_codecmodules="divx4linux $_codecmodules"
echores "DivX4linux (with libdivxdecore.so)"
elif test "$_divx4linux" != no ; then
else
# if test "$_divx4linux" != no ; then
# DivX5 check
# OdivxPP disabled because of:
# ld: Warning: type of symbol `dering' changed from 1 to 2 in opendivx/postprocess.o
@ -4210,8 +4199,7 @@ cat > $TMPC << EOF
#include <decore.h>
int main(void) { (void) decore(0, 0, 0, 0); return DEC_OPT_MEMORY_REQS; }
EOF
if cc_check -lm -ldivxdecore -lm ; then
_divx4linux=yes
if test "$_divx4linux" != no && cc_check -lm -ldivxdecore -lm ; then
_opendivx=no
# _ld_decore='-ldivxdecore opendivx/postprocess.o'
_ld_decore='-ldivxdecore'
@ -4224,7 +4212,6 @@ if cc_check -lm -ldivxdecore -lm ; then
_nocodecmodules="divx4linux $_nocodecmodules"
echores "DivX5linux (with libdivxdecore.so)"
elif test "$_opendivx" != no ; then
_divx4linux=no
_opendivx=yes
_ld_decore='opendivx/libdecore.a'
_def_decore='#undef NEW_DECORE'
@ -4234,8 +4221,17 @@ elif test "$_opendivx" != no ; then
_codecmodules="opendivx $_codecmodules"
_nocodecmodules="divx5linux $_nocodecmodules"
echores "OpenDivX"
elif test "$_xvidcompat" = yes ; then
_opendivx=no
_ld_decore=''
_def_decore='#define NEW_DECORE 1'
_def_divx='#define USE_DIVX 1'
_def_divx5='#undef DECORE_DIVX5'
_def_decore_xvid='#define DECORE_XVID 1'
_def_odivx_postprocess='#undef HAVE_ODIVX_POSTPROCESS'
_nocodecmodules="opendivx divx5linux divx4linux $_nocodecmodules"
echores "XviD compat."
else
_divx4linux=no
_opendivx=no
_ld_decore=''
_def_decore='#undef NEW_DECORE'
@ -4247,7 +4243,6 @@ else
fi # DivX5 check
fi
fi # XviD divx4 compatiblity check
# mencoder requires (optional) those libs: libmp3lame and divx4linux encore
if test "$_mencoder" != no ; then
@ -4269,27 +4264,25 @@ EOF
echores "$_mp3lame"
echocheck "XviD/DivX4linux encore (for mencoder)"
echocheck "DivX4linux encore (for mencoder)"
cat > $TMPC << EOF
#include <encore2.h>
int main(void) { (void) encore(0, 0, 0, 0); return 0; }
EOF
if test "$_xvid" != no && test "$_xvidcore" && cc_check -lm "$_xvidcore" ; then
_def_encore='#define HAVE_DIVX4ENCORE 1'
_ld_encore="$_xvidcore"
echores "XviD (with $_xvidcore)"
elif test "$_xvid" != no && cc_check -lm -lxvidcore ; then
_def_encore='#define HAVE_DIVX4ENCORE 1'
_ld_encore='-lxvidcore'
echores "XviD (with libxvidcore.so)"
elif test "$_divx4linux" != no && cc_check -lm -ldivxencore ; then
if test "$_divx4linux" != no && cc_check -ldivxencore -lm ; then
_def_encore='#define HAVE_DIVX4ENCORE 1'
_ld_encore='-ldivxencore'
echores "DivX4linux (with libdivxencore.so)"
elif test "$_xvidcompat" = yes ; then
_def_encore='#define HAVE_DIVX4ENCORE 1'
_ld_encore=''
_def_encore_xvid='#define ENCORE_XVID 1'
echores "XviD compat."
else
_def_encore='#undef HAVE_DIVX4ENCORE'
echores "no"
fi
fi
echocheck "mencoder"
@ -4849,7 +4842,6 @@ FAME_LIB = $_ld_fame
MP1E_DEP = $_dep_mp1e
MP1E_LIB = $_ld_mp1e
ARCH_LIB = $_ld_arch $_ld_iconv
DIVX4LINUX = $_divx4linux
XVID = $_xvid
XVID_LIB = $_ld_xvid
DECORE_LIB = $_ld_decore
@ -4964,9 +4956,8 @@ $_def_divx5
/* Define if you are using XviD library */
$_def_xvid
/* Define if you have divx4.h in place of decore.h */
$_def_divx4_h
$_def_decore_xvid
$_def_encore_xvid
/* Define to include support for libdv-0.9.5 */
$_def_libdv

View File

@ -14,19 +14,27 @@
static vd_info_t info = {
#ifdef DECORE_DIVX5
"DivX5Linux lib (divx4 mode)",
"DivX5Linux lib",
#else
"DivX4Linux lib (divx4 mode)",
#ifdef DECORE_XVID
"XviD lib (divx4 compat.)",
#else
"DivX4Linux lib",
#endif
#endif
"divx4",
"A'rpi",
#ifdef DECORE_XVID
"http://www.xvid.com",
#else
"http://www.divx.com",
#endif
"native binary codec"
};
LIBVD_EXTERN(divx4)
#ifdef HAVE_DIVX4_H
#ifdef DECORE_XVID
#include <divx4.h>
#else
#include <decore.h>

View File

@ -13,9 +13,13 @@
static vd_info_t info = {
#ifdef NEW_DECORE
#ifdef DECORE_DIVX5
"DivX5Linux lib (odivx mode)",
"DivX5Linux lib (odivx compat.)",
#else
"DivX4Linux lib (odivx mode)",
#ifdef DECORE_XVID
"XviD lib (odivx compat.)",
#else
"DivX4Linux lib (odivx compat.)",
#endif
#endif
#else
"Opendivx 0.48 codec",
@ -23,7 +27,11 @@ static vd_info_t info = {
"odivx",
"A'rpi",
#ifdef NEW_DECORE
#ifdef DECORE_XVID
"http://www.xvid.com",
#else
"http://www.divx.com",
#endif
#else
"http://www.projectmayo.org",
#endif
@ -39,7 +47,7 @@ LIBVD_EXTERN(odivx)
#ifndef NEW_DECORE
#include "opendivx/decore.h"
#include "postproc/postprocess.h"
#elif HAVE_DIVX4_H
#elif DECORE_XVID
#include <divx4.h>
#else
#include <decore.h>

View File

@ -9,9 +9,17 @@
#include "vd_internal.h"
#include "cfgparser.h"
#include <divx4.h>
#include <xvid.h>
typedef struct
{
void *y;
void *u;
void *v;
int stride_y;
int stride_uv;
}
DIVX4_DEC_PICTURE;
#ifdef XVID_API_UNSTABLE
#warning *******************************************************************
@ -178,7 +186,7 @@ static void uninit(sh_video_t *sh){
// decode a frame
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
XVID_DEC_FRAME dec;
DEC_PICTURE d4_pic;
DIVX4_DEC_PICTURE d4_pic;
#ifdef XVID_CSP_EXTERN
XVID_DEC_PICTURE pic;
#endif

View File

@ -45,7 +45,11 @@
static int pass;
extern char* passtmpfile;
#ifdef ENCORE_XVID
#include <divx4.h>
#else
#include <encore2.h>
#endif
#ifndef ENCORE_MAJOR_VERSION
#define ENCORE_MAJOR_VERSION 4000