0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

Merge svn changes up to r31020

This commit is contained in:
Uoti Urpala 2010-04-26 18:06:00 +03:00
commit 837c48ddee
9 changed files with 168 additions and 104 deletions

117
configure vendored
View File

@ -6587,7 +6587,7 @@ int main(void) { unsigned long x, y; faacEncOpen(48000, 2, &x, &y); return 0; }
EOF
_faac=no
for _ld_faac in "-lfaac" "-lfaac -lmp4v2 -lstdc++" ; do
cc_check -O2 $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break
cc_check $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break
done
fi
if test "$_faac" = yes ; then
@ -7818,46 +7818,47 @@ MAN_LANG_ALL = $man_lang_all
MSG_LANGS = $language_msg
MSG_LANG_ALL = $msg_lang_all
prefix = \$(DESTDIR)$_prefix
BINDIR = \$(DESTDIR)$_bindir
prefix = \$(DESTDIR)$_prefix
BINDIR = \$(DESTDIR)$_bindir
DATADIR = \$(DESTDIR)$_datadir
LIBDIR = \$(DESTDIR)$_libdir
MANDIR = \$(DESTDIR)$_mandir
LIBDIR = \$(DESTDIR)$_libdir
MANDIR = \$(DESTDIR)$_mandir
CONFDIR = \$(DESTDIR)$_confdir
LOCALEDIR = \$(DESTDIR)$_localedir
AR = $_ar
AS = $_cc
CC = $_cc
CXX = $_cc
AR = $_ar
AS = $_cc
CC = $_cc
CXX = $_cc
HOST_CC = $_host_cc
INSTALL = $_install
INSTALLSTRIP = $_install_strip
WINDRES = $_windres
CFLAGS = $CFLAGS $extra_cflags
CFLAGS = $CFLAGS $extra_cflags
CXXFLAGS = $CXXFLAGS $extra_cflags $extra_cxxflags
CFLAGS_DHAHELPER = $cflags_dhahelper
CFLAGS_FAAD_FIXED = $cflags_faad_fixed
CFLAGS_LIBDVDCSS = $cflags_libdvdcss
CFLAGS_LIBDVDCSS_DVDREAD = $cflags_libdvdcss_dvdread
CFLAGS_LIBDVDNAV = $cflags_libdvdnav
CFLAGS_NO_OMIT_LEAF_FRAME_POINTER = $cflags_no_omit_leaf_frame_pointer
CFLAGS_STACKREALIGN = $cflags_stackrealign
CFLAGS_SVGALIB_HELPER = $cflags_svgalib_helper
CFLAGS_TREMOR_LOW = $cflags_tremor_low
EXTRALIBS = $extra_ldflags $_ld_static $_ld_lm $extra_libs
EXTRALIBS_MPLAYER = $libs_mplayer
CFLAGS_DHAHELPER = $cflags_dhahelper
CFLAGS_FAAD_FIXED = $cflags_faad_fixed
CFLAGS_LIBDVDCSS = $cflags_libdvdcss
CFLAGS_LIBDVDCSS_DVDREAD = $cflags_libdvdcss_dvdread
CFLAGS_LIBDVDNAV = $cflags_libdvdnav
CFLAGS_NO_OMIT_LEAF_FRAME_POINTER = $cflags_no_omit_leaf_frame_pointer
CFLAGS_STACKREALIGN = $cflags_stackrealign
CFLAGS_SVGALIB_HELPER = $cflags_svgalib_helper
CFLAGS_TREMOR_LOW = $cflags_tremor_low
EXTRALIBS = $extra_ldflags $_ld_static $_ld_lm $extra_libs
EXTRALIBS_MPLAYER = $libs_mplayer
EXTRALIBS_MENCODER = $libs_mencoder
MPDEPEND_CMD = \$(CC) -MM \$(CFLAGS) \$(filter-out %.xpm,\$(filter-out %.h,$^)) | sed -e "s,[0-9a-z._-]*: \([a-z0-9/]*/\)[^/]* ,\1&," -e "s,\(.*\)\.o: ,\1.d &,"
MPDEPEND_CMD_CXX = \$(CC) -MM \$(CXXFLAGS) \$(filter-out %.hh,\$(filter-out %.h,$^)) | sed -e "s,[0-9a-z._-]*: \([a-z0-9/]*/\)[^/]* ,\1&," -e "s,\(.*\)\.o: ,\1.d &,"
MPDEPEND_CMD_CXX = \$(CC) -MM \$(CXXFLAGS) \$(filter-out %.hh,\$(filter-out %.h,$^)) | sed -e "s,[0-9a-z._-]*: \([a-z0-9/]*/\)[^/]* ,\1&," -e "s,\(.*\)\.o: ,\1.d &,"
GETCH = $_getch
TIMER = $_timer
EXESUF = $_exesuf
EXESUF = $_exesuf
EXESUFS_ALL = .exe
ARCH = $arch
@ -7866,16 +7867,16 @@ $(mak_enable "$subarch_all" "$subarch" ARCH)
$(mak_enable "$cpuexts_all" "$cpuexts" HAVE)
MENCODER = $_mencoder
MPLAYER = $_mplayer
MPLAYER = $_mplayer
NEED_GETTIMEOFDAY = $_need_gettimeofday
NEED_GLOB = $_need_glob
NEED_MMAP = $_need_mmap
NEED_SETENV = $_need_setenv
NEED_SHMEM = $_need_shmem
NEED_STRSEP = $_need_strsep
NEED_SWAB = $_need_swab
NEED_VSSCANF = $_need_vsscanf
NEED_GETTIMEOFDAY = $_need_gettimeofday
NEED_GLOB = $_need_glob
NEED_MMAP = $_need_mmap
NEED_SETENV = $_need_setenv
NEED_SHMEM = $_need_shmem
NEED_STRSEP = $_need_strsep
NEED_SWAB = $_need_swab
NEED_VSSCANF = $_need_vsscanf
# features
3DFX = $_3dfx
@ -8034,41 +8035,41 @@ YUV4MPEG = $_yuv4mpeg
ZR = $_zr
# FFmpeg
LIBAVUTIL = $_libavutil
LIBAVCODEC = $_libavcodec
LIBAVFORMAT = $_libavformat
LIBPOSTPROC = $_libpostproc
LIBSWSCALE = $_libswscale
LIBAVUTIL = $_libavutil
LIBAVCODEC = $_libavcodec
LIBAVFORMAT = $_libavformat
LIBPOSTPROC = $_libpostproc
LIBSWSCALE = $_libswscale
LIBAVCODEC_INTERNALS = $_libavcodec_internals
LIBSWSCALE_INTERNALS = $_libswscale_internals
FFMPEG_SOURCE_PATH = $_ffmpeg_source
RANLIB = $_ranlib
YASM = $_yasm
YASMFLAGS = $YASMFLAGS
RANLIB = $_ranlib
YASM = $_yasm
YASMFLAGS = $YASMFLAGS
# Some FFmpeg codecs depend on these. Enable them unconditionally for now.
CONFIG_AANDCT=yes
CONFIG_FFT=yes
CONFIG_GOLOMB=yes
CONFIG_H264DSP=yes
CONFIG_LPC=yes
CONFIG_MDCT=yes
CONFIG_RDFT=yes
CONFIG_AANDCT = yes
CONFIG_FFT = yes
CONFIG_GOLOMB = yes
CONFIG_H264DSP = yes
CONFIG_LPC = yes
CONFIG_MDCT = yes
CONFIG_RDFT = yes
CONFIG_BZLIB=$bzlib
CONFIG_ENCODERS=yes
CONFIG_GPL=yes
CONFIG_MLIB = $_mlib
CONFIG_MUXERS=$_mencoder
CONFIG_VDPAU=$_vdpau
CONFIG_XVMC=$_xvmc
CONFIG_ZLIB=$_zlib
CONFIG_BZLIB = $bzlib
CONFIG_ENCODERS = yes
CONFIG_GPL = yes
CONFIG_MLIB = $_mlib
CONFIG_MUXERS = $_mencoder
CONFIG_VDPAU = $_vdpau
CONFIG_XVMC = $_xvmc
CONFIG_ZLIB = $_zlib
HAVE_PTHREADS = $_pthreads
HAVE_SHM = $_shm
HAVE_PTHREADS = $_pthreads
HAVE_SHM = $_shm
HAVE_W32THREADS = $_w32threads
HAVE_YASM = $have_yasm
HAVE_YASM = $have_yasm
EOF

