Commit 6b8eb793 authored by Nicolas Chauvet (kwizart)'s avatar Nicolas Chauvet (kwizart) Committed by Rémi Denis-Courmont

Remove internal libmpeg2 from xvmc codec/vout

This removes deprecated argument from libmpeg2 functions.
Only mpeg2_internal.h remains used and needs to be updated,
but it can also be installed as a system header.

This also fixes warnings in xcommon.c.

Previously, this vout didn't work for me. (nVidia)
It is aimed to be tested on Intel/Via XvMC capable hardware.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 7334fc54
SOURCES_xvmc = \
xxmc.c \
alloc.c \
cpu_accel.c \
cpu_state.c \
decode.c \
header.c \
motion_comp.c \
motion_comp_mmx.c \
slice.c \
slice_xvmc_vld.c \
accel_xvmc.h \
attributes.h \
xxmc-config.h \
mpeg2.h \
mpeg2_internal.h \
vlc.h \
xvmc_vld.h \
$(NULL)
......@@ -41,9 +41,9 @@
#endif
#include "mpeg2.h"
#include "attributes.h"
//#include "attributes.h"
#include "mpeg2_internal.h"
#include "xvmc_vld.h"
//#include "xvmc_vld.h"
/* Aspect ratio (ISO/IEC 13818-2 section 6.3.3, table 6-3) */
#define AR_SQUARE_PICTURE 1 /* square pixels */
......@@ -277,7 +277,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if ( p_sys->b_slice_i )
{
decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
I_CODING_TYPE, 2, 0, 0,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
decoder_SynchroDecode( p_sys->p_synchro );
decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
......@@ -396,7 +396,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
decoder_SynchroNewPicture( p_sys->p_synchro,
p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
p_sys->p_info->current_picture->nb_fields,
0, 0, p_sys->i_current_rate,
0, 0,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
if( p_sys->b_skip )
......@@ -422,7 +422,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* Intra-slice refresh. Simulate a blank I picture. */
msg_Dbg( p_dec, "intra-slice refresh stream" );
decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
I_CODING_TYPE, 2, 0, 0,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
decoder_SynchroDecode( p_sys->p_synchro );
decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
......@@ -457,7 +457,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
decoder_SynchroNewPicture( p_sys->p_synchro,
p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
p_sys->p_info->current_picture->nb_fields, i_pts,
0, p_sys->i_current_rate,
0,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
if ( !(p_sys->b_slice_i
......@@ -486,8 +486,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
}
p_sys->p_mpeg2dec->ptr_forward_ref_picture = p_sys->p_mpeg2dec->fbuf[2]->id;
p_sys->p_mpeg2dec->ptr_backward_ref_picture = p_sys->p_mpeg2dec->fbuf[1]->id;
//p_sys->p_mpeg2dec->ptr_forward_ref_picture = p_sys->p_mpeg2dec->fbuf[2]->id;
//p_sys->p_mpeg2dec->ptr_backward_ref_picture = p_sys->p_mpeg2dec->fbuf[1]->id;
if ((p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE) != B_CODING_TYPE)
{
......@@ -495,9 +495,9 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
// p_sys->p_mpeg2dec->ptr_forward_ref_picture != picture->backward_reference_frame)
// p_pic->forward_reference_frame->free (p_pic->forward_reference_frame);
p_sys->p_mpeg2dec->ptr_forward_ref_picture =
p_sys->p_mpeg2dec->ptr_backward_ref_picture;
p_sys->p_mpeg2dec->ptr_backward_ref_picture = (void *)p_pic;
//p_sys->p_mpeg2dec->ptr_forward_ref_picture =
// p_sys->p_mpeg2dec->ptr_backward_ref_picture;
//p_sys->p_mpeg2dec->ptr_backward_ref_picture = (void *)p_pic;
}
mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
}
......@@ -595,7 +595,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->b_slice_i )
{
decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate,
I_CODING_TYPE, 2, 0, 0,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
decoder_SynchroDecode( p_sys->p_synchro );
decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
......@@ -644,7 +644,7 @@ static double get_aspect_ratio( decoder_t *p_dec )
{
/* these hardcoded values are defined on mpeg2 standard for
* aspect ratio. other values are reserved or forbidden. */
switch( p_sys->p_mpeg2dec->decoder.aspect_ratio_information )
/*switch( p_sys->p_mpeg2dec->decoder.aspect_ratio_information )
{
case 2:
ratio = 4.0/3.0;
......@@ -656,16 +656,16 @@ static double get_aspect_ratio( decoder_t *p_dec )
ratio = 2.11/1.0;
break;
case 1:
default:
default:*/
ratio = (double)p_sys->p_mpeg2dec->decoder.width/(double)p_sys->p_mpeg2dec->decoder.height;
break;
}
/* break;
}*/
}
else
{
/* mpeg1 constants refer to pixel aspect ratio */
ratio = (double)p_sys->p_mpeg2dec->decoder.width/(double)p_sys->p_mpeg2dec->decoder.height;
ratio /= mpeg1_pel_ratio[p_sys->p_mpeg2dec->decoder.aspect_ratio_information];
/* ratio /= mpeg1_pel_ratio[p_sys->p_mpeg2dec->decoder.aspect_ratio_information]; */
}
return ratio;
}
......@@ -730,8 +730,8 @@ static picture_t *GetNewPicture( decoder_t *p_dec, uint8_t **pp_buf )
p_dec->fmt_out.video.i_height,
p_dec->fmt_out.video.i_aspect,
format, flags);
#endif
mpeg2_xxmc_choose_coding( p_dec, &p_sys->p_mpeg2dec->decoder, p_pic,
get_aspect_ratio(p_dec), 0 );
#endif
return p_pic;
}
......@@ -116,16 +116,7 @@ static void DestroyWindow ( vout_thread_t *, x11_window_t * );
static int NewPicture ( vout_thread_t *, picture_t * );
static void FreePicture ( vout_thread_t *, picture_t * );
#ifndef MODULE_NAME_IS_glx
static IMAGE_TYPE *CreateImage ( vout_thread_t *,
Display *, EXTRA_ARGS, int, int );
#endif
#ifdef HAVE_SYS_SHM_H
#ifndef MODULE_NAME_IS_glx
IMAGE_TYPE *CreateShmImage ( vout_thread_t *,
Display *, EXTRA_ARGS_SHM, int, int );
#endif
static int i_shm_major = 0;
#endif
......@@ -428,7 +419,7 @@ int Activate ( vlc_object_t *p_this )
if( checkXvMCCap( p_vout ) == VLC_EGENERIC )
{
msg_Err( p_vout, "no XVMC capability found" );
Deactivate( p_vout );
Deactivate( p_this );
return VLC_EGENERIC;
}
subpicture_t sub_pic;
......@@ -1076,7 +1067,7 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
if( p_vout->p_sys->i_shm_opcode )
{
/* Display rendered image using shared memory extension */
# if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
XvShmPutImage( p_vout->p_sys->p_display, p_vout->p_sys->i_xvport,
p_vout->p_sys->p_win->video_window,
p_vout->p_sys->p_win->gc, p_pic->p_sys->p_image,
......@@ -1086,7 +1077,7 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
p_vout->fmt_out.i_visible_height,
0 /*dest_x*/, 0 /*dest_y*/, i_width, i_height,
False /* Don't put True here or you'll waste your CPU */ );
# else
#else
XShmPutImage( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->video_window,
p_vout->p_sys->p_win->gc, p_pic->p_sys->p_image,
......@@ -1096,7 +1087,7 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
p_vout->fmt_out.i_visible_width,
p_vout->fmt_out.i_visible_height,
False /* Don't put True here ! */ );
# endif
#endif
}
else
#endif /* HAVE_SYS_SHM_H */
......@@ -1922,13 +1913,13 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
/* Create image using XShm extension */
p_pic->p_sys->p_image =
CreateShmImage( p_vout, p_vout->p_sys->p_display,
# if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
p_vout->p_sys->i_xvport,
VLC2X11_FOURCC(p_vout->output.i_chroma),
# else
#else
p_vout->p_sys->p_visual,
p_vout->p_sys->i_screen_depth,
# endif
#endif
&p_pic->p_sys->shminfo,
p_vout->output.i_width, p_vout->output.i_height );
}
......
......@@ -395,4 +395,12 @@ typedef struct mwmhints_t
# define MAX_DIRECTBUFFERS 2
#endif
#ifndef MODULE_NAME_IS_glx
static IMAGE_TYPE *CreateImage ( vout_thread_t *,
Display *, EXTRA_ARGS, int, int );
#ifdef HAVE_SYS_SHM_H
IMAGE_TYPE *CreateShmImage ( vout_thread_t *,
Display *, EXTRA_ARGS_SHM, int, int );
#endif
#endif
......@@ -1304,7 +1304,7 @@ void xxmc_do_update_frame( picture_t *picture, uint32_t width, uint32_t height,
/* Wait a little till frame is being displayed */
while( status & XVMC_DISPLAYING )
{
msleep(1);
/* msleep(1); */
XvMCGetSurfaceStatus( p_vout->p_sys->p_display,
picture->p_sys->xvmc_surf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment