View | Details | Raw Unified | Return to bug 13452
Collapse All | Expand All

(-)codec-cfg.c (+1 lines)
Lines 179-184 Link Here
179
		{"ZRMJPEGIT", IMGFMT_ZRMJPEGIT},
179
		{"ZRMJPEGIT", IMGFMT_ZRMJPEGIT},
180
		{"ZRMJPEGIB", IMGFMT_ZRMJPEGIB},
180
		{"ZRMJPEGIB", IMGFMT_ZRMJPEGIB},
181
181
182
		{"VLD_MPEG2",IMGFMT_XVMC_VLD_MPEG2},
182
		{"IDCT_MPEG2",IMGFMT_XVMC_IDCT_MPEG2},
183
		{"IDCT_MPEG2",IMGFMT_XVMC_IDCT_MPEG2},
183
		{"MOCO_MPEG2",IMGFMT_XVMC_MOCO_MPEG2},
184
		{"MOCO_MPEG2",IMGFMT_XVMC_MOCO_MPEG2},
184
185
(-)configure (-1 / +28 lines)
Lines 527-532 Link Here
527
_dga2=auto
527
_dga2=auto
528
_xv=auto
528
_xv=auto
529
_xvmc=no  #auto when complete
529
_xvmc=no  #auto when complete
530
_xvmc_vld=auto
530
_sdl=auto
531
_sdl=auto
531
_directx=auto
532
_directx=auto
532
_win32waveout=auto
533
_win32waveout=auto
Lines 3901-3907 Link Here
3901
  _novomodules="x11 $_novomodules"
3902
  _novomodules="x11 $_novomodules"
3902
  _res_comment="check if the dev(el) packages are installed"
3903
  _res_comment="check if the dev(el) packages are installed"
3903
  # disable stuff that depends on X
3904
  # disable stuff that depends on X
3904
  _xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no
3905
  _xv=no ; _xvmc=no ; _xvmc_vld=no ; _xinerama=no ; _vm=no ; _xf86keysym=no
3905
fi
3906
fi
3906
echores "$_x11"
3907
echores "$_x11"
3907
3908
Lines 4001-4006 Link Here
4001
echores "$_xvmc"
4002
echores "$_xvmc"
4002
4003
4003
4004
4005
echocheck "XvMC VLD"
4006
if test "$_xvmc" = yes ; then
4007
  _xvmc_vld=no
4008
  cat > $TMPC <<EOF
4009
#include <X11/Xlib.h>
4010
#include <X11/extensions/Xvlib.h>
4011
#include <X11/extensions/XvMClib.h>
4012
#include <X11/extensions/vldXvMC.h>
4013
int main(void) { 
4014
  (void) XvMCQueryExtension(0,0,0);
4015
  (void) XvMCCreateContext(0,0,0,0,0,0,0);
4016
  return 0; }
4017
EOF
4018
  cc_check -lXvMC -l$_xvmclib && _xvmc_vld=yes
4019
  if test "$_xvmc_vld" = yes ; then
4020
    _def_xvmc_vld='#define HAVE_XVMC_VLD 1'
4021
    _libs_mencoder="$_libs_mencoder -l$_xvmclib"
4022
  else
4023
    _def_xvmc_vld='#undef HAVE_XVMC_VLD'
4024
    _libavdecoders=`echo $_libavdecoders | sed -e s/MPEG_XVMC_VLD_DECODER// `
4025
  fi
4026
fi
4027
echores "$_xvmc_vld"
4028
4029
4004
echocheck "Xinerama"
4030
echocheck "Xinerama"
4005
if test "$_xinerama" = auto ; then
4031
if test "$_xinerama" = auto ; then
4006
  cat > $TMPC <<EOF
4032
  cat > $TMPC <<EOF
Lines 8455-8460 Link Here
8455
$_def_x11
8481
$_def_x11
8456
$_def_xv
8482
$_def_xv
8457
$_def_xvmc
8483
$_def_xvmc
8484
$_def_xvmc_vld
8458
$_def_vm
8485
$_def_vm
8459
$_def_xf86keysym
8486
$_def_xf86keysym
8460
$_def_xinerama
8487
$_def_xinerama
(-)etc/codecs.conf (+1 lines)
Lines 128-133 Link Here
128
  fourcc MMES,mmes   ; matrox mpeg2 in avi
128
  fourcc MMES,mmes   ; matrox mpeg2 in avi
129
  driver ffmpeg
129
  driver ffmpeg
130
  dll "mpegvideo_xvmc"
130
  dll "mpegvideo_xvmc"
131
  out VLD_MPEG2
131
  out IDCT_MPEG2
