1
mirror of https://github.com/mpv-player/mpv synced 2025-01-20 21:07:29 +01:00

Merge svn changes up to r28641

Convert vo_x11_border (used in vo_gl/gl2 though the vo_gl_border
macro) to use a wrapper macro in old-style VOs which do not provide a
VO object argument. Before this function had an explicit global_vo
argument in vo_gl/gl2. New vo_vdpau uses it too so use the same
mechanism as most other functions.
This commit is contained in:
Uoti Urpala 2009-02-18 01:07:37 +02:00
commit 186e5a998c
71 changed files with 990 additions and 94 deletions

View File

@ -3423,6 +3423,11 @@ Select the driver to use as source to overlay on top of X11.
.PD 1
.
.TP
.B vdpau (with \-vc ffmpeg12vdpau, ffwmv3vdpau, ffvc1vdpau or ffh264vdpau)
Video output that uses VDPAU to decode video via hardware.
Also supports displaying of software-decoded video.
.
.TP
.B xvmc (X11 with \-vc ffmpeg12mc only)
Video output driver that uses the XvMC (X Video Motion Compensation)
extension of XFree86 4.x to speed up MPEG-1/2 and VCR2 decoding.

View File

@ -113,6 +113,8 @@ you need to go back.
earlier version, so if you do not make a backup copy of your original
source tree, you will have to recompile everything in it when you come
back to the present.)
Alternatively you may use <ulink url="http://ccache.samba.org/">ccache</ulink>
to speed up compilation.
</para>
<para>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- synced with r28201 -->
<!-- synced with r28615 -->
<appendix id="bugreports">
<title>Как сообщать об ошибках</title>
@ -109,6 +109,8 @@ make
(Как правило необходимо выполнять 'make distclean' до перекомпиляции
более ранней версии, поэтому при отсутствии сохраненной копии
Вам придется перекомпилировать весь проект.)
Также Вы можете использовать <ulink url="http://ccache.samba.org/">ccache</ulink>
для ускорения компиляции.
</para>
<para>

View File

@ -633,6 +633,7 @@ SRCS_MPLAYER-$(TDFXVID) += libvo/vo_tdfx_vid.c
SRCS_MPLAYER-$(TGA) += libvo/vo_tga.c
SRCS_MPLAYER-$(V4L2) += libvo/vo_v4l2.c
SRCS_MPLAYER-$(V4L2) += libao2/ao_v4l2.c
SRCS_MPLAYER-$(VDPAU) += libvo/vo_vdpau.c
SRCS_MPLAYER-$(VESA) += libvo/gtf.c libvo/vo_vesa.c libvo/vesa_lvo.c
SRCS_MPLAYER-$(VIDIX) += libvo/vo_cvidix.c \
libvo/vosub_vidix.c \

50
configure vendored
View File

@ -382,6 +382,7 @@ Video output:
--enable-xmga enable mga_vid X11 video output [autodetect]
--enable-xv enable Xv video output [autodetect]
--enable-xvmc enable XvMC acceleration [disable]
--enable-vdpau enable VDPAU acceleration [autodetect]
--enable-vm enable XF86VidMode support [autodetect]
--enable-xinerama enable Xinerama support [autodetect]
--enable-x11 enable X11 video output [autodetect]
@ -523,7 +524,7 @@ _libavcodec_a=auto
_libamr_nb=auto
_libamr_wb=auto
_libavdecoders_all=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`
_libavdecoders=` echo $_libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g' -e s/MPEG4AAC_DECODER// -e s/H264_VDPAU_DECODER// -e s/MPEG_VDPAU_DECODER// -e s/MPEG1_VDPAU_DECODER// -e s/VC1_VDPAU_DECODER// -e s/WMV3_VDPAU_DECODER// `
_libavdecoders=` echo $_libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g' -e s/MPEG4AAC_DECODER//`
_libavencoders_all=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`
_libavencoders=` echo $_libavencoders_all | sed 's/ LIB[A-Z0-9_]*_ENCODER//g'`
_libavparsers_all=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`
@ -552,6 +553,7 @@ _dga1=auto
_dga2=auto
_xv=auto
_xvmc=no #auto when complete
_vdpau=auto
_sdl=auto
_direct3d=auto
_directx=auto
@ -880,6 +882,8 @@ for ac_option do
--disable-xv) _xv=no ;;
--enable-xvmc) _xvmc=yes ;;
--disable-xvmc) _xvmc=no ;;
--enable-vdpau) _vdpau=yes ;;
--disable-vdpau) _vdpau=no ;;
--enable-sdl) _sdl=yes ;;
--disable-sdl) _sdl=no ;;
--enable-direct3d) _direct3d=yes ;;
@ -1700,7 +1704,7 @@ fi
def_fast_64bit='#define HAVE_FAST_64BIT 0'
_arch_all='X86 X86_32 X86_64 IA64 SPARC ARM SH4 PPC ALPHA SGI_MIPS PA_RISC S390 S390X VAX BFIN XTENSA GENERIC'
_arch_all='X86 X86_32 X86_64 IA64 SPARC ARM AVR32 SH4 PPC ALPHA SGI_MIPS PA_RISC S390 S390X VAX BFIN XTENSA GENERIC'
case "$host_arch" in
i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686)
_arch='X86 X86_32'
@ -2059,6 +2063,13 @@ EOF
iproc='arm'
;;
avr32)
_arch='AVR32'
_target_arch='ARCH_AVR32 = yes'
def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
iproc='avr32'
;;
sh|sh4)
_arch='SH4'
_target_arch='ARCH_SH4 = yes'
@ -3145,10 +3156,10 @@ cc_check && _malloc=yes
if test "$_malloc" = yes ; then
def_malloc_h='#define HAVE_MALLOC_H 1'
else
def_malloc_h='#undef HAVE_MALLOC_H'
def_malloc_h='#define HAVE_MALLOC_H 0'
fi
# malloc.h emits a warning in FreeBSD and OpenBSD
freebsd || openbsd || dragonfly && def_malloc_h='#undef HAVE_MALLOC_H'
freebsd || openbsd || dragonfly && def_malloc_h='#define HAVE_MALLOC_H 0'
echores "$_malloc"
@ -3164,7 +3175,7 @@ cc_check && _memalign=yes
if test "$_memalign" = yes ; then
def_memalign='#define HAVE_MEMALIGN 1'
else
def_memalign='#undef HAVE_MEMALIGN'
def_memalign='#define HAVE_MEMALIGN 0'
def_map_memalign='#define memalign(a,b) malloc(b)'
darwin || def_memalign_hack='#define CONFIG_MEMALIGN_HACK 1'
fi
@ -4179,7 +4190,7 @@ else
_novomodules="x11 $_novomodules"
_res_comment="check if the dev(el) packages are installed"
# disable stuff that depends on X
_xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no
_xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no ; _vdpau=no
fi
echores "$_x11"
@ -4290,6 +4301,28 @@ fi
echores "$_xvmc"
echocheck "VDPAU"
if test "$_vdpau" = auto ; then
_vdpau=no
if test "$_dl" = yes ; then
cat > $TMPC <<EOF
#include <vdpau/vdpau_x11.h>
int main(void) {return 0;}
EOF
cc_check && _vdpau=yes
fi
fi
if test "$_vdpau" = yes ; then
def_vdpau='#define CONFIG_VDPAU 1'
_vomodules="vdpau $_vomodules"
else
def_vdpau='#define CONFIG_VDPAU 0'
_novomodules="vdpau $_novomodules"
_libavdecoders=`echo $_libavdecoders | sed -e s/MPEG_VDPAU_DECODER// -e s/MPEG1_VDPAU_DECODER// -e s/H264_VDPAU_DECODER// -e s/WMV3_VDPAU_DECODER// -e s/VC1_VDPAU_DECODER//`
fi
echores "$_vdpau"
echocheck "Xinerama"
if test "$_xinerama" = auto ; then
cat > $TMPC <<EOF
@ -8161,6 +8194,7 @@ TWOLAME=$_twolame
UNRAR_EXEC = $_unrar_exec
V4L2 = $_v4l2
VCD = $_vcd
VDPAU = $_vdpau
VESA = $_vesa
VIDIX = $_vidix
VIDIX_PCIDB = $_vidix_pcidb_val
@ -8246,6 +8280,7 @@ CONFIG_MUXERS=$_mencoder
CONFIG_POSTPROC = yes
# Prevent building libavcodec/imgresample.c with conflicting symbols
CONFIG_SWSCALE=yes
CONFIG_VDPAU=$_vdpau
CONFIG_XVMC=$_xvmc
CONFIG_ZLIB=$_zlib
@ -8606,6 +8641,7 @@ $def_tdfxfb
$def_tdfxvid
$def_tga
$def_v4l2
$def_vdpau
$def_vesa
$def_vidix
$def_vidix_drv_cyberblade
@ -8701,6 +8737,8 @@ $def_yasm
#define HAVE_EBX_AVAILABLE 1
#ifndef MP_DEBUG
#define HAVE_EBP_AVAILABLE 1
#else
#define HAVE_EBP_AVAILABLE 0
#endif
/* External libraries used through libavcodec. */