View File

@ -91,7 +91,7 @@ static void blur_line_c(uint16_t *dc, uint16_t *buf, uint16_t *buf1,
}
}
#if HAVE_SSSE3
#if HAVE_MMX2
static void filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc,
int width, int thresh, const uint16_t *dithers)
{
@ -138,7 +138,9 @@ static void filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc,
:"memory"
);
}
#endif
#if HAVE_SSSE3
static void filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc,
int width, int thresh, const uint16_t *dithers)
{
@ -184,7 +186,9 @@ static void filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc,
:"memory"
);
}
#endif // HAVE_SSSE3
#if HAVE_6REGS && HAVE_SSE2
#define BLURV(load)\
intptr_t x = -2*width;\
__asm__ volatile(\
@ -218,7 +222,6 @@ static void filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc,
:"memory"\
);
#if HAVE_6REGS
static void blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1,
uint8_t *src, int sstride, int width)
{
@ -228,8 +231,7 @@ static void blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1,
BLURV("movdqa");
}
}
#endif // HAVE_6REGS
#endif // HAVE_SSSE3
#endif // HAVE_6REGS && HAVE_SSE2
static void filter(struct vf_priv_s *ctx, uint8_t *dst, uint8_t *src,
int width, int height, int dstride, int sstride, int r)
@ -383,13 +385,15 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->priv->blur_line = blur_line_c;
vf->priv->filter_line = filter_line_c;
#if HAVE_SSSE3
#if HAVE_6REGS
#if HAVE_6REGS && HAVE_SSE2
if (gCpuCaps.hasSSE2)
vf->priv->blur_line = blur_line_sse2;
#endif
#if HAVE_MMX2
if (gCpuCaps.hasMMX2)
vf->priv->filter_line = filter_line_mmx2;
#endif
#if HAVE_SSSE3
if (gCpuCaps.hasSSSE3)
vf->priv->filter_line = filter_line_ssse3;
#endif