132
  out IDCT_MPEG2
132
  out MOCO_MPEG2
133
  out MOCO_MPEG2
133
134
(-)help/help_mp-en.h (+1 lines)
Lines 1645-1650 Link Here
1645
#define MSGTR_MPCODECS_DRIFailure "[VD_FFMPEG] DRI failure.\n"
1645
#define MSGTR_MPCODECS_DRIFailure "[VD_FFMPEG] DRI failure.\n"
1646
#define MSGTR_MPCODECS_CouldntAllocateImageForCodec "[VD_FFMPEG] Couldn't allocate image for codec.\n"
1646
#define MSGTR_MPCODECS_CouldntAllocateImageForCodec "[VD_FFMPEG] Couldn't allocate image for codec.\n"
1647
#define MSGTR_MPCODECS_XVMCAcceleratedMPEG2 "[VD_FFMPEG] XVMC-accelerated MPEG-2.\n"
1647
#define MSGTR_MPCODECS_XVMCAcceleratedMPEG2 "[VD_FFMPEG] XVMC-accelerated MPEG-2.\n"
1648
#define MSGTR_MPCODECS_XVMCVLDAcceleratedMPEG2 "[VD_FFMPEG] XVMC-VLD-accelerated MPEG-2.\n"
1648
#define MSGTR_MPCODECS_TryingPixfmt "[VD_FFMPEG] Trying pixfmt=%d.\n"
1649
#define MSGTR_MPCODECS_TryingPixfmt "[VD_FFMPEG] Trying pixfmt=%d.\n"
1649
#define MSGTR_MPCODECS_McGetBufferShouldWorkOnlyWithXVMC "[VD_FFMPEG] The mc_get_buffer should work only with XVMC acceleration!!"
1650
#define MSGTR_MPCODECS_McGetBufferShouldWorkOnlyWithXVMC "[VD_FFMPEG] The mc_get_buffer should work only with XVMC acceleration!!"
1650
#define MSGTR_MPCODECS_UnexpectedInitVoError "[VD_FFMPEG] Unexpected init_vo error.\n"
1651
#define MSGTR_MPCODECS_UnexpectedInitVoError "[VD_FFMPEG] Unexpected init_vo error.\n"
(-)libmpcodecs/vd_ffmpeg.c (-2 / +25 lines)
Lines 12-17 Link Here
12
#include "mpbswap.h"
12
#include "mpbswap.h"
13
13
14
#include "vd_internal.h"
14
#include "vd_internal.h"
15
#include "libvo/video_out.h"
15
16
16
static vd_info_t info = {
17
static vd_info_t info = {
17
	"FFmpeg's libavcodec codec family",
18
	"FFmpeg's libavcodec codec family",
Lines 155-160 Link Here
155
        case IMGFMT_XVMC_IDCT_MPEG2:
156
        case IMGFMT_XVMC_IDCT_MPEG2:
156
        case IMGFMT_XVMC_MOCO_MPEG2:
157
        case IMGFMT_XVMC_MOCO_MPEG2:
157
            if(avctx->pix_fmt==PIX_FMT_XVMC_MPEG2_IDCT) return CONTROL_TRUE;
158
            if(avctx->pix_fmt==PIX_FMT_XVMC_MPEG2_IDCT) return CONTROL_TRUE;
159
        case IMGFMT_XVMC_VLD_MPEG2:
160
            if(avctx->pix_fmt==PIX_FMT_XVMC_MPEG2_VLD) return CONTROL_TRUE;
158
#endif
161
#endif
159
	}
162
	}
160
        return CONTROL_FALSE;
163
        return CONTROL_FALSE;
Lines 225-230 Link Here
225
    vd_ffmpeg_ctx *ctx;
228
    vd_ffmpeg_ctx *ctx;
226
    AVCodec *lavc_codec;
229
    AVCodec *lavc_codec;
227
    int lowres_w=0;
230
    int lowres_w=0;
231
#ifdef HAVE_XVMC
232
    char *voname = 0;
233
#endif
228
    int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
234
    int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
