Sync with latest round of xvmc changes in FFmpeg.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28237 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2009-01-02 17:06:09 +00:00
parent eec12427d7
commit 339746a776
3 changed files with 76 additions and 55 deletions

View File

@ -939,7 +939,7 @@ static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic){
sh_video_t * sh = avctx->opaque;
vd_ffmpeg_ctx *ctx = sh->context;
mp_image_t* mpi=NULL;
xvmc_render_state_t * render;
struct xvmc_render_state * render;
int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE|
MP_IMGFLAG_DRAW_CALLBACK;
@ -1018,7 +1018,7 @@ static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic){
pic->type= FF_BUFFER_TYPE_USER;
render=(xvmc_render_state_t*)mpi->priv;//same as data[2]
render=(struct xvmc_render_state*)mpi->priv;//same as data[2]
if( mp_msg_test(MSGT_DECVIDEO,MSGL_DBG5) )
mp_msg(MSGT_DECVIDEO, MSGL_DBG5, "vd_ffmpeg::mc_get_buffer (render=%p)\n",render);
assert(render != 0);
@ -1032,7 +1032,7 @@ static void mc_release_buffer(AVCodecContext *avctx, AVFrame *pic){
mp_image_t* mpi= pic->opaque;
sh_video_t * sh = avctx->opaque;
vd_ffmpeg_ctx *ctx = sh->context;
xvmc_render_state_t * render;
struct xvmc_render_state * render;
int i;
@ -1045,7 +1045,7 @@ static void mc_release_buffer(AVCodecContext *avctx, AVFrame *pic){
//printf("R%X %X\n", pic->linesize[0], pic->data[0]);
//mark the surface as not requared for prediction
render=(xvmc_render_state_t*)pic->data[2];//same as mpi->priv
render=(struct xvmc_render_state*)pic->data[2];//same as mpi->priv
if( mp_msg_test(MSGT_DECVIDEO,MSGL_DBG5) )
mp_msg(MSGT_DECVIDEO, MSGL_DBG5, "vd_ffmpeg::mc_release_buffer (render=%p)\n",render);
assert(render!=NULL);

View File

@ -84,13 +84,13 @@ static XvMCMacroBlockArray mv_blocks;
#define MAX_SURFACES 8
static int number_of_surfaces=0;
static XvMCSurface surface_array[MAX_SURFACES];
static xvmc_render_state_t * surface_render;
static struct xvmc_render_state * surface_render;
static xvmc_render_state_t * p_render_surface_to_show=NULL;
static xvmc_render_state_t * p_render_surface_visible=NULL;
static struct xvmc_render_state * p_render_surface_to_show=NULL;
static struct xvmc_render_state * p_render_surface_visible=NULL;
//display queue, kinda render ahead
static xvmc_render_state_t * show_queue[MAX_SURFACES];
static struct xvmc_render_state * show_queue[MAX_SURFACES];
static int free_element;
@ -118,7 +118,7 @@ static const struct{
static void xvmc_free(void);
static void xvmc_clean_surfaces(void);
static int count_free_surfaces();
static xvmc_render_state_t * find_free_surface();
static struct xvmc_render_state * find_free_surface();
static const vo_info_t info = {
"XVideo Motion Compensation",
@ -346,13 +346,13 @@ surface_found:
}
static uint32_t xvmc_draw_image(mp_image_t *mpi){
xvmc_render_state_t * rndr;
struct xvmc_render_state * rndr;
assert(mpi!=NULL);
assert(mpi->flags &MP_IMGFLAG_DIRECT);
// assert(mpi->flags &MP_IMGFLAGS_DRAWBACK);
rndr = (xvmc_render_state_t*)mpi->priv;//there is copy in plane[2]
rndr = (struct xvmc_render_state*)mpi->priv;//there is copy in plane[2]
assert( rndr != NULL );
assert( rndr->magic == MP_XVMC_RENDER_MAGIC );
if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
@ -520,8 +520,8 @@ int vm = flags & VOFLAG_MODESWITCHING;
printf("vo_xvmc: mv_blocks allocated\n");
if(surface_render==NULL)
surface_render=malloc(MAX_SURFACES*sizeof(xvmc_render_state_t));//easy mem debug
memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t));
surface_render=malloc(MAX_SURFACES*sizeof(struct xvmc_render_state));//easy mem debug
memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state));
for(i=0; i<MAX_SURFACES; i++){
rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]);
@ -850,7 +850,7 @@ int rez;
}
static void draw_osd(void){
xvmc_render_state_t * osd_rndr;
struct xvmc_render_state * osd_rndr;
int osd_has_changed;
int have_osd_to_draw;
int rez;
@ -945,7 +945,8 @@ int status,rez;
XvMCSyncSurface(mDisplay, srf);
}
static void put_xvmc_image(xvmc_render_state_t * p_render_surface, int draw_ck){
static void put_xvmc_image(struct xvmc_render_state * p_render_surface,
int draw_ck){
int rez;
int clipX,clipY,clipW,clipH;
int i;
@ -1071,7 +1072,7 @@ int i;
surface_render[i].state);
}
memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t));//for debuging
memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state));//for debuging
free(surface_render);surface_render=NULL;
XvMCDestroyContext(mDisplay,&ctx);
@ -1127,13 +1128,13 @@ int mode_id;
static int draw_slice(uint8_t *image[], int stride[],
int w, int h, int x, int y){
xvmc_render_state_t * rndr;
struct xvmc_render_state * rndr;
int rez;
if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
printf("vo_xvmc: draw_slice y=%d\n",y);
rndr = (xvmc_render_state_t*)image[2];//this is copy of priv-ate
rndr = (struct xvmc_render_state*)image[2];//this is copy of priv-ate
assert( rndr != NULL );
assert( rndr->magic == MP_XVMC_RENDER_MAGIC );
@ -1187,8 +1188,8 @@ int rez;
//XvMCHide hides the surface on next retrace, so
//check if the surface is not still displaying
static void check_osd_source(xvmc_render_state_t * src_rndr){
xvmc_render_state_t * osd_rndr;
static void check_osd_source(struct xvmc_render_state * src_rndr){
struct xvmc_render_state * osd_rndr;
int stat;
//If this is source surface, check does the OSD rendering is compleate
if(src_rndr->state & MP_XVMC_STATE_OSD_SOURCE){
@ -1211,10 +1212,10 @@ int i,num;
return num;
}
static xvmc_render_state_t * find_free_surface(){
static struct xvmc_render_state * find_free_surface(){
int i,t;
int stat;
xvmc_render_state_t * visible_rndr;
struct xvmc_render_state * visible_rndr;
visible_rndr = NULL;
for(i=0; i<number_of_surfaces; i++){
@ -1264,7 +1265,7 @@ int i;
}
static uint32_t get_image(mp_image_t *mpi){
xvmc_render_state_t * rndr;
struct xvmc_render_state * rndr;
rndr = find_free_surface();

View File

@ -1,5 +1,25 @@
#ifndef MPLAYER_XVMC_RENDER_H
#define MPLAYER_XVMC_RENDER_H
/*
* Copyright (C) 2003 Ivan Kalvachev
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_XVMC_RENDER_H
#define AVCODEC_XVMC_RENDER_H
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -9,47 +29,47 @@
#include <X11/extensions/XvMClib.h>
//the surface should be shown, video driver manipulates this
//the surface should be shown, the video driver manipulates this
#define MP_XVMC_STATE_DISPLAY_PENDING 1
//the surface is needed for prediction, codec manipulates this
//the surface is needed for prediction, the codec manipulates this
#define MP_XVMC_STATE_PREDICTION 2
//this surface is needed for subpicture rendering
#define MP_XVMC_STATE_OSD_SOURCE 4
// 1337 IDCT MCo
#define MP_XVMC_RENDER_MAGIC 0x1DC711C0
typedef struct{
//these are not changed by the decoder!
int magic;
struct xvmc_render_state {
//these are not changed by the decoder!
int magic;
short * data_blocks;
XvMCMacroBlock * mv_blocks;
int total_number_of_mv_blocks;
int total_number_of_data_blocks;
int mc_type;//XVMC_MPEG1/2/4,XVMC_H263 without XVMC_IDCT
int idct;//Do we use IDCT acceleration?
int chroma_format;//420,422,444
int unsigned_intra;//+-128 for intra pictures after clip
XvMCSurface* p_surface;//pointer to rendered surface, never changed
short * data_blocks;
XvMCMacroBlock * mv_blocks;
int total_number_of_mv_blocks;
int total_number_of_data_blocks;
int mc_type; //XVMC_MPEG1/2/4,XVMC_H263 without XVMC_IDCT
int idct; //Do we use IDCT acceleration?
int chroma_format; //420, 422, 444
int unsigned_intra; //+-128 for intra pictures after clipping
XvMCSurface* p_surface; //pointer to rendered surface, never changed
//these are changed by decoder
//used by XvMCRenderSurface function
XvMCSurface* p_past_surface;//pointer to the past surface
XvMCSurface* p_future_surface;//pointer to the future prediction surface
//these are changed by the decoder
//used by the XvMCRenderSurface function
XvMCSurface* p_past_surface; //pointer to the past surface
XvMCSurface* p_future_surface; //pointer to the future prediction surface
unsigned int picture_structure;//top/bottom fields or frame!
unsigned int flags;//XVMC_SECOND_FIELD - 1'st or 2'd field in the sequence
unsigned int display_flags; //1,2 or 1+2 fields for XvMCPutSurface,
unsigned int picture_structure; //top/bottom fields or frame!
unsigned int flags; //XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
unsigned int display_flags; //1,2 or 1+2 fields for XvMCPutSurface
//these are internal communication ones
int state;//0-free, 1 Waiting to Display, 2 Waiting for prediction
int start_mv_blocks_num;//offset in the array for the current slice, updated by vo
int filled_mv_blocks_num;//processed mv block in this slice, changed by decoder
//these are for internal communication
int state; //0 - free, 1 - waiting to display, 2 - waiting for prediction
int start_mv_blocks_num; //offset in the array for the current slice, updated by vo
int filled_mv_blocks_num; //processed mv block in this slice, changed by decoder
int next_free_data_block_num;//used in add_mv_block, pointer to next free block
//extensions
void * p_osd_target_surface_render;//pointer to the surface where subpicture is rendered
int next_free_data_block_num; //used in add_mv_block, pointer to next free block
//extensions
void * p_osd_target_surface_render; //pointer to the surface where subpicture is rendered
} xvmc_render_state_t;
};
#endif /* MPLAYER_XVMC_RENDER_H */
#endif /* AVCODEC_XVMC_RENDER_H */