View File

@ -4,7 +4,7 @@
CpuCaps gCpuCaps;
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>

View File

@ -77,7 +77,7 @@ rdtsc(void)
static const char*
brandname(int i)
{
const static char* brandmap[] = {
static const char* brandmap[] = {
NULL,
"Intel(R) Celeron(R) processor",
"Intel(R) Pentium(R) III processor",
@ -105,7 +105,7 @@ store32(char *d, unsigned int v)
int
main(int argc, char **argv)
main(void)
{
cpuid_regs_t regs, regs_ext;
char idstr[13];

View File

@ -66,7 +66,7 @@ struct voodoo_2d_reg_t {
uint32_t lineStipple;
uint32_t lineStyle;
uint32_t pattern0Alias;
uint32_t pattern1Alias;;
uint32_t pattern1Alias;
uint32_t clip1Min;
uint32_t clip1Max;
uint32_t srcFormat;

View File

@ -1629,7 +1629,7 @@ videocodec rv3040win
videocodec rv40
info "Linux RealPlayer 9 RV40"
status working
status buggy
fourcc RV40,rv40
driver realvid
dll "drv4.so.6.0"
@ -1653,7 +1653,7 @@ videocodec rv40mac
videocodec rv30
info "Linux RealPlayer 8 RV30"
status working
status buggy
fourcc RV30,rv30
driver realvid
dll "drv3.so.6.0"
@ -1702,7 +1702,7 @@ videocodec ffrv40
videocodec rv20
info "Linux RealPlayer 8 RV20"
status working
status buggy
fourcc RV20,rv20
driver realvid
dll "drv2.so.6.0"

View File

@ -40,10 +40,10 @@ static char help_text[]=
" < vagy > 1 fájllal előre/hátra lépés a lejátszási listában\n"
" p vagy SPACE pillanatállj (bármely billentyűre továbbmegy)\n"
" q vagy ESC lejátszás vége és kilépés\n"
" + vagy - audio késleltetése ą 0.1 másodperccel\n"
" + vagy - audio késleltetése ± 0.1 másodperccel\n"
" o OSD-mód váltása: nincs / keresősáv / keresősáv + idő\n"
" * vagy / hangerő fel/le\n"
" x vagy z felirat késleltetése ą 0.1 másodperccel\n"
" x vagy z felirat késleltetése ± 0.1 másodperccel\n"
" r vagy t felirat pozíciójának megváltoztatása, lásd -vf expand-ot is\n"
"\n"
" * * * A MANPAGE TOVÁBBI RÉSZLETEKET, OPCIÓKAT, BILLENTYŰKET TARTALMAZ! * * *\n"

View File

@ -2354,7 +2354,8 @@
+#include "mm_accel.h"
+#include "libavutil/avutil.h"
#ifdef HAVE_MEMALIGN
-#ifdef HAVE_MEMALIGN
+#if HAVE_MEMALIGN
/* some systems have memalign() but no declaration for it */
void * memalign (size_t align, size_t size);
-#else

View File

@ -39,7 +39,7 @@
#include "mm_accel.h"
#include "libavutil/avutil.h"
#ifdef HAVE_MEMALIGN
#if HAVE_MEMALIGN
/* some systems have memalign() but no declaration for it */
void * memalign (size_t align, size_t size);
#endif

View File

@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -454,6 +454,8 @@ static void reset(void){
#endif
oss_format = format2oss(ao_data.format);
if(ao_data.format == AF_FORMAT_AC3)
ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
ioctl (audio_fd, SNDCTL_DSP_SETFMT, &oss_format);
if(ao_data.format != AF_FORMAT_AC3) {
if (ao_data.channels > 2)
@ -479,7 +481,7 @@ static void audio_resume(void)
int fillcnt;
reset();
fillcnt = get_space() - prepause_space;
if (fillcnt > 0) {
if (fillcnt > 0 && !(ao_data.format & AF_FORMAT_SPECIAL_MASK)) {
void *silence = calloc(fillcnt, 1);
play(silence, fillcnt, 0);
free(silence);

View File

@ -69,7 +69,7 @@ extern "C" {
/* Use if target platform has address generators with autoincrement */
//#define PREFER_POINTERS
#if defined(_WIN32_WCE) || defined(__arm__)
#if defined(_WIN32_WCE) || defined(__arm__) || defined(__avr32__)
#define FIXED_POINT
#endif

View File

@ -52,7 +52,7 @@
//#define PREFER_POINTERS
-#ifdef _WIN32_WCE
+#if defined(_WIN32_WCE) || defined(__arm__)
+#if defined(_WIN32_WCE) || defined(__arm__) || defined(__avr32__)
#define FIXED_POINT
#endif

View File

@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -19,7 +19,7 @@
#include "libaf/af.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -2,7 +2,7 @@
#include "options.h"
#include <stdio.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>

View File

@ -5,7 +5,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -336,7 +336,8 @@ mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,
mp_image_t *mpi =
vf_get_image(sh->vfilter, sh->codec->outfmt[sh->outfmtidx], mp_imgtype,
mp_imgflag, w, h);
mpi->x = mpi->y = 0;
if (mpi)
mpi->x = mpi->y = 0;
return mpi;
}

View File

@ -215,15 +215,24 @@ static int init(sh_video_t *sh){
if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ)
ctx->do_dr1=1;
if (lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
ctx->do_dr1=1;
ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64;
ctx->ip_count= ctx->b_count= 0;
ctx->pic = avcodec_alloc_frame();
ctx->avctx = avcodec_alloc_context();
avctx = ctx->avctx;
avctx->opaque = sh;
#if CONFIG_VDPAU
if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){
avctx->get_format = get_format;
avctx->draw_horiz_band = draw_slice;
avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
}
#endif /* CONFIG_VDPAU */
#if CONFIG_XVMC
if(lavc_codec->capabilities & CODEC_CAP_HWACCEL){
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec);
assert(ctx->do_dr1);//these are must to!
@ -529,7 +538,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
return avctx->get_buffer(avctx, pic);
}
if (IMGFMT_IS_XVMC(ctx->best_csp)) {
if (IMGFMT_IS_XVMC(ctx->best_csp) || IMGFMT_IS_VDPAU(ctx->best_csp)) {
type = MP_IMGTYPE_NUMBERED | (0xffff << 16);
} else
if (!pic->buffer_hints) {
@ -559,6 +568,9 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
avctx->draw_horiz_band= draw_slice;
} else
avctx->draw_horiz_band= NULL;
if(IMGFMT_IS_VDPAU(mpi->imgfmt)) {
avctx->draw_horiz_band= draw_slice;
}
#if CONFIG_XVMC
if(IMGFMT_IS_XVMC(mpi->imgfmt)) {
struct xvmc_pix_fmt *render = mpi->priv; //same as data[2]
@ -718,7 +730,6 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
//ffmpeg interlace (mpeg2) bug have been fixed. no need of -noslices
if (!dr1)
avctx->draw_horiz_band=NULL;
avctx->opaque=sh;
if(ctx->vo_initialized && !(flags&3) && !dr1){
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE |
(ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0),
@ -864,7 +875,7 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
return mpi;
}
#if CONFIG_XVMC
#if CONFIG_XVMC || CONFIG_VDPAU
static enum PixelFormat get_format(struct AVCodecContext *avctx,
const enum PixelFormat *fmt){
enum PixelFormat selected_format = fmt[0];
@ -874,7 +885,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
for(i=0;fmt[i]!=PIX_FMT_NONE;i++){
imgfmt = pixfmt2imgfmt(fmt[i]);
if(!IMGFMT_IS_XVMC(imgfmt)) continue;
if(!IMGFMT_IS_XVMC(imgfmt) && !IMGFMT_IS_VDPAU(imgfmt)) continue;
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i);
if(init_vo(sh, fmt[i]) >= 0) {
selected_format = fmt[i];
@ -882,7 +893,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
}
}
imgfmt = pixfmt2imgfmt(selected_format);
if(IMGFMT_IS_XVMC(imgfmt)) {
if(IMGFMT_IS_XVMC(imgfmt) || IMGFMT_IS_VDPAU(imgfmt)) {
vd_ffmpeg_ctx *ctx = sh->context;
avctx->get_buffer= get_buffer;
avctx->release_buffer= release_buffer;
@ -894,5 +905,4 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
}
return selected_format;
}
#endif /* CONFIG_XVMC */
#endif /* CONFIG_XVMC || CONFIG_VDPAU */

View File

@ -3,7 +3,7 @@
#include <string.h>
#include "config.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
@ -319,7 +319,6 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype,
// keep buffer allocation status & color flags only:
// mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT);
mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS;
mpi->flags |= MP_IMGFLAG_IN_USE;
// accept restrictions & draw_slice flags only:
mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK);
if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
@ -346,6 +345,11 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype,
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
// non-direct and not yet allocated image. allocate it!
if (!mpi->bpp) { // no way we can allocate this
mp_msg(MSGT_DECVIDEO, MSGL_FATAL,
"vf_get_image: Tried to allocate a format that can not be allocated!\n");
return NULL;
}
// check if codec prefer aligned stride:
if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){
@ -426,6 +430,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype,
mpi->qscale = NULL;
}
mpi->flags |= MP_IMGFLAG_IN_USE;
// printf("\rVF_MPI: %p %p %p %d %d %d \n",
// mpi->planes[0],mpi->planes[1],mpi->planes[2],
// mpi->stride[0],mpi->stride[1],mpi->stride[2]);

View File

@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -30,7 +30,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -43,13 +43,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
@ -58,6 +52,12 @@
#include "vf.h"
#include "libvo/fastmemcpy.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
#undef free
#undef malloc
@ -690,7 +690,6 @@ const vf_info_t vf_info_fspp = {
//Specific spp's dct, idct and threshold functions
//I'd prefer to have them in the separate file.
#include "mangle.h"
//#define MANGLE(a) #a
//typedef int16_t DCTELEM; //! only int16_t

View File

@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -28,7 +28,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -65,7 +65,7 @@ Known Issues:
#undef free
#undef malloc
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -28,7 +28,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -36,7 +36,7 @@
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -28,7 +28,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -8,7 +8,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -30,7 +30,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -36,7 +36,7 @@
#include "libavcodec/avcodec.h"
#include "libavcodec/eval.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <string.h>

View File

@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -46,7 +46,7 @@
#undef free
#undef malloc
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -28,7 +28,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -32,7 +32,7 @@
#include "libavcodec/avcodec.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -30,7 +30,7 @@
#include "mp_msg.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -322,7 +322,7 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es)
sh_video_t *sh = new_sh_video_vid(demuxer, priv->last_vid, es->pid);
if(sh)
{
sh->format = IS_VIDEO(es->type) ? es->type : es->subtype;;
sh->format = IS_VIDEO(es->type) ? es->type : es->subtype;
sh->ds = demuxer->video;
priv->ts.streams[es->pid].id = priv->last_vid;

View File

@ -538,7 +538,7 @@ static void write_mpeg2_scr(unsigned char *b, uint64_t ts)
scr_ext = ts % 300ULL;
ts /= 300ULL;
ts &= 0x1FFFFFFFFULL; //33 bits
t1 = (ts >> 30) & 0x7;;
t1 = (ts >> 30) & 0x7;
t2 = (ts >> 15) & 0x7fff;
t3 = ts & 0x7fff;

View File

@ -23,7 +23,7 @@
#include <stdio.h>
#include <inttypes.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>

View File

@ -3,7 +3,7 @@
#include "config.h"
#include <stdio.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>

View File

@ -21,7 +21,7 @@
#include <string.h>
#include "config.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
@ -1242,7 +1242,7 @@ struct osd_state *osd_create(void)
#ifdef CONFIG_DVDNAV
new_osd_obj(OSDTYPE_DVDNAV);
#endif
#if CONFIG_TV_TELETEXT
#ifdef CONFIG_TV_TELETEXT
new_osd_obj(OSDTYPE_TELETEXT);
#endif
#ifdef CONFIG_FREETYPE

View File

@ -75,6 +75,7 @@ extern struct vo_driver video_out_xmga;
extern struct vo_driver video_out_x11;
extern struct vo_driver video_out_xover;
extern struct vo_driver video_out_xvmc;
extern struct vo_driver video_out_vdpau;
extern struct vo_driver video_out_xv;
extern struct vo_driver video_out_gl;
extern struct vo_driver video_out_gl2;
@ -157,6 +158,9 @@ const struct vo_driver *video_out_drivers[] =
#ifdef CONFIG_3DFX
&video_out_3dfx,
#endif
#if CONFIG_VDPAU
&video_out_vdpau,
#endif
#ifdef CONFIG_XV
&video_out_xv,
#endif
@ -444,8 +448,13 @@ static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_siz
* Can be extended to take future cropping support into account.
*
* \param crop specifies the cropping border size in the left, right, top and bottom members, may be NULL
* \param borders the border values as e.g. EOSD (ASS) and properly placed DVD highlight support requires,
* may be NULL and only left and top are currently valid.
*/
void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, struct vo_rect *crop) {
void calc_src_dst_rects(struct vo *vo, int src_width, int src_height,
struct vo_rect *src, struct vo_rect *dst,
struct vo_rect *borders, const struct vo_rect *crop)
{
static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0};
int scaled_width = 0;
int scaled_height = 0;
@ -458,11 +467,18 @@ void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, struct vo_
dst->top = 0; dst->bottom = vo->dheight;
src->left = 0; src->right = src_width;
src->top = 0; src->bottom = src_height;
if (borders) {
borders->left = 0; borders->top = 0;
}
if (vo_fs) {
aspect(vo, &scaled_width, &scaled_height, A_ZOOM);
panscan_calc(vo);
scaled_width += vo->panscan_x;
scaled_height += vo->panscan_y;
if (borders) {
borders->left = (vo->dwidth - scaled_width ) / 2;
borders->top = (vo->dheight - scaled_height) / 2;
}
src_dst_split_scaling(src_width, vo->dwidth, scaled_width,
&src->left, &src->right, &dst->left, &dst->right);
src_dst_split_scaling(src_height, vo->dheight, scaled_height,

View File

@ -321,6 +321,8 @@ int lookup_keymap_table(const struct keymap *map, int key);
struct vo_rect {
int left, right, top, bottom, width, height;
};
void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, struct vo_rect *crop);
void calc_src_dst_rects(struct vo *vo, int src_width, int src_height,
struct vo_rect *src, struct vo_rect *dst,
struct vo_rect *borders, const struct vo_rect *crop);
#endif /* MPLAYER_VIDEO_OUT_H */

View File

@ -63,6 +63,8 @@ static struct global_priv {
fullscreen */
int src_width; /**< Source (movie) width */
int src_height; /**< Source (movie) heigth */
int border_x; /**< horizontal border value for OSD */
int border_y; /**< vertical border value for OSD */
D3DFORMAT movie_src_fmt; /**< Movie colorspace format (depends on
the movie's codec) */
@ -149,7 +151,8 @@ static void calc_fs_rect(void)
{
struct vo_rect src_rect;
struct vo_rect dst_rect;
calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, NULL);
struct vo_rect borders;
calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, &borders, NULL);
priv->fs_movie_rect.left = dst_rect.left;
priv->fs_movie_rect.right = dst_rect.right;
@ -159,6 +162,8 @@ static void calc_fs_rect(void)
priv->fs_panscan_rect.right = src_rect.right;
priv->fs_panscan_rect.top = src_rect.top;
priv->fs_panscan_rect.bottom = src_rect.bottom;
priv->border_x = borders.left;
priv->border_y = borders.top;
mp_msg(MSGT_VO, MSGL_V,
"<vo_direct3d>Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n",
@ -1027,7 +1032,8 @@ static void draw_osd(void)
/* required for if subs are in the boarder region */
priv->is_clear_needed = 1;
vo_draw_text(priv->osd_width, priv->osd_height, draw_alpha);
vo_draw_text_ext(priv->osd_width, priv->osd_height, priv->border_x, priv->border_y,
priv->border_x, priv->border_y, priv->src_width, priv->src_height, draw_alpha);
if (!priv->device_texture_sys)
{

View File

@ -37,7 +37,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "fastmemcpy.h"

View File

@ -155,6 +155,7 @@ static void resize(int x,int y){
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
ass_border_x = ass_border_y = 0;
if (vo_fs && use_aspect) {
int new_w, new_h;
GLdouble scale_x, scale_y;
@ -1137,7 +1138,7 @@ static int control(uint32_t request, void *data)
resize(vo_dwidth, vo_dheight);
return VO_TRUE;
case VOCTRL_BORDER:
vo_gl_border(global_vo);
vo_gl_border();
resize(vo_dwidth, vo_dheight);
return VO_TRUE;
case VOCTRL_GET_PANSCAN:

View File

@ -897,7 +897,7 @@ static int control(uint32_t request, void *data)
resize(&vo_dwidth, &vo_dheight);
return VO_TRUE;
case VOCTRL_BORDER:
vo_gl_border(global_vo);
vo_gl_border();
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
return VO_TRUE;

803
libvo/vo_vdpau.c Normal file
View File

@ -0,0 +1,803 @@
/*
* VDPAU video output driver
*
* Copyright (C) 2008 NVIDIA
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \defgroup VDPAU_Presentation VDPAU Presentation
* \ingroup Decoder
*
* Actual decoding and presentation are implemented here.
* All necessary frame information is collected through
* the "vdpau_render_state" structure after parsing all headers
* etc. in libavcodec for different codecs.
*
* @{
*/
#include <stdio.h>
#include <dlfcn.h>
#include "config.h"
#include "mp_msg.h"
#include "video_out.h"
#include "video_out_internal.h"
#include "x11_common.h"
#include "aspect.h"
#include "sub.h"
#include "libavcodec/vdpau.h"
#include "gui/interface.h"
#include "libavutil/common.h"
static vo_info_t info = {
"VDPAU with X11",
"vdpau",
"Rajib Mahapatra <rmahapatra@nvidia.com> and others",
""
};
LIBVO_EXTERN(vdpau)
#define CHECK_ST_ERROR(message) \
if (vdp_st != VDP_STATUS_OK) { \
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \
message, vdp_get_error_string(vdp_st)); \
return -1; \
}
#define CHECK_ST_WARNING(message) \
if (vdp_st != VDP_STATUS_OK) \
mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \
message, vdp_get_error_string(vdp_st));
/* number of video and output surfaces */
#define NUM_OUTPUT_SURFACES 3
#define MAX_VIDEO_SURFACES 50
/* number of palette entries */
#define PALETTE_SIZE 256
/*
* Global variable declaration - VDPAU specific
*/
/* Declaration for all variables of win_x11_init_vdpau_procs() and
* win_x11_init_vdpau_flip_queue() functions
*/
static VdpDevice vdp_device;
static VdpDeviceCreateX11 *vdp_device_create;
static VdpGetProcAddress *vdp_get_proc_address;
static VdpPresentationQueueTarget vdp_flip_target;
static VdpPresentationQueue vdp_flip_queue;
static VdpDeviceDestroy *vdp_device_destroy;
static VdpVideoSurfaceCreate *vdp_video_surface_create;
static VdpVideoSurfaceDestroy *vdp_video_surface_destroy;
static VdpGetErrorString *vdp_get_error_string;
/* May be used in software filtering/postprocessing options
* in MPlayer (./mplayer -vf ..) if we copy video_surface data to
* system memory.
*/
static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr;
static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native;
static VdpOutputSurfaceCreate *vdp_output_surface_create;
static VdpOutputSurfaceDestroy *vdp_output_surface_destroy;
/* VideoMixer puts video_surface data on displayable output_surface. */
static VdpVideoMixerCreate *vdp_video_mixer_create;
static VdpVideoMixerDestroy *vdp_video_mixer_destroy;
static VdpVideoMixerRender *vdp_video_mixer_render;
static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy;
static VdpPresentationQueueCreate *vdp_presentation_queue_create;
static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy;
static VdpPresentationQueueDisplay *vdp_presentation_queue_display;
static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle;
static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11;
/* output_surfaces[2] is used in composite-picture. */
static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface;
static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed;
static VdpDecoderCreate *vdp_decoder_create;
static VdpDecoderDestroy *vdp_decoder_destroy;
static VdpDecoderRender *vdp_decoder_render;
static void *vdpau_lib_handle;
static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES];
static int output_surface_width, output_surface_height;
static VdpVideoMixer video_mixer;
static VdpDecoder decoder;
static int decoder_max_refs;
static VdpRect src_rect_vid;
static VdpRect out_rect_vid;
static int border_x, border_y;
static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES];
static int surface_num;
static int vid_surface_num;
static uint32_t vid_width, vid_height;
static uint32_t image_format;
static const VdpChromaType vdp_chroma_type = VDP_CHROMA_TYPE_420;
/* draw_osd */
static unsigned char *index_data;
static int index_data_size;
static uint32_t palette[PALETTE_SIZE];
/*
* X11 specific
*/
static int visible_buf;
static int int_pause;
static void video_to_output_surface(void)
{
VdpTime dummy;
VdpStatus vdp_st;
VdpOutputSurface output_surface = output_surfaces[surface_num];
if (vid_surface_num < 0)
return;
vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue,
output_surface,
&dummy);
CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle")
vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0,
VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME,
0, NULL, surface_render[vid_surface_num].surface, 0, NULL, &src_rect_vid,
output_surface,
NULL, &out_rect_vid, 0, NULL);
CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
}
static void resize(void)
{
VdpStatus vdp_st;
int i;
struct vo_rect src_rect;
struct vo_rect dst_rect;
struct vo_rect borders;
calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, &borders, NULL);
out_rect_vid.x0 = dst_rect.left;
out_rect_vid.x1 = dst_rect.right;
out_rect_vid.y0 = dst_rect.top;
out_rect_vid.y1 = dst_rect.bottom;
src_rect_vid.x0 = src_rect.left;
src_rect_vid.x1 = src_rect.right;
src_rect_vid.y0 = src_rect.top;
src_rect_vid.y1 = src_rect.bottom;
border_x = borders.left;
border_y = borders.top;
#ifdef CONFIG_FREETYPE
// adjust font size to display size
force_load_font = 1;
#endif
vo_osd_changed(OSDTYPE_OSD);
if (output_surface_width < vo_dwidth || output_surface_height < vo_dheight) {
if (output_surface_width < vo_dwidth) {
output_surface_width += output_surface_width >> 1;
output_surface_width = FFMAX(output_surface_width, vo_dwidth);
}
if (output_surface_height < vo_dheight) {
output_surface_height += output_surface_height >> 1;
output_surface_height = FFMAX(output_surface_height, vo_dheight);
}
// Creation of output_surfaces
for (i = 0; i < NUM_OUTPUT_SURFACES; i++) {
if (output_surfaces[i] != VDP_INVALID_HANDLE)
vdp_output_surface_destroy(output_surfaces[i]);
vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8,
output_surface_width, output_surface_height,
&output_surfaces[i]);
CHECK_ST_WARNING("Error when calling vdp_output_surface_create")
mp_msg(MSGT_VO, MSGL_DBG2, "OUT CREATE: %u\n", output_surfaces[i]);
}
}
video_to_output_surface();
if (visible_buf)
flip_page();
}
/* Initialize vdp_get_proc_address, called from preinit() */
static int win_x11_init_vdpau_procs(void)
{
VdpStatus vdp_st;
struct vdp_function {
const int id;
void *pointer;
};
const struct vdp_function *dsc;
static const struct vdp_function vdp_func[] = {
{VDP_FUNC_ID_GET_ERROR_STRING, &vdp_get_error_string},
{VDP_FUNC_ID_DEVICE_DESTROY, &vdp_device_destroy},
{VDP_FUNC_ID_VIDEO_SURFACE_CREATE, &vdp_video_surface_create},
{VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, &vdp_video_surface_destroy},
{VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR,
&vdp_video_surface_put_bits_y_cb_cr},
{VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE,
&vdp_output_surface_put_bits_native},
{VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, &vdp_output_surface_create},
{VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, &vdp_output_surface_destroy},
{VDP_FUNC_ID_VIDEO_MIXER_CREATE, &vdp_video_mixer_create},
{VDP_FUNC_ID_VIDEO_MIXER_DESTROY, &vdp_video_mixer_destroy},
{VDP_FUNC_ID_VIDEO_MIXER_RENDER, &vdp_video_mixer_render},
{VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY,
&vdp_presentation_queue_target_destroy},
{VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, &vdp_presentation_queue_create},
{VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY,
&vdp_presentation_queue_destroy},
{VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY,
&vdp_presentation_queue_display},
{VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE,
&vdp_presentation_queue_block_until_surface_idle},
{VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11,
&vdp_presentation_queue_target_create_x11},
{VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE,
&vdp_output_surface_render_output_surface},
{VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED,
&vdp_output_surface_put_bits_indexed},
{VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create},
{VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render},
{VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy},
{0, NULL}
};
vdp_st = vdp_device_create(mDisplay, mScreen,
&vdp_device, &vdp_get_proc_address);
if (vdp_st != VDP_STATUS_OK) {
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st);
return -1;
}
for (dsc = vdp_func; dsc->pointer; dsc++) {
vdp_st = vdp_get_proc_address(vdp_device, dsc->id, dsc->pointer);
if (vdp_st != VDP_STATUS_OK) {
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n", dsc->id, vdp_get_error_string ? vdp_get_error_string(vdp_st) : "?");
return -1;
}
}
return 0;
}
/* Initialize vdpau_flip_queue, called from config() */
static int win_x11_init_vdpau_flip_queue(void)
{
VdpStatus vdp_st;
vdp_st = vdp_presentation_queue_target_create_x11(vdp_device, vo_window,
&vdp_flip_target);
CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11")
vdp_st = vdp_presentation_queue_create(vdp_device, vdp_flip_target,
&vdp_flip_queue);
CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create")
return 0;
}
static int create_vdp_mixer(VdpChromaType vdp_chroma_type) {
#define VDP_NUM_MIXER_PARAMETER 3
VdpStatus vdp_st;
static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = {
VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH,
VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT,
VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE
};
const void *const parameter_values[VDP_NUM_MIXER_PARAMETER] = {
&vid_width,
&vid_height,
&vdp_chroma_type
};
vdp_st = vdp_video_mixer_create(vdp_device, 0, 0,
VDP_NUM_MIXER_PARAMETER,
parameters, parameter_values,
&video_mixer);
CHECK_ST_ERROR("Error when calling vdp_video_mixer_create")
return 0;
}
// Free everything specific to a certain video file
static void free_video_specific(void) {
int i;
VdpStatus vdp_st;
if (decoder != VDP_INVALID_HANDLE)
vdp_decoder_destroy(decoder);
decoder = VDP_INVALID_HANDLE;
decoder_max_refs = -1;
for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
if (surface_render[i].surface != VDP_INVALID_HANDLE) {
vdp_st = vdp_video_surface_destroy(surface_render[i].surface);
CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy")
}
surface_render[i].surface = VDP_INVALID_HANDLE;
}
if (video_mixer != VDP_INVALID_HANDLE)
vdp_st = vdp_video_mixer_destroy(video_mixer);
CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy")
video_mixer = VDP_INVALID_HANDLE;
}
/*
* connect to X server, create and map window, initialize all
* VDPAU objects, create different surfaces etc.
*/
static int config(uint32_t width, uint32_t height, uint32_t d_width,
uint32_t d_height, uint32_t flags, char *title,
uint32_t format)
{
XVisualInfo vinfo;
XSetWindowAttributes xswa;
XWindowAttributes attribs;
unsigned long xswamask;
int depth;
#ifdef CONFIG_XF86VM
int vm = flags & VOFLAG_MODESWITCHING;
#endif
image_format = format;
int_pause = 0;
visible_buf = 0;
#ifdef CONFIG_GUI
if (use_gui)
guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize our window
else
#endif
{
#ifdef CONFIG_XF86VM
if (vm)
vo_vm_switch();
else
#endif
XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);
depth = attribs.depth;
if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
depth = 24;
XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
xswa.background_pixel = 0;
xswa.border_pixel = 0;
xswamask = CWBackPixel | CWBorderPixel;
vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height,
flags, CopyFromParent, "vdpau", title);
XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
#ifdef CONFIG_XF86VM
if (vm) {
/* Grab the mouse pointer in our window */
if (vo_grabpointer)
XGrabPointer(mDisplay, vo_window, True, 0,
GrabModeAsync, GrabModeAsync,
vo_window, None, CurrentTime);
XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime);
}
#endif
}
if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0)
vo_fs = 1;
/* -----VDPAU related code here -------- */
free_video_specific();
if (vdp_flip_queue == VDP_INVALID_HANDLE && win_x11_init_vdpau_flip_queue())
return -1;
// video width and height
vid_width = width;
vid_height = height;
if (create_vdp_mixer(vdp_chroma_type))
return -1;
surface_num = 0;
vid_surface_num = -1;
resize();
return 0;
}
static void check_events(void)
{
int e = vo_x11_check_events(mDisplay);
if (e & VO_EVENT_RESIZE)
resize();
if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) {
/* did we already draw a buffer */
if (visible_buf) {
/* redraw the last visible buffer */
VdpStatus vdp_st;
vdp_st = vdp_presentation_queue_display(vdp_flip_queue,
output_surfaces[surface_num],
vo_dwidth, vo_dheight,
0);
CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
}
}
}
static void draw_osd_I8A8(int x0,int y0, int w,int h, unsigned char *src,
unsigned char *srca, int stride)
{
VdpOutputSurface output_surface = output_surfaces[surface_num];
VdpStatus vdp_st;
int i, j;
int pitch;
int index_data_size_required;
VdpRect output_indexed_rect_vid;
VdpOutputSurfaceRenderBlendState blend_state;
if (!w || !h)
return;
index_data_size_required = 2*w*h;
if (index_data_size < index_data_size_required) {
index_data = realloc(index_data, index_data_size_required);
index_data_size = index_data_size_required;
}
// index_data creation, component order - I, A, I, A, .....
for (i = 0; i < h; i++)
for (j = 0; j < w; j++) {
index_data[i*2*w + j*2] = src [i*stride+j];
index_data[i*2*w + j*2 + 1] = -srca[i*stride+j];
}
output_indexed_rect_vid.x0 = x0;
output_indexed_rect_vid.y0 = y0;
output_indexed_rect_vid.x1 = x0 + w;
output_indexed_rect_vid.y1 = y0 + h;
pitch = w*2;
// write source_data to output_surfaces[2].
vdp_st = vdp_output_surface_put_bits_indexed(output_surfaces[2],
VDP_INDEXED_FORMAT_I8A8,
(const void *const*)&index_data,
&pitch,
&output_indexed_rect_vid,
VDP_COLOR_TABLE_FORMAT_B8G8R8X8,
(void *)palette);
CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed")
blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION;
blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
vdp_st = vdp_output_surface_render_output_surface(output_surface,
&output_indexed_rect_vid,
output_surfaces[2],
&output_indexed_rect_vid,
NULL,
&blend_state,
VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
}
static void draw_osd(void)
{
mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n");
vo_draw_text_ext(vo_dwidth, vo_dheight, border_x, border_y, border_x, border_y,
vid_width, vid_height, draw_osd_I8A8);
}
static void flip_page(void)
{
VdpStatus vdp_st;
mp_msg(MSGT_VO, MSGL_DBG2, "\nFLIP_PAGE VID:%u -> OUT:%u\n",
surface_render[vid_surface_num].surface, output_surfaces[surface_num]);
vdp_st = vdp_presentation_queue_display(vdp_flip_queue, output_surfaces[surface_num],
vo_dwidth, vo_dheight,
0);
CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
surface_num = !surface_num;
visible_buf = 1;
}
static int draw_slice(uint8_t *image[], int stride[], int w, int h,
int x, int y)
{
VdpStatus vdp_st;
struct vdpau_render_state *rndr = (struct vdpau_render_state *)image[0];
int max_refs = image_format == IMGFMT_VDPAU_H264 ? rndr->info.h264.num_ref_frames : 2;
if (!IMGFMT_IS_VDPAU(image_format))
return VO_FALSE;
if (decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs) {
VdpDecoderProfile vdp_decoder_profile;
if (decoder != VDP_INVALID_HANDLE)
vdp_decoder_destroy(decoder);
decoder = VDP_INVALID_HANDLE;
switch (image_format) {
case IMGFMT_VDPAU_MPEG1:
vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1;
break;
case IMGFMT_VDPAU_MPEG2:
vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN;
break;
case IMGFMT_VDPAU_H264:
vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH;
break;
case IMGFMT_VDPAU_WMV3:
vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN;
break;
case IMGFMT_VDPAU_VC1:
vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED;
break;
}
vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, vid_width, vid_height, max_refs, &decoder);
CHECK_ST_WARNING("Failed creating VDPAU decoder");
decoder_max_refs = max_refs;
}
vdp_st = vdp_decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
CHECK_ST_WARNING("Failed VDPAU decoder rendering");
return VO_TRUE;
}
static int draw_frame(uint8_t *src[])
{
return VO_ERROR;
}
static struct vdpau_render_state *get_surface(int number)
{
if (number > MAX_VIDEO_SURFACES)
return NULL;
if (surface_render[number].surface == VDP_INVALID_HANDLE) {
VdpStatus vdp_st;
vdp_st = vdp_video_surface_create(vdp_device, vdp_chroma_type,
vid_width, vid_height,
&surface_render[number].surface);
CHECK_ST_WARNING("Error when calling vdp_video_surface_create")
if (vdp_st != VDP_STATUS_OK)
return NULL;
}
mp_msg(MSGT_VO, MSGL_DBG2, "VID CREATE: %u\n", surface_render[number].surface);
return &surface_render[number];
}
static uint32_t draw_image(mp_image_t *mpi)
{
if (IMGFMT_IS_VDPAU(image_format)) {
struct vdpau_render_state *rndr = mpi->priv;
vid_surface_num = rndr - surface_render;
} else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) {
VdpStatus vdp_st;
void *destdata[3] = {mpi->planes[0], mpi->planes[2], mpi->planes[1]};
struct vdpau_render_state *rndr = get_surface(0);
vid_surface_num = rndr - surface_render;
vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface,
VDP_YCBCR_FORMAT_YV12,
(const void *const*)destdata,
mpi->stride); // pitch
CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
}
video_to_output_surface();
return VO_TRUE;
}
static uint32_t get_image(mp_image_t *mpi)
{
struct vdpau_render_state *rndr;
// no dr for non-decoding for now
if (!IMGFMT_IS_VDPAU(image_format)) return VO_FALSE;
if (mpi->type != MP_IMGTYPE_NUMBERED) return VO_FALSE;
rndr = get_surface(mpi->number);
if (!rndr) {
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] no surfaces available in get_image\n");
// TODO: this probably breaks things forever, provide a dummy buffer?
return VO_FALSE;
}
mpi->flags |= MP_IMGFLAG_DIRECT;
mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = 0;
mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = NULL;
// hack to get around a check and to avoid a special-case in vd_ffmpeg.c
mpi->planes[0] = (void *)rndr;
mpi->num_planes = 1;
mpi->priv = rndr;
return VO_TRUE;
}
static int query_format(uint32_t format)
{
switch (format) {
case IMGFMT_YV12:
case IMGFMT_VDPAU_MPEG1:
case IMGFMT_VDPAU_MPEG2:
case IMGFMT_VDPAU_H264:
case IMGFMT_VDPAU_WMV3:
case IMGFMT_VDPAU_VC1:
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD;
}
return 0;
}
static void DestroyVdpauObjects(void)
{
int i;
VdpStatus vdp_st;
free_video_specific();
vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue);
CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy")
vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target);
CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy")
for (i = 0; i < NUM_OUTPUT_SURFACES; i++) {
vdp_st = vdp_output_surface_destroy(output_surfaces[i]);
output_surfaces[i] = VDP_INVALID_HANDLE;
CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy")
}
vdp_st = vdp_device_destroy(vdp_device);
CHECK_ST_WARNING("Error when calling vdp_device_destroy")
}
static void uninit(void)
{
if (!vo_config_count)
return;
visible_buf = 0;
/* Destroy all vdpau objects */
DestroyVdpauObjects();
free(index_data);
index_data = NULL;
#ifdef CONFIG_XF86VM
vo_vm_close();
#endif
vo_x11_uninit();
dlclose(vdpau_lib_handle);
}
static int preinit(const char *arg)
{
int i;
static const char *vdpaulibrary = "libvdpau.so.1";
static const char *vdpau_device_create = "vdp_device_create_x11";
if (arg) {
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Unknown subdevice: %s\n", arg);
return ENOSYS;
}
vdpau_lib_handle = dlopen(vdpaulibrary, RTLD_LAZY);
if (!vdpau_lib_handle) {
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Could not open dynamic library %s\n",
vdpaulibrary);
return -1;
}
vdp_device_create = dlsym(vdpau_lib_handle, vdpau_device_create);
if (!vdp_device_create) {
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Could not find function %s in %s\n",
vdpau_device_create, vdpaulibrary);
return -1;
}
if (!vo_init() || win_x11_init_vdpau_procs())
return -1;
decoder = VDP_INVALID_HANDLE;
for (i = 0; i < MAX_VIDEO_SURFACES; i++)
surface_render[i].surface = VDP_INVALID_HANDLE;
video_mixer = VDP_INVALID_HANDLE;
for (i = 0; i < NUM_OUTPUT_SURFACES; i++)
output_surfaces[i] = VDP_INVALID_HANDLE;
vdp_flip_queue = VDP_INVALID_HANDLE;
output_surface_width = output_surface_height = -1;
// full grayscale palette.
for (i = 0; i < PALETTE_SIZE; ++i)
palette[i] = (i << 16) | (i << 8) | i;
index_data = NULL;
index_data_size = 0;
return 0;
}
static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_PAUSE:
return (int_pause = 1);
case VOCTRL_RESUME:
return (int_pause = 0);
case VOCTRL_QUERY_FORMAT:
return query_format(*(uint32_t *)data);
case VOCTRL_GET_IMAGE:
return get_image(data);
case VOCTRL_DRAW_IMAGE:
return draw_image(data);
case VOCTRL_GUISUPPORT:
return VO_TRUE;
case VOCTRL_BORDER:
vo_x11_border();
resize();
return VO_TRUE;
case VOCTRL_FULLSCREEN:
vo_x11_fullscreen();
resize();
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
return VO_TRUE;
case VOCTRL_SET_PANSCAN:
resize();
return VO_TRUE;
case VOCTRL_SET_EQUALIZER: {
struct voctrl_set_equalizer_args *args = data;
return vo_x11_set_equalizer(args->name, args->value);
}
case VOCTRL_GET_EQUALIZER:
{
struct voctrl_get_equalizer_args *args = data;
return vo_x11_get_equalizer(args->name, args->valueptr);
}
case VOCTRL_ONTOP:
vo_x11_ontop();
return VO_TRUE;
case VOCTRL_UPDATE_SCREENINFO:
update_xinerama_info();
return VO_TRUE;
}
return VO_NOTIMPL;
}
/* @} */