229
235
230
    if(!avcodec_inited){
236
    if(!avcodec_inited){
Lines 260-270 Link Here
260
266
261
#ifdef HAVE_XVMC
267
#ifdef HAVE_XVMC
262
268
269
    // Try and get the name of the selected vo system
270
    // so that if its _not_ xvmc we can fail gracefully
271
    // and mplayer can fall back to a sw decoder
272
    if (sh->video_out) {
273
      vo_info_t *voinfo;
274
      vo_functions_t * shvoc=sh->video_out;
275
      if (shvoc) {
276
        voinfo = shvoc->info;
277
        if (voinfo) voname=voinfo->short_name;
278
      }
279
    }
263
#ifdef CODEC_CAP_HWACCEL
280
#ifdef CODEC_CAP_HWACCEL
264
    if(lavc_codec->capabilities & CODEC_CAP_HWACCEL){
281
    if((lavc_codec->capabilities & CODEC_CAP_HWACCEL) &&
265
#else
282
#else
266
    if(lavc_codec->id == CODEC_ID_MPEG2VIDEO_XVMC){
283
    if((lavc_codec->id == CODEC_ID_MPEG2VIDEO_XVMC) &&
267
#endif /* CODEC_CAP_HWACCEL */
284
#endif /* CODEC_CAP_HWACCEL */
285
        voname && !strcmp(voname,"xvmc") ) {
268
        mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec);
286
        mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec);
269
        assert(ctx->do_dr1);//these are must to!
287
        assert(ctx->do_dr1);//these are must to!
270
        assert(ctx->do_slices); //it is (vo_)ffmpeg bug if this fails
288
        assert(ctx->do_slices); //it is (vo_)ffmpeg bug if this fails
Lines 535-540 Link Here
535
#ifdef HAVE_XVMC
553
#ifdef HAVE_XVMC
536
        case PIX_FMT_XVMC_MPEG2_MC:ctx->best_csp=IMGFMT_XVMC_MOCO_MPEG2;break;
554
        case PIX_FMT_XVMC_MPEG2_MC:ctx->best_csp=IMGFMT_XVMC_MOCO_MPEG2;break;
537
        case PIX_FMT_XVMC_MPEG2_IDCT:ctx->best_csp=IMGFMT_XVMC_IDCT_MPEG2;break;
555
        case PIX_FMT_XVMC_MPEG2_IDCT:ctx->best_csp=IMGFMT_XVMC_IDCT_MPEG2;break;
556
        case PIX_FMT_XVMC_MPEG2_VLD:ctx->best_csp=IMGFMT_XVMC_VLD_MPEG2;break;
538
#endif
557
#endif
539
	default:
558
	default:
540
	    ctx->best_csp=0;
559
	    ctx->best_csp=0;
Lines 919-925 Link Here
919
        avctx->get_buffer= mc_get_buffer;
938
        avctx->get_buffer= mc_get_buffer;
920
        avctx->release_buffer= mc_release_buffer;
939
        avctx->release_buffer= mc_release_buffer;
921
        avctx->draw_horiz_band = mc_render_slice;
940
        avctx->draw_horiz_band = mc_render_slice;
941
        if (avctx->xvmc_acceleration != 4)
922
        mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedMPEG2);
942
        mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedMPEG2);
943
        else
944
            mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCVLDAcceleratedMPEG2);
945
923
        assert(ctx->do_dr1);//these are must to!
946
        assert(ctx->do_dr1);//these are must to!
924
        assert(ctx->do_slices); //it is (vo_)ffmpeg bug if this fails
947
        assert(ctx->do_slices); //it is (vo_)ffmpeg bug if this fails
925
        avctx->flags|= CODEC_FLAG_EMU_EDGE;//do i need that??!!
948
        avctx->flags|= CODEC_FLAG_EMU_EDGE;//do i need that??!!
(-)libmpcodecs/img_format.c (+1 lines)
Lines 67-72 Link Here
67
	case IMGFMT_ZRMJPEGIB: return("Zoran MJPEG bottom field first");
67
	case IMGFMT_ZRMJPEGIB: return("Zoran MJPEG bottom field first");
68
	case IMGFMT_XVMC_MOCO_MPEG2: return("MPEG1/2 Motion Compensation");
68
	case IMGFMT_XVMC_MOCO_MPEG2: return("MPEG1/2 Motion Compensation");
69
	case IMGFMT_XVMC_IDCT_MPEG2: return("MPEG1/2 Motion Compensation and IDCT");
69
	case IMGFMT_XVMC_IDCT_MPEG2: return("MPEG1/2 Motion Compensation and IDCT");
70
	case IMGFMT_XVMC_VLD_MPEG2: return("MPEG1/2 Motion Compensation and VLD");
70
    }
71
    }
71
    snprintf(unknow_format,20,"Unknown 0x%04x",format);
72
    snprintf(unknow_format,20,"Unknown 0x%04x",format);
72
    return unknow_format;
73
    return unknow_format;