View File

@ -1380,6 +1380,20 @@ static void glSetupYUVFragprog(gl_conversion_params_t *params) {
free(yuv_prog);
}
/**
* \brief detect the best YUV->RGB conversion method available
*/
int glAutodetectYUVConversion(void) {
const char *extensions = mpglGetString(GL_EXTENSIONS);
if (strstr(extensions, "GL_ARB_fragment_program"))
return YUV_CONVERSION_FRAGMENT;
if (strstr(extensions, "GL_ATI_text_fragment_shader"))
return YUV_CONVERSION_TEXT_FRAGMENT;
if (strstr(extensions, "GL_ATI_fragment_shader"))
return YUV_CONVERSION_COMBINERS_ATI;
return YUV_CONVERSION_NONE;
}
/**
* \brief setup YUV->RGB conversion
* \param parms struct containing parameters like conversion and scaler type,

View File

@ -347,6 +347,7 @@ typedef struct {
float filter_strength;
} gl_conversion_params_t;
int glAutodetectYUVConversion(void);
void glSetupYUVConversion(gl_conversion_params_t *params);
void glEnableYUVConversion(GLenum target, int type);
void glDisableYUVConversion(GLenum target, int type);

View File

@ -104,7 +104,11 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigne
{
switch (image_format)
{
case IMGFMT_RGB32:
case IMGFMT_RGB24:
vo_draw_alpha_rgb24(w,h,src,srca,stride,image_data+3*(y0*image_width+x0),3*image_width);
break;
case IMGFMT_ARGB:
case IMGFMT_BGRA:
vo_draw_alpha_rgb32(w,h,src,srca,stride,image_data+4*(y0*image_width+x0),4*image_width);
break;
case IMGFMT_YUY2:
@ -170,8 +174,11 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
image_height = height;
switch (image_format)
{
case IMGFMT_BGR32:
case IMGFMT_RGB32:
case IMGFMT_RGB24:
image_depth = 24;
break;
case IMGFMT_ARGB:
case IMGFMT_BGRA:
image_depth = 32;
break;
case IMGFMT_YUY2:
@ -287,35 +294,38 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
static int draw_frame(uint8_t *src[])
{
switch (image_format)
{
case IMGFMT_BGR32:
case IMGFMT_RGB32:
fast_memcpy(image_data, src[0], image_width*image_height*image_bytes);
break;
return 0;
}
case IMGFMT_YUY2:
memcpy_pic(image_data, src[0], image_width * 2, image_height, image_width * 2, image_width * 2);
break;
}
static uint32_t draw_image(mp_image_t *mpi)
{
memcpy_pic(image_data, mpi->planes[0], image_width*image_bytes, image_height, image_width*image_bytes, mpi->stride[0]);
return 0;
}
static int query_format(uint32_t format)
{
const int supportflags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
image_format = format;
switch(format)
{
case IMGFMT_YUY2:
pixelFormat = kYUVSPixelFormat;
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
return supportflags;
case IMGFMT_RGB32:
case IMGFMT_BGR32:
case IMGFMT_RGB24:
pixelFormat = k24RGBPixelFormat;
return supportflags;
case IMGFMT_ARGB:
pixelFormat = k32ARGBPixelFormat;
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
return supportflags;
case IMGFMT_BGRA:
pixelFormat = k32BGRAPixelFormat;
return supportflags;
}
return 0;
}
@ -405,6 +415,7 @@ static int control(uint32_t request, void *data)
{
switch (request)
{
case VOCTRL_DRAW_IMAGE: return draw_image(data);
case VOCTRL_PAUSE: return int_pause = 1;
case VOCTRL_RESUME: return int_pause = 0;
case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data));

View File

@ -496,7 +496,8 @@ static void autodetectGlExtensions(void) {
if (ati_hack == -1) ati_hack = ati_broken_pbo;
if (force_pbo == -1) force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0;
if (use_rectangle == -1) use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0;
if (use_yuv == -1) use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0;
if (use_yuv == -1)
use_yuv = glAutodetectYUVConversion();
if (is_ati && (lscale == 1 || lscale == 2 || cscale == 1 || cscale == 2))
mp_msg(MSGT_VO, MSGL_WARN, "[gl] Selected scaling mode may be broken on ATI cards.\n"
"Tell _them_ to fix GL_REPEAT if you have issues.\n");

View File

@ -169,7 +169,6 @@ static int initTextures(void)
GLfloat texpercx, texpercy;
int s;
int x=0, y=0;
GLint format=0;
// textures smaller than 64x64 might not be supported
s=64;
@ -183,37 +182,37 @@ static int initTextures(void)
texture_height=s;
if (!is_yuv)
gl_internal_format = getInternalFormat();
gl_internal_format = getInternalFormat();
/* Test the max texture size */
do {
GLint w;
glTexImage2D (GL_PROXY_TEXTURE_2D, 0,
gl_internal_format,
texture_width, texture_height,
0, gl_bitmap_format, gl_bitmap_type, NULL);
glGetTexLevelParameteriv
(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &format);
(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
if (format != gl_internal_format)
{
mp_msg (MSGT_VO, MSGL_V, "[gl2] Needed texture [%dx%d] too big, trying ",
texture_height, texture_width);
if (w >= texture_width)
break;
if (texture_width > texture_height)
texture_width /= 2;
else
texture_height /= 2;
mp_msg (MSGT_VO, MSGL_V, "[gl2] Needed texture [%dx%d] too big, trying ",
texture_width, texture_height);
mp_msg (MSGT_VO, MSGL_V, "[%dx%d] !\n", texture_height, texture_width);
if (texture_width > texture_height)
texture_width /= 2;
else
texture_height /= 2;
if(texture_width < 64 || texture_height < 64) {
mp_msg (MSGT_VO, MSGL_FATAL, "[gl2] Give up .. usable texture size not avaiable, or texture config error !\n");
return -1;
}
mp_msg (MSGT_VO, MSGL_V, "[%dx%d] !\n", texture_width, texture_height);
if(texture_width < 64 || texture_height < 64) {
mp_msg (MSGT_VO, MSGL_FATAL, "[gl2] Give up .. usable texture size not avaiable, or texture config error !\n");
return -1;
}
}
while (format != gl_internal_format && texture_width > 1 && texture_height > 1);
} while (texture_width > 1 && texture_height > 1);
#ifdef TEXTURE_WIDTH
texture_width = TEXTURE_WIDTH;
#endif
@ -865,7 +864,6 @@ static int preinit(const char *arg)
}
if(!init_mpglcontext(&glctx, gltype)) goto err_out;
if (use_yuv == -1) {
const char *extensions;
#ifdef CONFIG_GL_WIN32
if (config_w32(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1)
#else
@ -874,8 +872,7 @@ static int preinit(const char *arg)
goto err_out;
if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
goto err_out;
extensions = mpglGetString(GL_EXTENSIONS);
use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0;
use_yuv = glAutodetectYUVConversion();
}
return 0;

View File

@ -90,6 +90,40 @@ static int seek(stream_t *s,off_t newpos) {
return 1;
}
static int control(stream_t *stream, int cmd, void *arg) {
struct stream_priv_s *p = stream->priv;
switch(cmd) {
case STREAM_CTRL_GET_NUM_CHAPTERS:
{
mp_vcd_priv_t *vcd = vcd_read_toc(stream->fd);
if (!vcd)
break;
*(unsigned int *)arg = vcd->tochdr.cdth_trk1;
return STREAM_OK;
}
case STREAM_CTRL_SEEK_TO_CHAPTER:
{
int r;
unsigned int track = *(unsigned int *)arg + 1;
mp_vcd_priv_t *vcd = vcd_read_toc(stream->fd);
if (!vcd)
break;
r = vcd_seek_to_track(vcd, track);
if (r >= 0) {
p->track = track;
return STREAM_OK;
}
break;
}
case STREAM_CTRL_GET_CURRENT_CHAPTER:
{
*(unsigned int *)arg = p->track - 1;
return STREAM_OK;
}
}
return STREAM_UNSUPPORTED;
}
static void close_s(stream_t *stream) {
free(stream->priv);
}
@ -204,6 +238,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
stream->fill_buffer = fill_buffer;
stream->seek = seek;
stream->control = control;
stream->close = close_s;
*file_format = DEMUXER_TYPE_MPEG_PS;

View File

@ -93,7 +93,7 @@ typedef struct {
uint8_t lineBufSize;
uint8_t(*VBlankActiveFunc) ();
uint8_t(*VBlankActiveFunc)(void);
uint16_t SCREENheight;