View File

@ -30,7 +30,7 @@
#include "help_mp.h"
#include "gtf.h"
#include <stdio.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>

View File

@ -186,7 +186,7 @@ static void resize(struct vo *vo)
struct xvctx *ctx = vo->priv;
calc_src_dst_rects(vo, ctx->image_width, ctx->image_height, &ctx->src_rect,
&ctx->dst_rect, NULL);
&ctx->dst_rect, NULL, NULL);
struct vo_rect *dst = &ctx->dst_rect;
vo_x11_clearwindow_part(vo, vo->x11->window, dst->width, dst->height, 1);
vo_xv_draw_colorkey(vo, dst->left, dst->top, dst->width, dst->height);

View File

@ -529,7 +529,7 @@ int vm = flags & VOFLAG_MODESWITCHING;
surface_render[i].data_blocks = data_blocks.blocks;
surface_render[i].mv_blocks = mv_blocks.macro_blocks;
surface_render[i].allocated_mv_blocks = numblocks;
surface_render[i].allocated_data_blocks = numblocks*blocks_per_macroblock;;
surface_render[i].allocated_data_blocks = numblocks*blocks_per_macroblock;
surface_render[i].idct = (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT;
surface_render[i].unsigned_intra = (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED;
surface_render[i].p_surface = &surface_array[i];
@ -943,7 +943,7 @@ int i;
if(p_render_surface == NULL)
return;
calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL);
calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL);
if(draw_ck)
vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);