(-)libmpcodecs/img_format.h (+1 lines)
Lines 107-112 Link Here
107
//these are chroma420
107
//these are chroma420
108
#define IMGFMT_XVMC_MOCO_MPEG2 (IMGFMT_XVMC|0x02)
108
#define IMGFMT_XVMC_MOCO_MPEG2 (IMGFMT_XVMC|0x02)
109
#define IMGFMT_XVMC_IDCT_MPEG2 (IMGFMT_XVMC|0x82)
109
#define IMGFMT_XVMC_IDCT_MPEG2 (IMGFMT_XVMC|0x82)
110
#define IMGFMT_XVMC_VLD_MPEG2 (IMGFMT_XVMC|0x42)
110
111
111
typedef struct {
112
typedef struct {
112
    void* data;
113
    void* data;
(-)libmpdemux/stheader.h (+1 lines)
Lines 78-83 Link Here
78
  int disp_w,disp_h;      // display size (filled by fileformat parser)
78
  int disp_w,disp_h;      // display size (filled by fileformat parser)
79
  // output driver/filters: (set by libmpcodecs core)
79
  // output driver/filters: (set by libmpcodecs core)
80
  unsigned int outfmtidx;
80
  unsigned int outfmtidx;
81
  void* video_out;        // the video_out handle, used for this video stream
81
  struct vf_instance_s *vfilter;          // the video filter chain, used for this video stream
82
  struct vf_instance_s *vfilter;          // the video filter chain, used for this video stream
82
  int vf_inited;
83
  int vf_inited;
83
#ifdef DYNAMIC_PLUGINS
84
#ifdef DYNAMIC_PLUGINS
(-)libvo/vo_xvmc.c (-8 / +146 lines)
Lines 23-28 Link Here
23
#include <X11/extensions/Xvlib.h>
23
#include <X11/extensions/Xvlib.h>
24
#include <X11/extensions/XvMClib.h>
24
#include <X11/extensions/XvMClib.h>
25
25
26
#ifdef HAVE_XVMC_VLD
27
#include <X11/extensions/vldXvMC.h>
28
extern int has_xvmc_vld;
29
#endif
30
26
#include "x11_common.h"
31
#include "x11_common.h"
27
#include "xvmc_render.h"
32
#include "xvmc_render.h"
28
33
Lines 45-50 Link Here
45
50
46
51
47
#define UNUSED(x) ((void)(x))
52
#define UNUSED(x) ((void)(x))
53
extern unsigned int video_format; 
48
54
49
#include "libavcodec/avcodec.h"
55
#include "libavcodec/avcodec.h"
50
#if LIBAVCODEC_BUILD < ((51<<16)+(40<<8)+2)
56
#if LIBAVCODEC_BUILD < ((51<<16)+(40<<8)+2)
Lines 59-64 Link Here
59
static int xv_port_request = 0;
65
static int xv_port_request = 0;
60
static int bob_deinterlace;
66
static int bob_deinterlace;
61
static int top_field_first;
67
static int top_field_first;
68
static int use_deint_one;
69
static int use_tv_clip;
62
70
63
static int image_width,image_height;
71
static int image_width,image_height;
64
static int image_format;
72
static int image_format;
Lines 123-129 Link Here
123
  "XVideo Motion Compensation",
131
  "XVideo Motion Compensation",
124
  "xvmc",
132
  "xvmc",
125
  "Ivan Kalvachev <iive@users.sf.net>",
133
  "Ivan Kalvachev <iive@users.sf.net>",
126
  ""
134
  "Ivor Hewitt <ivor@ivor.org> - VIA VLD support"
127
};
135
};
128
136
129
LIBVO_EXTERN(xvmc);
137
LIBVO_EXTERN(xvmc);
Lines 196-202 Link Here
196
}
204
}
197
//end of vo_xv shm/xvimage code
205
//end of vo_xv shm/xvimage code
198
206
207
int hasVLDAcceleration()
208
{
209
#ifdef HAVE_XVMC_VLD
210
    return XVMC_VLD == (surface_info.mc_type & XVMC_VLD);
211
#else
212
    return 0;
213
#endif
214
}            
215
199
static int xvmc_check_surface_format(uint32_t format, XvMCSurfaceInfo * surf_info){
216
static int xvmc_check_surface_format(uint32_t format, XvMCSurfaceInfo * surf_info){
217
#ifdef HAVE_XVMC_VLD
218
    if (format == IMGFMT_XVMC_VLD_MPEG2 ){
219
        if( surf_info->mc_type != (XVMC_VLD|XVMC_MPEG_2) ) return -1;
220
        if( surf_info->chroma_format != XVMC_CHROMA_FORMAT_420 ) return -1;
221
        return 0;
222
    }
223
#endif
200
   if ( format == IMGFMT_XVMC_IDCT_MPEG2 ){ 
224
   if ( format == IMGFMT_XVMC_IDCT_MPEG2 ){ 
201
      if( surf_info->mc_type != (XVMC_IDCT|XVMC_MPEG_2) ) return -1;
225
      if( surf_info->mc_type != (XVMC_IDCT|XVMC_MPEG_2) ) return -1;
202
      if( surf_info->chroma_format != XVMC_CHROMA_FORMAT_420 ) return -1;
226
      if( surf_info->chroma_format != XVMC_CHROMA_FORMAT_420 ) return -1;
Lines 361-366 Link Here
361
   return VO_TRUE;
385
   return VO_TRUE;
362
}
386
}
363
387
388
389
static int
390
check_xvmc_vld()
391
{
392
   int              rez;
393
   XvAdaptorInfo*   ai;
394
   XvMCSurfaceInfo* surf_info;
395
   int              max_adaptor;
396
   int              max_surf;
397
   int              i;
398
   unsigned long    p;
399
   int              s;
400
401
   rez = XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay),
402
        &max_adaptor,&ai);
403
   if (rez != Success)  return;
404
405
   if (mp_msg_test(MSGT_VO, MSGL_DBG3))
406
      printf("vo_xvmc: Querying %d adaptors for VLD\n", max_adaptor);
407
408
   for (i = 0;  i < max_adaptor;  i++)
409
   {
410
      if (mp_msg_test(MSGT_VO,MSGL_DBG3))
411
         printf("vo_xvmc: Quering adaptor #%d for VLD\n", i);
412
      if (ai[i].type == 0)  continue;
413
414
      // Probing every XV port
415
      for (p = ai[i].base_id;  p < ai[i].base_id + ai[i].num_ports;  p++)
416
      {
417
         // Respect the users wish
418
         if ((xv_port_request != 0) && (xv_port_request != p))  continue;
419
         if (mp_msg_test(MSGT_VO,MSGL_DBG3))
420
            printf("vo_xvmc: Probing port #%ld for VLD\n", p);
421
         surf_info = XvMCListSurfaceTypes(mDisplay, p, &max_surf);
422
         if (surf_info == NULL || max_surf == 0)  continue;
423
424
         // We have XvMC list!
425
         for(s = 0;  s < max_surf;  s++)
426
         {
427
            // We have match!
428
            if (XVMC_VLD == (surf_info[s].mc_type & XVMC_VLD))
429
                has_xvmc_vld = 1;
430
         }
431
         XFree(surf_info);
432
      }
433
   }
434
   XvFreeAdaptorInfo(ai);
435
436
   if (mp_msg_test(MSGT_VO,MSGL_DBG3) && has_xvmc_vld)
437
      printf("vo_xvmc: Found VLD support in XvMC\n");
438
}
439
440
364
static int preinit(const char *arg){
441
static int preinit(const char *arg){
365
int xv_version,xv_release,xv_request_base,xv_event_base,xv_error_base;
442
int xv_version,xv_release,xv_request_base,xv_event_base,xv_error_base;
366
int mc_eventBase,mc_errorBase;
443
int mc_eventBase,mc_errorBase;
Lines 377-385 Link Here
377
  {  "sleep",     OPT_ARG_BOOL, &use_sleep,       NULL },
454
  {  "sleep",     OPT_ARG_BOOL, &use_sleep,       NULL },
378
  {  "queue",     OPT_ARG_BOOL, &use_queue,       NULL },
455
  {  "queue",     OPT_ARG_BOOL, &use_queue,       NULL },
379
  {  "bobdeint",  OPT_ARG_BOOL, &bob_deinterlace, NULL },
456
  {  "bobdeint",  OPT_ARG_BOOL, &bob_deinterlace, NULL },
457
  {  "onedeint",  OPT_ARG_BOOL, &use_deint_one,   NULL },
458
  {  "tv-clip",   OPT_ARG_BOOL, &use_tv_clip,     NULL },
380
  {  NULL }
459
  {  NULL }
381
};
460
};
382
461
462
   // If the video is not MPEG1 or MPEG2, we can't decode it, so
463
   // fail cleanly to allow mplayer to fallback to another vo system
464
   if (video_format != 0x10000001 && video_format != 0x10000002) return -1;
465
466
383
   //Obtain display handler
467
   //Obtain display handler
384
   if (!vo_init()) return -1;//vo_xv
468
   if (!vo_init()) return -1;//vo_xv
385
469
Lines 415-420 Link Here
415
   use_sleep = 0;
499
   use_sleep = 0;
416
   use_queue = 0;
500
   use_queue = 0;
417
   bob_deinterlace = 0;
501
   bob_deinterlace = 0;
502
   use_deint_one = 0;
503
   use_tv_clip = 0;
418
504
419
   /* parse suboptions */
505
   /* parse suboptions */
420
   if ( subopt_parse( arg, subopts ) != 0 )
506
   if ( subopt_parse( arg, subopts ) != 0 )
Lines 424-429 Link Here
424
510
425
   xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str );
511
   xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str );
426
512
513
   // Check whether XvMC supports VLD
514
   check_xvmc_vld();
515
427
   return 0;
516
   return 0;
428
}
517
}
429
518
Lines 505-510 Link Here
505
   if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_444)
594
   if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_444)
506
      blocks_per_macroblock = 12;
595
      blocks_per_macroblock = 12;