View File

@ -202,6 +202,7 @@ void xscreensaver_heartbeat(struct vo_x11_state *x11);
#define vo_x11_classhint(display, window, name) vo_x11_classhint(global_vo, window, name)
#define vo_x11_setlayer(display, window, layer) vo_x11_setlayer(global_vo, window, layer)
#define xv_setup_colorkeyhandling(a, b) xv_setup_colorkeyhandling(global_vo, a, b)
#define vo_x11_border() vo_x11_border(global_vo)
#define mDisplay global_vo->x11->display
#define vo_depthonscreen global_vo->x11->depthonscreen

View File

@ -7,7 +7,7 @@
#include "debug.h"
#include <stdio.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>

View File

@ -184,7 +184,7 @@ int DS_AudioDecoder_GetSrcSize(DS_AudioDecoder *this, int dest_size)
{
double efficiency =(double) this->in_fmt.nAvgBytesPerSec
/ (this->in_fmt.nSamplesPerSec*this->in_fmt.nBlockAlign);
int frames = (int)(dest_size*efficiency);;
int frames = (int)(dest_size*efficiency);
if (frames < 1)
frames = 1;

View File

@ -14,7 +14,7 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <unistd.h>

View File

@ -18,7 +18,7 @@ void* GetProcAddress(void* handle,char* func);
#define __cdecl __attribute__((__cdecl__))
#define APIENTRY
int main(int argc, char *argv[]){
int main(void) {
void *handler;
ComponentDescription desc;
Component (*FindNextComponent)(Component prev,ComponentDescription* desc);

View File

@ -33,7 +33,7 @@ unsigned int* x_table[0x00001837];
static OSErr (*InitializeQTML)(long flags);
int main(int argc, char *argv[]){
int main(void) {
void *handler;
void *handler2;
void* theqtdp=NULL;

View File

@ -53,7 +53,7 @@ for DLL to know too much about its environment.
#include <ctype.h>
#include <pthread.h>
#include <errno.h>
#ifdef HAVE_MALLOC_H
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <time.h>

View File

@ -19,8 +19,6 @@
#include "mpg123.h"
#include "huffman.h"
#include "mp3.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "mpbswap.h"
#include "cpudetect.h"
//#include "liba52/mm_accel.h"
@ -28,6 +26,9 @@
#include "libvo/fastmemcpy.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#undef fprintf
#undef printf

View File

@ -225,7 +225,7 @@ inline static int stream_read(stream_t *s,char* mem,int total){
inline static unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max) {
int len;
unsigned char* end,*ptr = mem;;
unsigned char* end,*ptr = mem;
do {
len = s->buf_len-s->buf_pos;
// try to fill the buffer

View File

@ -733,7 +733,7 @@ int mp_dvdnav_aid_from_lang(stream_t *stream, unsigned char *language) {
dvdnav_priv_t * priv = stream->priv;
int k;
uint8_t lg;
uint16_t lang, lcode;;
uint16_t lang, lcode;
while(language && strlen(language)>=2) {
lcode = (language[0] << 8) | (language[1]);

View File

@ -3312,7 +3312,7 @@ static int control(priv_t * priv, int cmd, void *arg)
if (!priv->chains[1]->arpmt[0])
return TVI_CONTROL_FALSE;
samplerate = *(int *) arg;;
samplerate = *(int *) arg;
for (i = 0; priv->chains[1]->arpmt[i]; i++)
if (check_audio_format