507
596
597
if (!hasVLDAcceleration())
598
{
508
   rez = XvMCCreateBlocks(mDisplay,&ctx,numblocks*blocks_per_macroblock,&data_blocks);
599
   rez = XvMCCreateBlocks(mDisplay,&ctx,numblocks*blocks_per_macroblock,&data_blocks);
509
   if( rez != Success ){
600
   if( rez != Success ){
510
      XvMCDestroyContext(mDisplay,&ctx);
601
      XvMCDestroyContext(mDisplay,&ctx);
Lines 520-525 Link Here
520
   }
611
   }
521
   printf("vo_xvmc: mv_blocks allocated\n");
612
   printf("vo_xvmc: mv_blocks allocated\n");
522
613
614
}
615
523
   if(surface_render==NULL)
616
   if(surface_render==NULL)
524
      surface_render=malloc(MAX_SURFACES*sizeof(xvmc_render_state_t));//easy mem debug
617
      surface_render=malloc(MAX_SURFACES*sizeof(xvmc_render_state_t));//easy mem debug
525
   memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t));
618
   memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t));
Lines 538-543 Link Here
538
      surface_render[i].chroma_format = surface_info.chroma_format;
631
      surface_render[i].chroma_format = surface_info.chroma_format;
539
      surface_render[i].unsigned_intra = (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED;
632
      surface_render[i].unsigned_intra = (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED;
540
      surface_render[i].p_surface = &surface_array[i];
633
      surface_render[i].p_surface = &surface_array[i];
634
635
      surface_render[i].state = 0;
636
      surface_render[i].disp = mDisplay;
637
      surface_render[i].ctx = &ctx;
638
541
      if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
639
      if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
542
          printf("vo_xvmc: surface[%d] = %p .rndr=%p\n",i,&surface_array[i], &surface_render[i]);
640
          printf("vo_xvmc: surface[%d] = %p .rndr=%p\n",i,&surface_array[i], &surface_render[i]);
543
   }
641
   }
Lines 993-998 Link Here
993
int rez;
1091
int rez;
994
int clipX,clipY,clipW,clipH;
1092
int clipX,clipY,clipW,clipH;
995
int i;
1093
int i;
1094
 int srcY=0, srcH=image_height;
1095
 int fieldnobob;
996
1096
997
   if(p_render_surface == NULL)
1097
   if(p_render_surface == NULL)
998
      return;
1098
      return;
Lines 1002-1023 Link Here
1002
   clipW = vo_dwidth+vo_panscan_x;
1102
   clipW = vo_dwidth+vo_panscan_x;
1003
   clipH = vo_dheight+vo_panscan_y;
1103
   clipH = vo_dheight+vo_panscan_y;
1004
   
1104
   
1105
   if (use_tv_clip) {
1106
     /*
1107
      * Clip top few lines off to get rid of annoying flicker
1108
      * when using bob de-interlacing on TV sourced video.
1109
      */
1110
     srcY+=4;
1111
     srcH-=4;
1112
   }
1113
   
1005
   if(draw_ck)
1114
   if(draw_ck)
1006
      vo_xv_draw_colorkey(clipX,clipY,clipW,clipH);
1115
      vo_xv_draw_colorkey(clipX,clipY,clipW,clipH);
1007
1116
1008
   if(benchmark)
1117
   if(benchmark)
1009
      return;
1118
      return;
1010
1119
1120
   fieldnobob = XVMC_FRAME_PICTURE;
1121
1122
   if (use_deint_one) 
1123
     fieldnobob = (top_field_first) ? XVMC_TOP_FIELD : XVMC_BOTTOM_FIELD;
1124
1011
   for (i = 1; i <= bob_deinterlace + 1; i++) {
1125
   for (i = 1; i <= bob_deinterlace + 1; i++) {
1012
   int field = top_field_first ? i : i ^ 3;
1126
     int field = top_field_first ? i : i ^ XVMC_FRAME_PICTURE;
1013
   rez = XvMCPutSurface(mDisplay, p_render_surface->p_surface, 
1127
   rez = XvMCPutSurface(mDisplay, p_render_surface->p_surface, 
1014
                        vo_window,
1128
                        vo_window,
1015
                        0, 0, image_width, image_height,
1129
			  0, srcY, image_width, srcH,
1016
                        clipX, clipY, clipW, clipH,
1130
                        clipX, clipY, clipW, clipH,
1017
                        bob_deinterlace ? field : 3);
1131
			  bob_deinterlace ? field : fieldnobob);
1018
                        //p_render_surface_to_show->display_flags);
1132
     if (i == 1 && bob_deinterlace) {
1133
       usleep(10*1000);
1134
     }
1019
   if(rez != Success){
1135
   if(rez != Success){
1020
      printf("vo_xvmc: PutSurface failer, critical error %d!\n",rez);
1136
       printf("vo_xvmc: PutSurface failure, critical error %d!\n",rez);
1021
      assert(0);
1137
      assert(0);
1022
   }
1138
   }
1023
   }
1139
   }
Lines 1109-1117 Link Here
1109
1225
1110
   if( number_of_surfaces ){
1226
   if( number_of_surfaces ){
1111
1227
1228
      if (!hasVLDAcceleration())
1229
      {
1112
      XvMCDestroyMacroBlocks(mDisplay,&mv_blocks);
1230
      XvMCDestroyMacroBlocks(mDisplay,&mv_blocks);
1113
      XvMCDestroyBlocks(mDisplay,&data_blocks);
1231
      XvMCDestroyBlocks(mDisplay,&data_blocks);
1114
1232
      }
1115
      for(i=0; i<number_of_surfaces; i++)
1233
      for(i=0; i<number_of_surfaces; i++)
1116
      {
1234
      {
1117
         XvMCHideSurface(mDisplay,&surface_array[i]);//it doesn't hurt, I hope
1235
         XvMCHideSurface(mDisplay,&surface_array[i]);//it doesn't hurt, I hope
Lines 1189-1194 Link Here
1189
   assert( rndr != NULL );
1307
   assert( rndr != NULL );
1190
   assert( rndr->magic == MP_XVMC_RENDER_MAGIC );
1308
   assert( rndr->magic == MP_XVMC_RENDER_MAGIC );
1191
1309
1310
   if (hasVLDAcceleration())
1311
   {
1312
        rez = XvMCPutSlice2(mDisplay,&ctx,(char*)rndr->slice_data,
1313
                            rndr->slice_datalen,
1314
                            rndr->slice_code);
1315
        if (rez)
1316
           printf("vo_xxmc::slice Error %d\n",rez);
1317
1318
   }
1319
   else
1320
   {
1192
   rez = XvMCRenderSurface(mDisplay,&ctx,rndr->picture_structure,
1321
   rez = XvMCRenderSurface(mDisplay,&ctx,rndr->picture_structure,
1193
             		   rndr->p_surface,
1322
             		   rndr->p_surface,
1194
                           rndr->p_past_surface,
1323
                           rndr->p_past_surface,
Lines 1200-1206 Link Here
1200
   if(rez != Success)
1329
   if(rez != Success)
1201
   {
1330
   {
1202
   int i;
1331
   int i;
1203
      printf("vo_xvmc::slice: RenderSirface returned %d\n",rez);
1332
      printf("vo_xvmc::slice: RenderSurface returned %d\n",rez);
1204
1333
1205
      printf("vo_xvmc::slice: pict=%d,flags=%x,start_blocks=%d,num_blocks=%d\n",
1334
      printf("vo_xvmc::slice: pict=%d,flags=%x,start_blocks=%d,num_blocks=%d\n",
1206
             rndr->picture_structure,rndr->flags,rndr->start_mv_blocks_num,
1335
             rndr->picture_structure,rndr->flags,rndr->start_mv_blocks_num,
Lines 1228-1233 Link Here
1228
   rez = XvMCFlushSurface(mDisplay, rndr->p_surface);
1357
   rez = XvMCFlushSurface(mDisplay, rndr->p_surface);
1229
   assert(rez==Success);
1358
   assert(rez==Success);
1230
1359
1360
}
1231
//   rndr->start_mv_blocks_num += rndr->filled_mv_blocks_num;
1361
//   rndr->start_mv_blocks_num += rndr->filled_mv_blocks_num;
1232
   rndr->start_mv_blocks_num = 0;
1362
   rndr->start_mv_blocks_num = 0;
1233
   rndr->filled_mv_blocks_num = 0;
1363
   rndr->filled_mv_blocks_num = 0;
Lines 1337-1344 Link Here
1337
1467
1338
// these are shared!! so watch out
1468
// these are shared!! so watch out
1339
// do call RenderSurface before overwriting
1469
// do call RenderSurface before overwriting
1470
if (!hasVLDAcceleration())
1471
{
1340
   mpi->planes[0] = (char*)data_blocks.blocks;   
1472
   mpi->planes[0] = (char*)data_blocks.blocks;   
1341
   mpi->planes[1] = (char*)mv_blocks.macro_blocks;
1473
   mpi->planes[1] = (char*)mv_blocks.macro_blocks;
1474
}
1475
else
1476
{
1477
   mpi->planes[0] = 1;
1478
   mpi->planes[1] = 0;
1479
}
1342
   mpi->priv =
1480
   mpi->priv =
1343
   mpi->planes[2] = (char*)rndr;
1481
   mpi->planes[2] = (char*)rndr;
1344
1482
(-)mencoder.c (+1 lines)
Lines 771-776 Link Here
771
mux_v->bih=NULL;
771
mux_v->bih=NULL;
772
}
772
}
773
sh_video->codec=NULL;
773
sh_video->codec=NULL;
774
sh_video->video_out=NULL;
774
sh_video->vfilter=NULL; // fixme!
775
sh_video->vfilter=NULL; // fixme!
775
776
776
switch(mux_v->codec){
777
switch(mux_v->codec){
(-)mplayer.c (+8 lines)
Lines 85-90 Link Here
85
int quiet=0;
85
int quiet=0;
86
int enable_mouse_movements=0;
86
int enable_mouse_movements=0;
87
87
88
unsigned int video_format=0;
89
88
#ifdef WIN32
90
#ifdef WIN32
89
char * proc_priority=NULL;
91
char * proc_priority=NULL;
90
#endif
92
#endif
Lines 1897-1906 Link Here
1897
    //shouldn't we set dvideo->id=-2 when we fail?
1899
    //shouldn't we set dvideo->id=-2 when we fail?
1898
    vo_config_count=0;
1900
    vo_config_count=0;
1899
    //if((mpctx->video_out->preinit(vo_subdevice))!=0){
1901
    //if((mpctx->video_out->preinit(vo_subdevice))!=0){
1902
1903
    // let the video driver know what format the video is in so it can
1904
    // reject it if it wants - lets vo_xvmc fail if ffmpeg12mc codec not used
1905
    video_format=sh_video->format; 
1906
1900
    if(!(mpctx->video_out=init_best_video_out(video_driver_list))){
1907
    if(!(mpctx->video_out=init_best_video_out(video_driver_list))){
1901
      mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorInitializingVODevice);
1908
      mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorInitializingVODevice);
1902
      goto err_out;
1909
      goto err_out;
1903
    }
1910
    }
1911
    sh_video->video_out=mpctx->video_out;
1904
    inited_flags|=INITED_VO;
1912
    inited_flags|=INITED_VO;
1905
  }
1913
  }
1906
1914
(-)xvmc_render.h (+12 lines)
Lines 5-10 Link Here
5
#include <X11/extensions/Xvlib.h>
5
#include <X11/extensions/Xvlib.h>
6
#include <X11/extensions/XvMClib.h>
6
#include <X11/extensions/XvMClib.h>
7
7
8
#ifdef HAVE_XVMC_VLD
9
#include <X11/extensions/vldXvMC.h>
10
#endif
8
11
9
//the surface should be shown, video driver manipulate this
12
//the surface should be shown, video driver manipulate this
10
#define MP_XVMC_STATE_DISPLAY_PENDING 1
13
#define MP_XVMC_STATE_DISPLAY_PENDING 1
Lines 27-32 Link Here
27
  int idct;//does we use IDCT acceleration?
30
  int idct;//does we use IDCT acceleration?
28
  int chroma_format;//420,422,444
31
  int chroma_format;//420,422,444
29
  int unsigned_intra;//+-128 for intra pictures after clip
32
  int unsigned_intra;//+-128 for intra pictures after clip
33
#ifdef HAVE_XVMC_VLD
34
  // These are for the XVMC VLD slice interface
35
  int pict_type; //this is for skipping frames
36
  int slice_code; 
37
  int slice_datalen;
38
  unsigned char *slice_data;
39
  Display *disp;
40
  XvMCContext *ctx;
41
#endif
30
  XvMCSurface* p_surface;//pointer to rendered surface, never changed
42
  XvMCSurface* p_surface;//pointer to rendered surface, never changed
31
43
32
//these are changed by decoder
44
//these are changed by decoder

Return to bug 13452