Thread: [Mplayerxp-cvslog] SF.net SVN: mplayerxp:[448] mplayerxp (Page 7)
Brought to you by:
olov
From: <nic...@us...> - 2012-11-25 11:53:41
|
Revision: 448 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=448&view=rev Author: nickols_k Date: 2012-11-25 11:53:28 +0000 (Sun, 25 Nov 2012) Log Message: ----------- security patch: Use class X11_System and its childs instead of plain mDisplay access vo_dga - removed (because provides no accelerations but still can be available through -vo sdl:dga) vo_opengl - doesn't work (X11 error: BadMatch (invalid parameter attributes)) vo_sdl - works (it seems exactly libSDL substitutes context of decoders :( ) vo_x11 - works vo_xv - untested (because official XOrg drivers for RadeonHD have too much memory leaks without illegal patch and cannot work longer than 5secs. It seems that Xorg X11 is only working driver because it has illegal patch on my working PC). A new word about illegal patch: svn diff -r 438:439 xmp_adecoder.cpp Index: xmp_adecoder.cpp =================================================================== --- xmp_adecoder.cpp (revision 438) +++ xmp_adecoder.cpp (revision 439) @@ -4,6 +4,7 @@ #include <stdio.h> #include <unistd.h> // for usleep() #include <math.h> +#include <sys/time.h> #include "mplayerxp.h" #include "mp_msg.h" it's more than clear that pure g++ (without illegal patch) couldn't compile this source without: #include <sys/time.h> Revision Links: -------------- http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=438&view=rev http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=439&view=rev Modified Paths: -------------- mplayerxp/configure mplayerxp/libvo/Makefile mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_sdl.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp Added Paths: ----------- mplayerxp/libvo/x11_system.cpp mplayerxp/libvo/x11_system.h Removed Paths: ------------- mplayerxp/libvo/vo_dga.cpp mplayerxp/libvo/x11_common.cpp mplayerxp/libvo/x11_common.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/configure 2012-11-25 11:53:28 UTC (rev 448) @@ -67,7 +67,6 @@ "jpg|build with JPEG for screenshots|http://www.ijg.org", "png|build with PNG for screenshots|http://www.libpng.org/pub/png/libpng.html", "opengl|build with OpenGL video output|http://mesa3d.org", - "dga|build with DGA video output|http://www.x.org", "vesa|build with VESA video output", "vidix|build with VIDIX video output|http://vidix.sourceforge.net", "xdpms|build with X11 DPMS support|http://www.x.org", @@ -638,14 +637,6 @@ print_config HAVE_ mp_config.h mp_config.mak xf86vm disabled x11 && disable dga -if enabled dga ; then -require2 dga2 "X11/Xlib.h X11/extensions/xf86dga.h" XDGASetViewport -lXxf86dga -print_config HAVE_ mp_config.h mp_config.mak dga2 -enabled dga2 && enable dga -disabled dga2 && require2 dga "X11/Xlib.h X11/extensions/xf86dga.h" XF86DGASetViewPort -lXxf86dga -print_config HAVE_ mp_config.h mp_config.mak dga -fi -enabled dga && vomodules="dga $vomodules" || novomodules="dga $novomodules" enabled fbdev && require2 fbdev "sys/ioctl.h linux/fb.h" ioctl print_config HAVE_ mp_config.h mp_config.mak fbdev Modified: mplayerxp/libvo/Makefile =================================================================== --- mplayerxp/libvo/Makefile 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/libvo/Makefile 2012-11-25 11:53:28 UTC (rev 448) @@ -11,14 +11,11 @@ CXXSRCS+=vo_opengl.cpp endif ifeq ($(HAVE_X11),yes) -CXXSRCS+=vo_x11.cpp x11_common.cpp +CXXSRCS+=vo_x11.cpp x11_system.cpp endif ifeq ($(HAVE_XV),yes) CXXSRCS+=vo_xv.cpp endif -ifeq ($(HAVE_DGA),yes) -CXXSRCS+=vo_dga.cpp -endif ifeq ($(HAVE_FBDEV),yes) CXXSRCS+=vo_fbdev.cpp endif Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/libvo/video_out.cpp 2012-11-25 11:53:28 UTC (rev 448) @@ -61,17 +61,11 @@ // extern const vo_functions_t video_out_x11; extern const vo_functions_t video_out_xv; -extern const vo_functions_t video_out_dga; extern const vo_functions_t video_out_sdl; extern const vo_functions_t video_out_null; -extern const vo_functions_t video_out_pgm; -extern const vo_functions_t video_out_md5; extern const vo_functions_t video_out_fbdev; -extern const vo_functions_t video_out_png; extern const vo_functions_t video_out_opengl; -#ifdef HAVE_VESA extern const vo_functions_t video_out_vesa; -#endif static const vo_functions_t* video_out_drivers[] = { @@ -81,9 +75,6 @@ #ifdef HAVE_OPENGL &video_out_opengl, #endif -#ifdef HAVE_DGA - &video_out_dga, -#endif #ifdef HAVE_X11 &video_out_x11, #endif @@ -190,14 +181,13 @@ vo_data_t* vo; vo=new(zeromem) vo_data_t; - vo->window = None; vo->osd_progbar_type=-1; vo->osd_progbar_value=100; // 0..256 vo_priv_t* priv; priv=new(zeromem) vo_priv_t; vo->vo_priv=priv; - rnd_fill(vo->antiviral_hole,offsetof(vo_data_t,mScreen)-offsetof(vo_data_t,antiviral_hole)); + rnd_fill(vo->antiviral_hole,offsetof(vo_data_t,flags)-offsetof(vo_data_t,antiviral_hole)); return vo; } Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/libvo/video_out.h 2012-11-25 11:53:28 UTC (rev 448) @@ -168,22 +168,15 @@ }; typedef struct vo_data_s { - Display* mDisplay; char antiviral_hole[RND_CHAR4]; - int mScreen; - Window window; - GC gc; int flags; -// correct resolution/bpp on screen: (should be autodetected by vo_x11_init()) - unsigned depthonscreen; // requested resolution/bpp: (-x -y -bpp options) vo_rect_t dest; video_private* vo_priv;/* private data of vo structure */ video_private* priv; /* private data of video driver */ - video_private* priv2; /* private data of X11 commons */ video_private* priv3; /* private data of vidix commons */ /* subtitle support */ Deleted: mplayerxp/libvo/vo_dga.cpp =================================================================== --- mplayerxp/libvo/vo_dga.cpp 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/libvo/vo_dga.cpp 2012-11-25 11:53:28 UTC (rev 448) @@ -1,810 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -#define DISP -/* - * video_out_dga.c, X11 interface - * - * - * Copyright ( C ) 2001, Andreas Ackermann. All Rights Reserved. - * - * <ac...@ac...> - * - * Sourceforge username: acki2 - * - * DRI_VO + XP mode support and lots of DGA1 - DGA2 related improvements - * by Nickols_K <nic...@ma...> - * Sourceforge username: nickols_k - */ - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <errno.h> - -#include "mplayerxp.h" -#include "video_out.h" -#include "video_out_internal.h" -#include "aspect.h" - -LIBVO_EXTERN( dga ) - -#include <X11/Xlib.h> -#include <X11/extensions/xf86dga.h> - -#ifdef HAVE_XF86VM -#include <X11/extensions/xf86vmode.h> -#endif - - -#include "x11_common.h" -#include "osdep/fastmemcpy.h" -#include "dri_vo.h" -#include "vo_msg.h" - -static vo_info_t vo_info = -{ -#ifdef HAVE_DGA2 - "X11/DGA ( Direct Graphic Access V2.0 )", -#else - "X11/DGA ( Direct Graphic Access V1.0+XF86VidModeExtension )", -#endif - "dga", - "Andreas Ackermann <ac...@ac...>, Nickols_K <nic...@ma...>", - "" -}; - -struct dga_priv_t : public video_private { - dga_priv_t(); - virtual ~dga_priv_t() {} - - int is_running; -#ifdef HAVE_XF86VM - XF86VidModeModeInfo **vidmodes; -#endif - int src_format; - unsigned src_width; // width of video in pixels - unsigned src_height;// height of video in pixels - unsigned src_mode; // index in mode list that is used by codec - unsigned width; // bytes per line in framebuffer - unsigned vp_width; // visible pixels per line in framebuffer - unsigned vp_height;// visible lines in framebuffer - unsigned vp_offset;// offset in dest - unsigned dest_width;// width of scaled image in pixels - unsigned dest_height;// height of scaled image in pixels - unsigned char *base; - unsigned hw_mode; // index in mode list that is actually used by framebuffer - unsigned XServer_mode;// index in mode list for resolution XServer is running - unsigned dbf_mem_offset[MAX_DRI_BUFFERS]; // offset in bytes for alternative framebuffer (0 if dbf is not possible) - unsigned dbf_y_offset[MAX_DRI_BUFFERS]; /* viewport y offset (in scanlines) */ - unsigned y_offset; - unsigned udf_screenw,udf_screenh; /* X11 overwrites them so we should preserve them */ - /* XP-specific data */ - unsigned num_buffers; // 1 - default - int x_off, y_off, dstFourcc; -}; - -dga_priv_t::dga_priv_t() { - num_buffers=1; -} -//----------------------------------------------------------------- - - -//------------------------------------------------------------------ -#define VO_DGA_INVALID_RES 100000 - -struct vd_modes { - unsigned vdm_mplayer_depth; - int vdm_supported; - unsigned vdm_depth; - unsigned vdm_bitspp; - unsigned vdm_bytespp; - int vdm_rmask; - int vdm_gmask; - int vdm_bmask; - int vdm_hw_mode; - int vdm_conversion_func; -}; - -//------------------------------------------------------------------ - -#define VDM_CONV_NATIVE 0 -#define VDM_CONV_15TO16 1 -#define VDM_CONV_24TO32 2 - -static struct vd_modes vo_dga_modes[] = { - // these entries describe HW modes - // however, we use the same entries to tell mplayer what we support - // so the last two values describe, which HW mode to use and which conversion - // function to use for a mode that is not supported by HW - - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 15, 0, 15, 16, 2, 0x7c00, 0x03e0, 0x001f, 2, VDM_CONV_15TO16 }, - { 16, 0, 16, 16, 2, 0xf800, 0x07e0, 0x001f, 2, VDM_CONV_NATIVE }, - { 24, 0, 24, 24, 3, 0xff0000, 0x00ff00, 0x0000ff, 4, VDM_CONV_24TO32}, - { 32, 0, 24, 32, 4, 0x00ff0000, 0x0000ff00, 0x000000ff, 4, VDM_CONV_NATIVE} -}; -static unsigned vo_dga_mode_num = sizeof(vo_dga_modes)/sizeof(struct vd_modes); - -inline struct vd_modes HW_MODE(dga_priv_t& priv) { return vo_dga_modes[priv.hw_mode]; } -inline struct vd_modes SRC_MODE(dga_priv_t& priv) { return vo_dga_modes[priv.src_mode]; } - -// enable a HW mode (by description) -static int __FASTCALL__ vd_EnableMode( unsigned depth, unsigned bitspp, - int rmask, int gmask, int bmask){ - unsigned i; - for(i=1; i<vo_dga_mode_num; i++){ - if(vo_dga_modes[i].vdm_depth == depth && - vo_dga_modes[i].vdm_bitspp == bitspp && - vo_dga_modes[i].vdm_rmask == rmask && - vo_dga_modes[i].vdm_gmask == gmask && - vo_dga_modes[i].vdm_bmask == bmask) { - vo_dga_modes[i].vdm_supported = 1; - vo_dga_modes[i].vdm_hw_mode = i; - vo_dga_modes[i].vdm_conversion_func = VDM_CONV_NATIVE; - return i; - } - } - return 0; -} - -static int __FASTCALL__ vd_ModeEqual(unsigned depth, unsigned bitspp, - int rmask, int gmask, int bmask, int idx){ - return ( - (vo_dga_modes[idx].vdm_depth == depth && - vo_dga_modes[idx].vdm_bitspp == bitspp && - vo_dga_modes[idx].vdm_rmask == rmask && - vo_dga_modes[idx].vdm_gmask == gmask && - vo_dga_modes[idx].vdm_bmask == bmask) - ? 1 : 0 ); -} - - -// enable a HW mode (mplayer_depth decides which) -static int __FASTCALL__ vd_ValidateMode( unsigned mplayer_depth){ - unsigned i; - if(mplayer_depth == 0)return 0; - for(i=1; i<vo_dga_mode_num; i++) { - if(vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth ){ - vo_dga_modes[i].vdm_supported = 1; - vo_dga_modes[i].vdm_hw_mode = i; - vo_dga_modes[i].vdm_conversion_func = VDM_CONV_NATIVE; - return i; - } - } - return 0; -} - -// do we support this mode? (not important whether native or conversion) -static int __FASTCALL__ vd_ModeValid( unsigned mplayer_depth){ - unsigned i; - if(mplayer_depth == 0)return 0; - for(i=1; i<vo_dga_mode_num; i++) { - if( vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth && - vo_dga_modes[i].vdm_supported != 0) { - return i; - } - } - return 0; -} - -static char * __FASTCALL__ vd_GetModeString(int _index){ - -#define VO_DGA_MAX_STRING_LEN 100 - static char stringbuf[VO_DGA_MAX_STRING_LEN]; - stringbuf[VO_DGA_MAX_STRING_LEN-1]=0; - snprintf(stringbuf, VO_DGA_MAX_STRING_LEN-2, - "depth=%d, bpp=%d, r=%06x, g=%06x, b=%06x, %s (-bpp %d)", - vo_dga_modes[_index].vdm_depth, - vo_dga_modes[_index].vdm_bitspp, - vo_dga_modes[_index].vdm_rmask, - vo_dga_modes[_index].vdm_gmask, - vo_dga_modes[_index].vdm_bmask, - vo_dga_modes[_index].vdm_supported ? - (vo_dga_modes[_index].vdm_conversion_func == VDM_CONV_NATIVE ? - "native (fast), " : "conversion (slow),") : - "not supported :-( ", - vo_dga_modes[_index].vdm_mplayer_depth); - return stringbuf; -} - - -//--------------------------------------------------------- - -// quick & dirty - for debugging only - -#if 0 -static void __FASTCALL__ fillblock(char *strt, int yoff, int lines, int val){ - char *i; - for(i = strt + yoff * priv.width *HW_MODE.vdm_bytespp; - i< strt + (lines+yoff) * priv.width *HW_MODE.vdm_bytespp; ){ - *i++ = val; - } -} -#endif -//--------------------------------------------------------- - -static uint32_t check_events(vo_data_t* vo) -{ - return vo_x11_check_events(vo,vo->mDisplay,NULL); -} - -//--------------------------------------------------------- - -#include "sub.h" - -static void __FASTCALL__ select_frame(vo_data_t*vo, unsigned idx ) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); -#ifdef HAVE_DGA2 - XDGASetViewport (vo->mDisplay, XDefaultScreen(vo->mDisplay), - 0, priv.dbf_y_offset[idx], - XDGAFlipRetrace); -#else - XF86DGASetViewPort (vo->mDisplay, XDefaultScreen(vo->mDisplay), - 0, priv.dbf_y_offset[idx]); -#endif -} - -//--------------------------------------------------------- - -static const vo_info_t* get_info(const vo_data_t* vo ) -{ - UNUSED(vo); - return &vo_info; -} - -//--------------------------------------------------------- - -static MPXP_Rc __FASTCALL__ query_format(vo_data_t*vo, vo_query_fourcc_t *fourcc ) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); -#ifdef HAVE_DGA2 - XDGAMode *modelines; - int modecount; -#endif - Display *qdisp; - - unsigned i; - static int dga_depths_init = 0; - - if(dga_depths_init == 0) { - if((qdisp = XOpenDisplay(0))==NULL) { - MSG_ERR( "vo_dga: Can't open display!\n"); - return MPXP_False; - } - priv.udf_screenw = vo_conf.screenwidth; - priv.udf_screenh = vo_conf.screenheight; - if(vo_x11_init(vo)!=MPXP_Ok){ - MSG_ERR( "vo_dga: vo_x11_init() failed!\n"); - return MPXP_False; - } - priv.XServer_mode = vd_ValidateMode(vo->depthonscreen); - - if(priv.XServer_mode ==0){ -#ifndef HAVE_DGA2 - MSG_ERR( "vo_dga: Your X-Server is not running in a "); - MSG_ERR( "resolution supported by DGA driver!\n"); -#endif - } - -#ifdef HAVE_DGA2 - modelines=XDGAQueryModes(qdisp, XDefaultScreen(qdisp),&modecount); - if(modelines) { - for(i=0; i< modecount; i++){ - MSG_DBG2( "vo_dga: (%03d) depth=%d, bpp=%d, r=%08x, g=%08x, b=%08x, %d x %d\n", - i, - modelines[i].depth, - modelines[i].bitsPerPixel, - modelines[i].redMask, - modelines[i].greenMask, - modelines[i].blueMask, - modelines[i].viewportWidth, - modelines[i].viewportHeight); - vd_EnableMode( - modelines[i].depth, - modelines[i].bitsPerPixel, - modelines[i].redMask, - modelines[i].greenMask, - modelines[i].blueMask); - } - XFree(modelines); - } -#endif - dga_depths_init = 1; - XCloseDisplay(qdisp); - - if( !vo_dga_modes[1].vdm_supported && vo_dga_modes[2].vdm_supported ) { - vo_dga_modes[1].vdm_supported = 1; - } - - if( !vo_dga_modes[3].vdm_supported && vo_dga_modes[4].vdm_supported ) { - vo_dga_modes[3].vdm_supported = 1; - } - - for(i=1; i<vo_dga_mode_num; i++) { - MSG_V( "vo_dga: Mode: %s", vd_GetModeString(i)); - if(vo_conf.dbpp && vo_conf.dbpp != vo_dga_modes[i].vdm_mplayer_depth) { - vo_dga_modes[i].vdm_supported = 0; - MSG_V( " ...disabled by -bpp %d", vo_conf.dbpp ); - } - MSG_V( "\n"); - } - } - fourcc->flags=VOCAP_NA; - switch(fourcc->fourcc) { - case IMGFMT_BGR15: if(vo_dga_modes[1].vdm_supported != 0) fourcc->flags=VOCAP_SUPPORTED; break; - case IMGFMT_BGR16: if(vo_dga_modes[2].vdm_supported != 0) fourcc->flags=VOCAP_SUPPORTED; break; - case IMGFMT_BGR24: if(vo_dga_modes[3].vdm_supported != 0) fourcc->flags=VOCAP_SUPPORTED; break; - case IMGFMT_BGR32: if(vo_dga_modes[4].vdm_supported != 0) fourcc->flags=VOCAP_SUPPORTED; break; - default: break; - } - return MPXP_Ok; -} - -//--------------------------------------------------------- - -static void uninit(vo_data_t*vo) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); -#ifdef HAVE_DGA2 - XDGADevice *dgadevice; -#endif - - if(priv.is_running) { - priv.is_running = 0; - MSG_DBG2( "vo_dga: in uninit\n"); - XUngrabPointer (vo->mDisplay, CurrentTime); - XUngrabKeyboard (vo->mDisplay, CurrentTime); -#ifdef HAVE_DGA2 - XDGACloseFramebuffer(vo->mDisplay, XDefaultScreen(vo->mDisplay)); - dgadevice = XDGASetMode(vo->mDisplay, XDefaultScreen(vo->mDisplay), 0); - if(dgadevice != NULL){ - XFree(dgadevice); - } -#else - XF86DGADirectVideo (vo->mDisplay, XDefaultScreen(vo->mDisplay), 0); - // first disable DirectVideo and then switch mode back! -#ifdef HAVE_XF86VM - if (priv.vidmodes != NULL ){ - int screen; - screen=XDefaultScreen( vo->mDisplay ); - MSG_DBG2( "vo_dga: VidModeExt: Switching back..\n"); - // seems some graphics adaptors need this more than once ... - XF86VidModeSwitchToMode(vo->mDisplay,screen,priv.vidmodes[0]); - XF86VidModeSwitchToMode(vo->mDisplay,screen,priv.vidmodes[0]); - XF86VidModeSwitchToMode(vo->mDisplay,screen,priv.vidmodes[0]); - XF86VidModeSwitchToMode(vo->mDisplay,screen,priv.vidmodes[0]); - XFree(priv.vidmodes); - } -#endif -#endif - XCloseDisplay(vo->mDisplay); - } - delete vo->priv; -} - -/*----------------------------------------------------------*/ -/* NK: since multibuffering maxY is meaningless */ -static int __FASTCALL__ check_res( int num, int x, int y, int bpp, - int new_x, int new_y, int new_vbi, int new_maxy, - int *old_x, int *old_y, int *old_vbi, int *old_maxy) { - -// MSG_V( "vo_dga: (%3d) Trying %4d x %4d @ %3d Hz @ depth %2d ..", -// num, new_x, new_y, new_vbi, bpp ); -// MSG_V( "%dx%d (old: %dx%d@%d).", x, y, *old_x, *old_y, *old_vbi); - if(new_x >= x && new_y >= y) { - /* NK: TODO: check for BPP of video mode and select the best */ - if( - (new_x < *old_x && new_y < *old_y) - || ((new_x == *old_x || new_y == *old_y) && new_vbi >= *old_vbi) - ) { - *old_x = new_x; - *old_y = new_y; - *old_maxy = new_maxy; - *old_vbi = new_vbi; - MSG_V( ".ok!!\n"); - return 1; - } - } - MSG_V( ".no\n"); - return 0; -} - -/*---------------------------------------------------------*/ - -#ifdef HAVE_DGA2 -static int __FASTCALL__ dga2_find_best_mode(vo_data_t*vo,unsigned wanted_width,unsigned wanted_height) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); - XDGAMode *modelines=NULL; - unsigned i,j=0; - int mVBI=100000, mMaxY=0,mX=VO_DGA_INVALID_RES, mY=VO_DGA_INVALID_RES,modecount; - int dga_modenum; - - modelines=XDGAQueryModes(vo->mDisplay, XDefaultScreen(vo->mDisplay),&modecount); - - MSG_DBG2("vo_dga: modelines=%p, modecount=%d\n", modelines, modecount); - - if (modelines == NULL) { - MSG_ERR( "vo_dga: can't get modelines\n"); - /* no mode is available */ - return -1; - } - - MSG_V("vo_dga: DGA 2.0 available! Can switch resolution AND depth!\n"); - - for (i=0; i<unsigned(modecount); i++) { - MSG_V("vo_dga: Trying hardware mode (%s) %ux%u@(depth %2d, bitspp %2d) *%3.2fHz [stride=%u]\n" - ,modelines[i].name - ,modelines[i].viewportWidth - ,modelines[i].viewportHeight - ,modelines[i].depth - ,modelines[i].bitsPerPixel - ,modelines[i].verticalRefresh - ,modelines[i].bytesPerScanline/((modelines[i].bitsPerPixel+7)/8)); - if(vd_ModeEqual( modelines[i].depth, - modelines[i].bitsPerPixel, - modelines[i].redMask, - modelines[i].greenMask, - modelines[i].blueMask, - priv.hw_mode)) { - MSG_DBG2( "maxy: %4d, depth: %2d, %4dx%4d, ", - modelines[i].maxViewportY, modelines[i].depth, - modelines[i].imageWidth, modelines[i].imageHeight ); - if ( check_res(i, wanted_width, wanted_height, modelines[i].depth, - modelines[i].viewportWidth, - modelines[i].viewportHeight, - (unsigned) modelines[i].verticalRefresh, - modelines[i].maxViewportY, - &mX, &mY, &mVBI, &mMaxY )) j = i; - } - } - MSG_V("vo_dga: Found hardware mode (%s) %ux%u@(depth %2d, bitspp %2d) *%3.2fHz [stride=%u]\n" - ,modelines[j].name - ,modelines[j].viewportWidth - ,modelines[j].viewportHeight - ,modelines[j].depth - ,modelines[j].bitsPerPixel - ,modelines[j].verticalRefresh - ,modelines[j].bytesPerScanline/((modelines[j].bitsPerPixel+7)/8)); - - priv.vp_width = mX; - priv.vp_height = mY; - - priv.width = modelines[j].bytesPerScanline / HW_MODE(priv).vdm_bytespp ; - dga_modenum = modelines[j].num; - - XFree(modelines); - return dga_modenum; -} - -static int __FASTCALL__ dga2_select_mode(vo_data_t*vo, int dga_modenum ) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); - XDGADevice *dgadevice; - int bank, ram_size; - if (!XDGAOpenFramebuffer(vo->mDisplay, XDefaultScreen(vo->mDisplay))){ - MSG_ERR( "vo_dga: Framebuffer mapping failed!!!\n"); - XCloseDisplay(vo->mDisplay); - return 1; - } - if(dga_modenum != -1) { - dgadevice=XDGASetMode(vo->mDisplay, XDefaultScreen(vo->mDisplay), dga_modenum); - XDGASync(vo->mDisplay, XDefaultScreen(vo->mDisplay)); - priv.base = dgadevice->data; - XFree(dgadevice); - } - else XF86DGAGetVideo (vo->mDisplay, XDefaultScreen(vo->mDisplay), - (char **)&priv.base, reinterpret_cast<int*>(&priv.width), - &bank, &ram_size); - XDGASetViewport (vo->mDisplay, XDefaultScreen(vo->mDisplay), 0, 0, XDGAFlipRetrace); - return 0; -} -#else - -#ifdef HAVE_XF86VM -static int __FASTCALL__ xf86vm_find_best_mode(vo_data_t*vo,unsigned wanted_width,unsigned wanted_height) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); - unsigned vm_event, vm_error; - unsigned vm_ver, vm_rev; - int i, j=0, have_vm=0; - int modecount, mX=VO_DGA_INVALID_RES, mY=VO_DGA_INVALID_RES, mVBI=100000, mMaxY=0, dga_modenum=-1; - - MSG_V("vo_dga: DGA 1.0 compatibility code: Using XF86VidMode for mode switching!\n"); - - if (XF86VidModeQueryExtension(vo->mDisplay, &vm_event, &vm_error)) { - XF86VidModeQueryVersion(vo->mDisplay, &vm_ver, &vm_rev); - MSG_V( "vo_dga: XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); - have_vm=1; - } else { - MSG_ERR( "vo_dga: XF86VidMode Extension not available.\n"); - return -1; - } - -#define GET_VREFRESH(dotclk, x, y)( (((dotclk)/(x))*1000)/(y) ) - - if (have_vm) { - int screen; - screen=XDefaultScreen(vo->mDisplay); - XF86VidModeGetAllModeLines(vo->mDisplay,screen,&modecount,&priv.vidmodes); - - if(priv.vidmodes != NULL ){ - for (i=0; i<modecount; i++){ - if ( check_res( i, wanted_width, wanted_height, - vo_dga_modes[priv.hw_mode].vdm_depth, - priv.vidmodes[i]->hdisplay, - priv.vidmodes[i]->vdisplay, - GET_VREFRESH(priv.vidmodes[i]->dotclock, - priv.vidmodes[i]->htotal, - priv.vidmodes[i]->vtotal), - 0, - &mX, &mY, &mVBI, &mMaxY )) j = i; - } - MSG_V("vo_dga: Selected video mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d\n", - mX, mY, mVBI, - vo_dga_modes[priv.hw_mode].vdm_depth, - vo_dga_modes[priv.hw_mode].vdm_bitspp); - } else { - MSG_V( "vo_dga: XF86VidMode returned no screens - using current resolution.\n"); - } - dga_modenum = j; - priv.vp_width = mX; - priv.vp_height = mY; - } - return dga_modenum; -} - -static void __FASTCALL__ xf86vm_select_mode(vo_data_t*vo, int dga_modenum ) -{ - if (dga_modenum != -1) { - XF86VidModeLockModeSwitch(vo->mDisplay,XDefaultScreen(vo->mDisplay),0); - /* Two calls are needed to switch modes on my ATI Rage 128. Why? - for riva128 one call is enough! */ - XF86VidModeSwitchToMode(vo->mDisplay,XDefaultScreen(vo->mDisplay),priv.vidmodes[dga_modenum]); - XF86VidModeSwitchToMode(vo->mDisplay,XDefaultScreen(vo->mDisplay),priv.vidmodes[dga_modenum]); - } -} -#endif -#endif - -static MPXP_Rc __FASTCALL__ config(vo_data_t*vo, uint32_t width,uint32_t height, - uint32_t d_width,uint32_t d_height, - uint32_t flags,char *title,uint32_t format) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); - unsigned wanted_width, wanted_height; - int dga_modenum; - int bank,ram_size; - unsigned dest_frame_size,freq; - int mX,mY; - - UNUSED(title); - if( priv.is_running ) return MPXP_False; - - priv.src_format = format; - priv.src_width = priv.dest_width = width; - priv.src_height = priv.dest_height = height; - - wanted_width = d_width; - wanted_height = d_height; - - if(!wanted_height) wanted_height = height; - if(!wanted_width) wanted_width = width; - - if(priv.udf_screenw) wanted_width = priv.udf_screenw; - if(priv.udf_screenh) wanted_height = priv.udf_screenh; - - if(vo_x11_init(vo)!=MPXP_Ok) { - MSG_ERR( "vo_dga: vo_x11_init() failed!\n"); - return MPXP_False; - } - - if(!vo_conf.dbpp ) priv.src_mode = priv.XServer_mode; - else priv.src_mode = vd_ModeValid(vo_conf.dbpp); - - priv.hw_mode = SRC_MODE(priv).vdm_hw_mode; - - if(priv.src_mode != priv.hw_mode ){ - MSG_ERR("vo_dga: swScaler supports native modes only. Using %d instead of selected %d.\n", - HW_MODE(priv).vdm_mplayer_depth, - SRC_MODE(priv).vdm_mplayer_depth ); - priv.src_mode = priv.hw_mode; - } - - if(!priv.src_mode) { - MSG_ERR( "vo_dga: unsupported video format!\n"); - return MPXP_False; - } - - if((vo->mDisplay = XOpenDisplay(0))==NULL) { - MSG_ERR( "vo_dga: Can't open display\n"); - return MPXP_False; - } - -// choose a suitable mode ... - -#ifdef HAVE_DGA2 - dga_modenum = dga2_find_best_mode(vo,wanted_width,wanted_height); -#else -#ifdef HAVE_XF86VM - dga_modenum = xf86vm_find_best_mode(wanted_width,wanted_height); -#else - UNUSED(dga_modenum); - MSG_V( "vo_dga: Only have DGA 1.0 extension and no XF86VidMode :-(\n" - " Thus, resolution switching is NOT possible.\n"); -#endif -#endif - MSG_V("vo_dga: Video parameters by codec: %3d x %3d, depth %2d, bitspp %2d.\n", - width, height, - SRC_MODE(priv).vdm_depth, - SRC_MODE(priv).vdm_bitspp); -/* now lets start the DGA thing */ -#ifdef HAVE_DGA2 - if(dga2_select_mode(vo,dga_modenum)) return MPXP_False; -#else - -#ifdef HAVE_XF86VM - xf86vm_select_mode(dga_modenum); -#endif - XF86DGADirectVideo (vo->mDisplay, XDefaultScreen(vo->mDisplay), - XF86DGADirectGraphics | XF86DGADirectMouse | - XF86DGADirectKeyb); - - XF86DGASetViewPort (vo->mDisplay, XDefaultScreen(vo->mDisplay), 0, 0); -#endif - /* for both DGA1 and DGA2 we need to know ram_size */ - XF86DGAGetVideo (vo->mDisplay, XDefaultScreen(vo->mDisplay), - (char **)&priv.base, reinterpret_cast<int*>(&priv.vp_width), - &bank, &ram_size); - - XF86DGAGetViewPortSize(vo->mDisplay,DefaultScreen(vo->mDisplay),&mX,&mY); - priv.vp_width = mX; - priv.vp_height = mY; - - MSG_DBG2( "vo_dga: XServer res: %dx%d\n", - priv.vp_width, priv.vp_height); - - if(priv.dest_width > priv.vp_width || priv.dest_height > priv.vp_height) { - MSG_ERR( "vo_dga: Sorry, video larger than viewport is not yet supported!\n"); - // ugly, do something nicer in the future ... -#ifndef HAVE_DGA2 -#ifdef HAVE_XF86VM - if(priv.vidmodes){ - XFree(priv.vidmodes); - priv.vidmodes = NULL; - } -#endif -#endif - return MPXP_False; - } - - if((flags&0x04)||(flags&0x01)) { /* -zoom or -fs */ - priv.dest_width = d_width; - priv.dest_height = d_height; - - aspect_save_orig(priv.src_width,priv.src_height); - aspect_save_screenres(mX,mY); - aspect_save_prescale(priv.dest_width,priv.dest_height); - if((flags&0x05)==0x05) /* -fs -zoom */ - aspect(&priv.dest_width,&priv.dest_height,A_ZOOM); - else if(flags&0x04)/* -zoom */ - aspect(&priv.dest_width,&priv.dest_height,A_NOZOOM); - else { /* -fs */ - priv.dest_width = mX; - priv.dest_height = mY; - } - MSG_V("vo_dga: Aspect corrected size for SwScaler: %4d x %4d.\n", - priv.dest_width, priv.dest_height); - } - switch(HW_MODE(priv).vdm_bitspp) { - case 32: priv.dstFourcc = IMGFMT_BGR32; break; - case 24: priv.dstFourcc = IMGFMT_BGR24; break; - case 15: priv.dstFourcc = IMGFMT_BGR15; break; - default: priv.dstFourcc = IMGFMT_BGR16; break; - } - - MSG_DBG2( "vo_dga: bytes/line: %d, screen res: %dx%d, depth: %d, base: %08x, bpp: %d\n", - priv.width, priv.vp_width, - priv.vp_height, HW_MODE(priv).vdm_bytespp, priv.base, - HW_MODE(priv).vdm_bitspp); - - priv.x_off = (priv.vp_width - priv.dest_width)>>1; - priv.y_offset = priv.y_off = (priv.vp_height - priv.dest_height)>>1; - priv.vp_offset = (priv.y_off * priv.width + priv.x_off ) * HW_MODE(priv).vdm_bytespp; - - MSG_DBG2( "vo_dga: vp_off=%d\n", priv.vp_offset); - - XGrabKeyboard (vo->mDisplay, DefaultRootWindow(vo->mDisplay), True, - GrabModeAsync,GrabModeAsync, CurrentTime); - XGrabPointer (vo->mDisplay, DefaultRootWindow(vo->mDisplay), True, - ButtonPressMask,GrabModeAsync, GrabModeAsync, - None, None, CurrentTime); -// TODO: check if mem of graphics adaptor is large enough for dbf - -// set up variables for double buffering ... - priv.dbf_y_offset[0] = 0; - priv.dbf_mem_offset[0] = 0; - dest_frame_size = priv.width*HW_MODE(priv).vdm_bytespp*priv.vp_height; - - priv.num_buffers = (ram_size*1024)/dest_frame_size; - if(priv.num_buffers > vo_conf.xp_buffs) priv.num_buffers = vo_conf.xp_buffs; - if(priv.num_buffers > MAX_DRI_BUFFERS) priv.num_buffers = MAX_DRI_BUFFERS; - - for(freq=1;freq<priv.num_buffers;freq++) { - priv.dbf_y_offset[freq] = priv.dbf_y_offset[freq-1] + priv.vp_height; - priv.dbf_mem_offset[freq] = priv.dbf_mem_offset[freq-1] + dest_frame_size; - } - - /* clear screen */ - for(freq=0;freq<priv.num_buffers;freq++) { - any_t*d; - d=(&((char*)priv.base)[priv.dbf_mem_offset[freq]]); - memset(d,0,dest_frame_size); - } - MSG_V("vo_dga: Doublebuffering is %s.\n",priv.num_buffers>1?"enabled":"disabled"); - priv.is_running = 1; - return MPXP_Ok; -} - -static MPXP_Rc __FASTCALL__ preinit(vo_data_t*vo,const char *arg) -{ - if(arg) { - MSG_V( "vo_dga: Unknown subdevice: %s\n",arg); - return MPXP_False; - } - dga_priv_t*priv=new(zeromem) dga_priv_t; - vo->priv=priv; - return MPXP_Ok; -} - -static void __FASTCALL__ dga_dri_get_surface_caps(vo_data_t*vo,dri_surface_cap_t *caps) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); - caps->caps = DRI_CAP_VIDEO_MMAPED; - caps->fourcc=priv.dstFourcc; - caps->width=priv.vp_width; - caps->height=priv.vp_height; - caps->x=priv.x_off; - caps->y=priv.y_off; - caps->w=priv.dest_width; - caps->h=priv.dest_height; - caps->strides[0] = priv.width*((HW_MODE(priv).vdm_bitspp+7)/8); - caps->strides[1] = 0; - caps->strides[2] = 0; - caps->strides[3] = 0; -} - -static void __FASTCALL__ dga_dri_get_surface(vo_data_t*vo,dri_surface_t *surf) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); - surf->planes[0] = priv.base + priv.dbf_mem_offset[surf->idx]; - surf->planes[1] = 0; - surf->planes[2] = 0; - surf->planes[3] = 0; -} - -static MPXP_Rc __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) -{ - dga_priv_t& priv = *static_cast<dga_priv_t*>(vo->priv); - switch (request) { - case VOCTRL_QUERY_FORMAT: - return query_format(vo,(vo_query_fourcc_t*)data); - case VOCTRL_CHECK_EVENTS: - check_events(vo); - (*(vo_resize_t *)data).event_type = 0; /* VO_EVENT_RESIZE is meaningless here */ - return MPXP_True; - case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = priv.num_buffers; - return MPXP_True; - case DRI_GET_SURFACE_CAPS: - dga_dri_get_surface_caps(vo,reinterpret_cast<dri_surface_cap_t*>(data)); - return MPXP_True; - case DRI_GET_SURFACE: - dga_dri_get_surface(vo,reinterpret_cast<dri_surface_t*>(data)); - return MPXP_True; - } - return MPXP_NA; -} Modified: mplayerxp/libvo/vo_opengl.cpp =================================================================== --- mplayerxp/libvo/vo_opengl.cpp 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/libvo/vo_opengl.cpp 2012-11-25 11:53:28 UTC (rev 448) @@ -41,11 +41,8 @@ #include <GL/gl.h> #include "w32_common.h" #else -#include <GL/gl.h> #include <X11/Xlib.h> -#include <GL/glx.h> -#include <GL/glut.h> -#include "x11_common.h" +#include "x11_system.h" #endif #include "aspect.h" @@ -80,8 +77,10 @@ unsigned depth,bpp,out_mode; unsigned num_buffers; // 1 - default - any_t* glx_context; uint32_t gl_out_format,out_format; +#ifdef HAVE_X11 + GLX_System* glx; +#endif }; ogl_priv_t::ogl_priv_t() { @@ -94,17 +93,6 @@ return(&vo_info); } -static XVisualInfo *get_visual_info(Display *dpy, Window win) -{ - XWindowAttributes wattr; - XVisualInfo vi_template; - int dummy; - - XGetWindowAttributes(dpy, win, &wattr); - vi_template.visualid = XVisualIDFromVisual(wattr.visual); - return XGetVisualInfo(dpy, VisualIDMask, &vi_template, &dummy); -} - static void gl_init_fb(vo_data_t*vo,unsigned x,unsigned y,unsigned d_width,unsigned d_height) { ogl_priv_t& priv = *static_cast<ogl_priv_t*>(vo->priv); @@ -143,7 +131,6 @@ } static void resize(vo_data_t*vo,int x,int y){ - ogl_priv_t& priv = *static_cast<ogl_priv_t*>(vo->priv); MSG_V("[gl] Resize: %dx%d\n",x,y); gl_init_fb(vo, 0, 0, x, y ); glClear(GL_COLOR_BUFFER_BIT); @@ -155,14 +142,11 @@ static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { ogl_priv_t& priv = *static_cast<ogl_priv_t*>(vo->priv); + GLX_System& glx = *priv.glx; int is_bgr; - const char *hello = (title == NULL) ? "Glx render" : title; XSizeHints hint; + unsigned i; - XGCValues xgcv; - XSetWindowAttributes xswa; - unsigned long xswamask,i; - aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); @@ -176,76 +160,47 @@ aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); aspect(&d_width,&d_height,vo_ZOOM(vo)?A_ZOOM:A_NOZOOM); - vo_x11_calcpos(vo,&hint,d_width,d_height,flags); - hint.flags = PPosition | PSize; + glx.calcpos(vo,&hint,d_width,d_height,flags); + hint.flags = PPosition | PSize; priv.dwidth=d_width; priv.dheight=d_height; //XXX: what are the copy vars used for? - XGetWindowAttributes(vo->mDisplay, DefaultRootWindow(vo->mDisplay), &priv.attribs); - priv.depth=priv.attribs.depth; - if (priv.depth != 15 && priv.depth != 16 && priv.depth != 24 && priv.depth != 32) priv.depth = 24; - XMatchVisualInfo(vo->mDisplay, vo->mScreen, priv.depth, TrueColor, &priv.vinfo); + priv.depth=glx.depth(); - xswa.background_pixel = 0; - xswa.border_pixel = 0; - xswamask = CWBackPixel | CWBorderPixel; + if (priv.depth != 15 && priv.depth != 16 && priv.depth != 24 && priv.depth != 32) + priv.depth = 24; + glx.match_visual( &priv.vinfo); - vo->window = XCreateWindow( vo->mDisplay, RootWindow(vo->mDisplay,vo->mScreen), - hint.x, hint.y, hint.width, hint.height, - 0, priv.depth,CopyFromParent,priv.vinfo.visual,xswamask,&xswa); + glx.create_window(hint,priv.vinfo.visual,vo_VM(vo),priv.depth,title); - vo_x11_classhint( vo->mDisplay,vo->window,"opengl" ); - vo_x11_hidecursor(vo->mDisplay,vo->window); + glx.classhint("opengl"); + glx.hidecursor(); - XSelectInput(vo->mDisplay, vo->window, - StructureNotifyMask | KeyPressMask | PointerMotionMask | - ButtonPressMask | ButtonReleaseMask ); - XSetStandardProperties(vo->mDisplay, vo->window, hello, hello, None, NULL, 0, &hint); - if ( vo_FS(vo) ) vo_x11_decoration(vo, vo->mDisplay,vo->window,0 ); - XMapWindow(vo->mDisplay, vo->window); -#ifdef HAVE_XINERAMA - vo_x11_xinerama_move(vo,vo->mDisplay,vo->window,&hint); -#endif - vo->gc = XCreateGC(vo->mDisplay, vo->window, 0L, &xgcv); - XFlush(vo->mDisplay); - XSync(vo->mDisplay, False); -#ifdef HAVE_XF86VM - if ( vo_VM(vo) ) { - /* Grab the mouse pointer in our window */ - XGrabPointer( vo->mDisplay, vo->window, True, 0, - GrabModeAsync, GrabModeAsync, - vo->window, None, CurrentTime); - XSetInputFocus(vo->mDisplay, vo->window, RevertToNone, CurrentTime); - } -#endif + if ( vo_FS(vo) ) glx.decoration(0); + + /* we cannot grab mouse events on root window :( */ + glx.select_input(StructureNotifyMask | KeyPressMask | + ButtonPressMask | ButtonReleaseMask | PointerMotionMask); #ifdef GL_WIN32 if (!vo_w32_config(d_width, d_height, flags)) return MPXP_False; #else { XVisualInfo *vi; - vi = get_visual_info(vo->mDisplay, vo->window); + vi = glx.get_visual(); if (vi == NULL) { MSG_ERR("[vo_oengl]: Can't get XVisualInfo\n"); return MPXP_False; } - priv.glx_context = glXCreateContext(vo->mDisplay, vi, NULL, True); + glx.create_context(vi); XFree(vi); - if (priv.glx_context == NULL) { - MSG_ERR("[vo_oengl]: Can't create GLX context\n"); - return MPXP_False; - } - if (!glXMakeCurrent(vo->mDisplay, vo->window, reinterpret_cast<__GLXcontextRec*>(priv.glx_context))) { - MSG_ERR("[vo_oengl]: Can't make GLX context current\n"); - return MPXP_False; - } } #endif gl_init_fb(vo,0,0,d_width,d_height); /* allocate multibuffers */ - for(i=0;i<priv.num_buffers;i++) vo_x11_getMyXImage(vo,i,priv.vinfo.visual,priv.depth,priv.image_width,priv.image_height); + for(i=0;i<priv.num_buffers;i++) glx.getMyXImage(i,priv.vinfo.visual,priv.depth,priv.image_width,priv.image_height); priv.out_mode=GL_RGB; - XImage *ximg=vo_x11_Image(vo,0); + XImage *ximg=glx.Image(0); is_bgr=(ximg->blue_mask&0x01)!=0; switch ((priv.bpp=ximg->bits_per_pixel)){ case 32:priv.out_mode=GL_RGBA; @@ -263,13 +218,14 @@ break; default: break; } - saver_off(vo,vo->mDisplay); return MPXP_Ok; } static uint32_t __FASTCALL__ check_events(vo_data_t*vo,vo_adjust_size_t adjust_size) { - int e=vo_x11_check_events(vo,vo->mDisplay,adjust_size); + ogl_priv_t& priv = *static_cast<ogl_priv_t*>(vo->priv); + GLX_System& glx = *priv.glx; + int e=glx.check_events(vo,adjust_size); if(e&VO_EVENT_RESIZE) resize(vo,vo->dest.w,vo->dest.h); return e|VO_EVENT_FORCE_UPDATE; } @@ -286,9 +242,10 @@ static void select_frame(vo_data_t*vo,unsigned idx) { ogl_priv_t& priv = *static_cast<ogl_priv_t*>(vo->priv); + GLX_System& glx = *priv.glx; - gl_display_Image(vo,vo_x11_Image(vo,idx)); - if (priv.num_buffers>1) glXSwapBuffers(vo->mDisplay, vo->window); + gl_display_Image(vo,glx.Image(idx)); + if (priv.num_buffers>1) glx.swap_buffers(); glFlush(); return; } @@ -309,17 +266,16 @@ static void uninit(vo_data_t*vo) { ogl_priv_t& priv = *static_cast<ogl_priv_t*>(vo->priv); + GLX_System& glx = *priv.glx; unsigned i; // if (!vo_config_count) return; glFinish(); - glXMakeCurrent(vo->mDisplay, None, NULL); - glXDestroyContext(vo->mDisplay, reinterpret_cast<__GLXcontextRec*>(priv.glx_context)); - for(i=0;i<priv.num_buffers;i++) vo_x11_freeMyXImage(vo,i); - saver_on(vo,vo->mDisplay); // screen saver back on + glx.destroy_context(); + for(i=0;i<priv.num_buffers;i++) glx.freeMyXImage(i); + glx.saver_on(); // screen saver back on #ifdef HAVE_XF86VM - vo_vm_close(vo,vo->mDisplay); + glx.vm_close(); #endif - vo_x11_uninit(vo,vo->mDisplay, vo->window); delete vo->priv; } @@ -329,7 +285,8 @@ priv=new(zeromem) ogl_priv_t; vo->priv=priv; UNUSED(arg); - if (vo_x11_init(vo)!=MPXP_Ok) return MPXP_False; + priv->glx=new(zeromem) GLX_System(vo_conf.mDisplayName); + priv->glx->saver_off(); return MPXP_Ok; } @@ -355,8 +312,8 @@ static void __FASTCALL__ gl_dri_get_surface(const vo_data_t*vo,dri_surface_t *surf) { ogl_priv_t& priv = *static_cast<ogl_priv_t*>(vo->priv); - UNUSED(priv); - surf->planes[0] = vo_x11_ImageData(vo,surf->idx); + GLX_System& glx = *priv.glx; + surf->planes[0] = glx.ImageData(surf->idx); surf->planes[1] = 0; surf->planes[2] = 0; surf->planes[3] = 0; Modified: mplayerxp/libvo/vo_sdl.cpp =================================================================== --- mplayerxp/libvo/vo_sdl.cpp 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/libvo/vo_sdl.cpp 2012-11-25 11:53:28 UTC (rev 448) @@ -121,7 +121,7 @@ #ifdef HAVE_X11 #include <X11/Xlib.h> -#include "x11_common.h" +#include "x11_system.h" #endif #include "input2/input.h" @@ -242,6 +242,9 @@ const char * vidix_name; vidix_server_t* vidix_server; #endif +#ifdef HAVE_X11 + X11_System* x11; +#endif }; sdl_priv_t::sdl_priv_t() { @@ -1161,15 +1164,17 @@ static void uninit(vo_data_t*vo) { + sdl_priv_t& priv = *static_cast<sdl_priv_t*>(vo->priv); + X11_System& x11 = *priv.x11; #ifdef HAVE_X11 - saver_on(vo,vo->mDisplay); - vo_x11_uninit(vo,vo->mDisplay, vo->window); + x11.saver_on(); #endif sdl_close(vo); #ifdef CONFIG_VIDIX - vidix_term(vo); - sdl_priv_t& priv = *static_cast<sdl_priv_t*>(vo->priv); - delete priv.vidix_server; + if(priv.vidix_name) { + vidix_term(vo); + delete priv.vidix_server; + } #endif delete vo->priv; } @@ -1180,8 +1185,8 @@ vo->priv=priv; if(arg) strcpy(sdl_subdevice,arg); #ifdef HAVE_X11 - if(vo_x11_init(vo)!=MPXP_Ok) return MPXP_False; // Can't open X11 - saver_off(vo,vo->mDisplay); + priv->x11=new(zeromem) X11_System(vo_conf.mDisplayName); + priv->x11->saver_off(); #endif return sdl_open(vo); } Modified: mplayerxp/libvo/vo_x11.cpp =================================================================== --- mplayerxp/libvo/vo_x11.cpp 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/libvo/vo_x11.cpp 2012-11-25 11:53:28 UTC (rev 448) @@ -2,7 +2,6 @@ #include "osdep/mplib.h" using namespace mpxp; -#define DISP /* * video_out_x11.c,X11 interface * @@ -37,7 +36,7 @@ #include <X11/extensions/xf86vmode.h> #endif -#include "x11_common.h" +#include "x11_system.h" #include "osdep/fastmemcpy.h" #include "sub.h" @@ -87,7 +86,6 @@ unsigned depth,bpp,mode; - XWindowAttributes attribs; XVisualInfo vinfo; int baseAspect; // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing @@ -98,6 +96,7 @@ vidix_server_t* vidix_server; #endif uint32_t subdev_flags; + X11_System* x11; }; x11_priv_t::x11_priv_t() { @@ -105,14 +104,66 @@ subdev_flags = 0xFFFFFFFEUL; } +static uint32_t __FASTCALL__ parseSubDevice(vo_data_t*vo,const char *sd) +{ + x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); + uint32_t flags; + flags = 0; #ifdef CONFIG_VIDIX + if(memcmp(sd,"vidix",5) == 0) priv.vidix_name = &sd[5]; /* priv.vidix_name will be valid within init() */ + else +#endif + { MSG_ERR("vo_vesa: Unknown subdevice: '%s'\n", sd); return 0xFFFFFFFFUL; } + return flags; +} + +static MPXP_Rc __FASTCALL__ preinit(vo_data_t*vo,const char *arg) +{ + MPXP_Rc vidix_err=MPXP_Ok; + x11_priv_t* priv; + priv=new(zeromem) x11_priv_t; + vo->priv=priv; + if(arg) priv->subdev_flags = parseSubDevice(vo,arg); +#ifdef CONFIG_VIDIX + if(priv->vidix_name) { + if(!(priv->vidix_server=vidix_preinit(vo,priv->vidix_name,&video_out_x11))) + vidix_err=MPXP_False; + } +#endif + priv->x11=new(zeromem) X11_System(vo_conf.mDisplayName); + priv->x11->saver_off(); + return vidix_err; +} + + +static void uninit(vo_data_t*vo) +{ + unsigned i; + x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); + X11_System& x11 = *priv.x11; +#ifdef CONFIG_VIDIX + if(priv.vidix_name) vidix_term(vo); + delete priv.vidix_server; +#endif + for(i=0;i<priv.num_buffers;i++) x11.freeMyXImage(i); + x11.saver_on(); // screen saver back on + +#ifdef HAVE_XF86VM + x11.vm_close(); +#endif + delete &x11; + delete vo->priv; +} + +#ifdef CONFIG_VIDIX static void resize_vidix(vo_data_t* vo) { x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); - XWindowAttributes xwa; - XGetWindowAttributes(vo->mDisplay, vo->window, &xwa); + X11_System& x11 = *priv.x11; + vo_rect_t winc; + x11.get_win_coord(&winc); vidix_stop(vo); - if (vidix_init(vo,priv.image_width, priv.image_height, xwa.x, xwa.y, - xwa.width, xwa.height, priv.in_format, vo->depthonscreen, + if (vidix_init(vo,priv.image_width, priv.image_height, winc.x, winc.y, + winc.w, winc.h, priv.in_format, x11.depth(), vo_conf.screenwidth, vo_conf.screenheight) != MPXP_Ok) { MSG_FATAL( "Can't initialize VIDIX driver: %s: %s\n", @@ -128,19 +179,17 @@ static uint32_t __FASTCALL__ check_events(vo_data_t*vo,vo_adjust_size_t adjust_size) { x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); - uint32_t ret = vo_x11_check_events(vo,vo->mDisplay,adjust_size); + X11_System& x11 = *priv.x11; + uint32_t ret = x11.check_events(vo,adjust_size); - /* clear the old window */ - if (ret & VO_EVENT_RESIZE) - { + /* clear the old window */ + if (ret & VO_EVENT_RESIZE) { unsigned idx; unsigned newW= vo->dest.w; unsigned newH= vo->dest.h; int newAspect= (newW*(1<<16) + (newH>>1))/newH; if(newAspect>priv.baseAspect) newW= (newH*priv.baseAspect + (1<<15))>>16; else newH= ((newW<<16) + (priv.baseAspect>>1)) /priv.baseAspect; - XSetBackground(vo->mDisplay, vo->gc, 0); - XClearWindow(vo->mDisplay, vo->window); priv.image_width= (newW+7)&(~7); priv.image_height= newH; #ifdef CONFIG_VIDIX @@ -150,8 +199,8 @@ { vo_lock_surfaces(vo); for(idx=0;idx<priv.num_buffers;idx++) { - vo_x11_freeMyXImage(vo,idx); - vo_x11_getMyXImage(vo,idx,priv.vinfo.visual,priv.depth,priv.image_width,priv.image_height); + x11.freeMyXImage(idx); + x11.getMyXImage(idx,priv.vinfo.visual,priv.depth,priv.image_width,priv.image_height); } vo_unlock_surfaces(vo); } @@ -162,14 +211,9 @@ static MPXP_Rc __FASTCALL__ config(vo_data_t*vo,uint32_t width,uint32_t height,uint32_t d_width,uint32_t d_height,uint32_t flags,char *title,uint32_t format) { x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); + X11_System& x11 = *priv.x11; // int interval, prefer_blank, allow_exp, nothing; - unsigned int fg,bg; XSizeHints hint; - XEvent xev; - XGCValues xgcv; - Colormap theCmap; - XSetWindowAttributes xswa; - unsigned long xswamask; unsigned i; priv.num_buffers=vo_conf.xp_buffs; @@ -179,12 +223,11 @@ priv.in_format=format; - XGetWindowAttributes( vo->mDisplay,DefaultRootWindow( vo->mDisplay ),&priv.attribs ); - priv.depth=priv.attribs.depth; + priv.depth=x11.depth(); + if ( priv.depth != 15 && priv.depth != 16 && priv.depth != 24 && priv.depth != 32 ) + priv.depth=24; + x11.match_visual( &priv.vinfo ); - if ( priv.depth != 15 && priv.depth != 16 && priv.depth != 24 && priv.depth != 32 ) priv.depth=24; - XMatchVisualInfo( vo->mDisplay,vo->mScreen,priv.depth,TrueColor,&priv.vinfo ); - priv.baseAspect= ((1<<16)*d_width + d_height/2)/d_height; aspect_save_orig(width,height); @@ -193,75 +236,33 @@ aspect(&d_width,&d_height,vo_FS(vo)?A_ZOOM:A_NOZOOM); - vo_x11_calcpos(vo,&hint,d_width,d_height,flags); + x11.calcpos(vo,&hint,d_width,d_height,flags); hint.flags=PPosition | PSize; - - bg=WhitePixel( vo->mDisplay,vo->mScreen ); - fg=BlackPixel( vo->mDisplay,vo->mScreen ); vo->dest.w=hint.width; vo->dest.h=hint.height; priv.image_width=d_width; priv.image_height=d_height; - theCmap =XCreateColormap( vo->mDisplay,RootWindow( vo->mDisplay,vo->mScreen ), - priv.vinfo.visual,AllocNone ); + x11.create_window(hint,priv.vinfo.visual,vo_VM(vo),priv.depth,title); - xswa.background_pixel=0; - xswa.border_pixel=0; - xswa.colormap=theCmap; - xswamask=CWBackPixel | CWBorderPixel | CWColormap; + x11.classhint("vo_x11"); + x11.hidecursor(); + if ( vo_FS(vo) ) x11.decoration(0); -#ifdef HAVE_XF86VM - if ( vo_VM(vo) ) { - xswa.override_redirect=True; - xswamask|=CWOverrideRedirect; - } -#endif - - vo->window=XCreateWindow( vo->mDisplay,RootWindow( vo->mDisplay,vo->mScreen ), - hint.x,hint.y, - hint.width,hint.height, - xswa.border_pixel,priv.depth,CopyFromParent,priv.vinfo.visual,xswamask,&xswa ); - vo_x11_classhint( vo->mDisplay,vo->window,"vo_x11" ); - vo_x11_hidecursor(vo->mDisplay,vo->window); - if ( vo_FS(vo) ) vo_x11_decoration(vo,vo->mDisplay,vo->window,0 ); - XSelectInput( vo->mDisplay,vo->window,StructureNotifyMask ); - XSetStandardProperties( vo->mDisplay,vo->window,title,title,None,NULL,0,&hint ); - XMapWindow( vo->mDisplay,vo->window ); -#ifdef HAVE_XINERAMA - vo_x11_xinerama_move(vo,vo->mDisplay,vo->window,&hint); -#endif - do { XNextEvent( vo->mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != vo->window ); - XSelectInput( vo->mDisplay,vo->window,NoEventMask ); - - XFlush( vo->mDisplay ); - XSync( vo->mDisplay,False ); - vo->gc=XCreateGC( vo->mDisplay,vo->window,0L,&xgcv ); - /* we cannot grab mouse events on root window :( */ - XSelectInput(vo->mDisplay,vo->window, - StructureNotifyMask | KeyPressMask | - ButtonPressMask | ButtonReleaseMask | PointerMotionMask); + x11.select_input(StructureNotifyMask | KeyPressMask | + ButtonPressMask | ButtonReleaseMask | PointerMotionMask); -#ifdef HAVE_XF86VM - if ( vo_VM(vo) ) { - /* Grab the mouse pointer in our window */ - XGrabPointer(vo->mDisplay, vo->window, True, 0, - GrabModeAsync, GrabModeAsync, - vo->window, None, CurrentTime); - XSetInputFocus(vo->mDisplay, vo->window, RevertToNone, CurrentTime); - } -#endif #ifdef CONFIG_VIDIX if(!priv.vidix_name) #endif - for(i=0;i<priv.num_buffers;i++) vo_x11_getMyXImage(vo,i,priv.vinfo.visual,priv.depth,priv.image_width,priv.image_height); + for(i=0;i<priv.num_buffers;i++) x11.getMyXImage(i,priv.vinfo.visual,priv.depth,priv.image_width,priv.image_height); #ifdef CONFIG_VIDIX if(!priv.vidix_name) { #endif - XImage* ximg=vo_x11_Image(vo,0); + XImage* ximg=x11.Image(0); switch ((priv.bpp=ximg->bits_per_pixel)){ case 24: priv.out_format= IMGFMT_BGR24; break; case 32: priv.out_format= IMGFMT_BGR32; break; @@ -301,11 +302,11 @@ #endif #ifdef CONFIG_VIDIX if(priv.vidix_name) { - XWindowAttributes xwa; - XGetWindowAttributes(vo->mDisplay, vo->window, &xwa); - if(vidix_init(vo,priv.image_width,priv.image_height,xwa.x,xwa.y, - xwa.width,xwa.height, - priv.in_format,priv.depth, + vo_rect_t winc; + x11.get_win_coord(&winc); + if(vidix_init(vo,priv.image_width,priv.image_height,winc.x,winc.y, + winc.w,winc.h, + priv.in_format,x11.depth(), vo_conf.screenwidth,vo_conf.screenheight) != MPXP_Ok) { MSG_ERR("vo_vesa: Can't initialize VIDIX driver\n"); priv.vidix_name = NULL; @@ -324,7 +325,6 @@ } } #endif - saver_off(vo,vo->mDisplay); return MPXP_Ok; } @@ -336,36 +336,27 @@ static void __FASTCALL__ Display_Image(vo_data_t*vo,XImage *myximage ) { -#ifdef DISP -#ifdef HAVE_SHM - if( vo_x11_Shmem_Flag(vo)) { - XShmPutImage( vo->mDisplay,vo->window,vo->gc,myximage, - 0,0, - ( vo->dest.w - myximage->width ) / 2,( vo->dest.h - myximage->height ) / 2, - myximage->width,myximage->height,True ); - } - else -#endif - { - XPutImage( vo->mDisplay,vo->window,vo->gc,myximage, - 0,0, - ( vo->dest.w - myximage->width ) / 2,( vo->dest.h - myximage->height ) / 2, - myximage->width,myximage->height); - } -#endif + x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); + X11_System& x11 = *priv.x11; + vo_rect_t r; + r.x=r.y=0; + r.w=(vo->dest.w-myximage->width)/2; + r.h=(vo->dest.h-myximage->height)/2; + x11.put_image(myximage,r); } static void __FASTCALL__ select_frame(vo_data_t*vo, unsigned idx ){ x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); + X11_System& x11 = *priv.x11; #ifdef CONFIG_VIDIX if(priv.vidix_server) { priv.vidix_server->select_frame(vo,idx); return; } #endif - Display_Image(vo,vo_x11_Image(vo,idx)); - if (priv.num_buffers>1) XFlush(vo->mDisplay); - else XSync(vo->mDisplay, False); + Display_Image(vo,x11.Image(idx)); + if (priv.num_buffers>1) x11.flush(); + else x11.sync(False); return; } @@ -386,55 +377,6 @@ return MPXP_False; } - -static void uninit(vo_data_t*vo) -{ - unsigned i; - x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); -#ifdef CONFIG_VIDIX - if(priv.vidix_name) vidix_term(vo); - delete priv.vidix_server; -#endif - for(i=0;i<priv.num_buffers;i++) vo_x11_freeMyXImage(vo,i); - saver_on(vo,vo->mDisplay); // screen saver back on - -#ifdef HAVE_XF86VM - vo_vm_close(vo,vo->mDisplay); -#endif - vo_x11_uninit(vo,vo->mDisplay, vo->window); - delete vo->priv; -} - -static uint32_t __FASTCALL__ parseSubDevice(vo_data_t*vo,const char *sd) -{ - x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); - uint32_t flags; - flags = 0; -#ifdef CONFIG_VIDIX - if(memcmp(sd,"vidix",5) == 0) priv.vidix_name = &sd[5]; /* priv.vidix_name will be valid within init() */ - else -#endif - { MSG_ERR("vo_vesa: Unknown subdevice: '%s'\n", sd); return 0xFFFFFFFFUL; } - return flags; -} - -static MPXP_Rc __FASTCALL__ preinit(vo_data_t*vo,const char *arg) -{ - MPXP_Rc vidix_err=MPXP_Ok; - x11_priv_t* priv; - priv=new(zeromem) x11_priv_t; - vo->priv=priv; - if(arg) priv->subdev_flags = parseSubDevice(vo,arg); -#ifdef CONFIG_VIDIX - if(priv->vidix_name) { - if(!(priv->vidix_server=vidix_preinit(vo,priv->vidix_name,&video_out_x11))) - vidix_err=MPXP_False; - } -#endif - if(vo_x11_init(vo)!=MPXP_Ok) return MPXP_False; // Can't open X11 - return vidix_err; -} - static void __FASTCALL__ x11_dri_get_surface_caps(const vo_data_t*vo,dri_surface_cap_t *caps) { x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); @@ -454,8 +396,9 @@ static void __FASTCALL__ x11_dri_get_surface(const vo_data_t*vo,dri_surface_t *surf) { - UNUSED(vo); - surf->planes[0] = vo_x11_ImageData(vo,surf->idx); + x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); + X11_System& x11 = *priv.x11; + surf->planes[0] = x11.ImageData(surf->idx); surf->planes[1] = 0; surf->planes[2] = 0; surf->planes[3] = 0; @@ -464,6 +407,7 @@ static MPXP_Rc __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) { x11_priv_t& priv = *static_cast<x11_priv_t*>(vo->priv); + X11_System& x11 = *priv.x11; #ifdef CONFIG_VIDIX if(priv.vidix_server) if(priv.vidix_server->control(vo,request,data)==MPXP_Ok) return MPXP_Ok; @@ -478,7 +422,7 @@ return MPXP_True; } case VOCTRL_FULLSCREEN: - vo_x11_fullscreen(vo); + x11.fullscreen(vo); #ifdef CONFIG_VIDIX if(priv.vidix_name) resize_vidix(vo); #endif Modified: mplayerxp/libvo/vo_xv.cpp =================================================================== --- mplayerxp/libvo/vo_xv.cpp 2012-11-24 09:44:40 UTC (rev 447) +++ mplayerxp/libvo/vo_xv.cpp 2012-11-25 11:53:28 UTC (rev 448) @@ -29,10 +29,9 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> -#include <X11/extensions/XShm.h> #include <errno.h> -#include "x11_common.h" +#include "x11_system.h" #include "osdep/fastmemcpy.h" #include "sub.h" @@ -40,11 +39,6 @@ #include "dri_vo.h" #include "xmpcore/mp_image.h" -#include <X11/extensions/Xv.h> -#include <X11/extensions/Xvlib.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> #include "vo_msg.h" static vo_info_t vo_info = @@ -70,196 +64,48 @@ uint32_t image_format; unsigned depth; - XWindowAttributes attribs; - XvAdaptorInfo* ai; - XvImageFormatValues*fo; - - unsigned int ver,rel,req,ev,err; unsigned int formats, adaptors, port, format, bpp; unsigned expose_idx,num_buffers; // 1 - default - XvImage* image[MAX_DRI_BUFFERS]; - XShmSegmentInfo Shminfo[MAX_DRI_BUFFERS]; + unsigned dwidth,dheight; - Window mRoot; - uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth; - uint32_t drwcX,drwcY,dwidth,dheight; + Xv_System* xv; }; xv_priv_t::xv_priv_t() { num_buffers=1; } -static int __FASTCALL__ xv_reset_video_eq(vo_data_t*vo) +static void set_gamma_correction( vo_data_t*vo ) { xv_priv_t& priv = *static_cast<xv_priv_t*>(vo->priv); - unsigned i; - XvAttribute *attributes; - int howmany,xv_atomka; - static int was_reset = 0; - /* get available attributes */ - attributes = XvQueryPortAttributes(vo->mDisplay, priv.port, &howmany); - /* first pass try reset */ - for (i = 0; (int)i < howmany && attributes; i++) { - if (attributes[i].flags & XvSettable && !strcmp(attributes[i].name,"XV_SET_DEFAULTS")) { - was_reset = 1; - MSG_DBG2("vo_xv: reset gamma correction\n"); - xv_atomka = XInternAtom(vo->mDisplay, attributes[i].name, True); - XvSetPortAttribute(vo->mDisplay, priv.port, xv_atomka, attributes[i].max_value); - } - } - return was_reset; + Xv_System& xv = *priv.xv; + vo_videq_t info; + /* try all */ + xv.reset_video_eq(); + info.name=VO_EC_BRIGHTNESS; + info.value=vo_conf.gamma.brightness; + xv.set_video_eq(&info); + info.name=VO_EC_CONTRAST; + info.value=vo_conf.gamma.contrast; + xv.set_video_eq(&info); + info.name=VO_EC_SATURATION; + info.value=vo_conf.gamma.saturation; + xv.set_video_eq(&info); + info.name=VO_EC_HUE; + info.value=vo_conf.gamma.hue; + xv.set_video_eq(&info); + info.name=VO_EC_RED_INTENSITY; + info.value=vo_conf.gamma.red_intensity; + xv.set_video_eq(&info); + info.name=VO_EC_GREEN_INTENSITY; + info.value=vo_conf.gamma.green_intensity; + xv.set_video_eq(&info); + info.name=VO_EC_BLUE_INTENSITY; + info.value=vo_conf.gamma.blue_intensity; + xv.set_video_eq(&info); } -static int __FASTCALL__ xv_set_video_eq(vo_data_t*vo,const vo_videq_t *info) -{ - xv_priv_t& priv = *static_cast<xv_priv_t*>(vo->priv); - unsigned i; - XvAttribute *attributes; - int howmany, xv_min,xv_max,xv_atomka; - /* get available attributes */ - attributes = XvQueryPortAttributes(vo->mDisplay, priv.port, &howmany); - for (i = 0; (int)i < howmany && attributes; i++) { - if (attributes[i].flags & XvSettable) { - xv_min = attributes[i].min_value; - xv_max = attributes[i].max_value; - xv_atomka = XInternAtom(vo->mDisplay, attributes[i].name, True); - /* since we have SET_DEFAULTS first in our list, we can check if it's available - then trigger it if it's ok so that the other values are at default upon query */ - if (xv_atomka != None) { - int port_value,port_min,port_max,port_mid,has_value=0; - if(!strcmp(attributes[i].name,"XV_BRIGHTNESS") && !strcmp(info->name,VO_EC_BRIGHTNESS)) { - has_value=1; - port_value = info->value; - } else if(!strcmp(attributes[i].name,"XV_SATURATION") && !strcmp(info->name,VO_EC_SATURATION)) { - has_value=1; - port_value = info->value; - } else if(!strcmp(attributes[i].name,"XV_CONTRAST") && !strcmp(info->name,VO_EC_CONTRAST)) { - has_value=1; - port_value = info->value; - } else -#if 0 -/* We may safely skip this parameter since NVidia driver has default == min - for XV_HUE but not mid. IMHO it's meaningless against RGB. */ - if(!strcmp(attributes[i].name,"XV_HUE") && !strcmp(info->name,VO_EC_HUE)) - { - has_value=1; - port_value = info->value; - } - else -#endif - /* Note: since 22.01.2002 GATOS supports these attrs for radeons (NK) */ - ... [truncated message content] |
From: <nic...@us...> - 2012-11-26 17:02:36
|
Revision: 457 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=457&view=rev Author: nickols_k Date: 2012-11-26 17:02:22 +0000 (Mon, 26 Nov 2012) Log Message: ----------- SECURITY PATCH: use class VO_Interface instead of struct video_out Note about illegal patch: it seems that glxContext is substituted on my working PC simply because the same method in official examples creates window and paints images into it. Modified Paths: -------------- mplayerxp/libmpsub/spudec.cpp mplayerxp/libmpsub/spudec.h mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_fbdev.cpp mplayerxp/libvo/vo_null.cpp mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_sdl.cpp mplayerxp/libvo/vo_vesa.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp mplayerxp/libvo/vosub_vidix.cpp mplayerxp/libvo/vosub_vidix.h Modified: mplayerxp/libmpsub/spudec.cpp =================================================================== --- mplayerxp/libmpsub/spudec.cpp 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libmpsub/spudec.cpp 2012-11-26 17:02:22 UTC (rev 457) @@ -89,7 +89,6 @@ unsigned char *scaled_aimage; int auto_palette; /* 1 if we lack a palette and must use an heuristic. */ int font_start_level; /* Darkest value used for the computed font */ - vo_functions_t *hw_spu; int spu_changed; unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */ unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */ @@ -476,13 +475,6 @@ static void __FASTCALL__ spudec_decode(spudec_handle_t *self, unsigned int pts100) { - if(self->hw_spu) { - vo_mpegpes_t packet = { NULL, 0, 0x20, 0 }; - packet.data = self->packet; - packet.size = self->packet_size; - packet.timestamp = pts100; -// self->hw_spu->draw_frame((uint8_t**)&pkg); - } else spudec_process_control(self, pts100); } @@ -1099,8 +1091,6 @@ spudec_handle_t *spu = (spudec_handle_t *) self; if (spu && palette) { memcpy(spu->global_palette, palette, sizeof(spu->global_palette)); -// if(spu->hw_spu) -// spu->hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette); } } @@ -1166,12 +1156,3 @@ delete spu; } } - -void __FASTCALL__ spudec_set_hw_spu(any_t*self, vo_functions_t *hw_spu) -{ - spudec_handle_t *spu = (spudec_handle_t*)self; - if (!spu) - return; - spu->hw_spu = hw_spu; -// hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette); -} Modified: mplayerxp/libmpsub/spudec.h =================================================================== --- mplayerxp/libmpsub/spudec.h 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libmpsub/spudec.h 2012-11-26 17:02:22 UTC (rev 457) @@ -21,7 +21,6 @@ void __FASTCALL__ spudec_reset(any_t*__self); // called after seek int __FASTCALL__ spudec_visible(any_t*__self); // check if spu is visible void __FASTCALL__ spudec_set_font_factor(any_t*__self, double factor); // sets the equivalent to ffactor -void __FASTCALL__ spudec_set_hw_spu(any_t*__self, vo_functions_t *hw_spu); int __FASTCALL__ spudec_changed(any_t*__self); void __FASTCALL__ spudec_calc_bbox(any_t*me, unsigned int dxs, unsigned int dys, unsigned int* bbox); void __FASTCALL__ spudec_set_forced_subs_only(any_t* const __self, const unsigned int flag); Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libvo/video_out.cpp 2012-11-26 17:02:22 UTC (rev 457) @@ -32,6 +32,7 @@ #include <sys/mman.h> #include "video_out.h" +#include "video_out_internal.h" #include "osdep/shmem.h" #include "mp_conf_lavc.h" @@ -59,35 +60,35 @@ // // Externally visible list of all vo drivers // -extern const vo_functions_t video_out_x11; -extern const vo_functions_t video_out_xv; -extern const vo_functions_t video_out_sdl; -extern const vo_functions_t video_out_null; -extern const vo_functions_t video_out_fbdev; -extern const vo_functions_t video_out_opengl; -extern const vo_functions_t video_out_vesa; +extern const vo_info_t x11_info; +extern const vo_info_t xv_info; +extern const vo_info_t sdl_info; +extern const vo_info_t null_info; +extern const vo_info_t fbdev_info; +extern const vo_info_t opengl_info; +extern const vo_info_t vesa_info; -static const vo_functions_t* video_out_drivers[] = +static const vo_info_t* vo_infos[] = { #ifdef HAVE_XV - &video_out_xv, + &xv_info, #endif #ifdef HAVE_OPENGL - &video_out_opengl, + &opengl_info, #endif #ifdef HAVE_X11 - &video_out_x11, + &x11_info, #endif #ifdef HAVE_SDL - &video_out_sdl, + &sdl_info, #endif #ifdef HAVE_VESA - &video_out_vesa, + &vesa_info, #endif #ifdef HAVE_FBDEV - &video_out_fbdev, + &fbdev_info, #endif - &video_out_null, + &null_info, NULL }; @@ -126,7 +127,8 @@ pthread_mutex_t surfaces_mutex; vo_format_desc vod; dri_priv_t dri; - const vo_functions_t * video_out; + const vo_info_t* video_out; + class VO_Interface* vo_iface; draw_alpha_f draw_alpha; }; @@ -140,40 +142,42 @@ vo_priv_t::~vo_priv_t() { pthread_mutex_destroy(&surfaces_mutex); + delete vo_iface; } void vo_print_help(vo_data_t*vo) { + UNUSED(vo); unsigned i; MSG_INFO("Available video output drivers:\n"); i=0; - while (video_out_drivers[i]) { - const vo_info_t *info = video_out_drivers[i++]->get_info (vo); + while (vo_infos[i]) { + const vo_info_t *info = vo_infos[i++]; MSG_INFO("\t%s\t%s\n", info->short_name, info->name); } MSG_INFO("\n"); } -const vo_functions_t* vo_register(vo_data_t*vo,const char *driver_name) +MPXP_Rc vo_register(vo_data_t*vo,const char *driver_name) { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); unsigned i; - if(!driver_name) priv.video_out=video_out_drivers[0]; + if(!driver_name) priv.video_out=vo_infos[0]; else - for (i=0; video_out_drivers[i] != &video_out_null; i++){ - const vo_info_t *info = video_out_drivers[i]->get_info (vo); + for (i=0; vo_infos[i] != &null_info; i++){ + const vo_info_t *info = vo_infos[i]; if(strcmp(info->short_name,driver_name) == 0){ - priv.video_out = video_out_drivers[i]; + priv.video_out = vo_infos[i]; break; } } - return priv.video_out; + return priv.video_out?MPXP_Ok:MPXP_False; } const vo_info_t* vo_get_info(vo_data_t*vo) { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); - return priv.video_out->get_info(vo); + return priv.video_out; } vo_data_t* __FASTCALL__ vo_preinit_structs( void ) @@ -196,7 +200,8 @@ vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_init(%s)\n",subdevice); priv.frame_counter=0; - return priv.video_out->preinit(vo,subdevice); + priv.vo_iface=priv.video_out->query_interface(subdevice); + return priv.vo_iface?MPXP_Ok:MPXP_False; } int __FASTCALL__ vo_describe_fourcc(uint32_t fourcc,vo_format_desc *vd) @@ -273,12 +278,12 @@ if(!priv.dri.bpp) priv.dri.has_dri=0; /*unknown fourcc*/ if(priv.dri.has_dri) { - priv.video_out->control_vo(vo,VOCTRL_GET_NUM_FRAMES,&priv.dri.num_xp_frames); + priv.vo_iface->ctrl(VOCTRL_GET_NUM_FRAMES,&priv.dri.num_xp_frames); priv.dri.num_xp_frames=std::min(priv.dri.num_xp_frames,unsigned(MAX_DRI_BUFFERS)); for(i=0;i<priv.dri.num_xp_frames;i++) { priv.dri.surf[i].idx=i; - priv.video_out->control_vo(vo,DRI_GET_SURFACE,&priv.dri.surf[i]); + priv.vo_iface->ctrl(DRI_GET_SURFACE,&priv.dri.surf[i]); } } } @@ -375,7 +380,7 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); priv.dri.has_dri = 1; - priv.video_out->control_vo(vo,DRI_GET_SURFACE_CAPS,&priv.dri.cap); + priv.vo_iface->ctrl(DRI_GET_SURFACE_CAPS,&priv.dri.cap); dri_config(vo,priv.dri.cap.fourcc); /* ugly workaround of swapped BGR-fourccs. Should be removed in the future */ if(!priv.dri.has_dri) @@ -422,11 +427,11 @@ priv.dri.d_height = d_h; MSG_V("priv.video_out->config(%u,%u,%u,%u,0x%x,'%s',%s)\n" ,w,h,d_w,d_h,fullscreen,title,vo_format_name(dest_fourcc)); - retval = priv.video_out->config_vo(vo,w,h,d_w,d_h,title,dest_fourcc); + retval = priv.vo_iface->configure(w,h,d_w,d_h,fullscreen,title,dest_fourcc); priv.srcFourcc=format; if(retval == MPXP_Ok) { int dri_retv; - dri_retv = priv.video_out->control_vo(vo,DRI_GET_SURFACE_CAPS,&priv.dri.cap); + dri_retv = priv.vo_iface->ctrl(DRI_GET_SURFACE_CAPS,&priv.dri.cap); priv.image_format = format; priv.image_width = w; priv.image_height = h; @@ -460,13 +465,12 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); uint32_t dri_forced_fourcc; - MPXP_Rc retval; vo_query_fourcc_t qfourcc; MSG_DBG3("dri_vo_dbg: vo_query_format(%08lX)\n",*fourcc); qfourcc.fourcc = *fourcc; qfourcc.w = src_w; qfourcc.h = src_h; - if(priv.video_out->control_vo(vo,VOCTRL_QUERY_FORMAT,&qfourcc)==MPXP_False) + if(priv.vo_iface->ctrl(VOCTRL_QUERY_FORMAT,&qfourcc)==MPXP_False) qfourcc.flags=VOCAP_NA; MSG_V("dri_vo: request for %s fourcc: %i\n",vo_format_name(*fourcc),qfourcc.flags); dri_forced_fourcc = *fourcc; @@ -477,7 +481,7 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_reset\n"); - return priv.video_out->control_vo(vo,VOCTRL_RESET,NULL); + return priv.vo_iface->ctrl(VOCTRL_RESET,NULL); } MPXP_Rc vo_screenshot(vo_data_t*vo,unsigned idx ) @@ -493,14 +497,14 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_pause\n"); - return priv.video_out->control_vo(vo,VOCTRL_PAUSE,0); + return priv.vo_iface->ctrl(VOCTRL_PAUSE,0); } MPXP_Rc vo_resume(vo_data_t*vo) { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_resume\n"); - return priv.video_out->control_vo(vo,VOCTRL_RESUME,0); + return priv.vo_iface->ctrl(VOCTRL_RESUME,0); } void vo_lock_surfaces(vo_data_t*vo) { @@ -572,7 +576,7 @@ else return MPXP_False; } -static int __FASTCALL__ adjust_size(any_t*vo,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) +static int __FASTCALL__ adjust_size(const any_t*vo,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) { vo_priv_t& priv=*static_cast<vo_priv_t*>(((vo_data_t*)vo)->vo_priv); MSG_DBG3("dri_vo_dbg: adjust_size was called %u %u %u %u\n",cw,ch,*nw,*nh); @@ -606,8 +610,9 @@ vo_resize_t vrest; MSG_DBG3("dri_vo_dbg: vo_check_events\n"); vrest.event_type = 0; + vrest.vo = vo; vrest.adjust_size = adjust_size; - retval = priv.video_out->control_vo(vo,VOCTRL_CHECK_EVENTS,&vrest); + retval = priv.vo_iface->ctrl(VOCTRL_CHECK_EVENTS,&vrest); /* it's ok since accelerated drivers doesn't touch surfaces but there is only one driver (vo_x11) which changes surfaces on 'fullscreen' key */ @@ -627,7 +632,7 @@ MPXP_Rc retval; MSG_DBG3("dri_vo_dbg: vo_fullscreen\n"); etype = 0; - retval = priv.video_out->control_vo(vo,VOCTRL_FULLSCREEN,&etype); + retval = priv.vo_iface->ctrl(VOCTRL_FULLSCREEN,&etype); if(priv.dri.has_dri && retval == MPXP_True && (etype & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) dri_reconfig(vo,etype); if(retval == MPXP_True) priv.dri.flags ^= VOFLG_FS; @@ -678,7 +683,7 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG2("dri_vo_dbg: vo_select_frame(play_idx=%u)\n",play_idx); - priv.video_out->select_frame(vo,play_idx); + priv.vo_iface->select_frame(play_idx); } void vo_flush_page(vo_data_t*vo,unsigned decoder_idx) @@ -687,7 +692,7 @@ MSG_DBG3("dri_vo_dbg: vo_flush_pages [idx=%u]\n",decoder_idx); priv.frame_counter++; if((priv.dri.cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) - priv.video_out->control_vo(vo,VOCTRL_FLUSH_PAGES,&decoder_idx); + priv.vo_iface->ctrl(VOCTRL_FLUSH_PAGES,&decoder_idx); } /* DRAW OSD */ @@ -890,7 +895,6 @@ vo_priv_t* priv=static_cast<vo_priv_t*>(vo->vo_priv); MSG_DBG3("dri_vo_dbg: vo_uninit\n"); vo_inited--; - priv->video_out->uninit(vo); delete priv; } @@ -898,7 +902,7 @@ { MPXP_Rc rval; vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); - rval=priv.video_out->control_vo(vo,request,data); + rval=priv.vo_iface->ctrl(request,data); MSG_DBG3("dri_vo_dbg: %u=vo_control( %u, %p )\n",rval,request,data); return rval; } Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libvo/video_out.h 2012-11-26 17:02:22 UTC (rev 457) @@ -59,13 +59,16 @@ }; /** Text description of VO-driver */ -typedef struct vo_info_s +class VO_Interface; +typedef VO_Interface* (*query_interface_t)(const char* args); +struct vo_info_t { - const char *name; /**< driver name ("Matrox Millennium G200/G400") */ - const char *short_name; /**< short name (for config strings) ("mga") */ - const char *author; /**< author ("Aaron Holtzman <aho...@es...>") */ - const char *comment; /**< any additional comments */ -} vo_info_t; + const char* name; /**< driver name ("Matrox Millennium G200/G400") */ + const char* short_name; /**< short name (for config strings) ("mga") */ + const char* author; /**< author ("Aaron Holtzman <aho...@es...>") */ + const char* comment;/**< any additional comments */ + query_interface_t query_interface; +}; enum { VOCAP_NA=0x00, @@ -81,22 +84,7 @@ unsigned flags; /**< Flags for this fourcc VOCAP_* */ }vo_query_fourcc_t; -/** Notification event when windowed output has been resized (as data of VOCTRL_CHECK_EVENT) */ -typedef int (*__FASTCALL__ vo_adjust_size_t)(any_t*,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh); -typedef struct vo_resize_s -{ - uint32_t event_type; /**< X11 event type */ - /** callback to adjust size of window keeping aspect ratio - * @param cw current window width - * @param ch current window height - * @param nw storage for new width to be stored current window width - * @param nh storage for new height to be stored current window width - * @return 0 if fail !0 if success - **/ - vo_adjust_size_t adjust_size; -}vo_resize_t; - /** Named video equalizer */ typedef struct vo_videq_s { @@ -174,7 +162,6 @@ video_private* vo_priv;/* private data of vo structure */ video_private* priv; /* private data of video driver */ - video_private* priv3; /* private data of vidix commons */ /* subtitle support */ char* osd_text; @@ -200,61 +187,30 @@ static inline void vo_FLIP_UNSET(vo_data_t*vo) { vo->flags&=~VOFLAG_FLIPPING; } static inline void vo_FLIP_REVERT(vo_data_t*vo){ vo->flags^=VOFLAG_FLIPPING; } -typedef MPXP_Rc (* __FASTCALL__ vo_control_t)(vo_data_t* vo,uint32_t request, any_t*data); -typedef void (* __FASTCALL__ vo_select_frame_t)(vo_data_t* vo,unsigned idx); -/** VO-driver interface */ -typedef struct vo_functions_s +/** Notification event when windowed output has been resized (as data of VOCTRL_CHECK_EVENT) */ +typedef int (*__FASTCALL__ vo_adjust_size_t)(const any_t*,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh); +typedef struct vo_resize_s { - /** Preinitializes driver (real INITIALIZATION) - * @param arg currently it's vo_subdevice - * @return MPXP_Ok on successful initialization. - **/ - MPXP_Rc (* __FASTCALL__ preinit)(vo_data_t* vo,const char *arg); + uint32_t event_type; /**< X11 event type */ - /** Initializes (means CONFIGURE) the display driver. - * @param width width of source image - * @param height height of source image - * @param d_width width of destinition image (may require prescaling) - * @param d_height height of destinition image (may require prescaling) - * @param fullscreen flags (see VOFLAG_XXX for detail) - * @param title window title, if available - * @param format fourcc of source image - * @return zero on successful initialization, non-zero on error. - **/ - MPXP_Rc (* __FASTCALL__ config_vo)(vo_data_t* vo, - uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height,const char *title, uint32_t format); + /** callback to adjust size of window keeping aspect ratio + * @param cw current window width + * @param ch current window height + * @param nw storage for new width to be stored current window width + * @param nh storage for new height to be stored current window width + * @return 0 if fail !0 if success + **/ + vo_data_t* vo; + vo_adjust_size_t adjust_size; +}vo_resize_t; - /** Control interface - * @param request command. See VOCTRL_** for detail - * @param data data associated with command - * @return MPXP_True if success MPXP_False VO_ERROR MPXP_NA otherwise - **/ - vo_control_t control_vo; - - /** Returns driver information. - * @return read-only pointer to a vo_info_t structure. - **/ - const vo_info_t* (* __FASTCALL__ get_info)(const vo_data_t* vo); - - /** Blit/Flip buffer to the screen. Must be called after each frame! - * @param idex index of frame to be selected as active frame - **/ - vo_select_frame_t select_frame; - - /** Closes driver. Should restore the original state of the system. - **/ - void (* __FASTCALL__ uninit)(vo_data_t* vo); - -} vo_functions_t; - /****************************************************** * High level VO functions to provide some abstraction * * level for video out library * \*****************************************************/ extern vo_data_t* __FASTCALL__ vo_preinit_structs( void ); extern void vo_print_help(vo_data_t*); -extern const vo_functions_t * vo_register(vo_data_t* vo,const char *driver_name); +extern MPXP_Rc vo_register(vo_data_t* vo,const char *driver_name); extern const vo_info_t* vo_get_info(vo_data_t* vo); extern MPXP_Rc __FASTCALL__ vo_init(vo_data_t* vo,const char *subdevice_name); extern MPXP_Rc __FASTCALL__ vo_config(vo_data_t* vo,uint32_t width, uint32_t height, uint32_t d_width, Modified: mplayerxp/libvo/video_out_internal.h =================================================================== --- mplayerxp/libvo/video_out_internal.h 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libvo/video_out_internal.h 2012-11-26 17:02:22 UTC (rev 457) @@ -22,23 +22,21 @@ */ #ifndef __VIDEO_OUT_INTERNAL_H #define __VIDEO_OUT_INTERNAL_H 1 -static MPXP_Rc __FASTCALL__ control_vo(vo_data_t*vo,uint32_t request, any_t*data); -static MPXP_Rc __FASTCALL__ config_vo(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height, const char *title, - uint32_t format); -static const vo_info_t* __FASTCALL__ get_info(const vo_data_t*vo); -static void __FASTCALL__ select_frame(vo_data_t*vo,unsigned idx); -static void __FASTCALL__ uninit(vo_data_t*vo); -static MPXP_Rc __FASTCALL__ preinit(vo_data_t*vo,const char *); -#define LIBVO_EXTERN(x) extern const vo_functions_t video_out_##x =\ -{\ - preinit,\ - config_vo,\ - control_vo,\ - get_info,\ - select_frame,\ - uninit\ +class VO_Interface : public Opaque { + public: + VO_Interface(const char *args) { UNUSED(args); }; + virtual ~VO_Interface() {}; + + virtual MPXP_Rc configure(uint32_t width, + uint32_t height, + uint32_t d_width, + uint32_t d_height, + unsigned flags, + const char *title, + uint32_t format) = 0; + virtual void select_frame(unsigned idx) = 0; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data) = 0; }; #include "osd.h" Modified: mplayerxp/libvo/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo/vo_fbdev.cpp 2012-11-26 09:03:57 UTC (rev 456) +++ mplayerxp/libvo/vo_fbdev.cpp 2012-11-26 17:02:22 UTC (rev 457) @@ -39,19 +39,40 @@ #include "libmpstream/mrl.h" #include "vo_msg.h" -LIBVO_EXTERN(fbdev) +#define PRINT_LINENUM //MSG_DBG2(" at line %d\n", line_num) -static vo_info_t vo_info = { - "Framebuffer Device" -#ifdef CONFIG_VIDIX - " (with fbdev:vidix subdevice)" -#endif - , - "fbdev", - "Szabolcs Berecz <sz...@in...>", - "" +#define MAX_NR_TOKEN 16 + +#define MAX_LINE_LEN 1000 + +#define RET_EOF -1 +#define RET_EOL -2 + +struct priv_conf_t { + priv_conf_t(); + ~priv_conf_t() {} +/* command line/config file options */ + char* dev_name; + const char* mode_cfgfile; + char* mode_name; + const char* monitor_hfreq_str; + const char* monitor_vfreq_str; + const char* monitor_dotclock_str; }; +static priv_conf_t priv_conf; +priv_conf_t::priv_conf_t() { + mode_cfgfile = "/etc/priv.modes"; +} +static const mrl_config_t fbconf[]= +{ + { "modeconfig", &priv_conf.mode_cfgfile, MRL_TYPE_STRING, 0, 0 }, + { "hfreq", &priv_conf.monitor_hfreq_str, MRL_TYPE_STRING, 0, 0 }, + { "vfreq", &priv_conf.monitor_vfreq_str, MRL_TYPE_STRING, 0, 0 }, + { "dotclock", &priv_conf.monitor_dotclock_str, MRL_TYPE_STRING, 0, 0 }, + { NULL, NULL, 0, 0, 0 }, +}; + /****************************** * fb.modes support * ******************************/ @@ -64,15 +85,6 @@ uint32_t vmode; } fb_mode_t; -#define PRINT_LINENUM //MSG_DBG2(" at line %d\n", line_num) - -#define MAX_NR_TOKEN 16 - -#define MAX_LINE_LEN 1000 - -#define RET_EOF -1 -#define RET_EOL -2 - static int __FASTCALL__ validate_mode(fb_mode_t *m) { if (!m->xres) { @@ -94,84 +106,210 @@ float max; } range_t; -struct fbdev_priv_t : public video_private { - fbdev_priv_t(); - virtual ~fbdev_priv_t() {} - FILE * fp; - int line_num; - char * line; - char * token[MAX_NR_TOKEN]; - uint32_t srcFourcc,dstFourcc; +class FBDev_VO_Interface : public VO_Interface { + public: + FBDev_VO_Interface(const char* args); + virtual ~FBDev_VO_Interface(); + + virtual MPXP_Rc configure(uint32_t width, + uint32_t height, + uint32_t d_width, + uint32_t d_height, + unsigned flags, + const char *title, + uint32_t format); + virtual void select_frame(unsigned idx); + virtual MPXP_Rc ctrl(uint32_t request, any_t*data); + private: + MPXP_Rc fb_preinit(); + uint32_t parse_sub_device(const char *sd); + int parse_fbmode_cfg(const char *cfgfile); + int get_token(int num); + void vt_set_textarea(int u, int l); + void lots_of_printf() const; + + void dri_get_surface_caps(dri_surface_cap_t *caps) const; + void dri_get_surface(dri_surface_t *surf) const; + MPXP_Rc query_format(vo_query_fourcc_t* format) const; + + FILE * fp; + int line_num; + char * line; + char * token[MAX_NR_TOKEN]; + uint32_t srcFourcc,dstFourcc; + unsigned flags; /* fb.modes related variables */ - range_t * monitor_hfreq; - range_t * monitor_vfreq; - range_t * monitor_dotclock; - fb_mode_t * mode; + range_t * monitor_hfreq; + range_t * monitor_vfreq; + range_t * monitor_dotclock; + fb_mode_t * mode; /* vt related variables */ - int vt_fd; - FILE * vt_fp; - int vt_doit; + int vt_fd; + FILE * vt_fp; + int vt_doit; /* vo_fbdev related variables */ - int dev_fd; - int tty_fd; - size_t size; - uint8_t * frame_buffer; - uint8_t * L123123875; /* thx .so :) */ - struct fb_fix_screeninfo finfo; - struct fb_var_screeninfo orig_vinfo; - struct fb_var_screeninfo vinfo; - struct fb_cmap oldcmap; - int cmap_changed; - unsigned pixel_size; // 32: 4 24: 3 16: 2 15: 2 - uint32_t pixel_format; - unsigned real_bpp; // 32: 24 24: 24 16: 16 15: 15 - unsigned bpp; // 32: 32 24: 24 16: 16 15: 15 - unsigned bpp_we_want; // 32: 32 24: 24 16: 16 15: 15 - unsigned line_len; - unsigned xres; - unsigned yres; + int dev_fd; + int tty_fd; + size_t size; + uint8_t * frame_buffer; + uint8_t * L123123875; /* thx .so :) */ + struct fb_fix_screeninfo finfo; + struct fb_var_screeninfo orig_vinfo; + struct fb_var_screeninfo vinfo; + struct fb_cmap oldcmap; + int cmap_changed; + unsigned pixel_size; // 32: 4 24: 3 16: 2 15: 2 + uint32_t pixel_format; + unsigned real_bpp; // 32: 24 24: 24 16: 16 15: 15 + unsigned bpp; // 32: 32 24: 24 16: 16 15: 15 + unsigned bpp_we_want; // 32: 32 24: 24 16: 16 15: 15 + unsigned line_len; + unsigned xres; + unsigned yres; - uint8_t * next_frame[MAX_DRI_BUFFERS]; - unsigned total_fr; - int in_width; - int in_height; - unsigned out_width; - unsigned out_height; - int last_row; - int fs; - MPXP_Rc pre_init_err; + uint8_t * next_frame[MAX_DRI_BUFFERS]; + unsigned total_fr; + int in_width; + int in_height; + unsigned out_width; + unsigned out_height; + int last_row; + int fs; + MPXP_Rc pre_init_err; #ifdef CONFIG_VIDIX /* Name of VIDIX driver */ - const char* vidix_name; - vidix_server_t* vidix_server; + const char* vidix_name; + vidix_server_t* vidix_server; + vidix_priv_t* vidix; #endif + int fb_preinit_done; + MPXP_Rc fb_works; }; -fbdev_priv_t::fbdev_priv_t() { +uint32_t FBDev_VO_Interface::parse_sub_device(const char *sd) +{ + const char *param; +#ifdef CONFIG_VIDIX + if(memcmp(sd,"vidix",5) == 0) vidix_name = &sd[5]; /* vidix_name will be valid within init() */ + else +#endif + { + param=mrl_parse_line(sd,NULL,NULL,&priv_conf.dev_name,&priv_conf.mode_name); + mrl_parse_params(param,fbconf); + } + return 0; +} + +MPXP_Rc FBDev_VO_Interface::fb_preinit() +{ + fb_preinit_done = 0; + fb_works = MPXP_Ok; vt_doit = 1; - pre_init_err = MPXP_Ok; + + if (fb_preinit_done) return fb_works; + + if (!priv_conf.dev_name && !(priv_conf.dev_name = getenv("FRAMEBUFFER"))) + priv_conf.dev_name = (char *)"/dev/fb0"; + MSG_DBG2(FBDEV "using %s\n", priv_conf.dev_name); + + if ((dev_fd = open(priv_conf.dev_name, O_RDWR)) == -1) { + MSG_ERR(FBDEV "Can't open %s: %s\n", priv_conf.dev_name, strerror(errno)); + goto err_out; + } + if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo)) { + MSG_ERR(FBDEV "Can't get VSCREENINFO: %s\n", strerror(errno)); + goto err_out_fd; + } + orig_vinfo = vinfo; + + if ((tty_fd = open("/dev/tty", O_RDWR)) < 0) { + MSG_DBG2(FBDEV "notice: Can't open /dev/tty: %s\n", strerror(errno)); + } + + bpp = vinfo.bits_per_pixel; + + if (bpp == 8 && !vo_conf.dbpp) { + MSG_ERR(FBDEV "8 bpp output is not supported.\n"); + goto err_out_tty_fd; + } + + /* 16 and 15 bpp is reported as 16 bpp */ + if (bpp == 16) + bpp = vinfo.red.length + vinfo.green.length + vinfo.blue.length; + + if (vo_conf.dbpp) { + if (vo_conf.dbpp != 15 && vo_conf.dbpp != 16 && vo_conf.dbpp != 24 && vo_conf.dbpp != 32) { + MSG_ERR(FBDEV "can't switch to %d bpp\n", vo_conf.dbpp); + goto err_out_fd; + } + bpp = vo_conf.dbpp; + } + + fb_preinit_done = 1; + fb_works = MPXP_Ok; + return MPXP_Ok; +err_out_tty_fd: + close(tty_fd); + tty_fd = -1; +err_out_fd: + close(dev_fd); + dev_fd = -1; +err_out: + fb_preinit_done = 1; + fb_works = MPXP_False; + return MPXP_False; } -struct priv_conf_t { - priv_conf_t(); - ~priv_conf_t() {} -/* command line/config file options */ - char* dev_name; - const char* mode_cfgfile; - char* mode_name; - const char* monitor_hfreq_str; - const char* monitor_vfreq_str; - const char* monitor_dotclock_str; -}; -static priv_conf_t priv_conf; -priv_conf_t::priv_conf_t() { - mode_cfgfile = "/etc/priv.modes"; +FBDev_VO_Interface::~FBDev_VO_Interface() +{ + unsigned i; + MSG_V(FBDEV "uninit\n"); + if (cmap_changed) { + if (ioctl(dev_fd, FBIOPUTCMAP, &oldcmap)) + MSG_ERR(FBDEV "Can't restore original cmap\n"); + cmap_changed = 0; + } + for(i=0;i<total_fr;i++) delete next_frame[i]; + if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo)) + MSG_ERR(FBDEV "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); + orig_vinfo.xoffset = vinfo.xoffset; + orig_vinfo.yoffset = vinfo.yoffset; + if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &orig_vinfo)) + MSG_ERR(FBDEV "Can't reset original fb_var_screeninfo: %s\n", strerror(errno)); + if (tty_fd >= 0) { + if (ioctl(tty_fd, KDSETMODE, KD_TEXT) < 0) + MSG_ERR(FBDEV "Can't restore text mode: %s\n", strerror(errno)); + } + if (vt_doit) vt_set_textarea(0, orig_vinfo.yres); + close(tty_fd); + close(dev_fd); + if(frame_buffer) munmap(frame_buffer,size); +#ifdef CONFIG_VIDIX + if(vidix_name) vidix_term(vidix); + delete vidix_server; + delete vidix; +#endif } -static int __FASTCALL__ get_token(vo_data_t*vo,int num) +FBDev_VO_Interface::FBDev_VO_Interface(const char *arg) + :VO_Interface(arg) { - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); + if(arg) parse_sub_device(arg); +#ifdef CONFIG_VIDIX + if(vidix_name) { + vidix=vidix_preinit(vidix_name); + if(!(vidix_server=vidix_get_server(vidix))) { + MSG_ERR("Cannot initialze vidix with '%s' argument\n",vidix_name); + exit_player("Vidix error"); + } + } +#endif + if(fb_preinit()!=MPXP_Ok) exit_player("FBDev preinit"); +} + +int FBDev_VO_Interface::get_token(int num) +{ static int read_nextline = 1; static int line_pos; int i; @@ -183,33 +321,33 @@ } if (read_nextline) { - if (!fgets(priv.line, MAX_LINE_LEN, priv.fp)) goto out_eof; + if (!fgets(line, MAX_LINE_LEN, fp)) goto out_eof; line_pos = 0; - ++priv.line_num; + ++line_num; read_nextline = 0; } for (i = 0; i < num; i++) { - while (isspace(priv.line[line_pos])) ++line_pos; - if (priv.line[line_pos] == '\0' || priv.line[line_pos] == '#') { + while (isspace(line[line_pos])) ++line_pos; + if (line[line_pos] == '\0' || line[line_pos] == '#') { read_nextline = 1; goto out_eol; } - priv.token[i] = priv.line + line_pos; - c = priv.line[line_pos]; + token[i] = line + line_pos; + c = line[line_pos]; if (c == '"' || c == '\'') { - priv.token[i]++; - while (priv.line[++line_pos] != c && priv.line[line_pos]) /* NOTHING */; - if (!priv.line[line_pos]) goto out_eol; - priv.line[line_pos] = ' '; + token[i]++; + while (line[++line_pos] != c && line[line_pos]) /* NOTHING */; + if (!line[line_pos]) goto out_eol; + line[line_pos] = ' '; } else { - for (/* NOTHING */; !isspace(priv.line[line_pos]) && priv.line[line_pos]; line_pos++) /* NOTHING */; + for (/* NOTHING */; !isspace(line[line_pos]) && line[line_pos]; line_pos++) /* NOTHING */; } - if (!priv.line[line_pos]) { + if (!line[line_pos]) { read_nextline = 1; if (i == num - 1) goto out_ok; goto out_eol; } - priv.line[line_pos++] = '\0'; + line[line_pos++] = '\0'; } out_ok: return i; @@ -222,9 +360,8 @@ static fb_mode_t *fb_modes = NULL; static int nr_modes = 0; -static int __FASTCALL__ parse_fbmode_cfg(vo_data_t*vo,const char *cfgfile) +int FBDev_VO_Interface::parse_fbmode_cfg(const char *cfgfile) { - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); #define CHECK_IN_MODE_DEF\ do {\ if (!in_mode_def) {\ @@ -233,39 +370,39 @@ }\ } while (0) - fb_mode_t *mode = NULL; + fb_mode_t *_mode = NULL; char *endptr; // strtoul()... int in_mode_def = 0; int tmp, i; MSG_DBG2("Reading %s: ", cfgfile); - if ((priv.fp = fopen(cfgfile, "r")) == NULL) { + if ((fp = fopen(cfgfile, "r")) == NULL) { MSG_ERR("can't open '%s': %s\n", cfgfile, strerror(errno)); return -1; } - if ((priv.line = (char *) mp_malloc(MAX_LINE_LEN + 1)) == NULL) { - MSG_ERR("can't get memory for 'priv.line': %s\n", strerror(errno)); + if ((line = (char *) mp_malloc(MAX_LINE_LEN + 1)) == NULL) { + MSG_ERR("can't get memory for 'line': %s\n", strerror(errno)); return -2; } /* * check if the cfgfile starts with 'mode' */ - while ((tmp = get_token(vo,1)) == RET_EOL) /* NOTHING */; + while ((tmp = get_token(1)) == RET_EOL) /* NOTHING */; if (tmp == RET_EOF) goto out; - if (!strcmp(priv.token[0], "mode")) goto loop_enter; + if (!strcmp(token[0], "mode")) goto loop_enter; goto err_out_parse_error; - while ((tmp = get_token(vo,1)) != RET_EOF) { + while ((tmp = get_token(1)) != RET_EOF) { if (tmp == RET_EOL) continue; - if (!strcmp(priv.token[0], "mode")) { + if (!strcmp(token[0], "mode")) { if (in_mode_def) { MSG_ERR("'endmode' required"); goto err_out_print_linenum; } - if (!validate_mode(mode)) goto err_out_not_valid; + if (!validate_mode(_mode)) goto err_out_not_valid; loop_enter: if (!(fb_modes = (fb_mode_t *) mp_realloc(fb_modes, sizeof(fb_mode_t) * (nr_modes + 1)))) { @@ -273,105 +410,105 @@ " %s\n", nr_modes, strerror(errno)); goto err_out; } - mode=fb_modes + nr_modes; + _mode=fb_modes + nr_modes; ++nr_modes; - memset(mode,0,sizeof(fb_mode_t)); + memset(_mode,0,sizeof(fb_mode_t)); - if (get_token(vo,1) < 0) goto err_out_parse_error; + if (get_token(1) < 0) goto err_out_parse_error; for (i = 0; i < nr_modes - 1; i++) { - if (!strcmp(priv.token[0], fb_modes[i].name)) { - MSG_ERR("mode name '%s' isn't unique", priv.token[0]); + if (!strcmp(token[0], fb_modes[i].name)) { + MSG_ERR("mode name '%s' isn't unique", token[0]); goto err_out_print_linenum; } } - if (!(mode->name = mp_strdup(priv.token[0]))) { + if (!(_mode->name = mp_strdup(token[0]))) { MSG_ERR("can't mp_strdup -> 'name': %s\n", strerror(errno)); goto err_out; } in_mode_def = 1; - } else if (!strcmp(priv.token[0], "geometry")) { + } else if (!strcmp(token[0], "geometry")) { CHECK_IN_MODE_DEF; - if (get_token(vo,5) < 0) goto err_out_parse_error; - mode->xres = strtoul(priv.token[0], &endptr, 0); + if (get_token(5) < 0) goto err_out_parse_error; + _mode->xres = strtoul(token[0], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->yres = strtoul(priv.token[1], &endptr, 0); + _mode->yres = strtoul(token[1], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->vxres = strtoul(priv.token[2], &endptr, 0); + _mode->vxres = strtoul(token[2], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->vyres = strtoul(priv.token[3], &endptr, 0); + _mode->vyres = strtoul(token[3], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->depth = strtoul(priv.token[4], &endptr, 0); + _mode->depth = strtoul(token[4], &endptr, 0); if (*endptr) goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "timings")) { + } else if (!strcmp(token[0], "timings")) { CHECK_IN_MODE_DEF; - if (get_token(vo,7) < 0) goto err_out_parse_error; - mode->pixclock = strtoul(priv.token[0], &endptr, 0); + if (get_token(7) < 0) goto err_out_parse_error; + _mode->pixclock = strtoul(token[0], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->left = strtoul(priv.token[1], &endptr, 0); + _mode->left = strtoul(token[1], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->right = strtoul(priv.token[2], &endptr, 0); + _mode->right = strtoul(token[2], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->upper = strtoul(priv.token[3], &endptr, 0); + _mode->upper = strtoul(token[3], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->lower = strtoul(priv.token[4], &endptr, 0); + _mode->lower = strtoul(token[4], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->hslen = strtoul(priv.token[5], &endptr, 0); + _mode->hslen = strtoul(token[5], &endptr, 0); if (*endptr) goto err_out_parse_error; - mode->vslen = strtoul(priv.token[6], &endptr, 0); + _mode->vslen = strtoul(token[6], &endptr, 0); if (*endptr) goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "endmode")) { + } else if (!strcmp(token[0], "endmode")) { CHECK_IN_MODE_DEF; in_mode_def = 0; - } else if (!strcmp(priv.token[0], "accel")) { + } else if (!strcmp(token[0], "accel")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; + if (get_token(1) < 0) goto err_out_parse_error; /* * it's only used for text acceleration * so we just ignore it. */ - } else if (!strcmp(priv.token[0], "hsync")) { + } else if (!strcmp(token[0], "hsync")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "low")) mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; - else if(!strcmp(priv.token[0], "high")) mode->sync |= FB_SYNC_HOR_HIGH_ACT; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; + else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_HOR_HIGH_ACT; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "vsync")) { + } else if (!strcmp(token[0], "vsync")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "low")) mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; - else if(!strcmp(priv.token[0], "high")) mode->sync |= FB_SYNC_VERT_HIGH_ACT; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; + else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_VERT_HIGH_ACT; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "csync")) { + } else if (!strcmp(token[0], "csync")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "low")) mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; - else if(!strcmp(priv.token[0], "high")) mode->sync |= FB_SYNC_COMP_HIGH_ACT; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; + else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_COMP_HIGH_ACT; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "extsync")) { + } else if (!strcmp(token[0], "extsync")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "false")) mode->sync &= ~FB_SYNC_EXT; - else if(!strcmp(priv.token[0], "true")) mode->sync |= FB_SYNC_EXT; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "false")) _mode->sync &= ~FB_SYNC_EXT; + else if(!strcmp(token[0], "true")) _mode->sync |= FB_SYNC_EXT; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "laced")) { + } else if (!strcmp(token[0], "laced")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "false")) mode->vmode = FB_VMODE_NONINTERLACED; - else if (!strcmp(priv.token[0], "true")) mode->vmode = FB_VMODE_INTERLACED; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "false")) _mode->vmode = FB_VMODE_NONINTERLACED; + else if (!strcmp(token[0], "true")) _mode->vmode = FB_VMODE_INTERLACED; else goto err_out_parse_error; - } else if (!strcmp(priv.token[0], "double")) { + } else if (!strcmp(token[0], "double")) { CHECK_IN_MODE_DEF; - if (get_token(vo,1) < 0) goto err_out_parse_error; - if (!strcmp(priv.token[0], "false")) ; - else if (!strcmp(priv.token[0], "true")) mode->vmode = FB_VMODE_DOUBLE; + if (get_token(1) < 0) goto err_out_parse_error; + if (!strcmp(token[0], "false")) ; + else if (!strcmp(token[0], "true")) _mode->vmode = FB_VMODE_DOUBLE; else goto err_out_parse_error; } else goto err_out_parse_error; } - if (!validate_mode(mode)) goto err_out_not_valid; + if (!validate_mode(_mode)) goto err_out_not_valid; out: MSG_DBG2("%d modes\n", nr_modes); - delete priv.line; - fclose(priv.fp); + delete line; + fclose(fp); return nr_modes; err_out_parse_error: MSG_ERR("parse error"); @@ -383,8 +520,8 @@ fb_modes = NULL; } nr_modes = 0; - delete priv.line; - delete priv.fp; + delete line; + delete fp; return -2; err_out_not_valid: MSG_ERR("previous mode is not correct"); @@ -674,160 +811,75 @@ return cmap; } -static const mrl_config_t fbconf[]= +void FBDev_VO_Interface::lots_of_printf() const { - { "modeconfig", &priv_conf.mode_cfgfile, MRL_TYPE_STRING, 0, 0 }, - { "hfreq", &priv_conf.monitor_hfreq_str, MRL_TYPE_STRING, 0, 0 }, - { "vfreq", &priv_conf.monitor_vfreq_str, MRL_TYPE_STRING, 0, 0 }, - { "dotclock", &priv_conf.monitor_dotclock_str, MRL_TYPE_STRING, 0, 0 }, - { NULL, NULL, 0, 0, 0 }, -}; - -static uint32_t __FASTCALL__ parseSubDevice(fbdev_priv_t* priv,const char *sd) -{ - const char *param; -#ifdef CONFIG_VIDIX - if(memcmp(sd,"vidix",5) == 0) priv->vidix_name = &sd[5]; /* vidix_name will be valid within init() */ - else -#endif - { - param=mrl_parse_line(sd,NULL,NULL,&priv_conf.dev_name,&priv_conf.mode_name); - mrl_parse_params(param,fbconf); - } - return 0; -} - -static MPXP_Rc fb_preinit(vo_data_t*vo) -{ - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); - static int fb_preinit_done = 0; - static MPXP_Rc fb_works = MPXP_Ok; - - if (fb_preinit_done) return fb_works; - - if (!priv_conf.dev_name && !(priv_conf.dev_name = getenv("FRAMEBUFFER"))) - priv_conf.dev_name = "/dev/fb0"; - MSG_DBG2(FBDEV "using %s\n", priv_conf.dev_name); - - if ((priv.dev_fd = open(priv_conf.dev_name, O_RDWR)) == -1) { - MSG_ERR(FBDEV "Can't open %s: %s\n", priv_conf.dev_name, strerror(errno)); - goto err_out; - } - if (ioctl(priv.dev_fd, FBIOGET_VSCREENINFO, &priv.vinfo)) { - MSG_ERR(FBDEV "Can't get VSCREENINFO: %s\n", strerror(errno)); - goto err_out_fd; - } - priv.orig_vinfo = priv.vinfo; - - if ((priv.tty_fd = open("/dev/tty", O_RDWR)) < 0) { - MSG_DBG2(FBDEV "notice: Can't open /dev/tty: %s\n", strerror(errno)); - } - - priv.bpp = priv.vinfo.bits_per_pixel; - - if (priv.bpp == 8 && !vo_conf.dbpp) { - MSG_ERR(FBDEV "8 bpp output is not supported.\n"); - goto err_out_tty_fd; - } - - /* 16 and 15 bpp is reported as 16 bpp */ - if (priv.bpp == 16) - priv.bpp = priv.vinfo.red.length + priv.vinfo.green.length + priv.vinfo.blue.length; - - if (vo_conf.dbpp) { - if (vo_conf.dbpp != 15 && vo_conf.dbpp != 16 && vo_conf.dbpp != 24 && vo_conf.dbpp != 32) { - MSG_ERR(FBDEV "can't switch to %d bpp\n", vo_conf.dbpp); - goto err_out_fd; - } - priv.bpp = vo_conf.dbpp; - } - - fb_preinit_done = 1; - fb_works = MPXP_Ok; - return MPXP_Ok; -err_out_tty_fd: - close(priv.tty_fd); - priv.tty_fd = -1; -err_out_fd: - close(priv.dev_fd); - priv.dev_fd = -1; -err_out: - fb_preinit_done = 1; - fb_works = MPXP_False; - return MPXP_False; -} - -static void lots_of_printf(vo_data_t*vo) -{ - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); MSG_V(FBDEV "var info:\n"); - MSG_V(FBDEV "xres: %u\n", priv.vinfo.xres); - MSG_V(FBDEV "yres: %u\n", priv.vinfo.yres); - MSG_V(FBDEV "xres_virtual: %u\n", priv.vinfo.xres_virtual); - MSG_V(FBDEV "yres_virtual: %u\n", priv.vinfo.yres_virtual); - MSG_V(FBDEV "xoffset: %u\n", priv.vinfo.xoffset); - MSG_V(FBDEV "yoffset: %u\n", priv.vinfo.yoffset); - MSG_V(FBDEV "bits_per_pixel: %u\n", priv.vinfo.bits_per_pixel); - MSG_V(FBDEV "grayscale: %u\n", priv.vinfo.grayscale); + MSG_V(FBDEV "xres: %u\n", vinfo.xres); + MSG_V(FBDEV "yres: %u\n", vinfo.yres); + MSG_V(FBDEV "xres_virtual: %u\n", vinfo.xres_virtual); + MSG_V(FBDEV "yres_virtual: %u\n", vinfo.yres_virtual); + MSG_V(FBDEV "xoffset: %u\n", vinfo.xoffset); + MSG_V(FBDEV "yoffset: %u\n", vinfo.yoffset); + MSG_V(FBDEV "bits_per_pixel: %u\n", vinfo.bits_per_pixel); + MSG_V(FBDEV "grayscale: %u\n", vinfo.grayscale); MSG_V(FBDEV "red: %lu %lu %lu\n", - (unsigned long) priv.vinfo.red.offset, - (unsigned long) priv.vinfo.red.length, - (unsigned long) priv.vinfo.red.msb_right); + (unsigned long) vinfo.red.offset, + (unsigned long) vinfo.red.length, + (unsigned long) vinfo.red.msb_right); MSG_V(FBDEV "green: %lu %lu %lu\n", - (unsigned long) priv.vinfo.green.offset, - (unsigned long) priv.vinfo.green.length, - (unsigned long) priv.vinfo.green.msb_right); + (unsigned long) vinfo.green.offset, + (unsigned long) vinfo.green.length, + (unsigned long) vinfo.green.msb_right); MSG_V(FBDEV "blue: %lu %lu %lu\n", - (unsigned long) priv.vinfo.blue.offset, - (unsigned long) priv.vinfo.blue.length, - (unsigned long) priv.vinfo.blue.msb_right); + (unsigned long) vinfo.blue.offset, + (unsigned long) vinfo.blue.length, + (unsigned long) vinfo.blue.msb_right); MSG_V(FBDEV "transp: %lu %lu %lu\n", - (unsigned long) priv.vinfo.transp.offset, - (unsigned long) priv.vinfo.transp.length, - (unsigned long) priv.vinfo.transp.msb_right); - MSG_V(FBDEV "nonstd: %u\n", priv.vinfo.nonstd); - MSG_DBG2(FBDEV "activate: %u\n", priv.vinfo.activate); - MSG_DBG2(FBDEV "height: %u\n", priv.vinfo.height); - MSG_DBG2(FBDEV "width: %u\n", priv.vinfo.width); - MSG_DBG2(FBDEV "accel_flags: %u\n", priv.vinfo.accel_flags); + (unsigned long) vinfo.transp.offset, + (unsigned long) vinfo.transp.length, + (unsigned long) vinfo.transp.msb_right); + MSG_V(FBDEV "nonstd: %u\n", vinfo.nonstd); + MSG_DBG2(FBDEV "activate: %u\n", vinfo.activate); + MSG_DBG2(FBDEV "height: %u\n", vinfo.height); + MSG_DBG2(FBDEV "width: %u\n", vinfo.width); + MSG_DBG2(FBDEV "accel_flags: %u\n", vinfo.accel_flags); MSG_DBG2(FBDEV "timing:\n"); - MSG_DBG2(FBDEV "pixclock: %u\n", priv.vinfo.pixclock); - MSG_DBG2(FBDEV "left_margin: %u\n", priv.vinfo.left_margin); - MSG_DBG2(FBDEV "right_margin: %u\n", priv.vinfo.right_margin); - MSG_DBG2(FBDEV "upper_margin: %u\n", priv.vinfo.upper_margin); - MSG_DBG2(FBDEV "lower_margin: %u\n", priv.vinfo.lower_margin); - MSG_DBG2(FBDEV "hsync_len: %u\n", priv.vinfo.hsync_len); - MSG_DBG2(FBDEV "vsync_len: %u\n", priv.vinfo.vsync_len); - MSG_DBG2(FBDEV "sync: %u\n", priv.vinfo.sync); - MSG_DBG2(FBDEV "vmode: %u\n", priv.vinfo.vmode); + MSG_DBG2(FBDEV "pixclock: %u\n", vinfo.pixclock); + MSG_DBG2(FBDEV "left_margin: %u\n", vinfo.left_margin); + MSG_DBG2(FBDEV "right_margin: %u\n", vinfo.right_margin); + MSG_DBG2(FBDEV "upper_margin: %u\n", vinfo.upper_margin); + MSG_DBG2(FBDEV "lower_margin: %u\n", vinfo.lower_margin); + MSG_DBG2(FBDEV "hsync_len: %u\n", vinfo.hsync_len); + MSG_DBG2(FBDEV "vsync_len: %u\n", vinfo.vsync_len); + MSG_DBG2(FBDEV "sync: %u\n", vinfo.sync); + MSG_DBG2(FBDEV "vmode: %u\n", vinfo.vmode); MSG_V(FBDEV "fix info:\n"); - MSG_V(FBDEV "framebuffer size: %d bytes\n", priv.finfo.smem_len); - MSG_V(FBDEV "type: %lu\n", (unsigned long) priv.finfo.type); - MSG_V(FBDEV "type_aux: %lu\n", (unsigned long) priv.finfo.type_aux); - MSG_V(FBDEV "visual: %lu\n", (unsigned long) priv.finfo.visual); - MSG_V(FBDEV "line_length: %lu bytes\n", (unsigned long) priv.finfo.line_length); - MSG_DBG2(FBDEV "id: %.16s\n", priv.finfo.id); - MSG_DBG2(FBDEV "smem_start: %p\n", (any_t*) priv.finfo.smem_start); - MSG_DBG2(FBDEV "xpanstep: %u\n", priv.finfo.xpanstep); - MSG_DBG2(FBDEV "ypanstep: %u\n", priv.finfo.ypanstep); - MSG_DBG2(FBDEV "ywrapstep: %u\n", priv.finfo.ywrapstep); - MSG_DBG2(FBDEV "mmio_start: %p\n", (any_t*) priv.finfo.mmio_start); - MSG_DBG2(FBDEV "mmio_len: %u bytes\n", priv.finfo.mmio_len); - MSG_DBG2(FBDEV "accel: %u\n", priv.finfo.accel); - MSG_V(FBDEV "priv.bpp: %d\n", priv.bpp); - MSG_V(FBDEV "priv.real_bpp: %d\n", priv.real_bpp); - MSG_V(FBDEV "priv.pixel_size: %d bytes\n", priv.pixel_size); + MSG_V(FBDEV "framebuffer size: %d bytes\n", finfo.smem_len); + MSG_V(FBDEV "type: %lu\n", (unsigned long) finfo.type); + MSG_V(FBDEV "type_aux: %lu\n", (unsigned long) finfo.type_aux); + MSG_V(FBDEV "visual: %lu\n", (unsigned long) finfo.visual); + MSG_V(FBDEV "line_length: %lu bytes\n", (unsigned long) finfo.line_length); + MSG_DBG2(FBDEV "id: %.16s\n", finfo.id); + MSG_DBG2(FBDEV "smem_start: %p\n", (any_t*) finfo.smem_start); + MSG_DBG2(FBDEV "xpanstep: %u\n", finfo.xpanstep); + MSG_DBG2(FBDEV "ypanstep: %u\n", finfo.ypanstep); + MSG_DBG2(FBDEV "ywrapstep: %u\n", finfo.ywrapstep); + MSG_DBG2(FBDEV "mmio_start: %p\n", (any_t*) finfo.mmio_start); + MSG_DBG2(FBDEV "mmio_len: %u bytes\n", finfo.mmio_len); + MSG_DBG2(FBDEV "accel: %u\n", finfo.accel); + MSG_V(FBDEV "priv.bpp: %d\n", bpp); + MSG_V(FBDEV "priv.real_bpp: %d\n", real_bpp); + MSG_V(FBDEV "priv.pixel_size: %d bytes\n",pixel_size); MSG_V(FBDEV "other:\n"); - MSG_V(FBDEV "priv.in_width: %d\n", priv.in_width); - MSG_V(FBDEV "priv.in_height: %d\n", priv.in_height); - MSG_V(FBDEV "priv.out_width: %d\n", priv.out_width); - MSG_V(FBDEV "priv.out_height: %d\n", priv.out_height); - MSG_V(FBDEV "priv.last_row: %d\n", priv.last_row); + MSG_V(FBDEV "priv.in_width: %d\n", in_width); + MSG_V(FBDEV "priv.in_height: %d\n", in_height); + MSG_V(FBDEV "priv.out_width: %d\n", out_width); + MSG_V(FBDEV "priv.out_height: %d\n", out_height); + MSG_V(FBDEV "priv.last_row: %d\n", last_row); } -static void __FASTCALL__ vt_set_textarea(vo_data_t*vo,int u, int l) +void FBDev_VO_Interface::vt_set_textarea(int u, int l) { - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); /* how can I determine the font height? * just use 16 for now */ @@ -836,364 +888,318 @@ if (mp_conf.verbose > 1) MSG_DBG2(FBDEV "vt_set_textarea(%d,%d): %d,%d\n", u, l, urow, lrow); - fprintf(priv.vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); - fflush(priv.vt_fp); + fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); + fflush(vt_fp); } -static MPXP_Rc __FASTCALL__ config_vo(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height, const char *title, +MPXP_Rc FBDev_VO_Interface::configure(uint32_t width, uint32_t height, uint32_t d_width, + uint32_t d_height, unsigned _flags, const char *title, uint32_t format) { - fbdev_priv_t& priv = *static_cast<fbdev_priv_t*>(vo->priv); struct fb_cmap *cmap; unsigned x_offset,y_offset,i; + flags=_flags; UNUSED(title); - priv.srcFourcc = format; - if((int)priv.pre_init_err == MPXP_Error) { + srcFourcc = format; + if((int)pre_init_err == MPXP_Error) { MSG_ERR(FBDEV "Internal fatal error: init() was called before preinit()\n"); return MPXP_False; } - if (priv.pre_init_err!=MPXP_Ok) return MPXP_False; + if (pre_init_err!=MPXP_Ok) return MPXP_False; - if (priv_conf.mode_name && !vo_VM(vo)) { + if (priv_conf.mode_name && !flags&VOFLAG_MODESWITCHING) { MSG_ERR(FBDEV "-fbmode can only be used with -vm\n"); return MPXP_False; } - if (vo_VM(vo) && (parse_fbmode_cfg(vo,priv_conf.mode_cfgfile) < 0)) return MPXP_False; - if (d_width && (vo_ZOOM(vo) || vo_VM(vo))) { - priv.out_width = d_width; - priv.out_height = d_height; + if ((flags&VOFLAG_MODESWITCHING) && (parse_fbmode_cfg(priv_conf.mode_cfgfile) < 0)) return MPXP_False; + if (d_width && ((flags&VOFLAG_SWSCALE) || (flags&VOFLAG_MODESWITCHING))) { + out_width = d_width; + out_height = d_height; } else { - priv.out_width = width; - priv.out_height = height; + out_width = width; + out_height = height; } - priv.in_width = width; - priv.in_height = height; - priv.pixel_format = format; + in_width = width; + in_height = height; + pixel_format = format; if (priv_conf.mode_name) { - if (!(priv.mode = find_mode_by_name(priv_conf.mode_name))) { + if (!(mode = find_mode_by_name(priv_conf.mode_name))) { MSG_ERR(FBDEV "can't find requested video mode\n"); return MPXP_False; } - fb_mode2fb_vinfo(priv.mode, &priv.vinfo); - } else if (vo_VM(vo)) { - priv.monitor_hfreq = str2range(priv_conf.monitor_hfreq_str); - priv.monitor_vfreq = str2range(priv_conf.monitor_vfreq_str); - priv.monitor_dotclock = str2range(priv_conf.monitor_dotclock_str); - if (!priv.monitor_hfreq || !priv.monitor_vfreq || !priv.monitor_dotclock) { + fb_mode2fb_vinfo(mode, &vinfo); + } else if (flags&VOFLAG_MODESWITCHING) { + monitor_hfreq = str2range(priv_conf.monitor_hfreq_str); + monitor_vfreq = str2range(priv_conf.monitor_vfreq_str); + monitor_dotclock = str2range(priv_conf.monitor_dotclock_str); + if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) { MSG_ERR(FBDEV "you have to specify the capabilities of" " the monitor.\n"); return MPXP_False; } - if (!(priv.mode = find_best_mode(priv.out_width, priv.out_height, - priv.monitor_hfreq, priv.monitor_vfreq, - priv.monitor_dotclock))) { + if (!(mode = find_best_mode(out_width, out_height, + monitor_hfreq, monitor_vfreq, + monitor_dotclock))) { MSG_ERR(FBDEV "can't find best video mode\n"); return MPXP_False; } - MSG_ERR(FBDEV "using mode %dx%d @ %.1fHz\n", priv.mode->xres, - priv.mode->yres, vsf(priv.mode)); - fb_mode2fb_vinfo(priv.mode, &priv.vinfo); + MSG_ERR(FBDEV "using mode %dx%d @ %.1fHz\n", mode->xres, + mode->yres, vsf(mode)); + fb_mode2fb_vinfo(mode, &vinfo); } - priv.bpp_we_want = priv.bpp; - set_bpp(&priv.vinfo, priv.bpp); - priv.vinfo.xres_virtual = priv.vinfo.xres; - priv.vinfo.yres_virtual = priv.vinfo.yres; + bpp_we_want = bpp; + set_bpp(&vinfo, bpp); + vinfo.xres_virtual = vinfo.xres; + vinfo.yres_virtual = vinfo.yres; - if (priv.tty_fd >= 0 && ioctl(priv.tty_fd, KDSETMODE, KD_GRAPHICS) < 0) { + if (tty_fd >= 0 && ioctl(tty_fd, KDSETMODE, KD_GRAPHICS) < 0) { MSG_DBG2(FBDEV "Can't set graphics mode: %s\n", strerror(errno)); - close(priv.tty_fd); - priv.tty_fd = -1; + close(tty_fd); + tty_fd = -1; } - if (ioctl(priv.dev_fd, FBIOPUT_VSCREENINFO, &priv.vinfo)) { + if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) { MSG_ERR(FBDEV "Can't put VSCREENINFO: %s\n", strerror(errno)); - if (priv.tty_fd >= 0 && ioctl(priv.tty_fd, KDSETMODE, KD_TEXT) < 0) { + if (tty_fd >= 0 && ioctl(tty_fd, KDSETMODE, KD_TEXT) < 0) { MSG_ERR(FBDEV "Can't restore text mode: %s\n", strerror(errno)); } return MPXP_False; } - priv.pixel_size = (priv.vinfo.bits_per_pixel+7) / 8; - priv.real_bpp = priv.vinfo.red.length + priv.vinfo.green.length + - priv.vinfo.blue.length; - priv.bpp = (priv.pixel_size == 4) ? 32 : priv.real_bpp; - if (priv.bpp_we_want != priv.bpp) + pixel_size = (vinfo.bits_per_pixel+7) / 8; + real_bpp = vinfo.red.length + vinfo.green.length + + vinfo.blue.length; + bpp = (pixel_size == 4) ? 32 : real_bpp; + if (bpp_we_want != bpp) MSG_ERR(FBDEV "requested %d bpp, got %d bpp!!!\n", - priv.bpp_we_want, priv.bpp); + bpp_we_want, bpp); - switch (priv.bpp) { + switch (bpp) { case 32: - priv.dstFourcc = IMGFMT_BGR32; + dstFourcc = IMGFMT_BGR32; break; case 24: - priv.dstFourcc = IMGFMT_BGR24; + dstFourcc = IMGFMT_BGR24; break; default: case 16: - priv.dstFourcc = IMGFMT_BGR16; + dstFourcc = IMGFMT_BGR16; break; case 15: - priv.dstFourcc = IMGFMT_BGR15; + dstFourcc = IMGFMT_BGR15; break; } - if (vo_FLIP(vo) && ((((priv.pixel_format & 0xff) + 7) / 8) != priv.pixel_size)) { + if ((flags&VOFLAG_FLIPPING) && ((((pixel_format & 0xff) + 7) / 8) != pixel_size)) { MSG_ERR(FBDEV "Flipped output with depth conversion is not " "supported\n"); return MPXP_False; } - priv.xres = priv.vinfo.xres; - priv.yres = priv.vinfo.yres; - priv.last_row = (priv.xres-priv.out_height) / 2; + xres = vinfo.xres; + yres = vinfo.yres; + last_row = (xres-out_height) / 2; - if (ioctl(priv.dev_fd, FBIOGET_FSCREENINFO, &priv.finfo)) { + if (ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo)) { MSG_ERR(FBDEV "Can't get FSCREENINFO: %s\n", strerror(errno)); return MPXP_False; } - lots_of_printf(vo); + lots_of_printf(); - if (priv.finfo.type != FB_TYPE_PACKED_PIXELS) { - MSG_ERR(FBDEV "type %d not supported\n", priv.finfo.type); + if (finfo.type != FB_TYPE_PACKED_PIXELS) { + MSG_ERR(FBDEV "type %d not supported\n", finfo.type); return MPXP_False; } - switch (priv.finfo.visual) { + switch (finfo.visual) { case FB_VISUAL_TRUECOLOR: break; case FB_VISUAL_DIRECTCOLOR: MSG_DBG2(FBDEV "creating cmap for directcolor\n"); - if (ioctl(priv.dev_fd, FBIOGETCMAP, &priv.oldcmap)) { + if (ioctl(dev_fd, FBIOGETCMAP, &oldcmap)) { MSG_ERR(FBDEV "can't get cmap: %s\n",strerror(errno)); return MPXP_False; } - if (!(cmap = make_directcolor_cmap(&priv.vinfo))) return MPXP_False; - if (ioctl(priv.dev_fd, FBIOPUTCMAP, cmap)) { + if (!(cmap = make_directcolor_cmap(&vinfo))) return MPXP_False; + if (ioctl(dev_fd, FBIOPUTCMAP, cmap)) { MSG_ERR(FBDEV "can't put cmap: %s\n",strerror(errno)); return MPXP_False; } - priv.cmap_changed = 1; + cmap_changed = 1; delete cmap->red; delete cmap->green; delete cmap->blue; delete cmap; break; default: - MSG_ERR(FBDEV "visual: %d not yet supported\n",priv.finfo.visual); + MSG_ERR(FBDEV "visual: %d not yet supported\n",finfo.visual); return MPXP_False; } - priv.line_len = priv.finfo.line_length; - priv.size = priv.finfo.smem_len; - priv.frame_buffer = NULL; - memset(priv.next_frame,0,sizeof(priv.next_frame)); - priv.out_width=width; - priv.out_height=height; - if(vo_ZOOM(vo)) { + line_len = finfo.line_length; + size = finfo.smem_len; + frame_buffer = NULL; + memset(next_frame,0,sizeof(next_frame)); + out_width=width; + out_height=height; + if(flags&VOFLAG_SWSCALE) { aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); - aspect_save_screenres(priv.xres,priv.yres); - aspect(&priv.out_width,&priv.out_height,A_ZOOM); - } else if(vo_FS(vo)) { - priv.out_width = priv.xres; - priv.out_height = priv.yres; + aspect_save_screenres(xres,yres); + aspect(&out_width,&out_height,A_ZOOM); + } else if(flags&VOFLAG_FULLSCREEN) { + out_width = xres; + out_height = yres; } - if(priv.xres > priv.out_width) - x_offset = (priv.xres - priv.out_width) / 2; + if(xres > out_width) + x_offset = (xres - out_width) / 2; else x_offset = 0; - if(priv.yres > priv.out_height) - y_offset = (priv.yres - priv.out_height) / 2; + if(yres > out_height) + y_offset = (yres - out_height) / 2; else y_offset = 0; #ifdef CONFIG_VIDIX - if(priv.vidix_name) { - if(vidix_init(vo,width,height,x_offset,y_offset,priv.out_width, - priv.out_height,format,priv.bpp, - priv.xres,priv.yres) != MPXP_Ok) { + if(vidix_name) { + if(vidix_init(vidix,width,height,x_offset,y_offset,out_width, + out_height,format,bpp, + xres,yres) != MPXP_Ok) { MSG_ERR(FBDEV "Can't initialize VIDIX driver\n"); - priv.vidix_name = NULL; - vidix_term(vo); + vidix_name = NULL; + vidix_term(vidix); return MPXP_False; } else MSG_V(FBDEV "Using VIDIX\n"); - if ((priv.frame_buffer = (uint8_t *) mmap(0, priv.size, PROT_READ | PROT_WRITE, - MAP_SHARED, priv.dev_fd, 0)) == (uint8_t *) -1) { + if ((frame_buffer = (uint8_t *) mmap(0, size, PROT_READ | PROT_WRITE, + MAP_SHARED, dev_fd, 0)) == (uint8_t *) -1) { MSG_ERR(FBDEV "Can't mmap %s: %s\n", priv_conf.dev_name, strerror(errno)); return MPXP_False; } - memset(priv.frame_buffer, 0, priv.line_len * priv.yres); - if(vidix_start(vo)!=0) { vidix_term(vo); return MPXP_False; } + memset(frame_buffer, 0, line_len * yres); + if(vidix_start(vidix)!=0) { vidix_term(vidix); return MPXP_False; } } else #endif { - if ((priv.frame_buffer = (uint8_t *) mmap(0, priv.size, PROT_READ | PROT_WRITE, - MAP_SHARED, priv.dev_fd, 0)) == (uint8_t *) -1) { + if ((frame_buffer = (uint8_t *) mmap(0, size, PROT_READ | PROT_WRITE, + MAP_SHARED, dev_fd, 0)) == (uint8_t *) -1) { MSG_ERR(FBDEV "Can't mmap %s: %s\n", priv_conf.dev_name, strerror(errno)); return MPXP_False; } - if(priv.out_width > priv.xres) priv.out_width=priv.xres; - if(priv.out_height > priv.yres) priv.out_width=priv.yres; - priv.L123123875 = priv.frame_buffer + x_offset * priv.pixel_size + y_offset * priv.line_len; - MSG_DBG2(FBDEV "priv.frame_buffer @ %p\n", priv.frame_buffer); - MSG_DBG2(F... [truncated message content] |
From: <nic...@us...> - 2012-11-27 09:45:03
|
Revision: 459 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=459&view=rev Author: nickols_k Date: 2012-11-27 09:44:49 +0000 (Tue, 27 Nov 2012) Log Message: ----------- performance patch: use methods instead of switch case constructions in ctrl(). IMHO, with c++ ctrl method should in most cases empty. It useful for some rare exotic cases but not for common methods. Also convert vobsub_vidix into class Vidix_System Modified Paths: -------------- mplayerxp/libvo/Makefile mplayerxp/libvo/dri_vo.h mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_fbdev.cpp mplayerxp/libvo/vo_null.cpp mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_sdl.cpp mplayerxp/libvo/vo_vesa.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp mplayerxp/postproc/vf_vo.cpp Added Paths: ----------- mplayerxp/libvo/vidix_system.cpp mplayerxp/libvo/vidix_system.h Removed Paths: ------------- mplayerxp/libvo/vosub_vidix.cpp mplayerxp/libvo/vosub_vidix.h Modified: mplayerxp/libvo/Makefile =================================================================== --- mplayerxp/libvo/Makefile 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/Makefile 2012-11-27 09:44:49 UTC (rev 459) @@ -23,7 +23,7 @@ CXXSRCS += vo_vesa.cpp endif ifeq ($(CONFIG_VIDIX),yes) -CXXSRCS += vosub_vidix.cpp +CXXSRCS += vidix_system.cpp endif CFLAGS = $(OPTFLAGS) -I. -I.. -DMPG12PLAY -Wall -W Modified: mplayerxp/libvo/dri_vo.h =================================================================== --- mplayerxp/libvo/dri_vo.h 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/dri_vo.h 2012-11-27 09:44:49 UTC (rev 459) @@ -40,9 +40,4 @@ unsigned idx; /**< app->drv:specify number of surface (0 default for single buffering) */ uint8_t* planes[4]; /**< drv->app:specify planes (include alpha channel) */ }dri_surface_t; - -enum { - DRI_GET_SURFACE_CAPS=16, /**< Query capabilties of surfaces. We assume that all surfaces have the same capabilities */ - DRI_GET_SURFACE =17, /**< Query surface by index */ -}; #endif Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/video_out.cpp 2012-11-27 09:44:49 UTC (rev 459) @@ -278,12 +278,12 @@ if(!priv.dri.bpp) priv.dri.has_dri=0; /*unknown fourcc*/ if(priv.dri.has_dri) { - priv.vo_iface->ctrl(VOCTRL_GET_NUM_FRAMES,&priv.dri.num_xp_frames); + priv.dri.num_xp_frames=priv.vo_iface->get_num_frames(); priv.dri.num_xp_frames=std::min(priv.dri.num_xp_frames,unsigned(MAX_DRI_BUFFERS)); for(i=0;i<priv.dri.num_xp_frames;i++) { priv.dri.surf[i].idx=i; - priv.vo_iface->ctrl(DRI_GET_SURFACE,&priv.dri.surf[i]); + priv.vo_iface->get_surface(&priv.dri.surf[i]); } } } @@ -380,7 +380,7 @@ { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); priv.dri.has_dri = 1; - priv.vo_iface->ctrl(DRI_GET_SURFACE_CAPS,&priv.dri.cap); + priv.vo_iface->get_surface_caps(&priv.dri.cap); dri_config(vo,priv.dri.cap.fourcc); /* ugly workaround of swapped BGR-fourccs. Should be removed in the future */ if(!priv.dri.has_dri) @@ -430,13 +430,12 @@ retval = priv.vo_iface->configure(w,h,d_w,d_h,fullscreen,title,dest_fourcc); priv.srcFourcc=format; if(retval == MPXP_Ok) { - int dri_retv; - dri_retv = priv.vo_iface->ctrl(DRI_GET_SURFACE_CAPS,&priv.dri.cap); + priv.vo_iface->get_surface_caps(&priv.dri.cap); priv.image_format = format; priv.image_width = w; priv.image_height = h; ps_tune(vo,priv.image_width,priv.org_height); - if(dri_retv == MPXP_True) dri_reconfig(vo,0); + dri_reconfig(vo,0); MSG_V("dri_vo_caps: driver does %s support DRI\n",priv.dri.has_dri?"":"not"); MSG_V("dri_vo_caps: caps=%08X fourcc=%08X(%s) x,y,w,h(%u %u %u %u)\n" "dri_vo_caps: width_height(%u %u) strides(%u %u %u %u) priv.dri.bpp=%u\n" @@ -470,7 +469,7 @@ qfourcc.fourcc = *fourcc; qfourcc.w = src_w; qfourcc.h = src_h; - if(priv.vo_iface->ctrl(VOCTRL_QUERY_FORMAT,&qfourcc)==MPXP_False) + if(priv.vo_iface->query_format(&qfourcc)==MPXP_False) qfourcc.flags=VOCAP_NA; MSG_V("dri_vo: request for %s fourcc: %i\n",vo_format_name(*fourcc),qfourcc.flags); dri_forced_fourcc = *fourcc; @@ -516,6 +515,12 @@ pthread_mutex_unlock(&priv.surfaces_mutex); } +MPXP_Rc __FASTCALL__ vo_get_surface_caps(vo_data_t* vo,dri_surface_cap_t*caps) { + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + priv.vo_iface->get_surface_caps(caps); + return MPXP_Ok; +} + MPXP_Rc __FASTCALL__ vo_get_surface(vo_data_t*vo,mp_image_t* mpi) { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/video_out.h 2012-11-27 09:44:49 UTC (rev 459) @@ -19,6 +19,7 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#include "dri_vo.h" #include "font_load.h" #include "sub.h" #include "libmpsub/subreader.h" @@ -35,7 +36,6 @@ enum { VOCTRL_UNUSED0=1, - VOCTRL_QUERY_FORMAT=2, /**< Query direct FOURCC support. Takes a pointer to uint32_t fourcc */ VOCTRL_RESET=3, /**< Signal a device reset seek */ VOCTRL_FULLSCREEN=4, /**< Signal to switch window to fullscreen. Must affect window only (not surfaces) */ VOCTRL_UNUSED=5, @@ -43,7 +43,6 @@ VOCTRL_RESUME=7, /**< Notification to start/resume playback after pause (for dxr3) */ VOCTRL_UNUSED2=8, VOCTRL_CHECK_EVENTS=9, /**< Notification that user performs key pressing. Takes (vo_resize_t *)&vrest as arg. Must return at least VO_EVENT_RESIZE */ - VOCTRL_GET_NUM_FRAMES=10, /**< Query total number of allocated frames (multibuffering) */ VOCTRL_UNUSED3=12, VOCTRL_FLUSH_PAGES=13, /**< Flush pages of frame from RAM into video memory (bus mastering) */ VOCTRL_UNUSED4=14, @@ -225,6 +224,7 @@ extern void vo_lock_surfaces(vo_data_t* vo); extern void vo_unlock_surfaces(vo_data_t* vo); extern MPXP_Rc __FASTCALL__ vo_get_surface(vo_data_t* vo,mp_image_t* mpi); +extern MPXP_Rc __FASTCALL__ vo_get_surface_caps(vo_data_t* vo,dri_surface_cap_t*); extern int vo_check_events(vo_data_t* vo); extern unsigned __FASTCALL__ vo_get_num_frames(vo_data_t* vo); Modified: mplayerxp/libvo/video_out_internal.h =================================================================== --- mplayerxp/libvo/video_out_internal.h 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/video_out_internal.h 2012-11-27 09:44:49 UTC (rev 459) @@ -22,6 +22,7 @@ */ #ifndef __VIDEO_OUT_INTERNAL_H #define __VIDEO_OUT_INTERNAL_H 1 +#include "dri_vo.h" class VO_Interface : public Opaque { public: @@ -35,7 +36,13 @@ unsigned flags, const char *title, uint32_t format) = 0; - virtual void select_frame(unsigned idx) = 0; + virtual MPXP_Rc select_frame(unsigned idx) = 0; + + virtual MPXP_Rc query_format(vo_query_fourcc_t* format) const = 0; + virtual void get_surface_caps(dri_surface_cap_t *caps) const = 0; + virtual void get_surface(dri_surface_t *surf) const = 0; + virtual unsigned get_num_frames() const = 0; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data) = 0; }; Copied: mplayerxp/libvo/vidix_system.cpp (from rev 458, mplayerxp/libvo/vosub_vidix.cpp) =================================================================== --- mplayerxp/libvo/vidix_system.cpp (rev 0) +++ mplayerxp/libvo/vidix_system.cpp 2012-11-27 09:44:49 UTC (rev 459) @@ -0,0 +1,506 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +/* vosub_vidix.c + * + * Copyright (C) Nickols_K <nic...@ma...> - 2002 + * Copyright (C) Alex Beregszaszi + * + * You can redistribute this file under terms and conditions + * of GNU General Public licence v2. + * + * This file contains vidix interface to any mplayer's VO plugin. + * (Partly based on vesa_lvo.c from mplayer's package) + */ +#include <errno.h> +#include <inttypes.h> +#include <sys/ioctl.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include "mplayerxp.h" + +#include "vidix_system.h" +#include "osdep/fastmemcpy.h" +#include "osd.h" +#include "sub.h" +#include "xmpcore/mp_image.h" +#include "vo_msg.h" + +using namespace vidix; + +#ifndef HAVE_MLOCK +/* stubs */ +int mlock(const any_t*addr,size_t len) { return ENOSYS; } +int munlock(const any_t*addr,size_t len) { return ENOSYS; } +#endif + +Vidix_System::Vidix_System(const char *drvname) + :vidix(*new(zeromem) Vidix(drvname?drvname[0]==':'?&drvname[1]:drvname[0]?drvname:NULL:NULL, + TYPE_OUTPUT, + mp_conf.verbose)) +{ + int err; + MSG_DBG2("vidix_preinit(%s) was called\n",drvname); + if(vidix.version() != VIDIX_VERSION) { + MSG_FATAL("You have wrong version of VIDIX library\n"); + exit_player("Vidix"); + } + if(vidix.is_error()) { + MSG_FATAL("Couldn't find working VIDIX driver\n"); + exit_player("Vidix"); + } + if((err=vidix.get_capabilities()) != 0) { + MSG_FATAL("Couldn't get capability: %s\n",strerror(err)); + exit_player("Vidix"); + } + else MSG_V("Driver capability: %X\n",vidix.cap.flags); + MSG_V("Using: %s by %s\n",vidix.cap.name,vidix.cap.author); +} + +Vidix_System::~Vidix_System() { + size_t i; + MSG_DBG2("vidix_term() was called\n"); + stop(); + if(vo_conf.use_bm) { + for(i=0;i<vo_conf.xp_buffs;i++) { + if(bm_locked) munlock(bm_buffs[i],vidix.playback.frame_size); + delete bm_buffs[i]; + bm_buffs[i]=NULL; + } + if(bm_slow_frames) + MSG_WARN("from %u frames %u were copied through memcpy()\n" + ,bm_total_frames,bm_slow_frames); + } +} + +int Vidix_System::start() +{ + int err; + if((err=vidix.playback_on())!=0) { + MSG_FATAL("Can't start playback: %s\n",strerror(err)); + return -1; + } + video_on=1; + if (vidix.cap.flags & FLAG_EQUALIZER) { + MSG_V("vo_gamma_brightness=%i\n" + "vo_gamma_saturation=%i\n" + "vo_gamma_contrast=%i\n" + "vo_gamma_hue=%i\n" + "vo_gamma_red_intensity=%i\n" + "vo_gamma_green_intensity=%i\n" + "vo_gamma_blue_intensity=%i\n" + ,vo_conf.gamma.brightness + ,vo_conf.gamma.saturation + ,vo_conf.gamma.contrast + ,vo_conf.gamma.hue + ,vo_conf.gamma.red_intensity + ,vo_conf.gamma.green_intensity + ,vo_conf.gamma.blue_intensity); + /* To use full set of priv.video_eq.cap */ + if(vidix.get_eq() == 0) { + vidix.video_eq.brightness = vo_conf.gamma.brightness; + vidix.video_eq.saturation = vo_conf.gamma.saturation; + vidix.video_eq.contrast = vo_conf.gamma.contrast; + vidix.video_eq.hue = vo_conf.gamma.hue; + vidix.video_eq.red_intensity = vo_conf.gamma.red_intensity; + vidix.video_eq.green_intensity = vo_conf.gamma.green_intensity; + vidix.video_eq.blue_intensity = vo_conf.gamma.blue_intensity; + vidix.video_eq.flags = VEQ_FLG_ITU_R_BT_601; + vidix.set_eq(); + } + } + return 0; +} + +int Vidix_System::stop() +{ + int err; + if((err=vidix.playback_off())!=0) { + MSG_ERR("Can't stop playback: %s\n",strerror(err)); + return -1; + } + video_on=0; + return 0; +} + +void Vidix_System::copy_dma(unsigned idx,int sync_mode) +{ + int err,i; + int dma_busy; + MSG_DBG2("vidix_copy_dma(%u,%i) was called\n",idx,sync_mode); + bm_total_frames++; + if(idx > vidix.playback.num_frames-1 && vidix.playback.num_frames>1) { + MSG_FATAL("\nDetected internal error!\n" + "Request to copy %u frame into %u array\n",idx,vidix.playback.num_frames); + return; + } + dma_busy = vidix.dma_status(); + i=5; + if(!sync_mode) + while(dma_busy && i) { + yield_timeslice(); + dma_busy = vidix.dma_status(); + i--; + } + if(!dma_busy || sync_mode) { + vidix.dma.src = bm_buffs[idx]; + vidix.dma.dest_offset = vidix.playback.offsets[vidix.playback.num_frames>1?idx:0]; + vidix.dma.size = vidix.playback.frame_size; + vidix.dma.flags = sync_mode?BM_DMA_SYNC:BM_DMA_ASYNC; + if(bm_locked) vidix.dma.flags |= BM_DMA_FIXED_BUFFS; + vidix.dma.idx = idx; + err=vidix.dma_copy_frame(); + if(err) { + /* We can switch back to DR here but for now exit */ + MSG_FATAL("\nerror '%s' occured during DMA transfer\n" + "Please send BUGREPORT to developers!!!\n",strerror(err)); + exit(EXIT_FAILURE); /* it's OK vidix_term will be called */ + } +#if 0 + printf("frame is DMA copied\n"); +#endif + } else { + memcpy(reinterpret_cast<any_t*>(reinterpret_cast<long>(vidix.playback.dga_addr)+vidix.playback.offsets[0]),bm_buffs[idx],vidix.playback.frame_size); + MSG_WARN("DMA frame is memcpy() copied\n"); + bm_slow_frames++; + } +} + +MPXP_Rc Vidix_System::select_frame(unsigned idx) +{ + MSG_DBG2("vidix_select_frame() was called\n"); + if(vo_conf.use_bm == 1) copy_dma(idx,0); + else vidix.frame_select(idx); + return MPXP_Ok; +} + +MPXP_Rc Vidix_System::query_fourcc(vo_query_fourcc_t* format) +{ + MSG_DBG2("query_format was called: %x (%s)\n",format->fourcc,vo_format_name(format->fourcc)); + vidix.fourcc.fourcc = format->fourcc; + vidix.fourcc.srcw = format->w; + vidix.fourcc.srch = format->h; + vidix.query_fourcc(); + format->flags = (vidix.fourcc.depth==VID_DEPTH_NONE)? VOCAP_NA : VOCAP_SUPPORTED|VOCAP_HWSCALER; + return MPXP_Ok; +} + +MPXP_Rc Vidix_System::grkey_support() const +{ + MPXP_Rc retval = (vidix.fourcc.flags & VID_CAP_COLORKEY)?MPXP_Ok:MPXP_False; + MSG_DBG2("query_grkey_support: %i\n",retval); + return retval; +} + +int Vidix_System::grkey_get(vidix_grkey_t *gr_key) const +{ + int rc; + rc=vidix.get_gr_keys(); + *gr_key=vidix.grkey; + return rc; +} + +int Vidix_System::grkey_set(const vidix_grkey_t *gr_key) +{ + vidix.grkey=*gr_key; + return vidix.set_gr_keys(); +} + +int Vidix_System::get_video_eq(vo_videq_t *info) const +{ + int rval; + if(!video_on) return EPERM; + rval =vidix.get_eq(); + if(!rval) { + if(!strcmp(info->name,VO_EC_BRIGHTNESS) && vidix.video_eq.cap&VEQ_CAP_BRIGHTNESS) + info->value=vidix.video_eq.brightness; + else if(!strcmp(info->name,VO_EC_SATURATION) && vidix.video_eq.cap&VEQ_CAP_SATURATION) + info->value=vidix.video_eq.saturation; + else if(!strcmp(info->name,VO_EC_CONTRAST) && vidix.video_eq.cap&VEQ_CAP_CONTRAST) + info->value=vidix.video_eq.contrast; + else if(!strcmp(info->name,VO_EC_HUE) && vidix.video_eq.cap&VEQ_CAP_HUE) + info->value=vidix.video_eq.hue; + else if(!strcmp(info->name,VO_EC_RED_INTENSITY) && vidix.video_eq.cap&VEQ_CAP_RGB_INTENSITY) + info->value=vidix.video_eq.red_intensity; + else if(!strcmp(info->name,VO_EC_GREEN_INTENSITY) && vidix.video_eq.cap&VEQ_CAP_RGB_INTENSITY) + info->value=vidix.video_eq.green_intensity; + else if(!strcmp(info->name,VO_EC_BLUE_INTENSITY) && vidix.video_eq.cap&VEQ_CAP_RGB_INTENSITY) + info->value=vidix.video_eq.blue_intensity; + } + return rval; +} + +int Vidix_System::set_video_eq(const vo_videq_t *info) +{ + int rval; + if(!video_on) return EPERM; + rval = vidix.get_eq(); + if(!rval) { + if(!strcmp(info->name,VO_EC_BRIGHTNESS) && vidix.video_eq.cap&VEQ_CAP_BRIGHTNESS) + vidix.video_eq.brightness=info->value; + else if(!strcmp(info->name,VO_EC_SATURATION) && vidix.video_eq.cap&VEQ_CAP_SATURATION) + vidix.video_eq.saturation=info->value; + else if(!strcmp(info->name,VO_EC_CONTRAST) && vidix.video_eq.cap&VEQ_CAP_CONTRAST) + vidix.video_eq.contrast=info->value; + else if(!strcmp(info->name,VO_EC_HUE) && vidix.video_eq.cap&VEQ_CAP_HUE) + vidix.video_eq.hue=info->value; + else if(!strcmp(info->name,VO_EC_RED_INTENSITY) && vidix.video_eq.cap&VEQ_CAP_RGB_INTENSITY) + vidix.video_eq.red_intensity=info->value; + else if(!strcmp(info->name,VO_EC_GREEN_INTENSITY) && vidix.video_eq.cap&VEQ_CAP_RGB_INTENSITY) + vidix.video_eq.green_intensity=info->value; + else if(!strcmp(info->name,VO_EC_BLUE_INTENSITY) && vidix.video_eq.cap&VEQ_CAP_RGB_INTENSITY) + vidix.video_eq.blue_intensity=info->value; + rval= vidix.set_eq(); + } + return rval; +} + +int Vidix_System::get_num_fx(unsigned *info) const +{ + if(!video_on) return EPERM; + return vidix.num_oemfx(*info); +} + +int Vidix_System::get_oem_fx(vidix_oem_fx_t *info) const +{ + int rc; + if(!video_on) return EPERM; + rc=vidix.get_oemfx(); + *info = vidix.oemfx; + return rc; +} + +int Vidix_System::set_oem_fx(const vidix_oem_fx_t *info) +{ + if(!video_on) return EPERM; + vidix.oemfx=*info; + return vidix.set_oemfx(); +} + +int Vidix_System::get_deint(vidix_deinterlace_t *info) const +{ + int rc; + if(!video_on) return EPERM; + rc=vidix.get_deint(); + *info = vidix.deint; + return rc; +} + +int Vidix_System::set_deint(const vidix_deinterlace_t *info) +{ + if(!video_on) return EPERM; + vidix.deint=*info; + return vidix.set_deint(); +} + +MPXP_Rc Vidix_System::configure(unsigned src_width,unsigned src_height, + unsigned x_org,unsigned y_org,unsigned dst_width, + unsigned dst_height,unsigned format,unsigned dest_bpp, + unsigned vid_w,unsigned vid_h) +{ + size_t i; + int err; + static int video_clean=0; + uint32_t apitch; + MSG_DBG2("vidix_init() was called\n" + "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" + "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" + ,src_width,src_height,x_org,y_org,dst_width,dst_height + ,vo_format_name(format),dest_bpp,vid_w,vid_h); + if(((vidix.cap.maxwidth != -1) && (vid_w > (unsigned)vidix.cap.maxwidth)) || + ((vidix.cap.minwidth != -1) && (vid_w < (unsigned)vidix.cap.minwidth)) || + ((vidix.cap.maxheight != -1) && (vid_h > (unsigned)vidix.cap.maxheight)) || + ((vidix.cap.minwidth != -1 ) && (vid_h < (unsigned)vidix.cap.minheight))) { + MSG_FATAL("video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", + vid_w, vid_h, vidix.cap.minwidth, vidix.cap.minheight, + vidix.cap.maxwidth, vidix.cap.maxheight); + return MPXP_False; + } + vidix.fourcc.fourcc = format; + vidix.query_fourcc(); + err = 0; + switch(dest_bpp) { + case 1: err = ((vidix.fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; + case 2: err = ((vidix.fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; + case 4: err = ((vidix.fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; + case 8: err = ((vidix.fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; + case 12:err = ((vidix.fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; + case 15:err = ((vidix.fourcc.depth & VID_DEPTH_15BPP) != VID_DEPTH_15BPP); break; + case 16:err = ((vidix.fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; + case 24:err = ((vidix.fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; + case 32:err = ((vidix.fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; + default: err=1; break; + } + if(err) { + MSG_FATAL("video server has unsupported color depth by vidix (%d)\n" + ,vidix.fourcc.depth); + return MPXP_False; + } + if((dst_width > src_width || dst_height > src_height) && (vidix.cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) { + MSG_FATAL("vidix driver can't upscale image (%d%d -> %d%d)\n", + src_width, src_height, dst_width, dst_height); + return MPXP_False; + } + if((dst_width > src_width || dst_height > src_height) && (vidix.cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) { + MSG_FATAL("vidix driver can't downscale image (%d%d -> %d%d)\n", + src_width, src_height, dst_width, dst_height); + return MPXP_False; + } + image_width = src_width; + image_height = src_height; + src_format = format; + if(forced_fourcc) format = forced_fourcc; + vidix.playback.fourcc = format; + vidix.playback.capability = vidix.cap.flags; /* every ;) */ + vidix.playback.blend_factor = 0; /* for now */ + /* display the full picture. + Nick: we could implement here zooming to a specified area -- alex */ + vidix.playback.src.x = vidix.playback.src.y = 0; + vidix.playback.src.w = src_width; + vidix.playback.src.h = src_height; + vidix.playback.dest.x = x_org; + vidix.playback.dest.y = y_org; + vidix.playback.dest.w = dst_width; + vidix.playback.dest.h = dst_height; + vidix.playback.num_frames=(vo_conf.use_bm!=1)?NUM_FRAMES-1:1; + if(vidix.playback.num_frames > vo_conf.xp_buffs) vidix.playback.num_frames = vo_conf.xp_buffs; + vidix.playback.src.pitch.y = vidix.playback.src.pitch.u = vidix.playback.src.pitch.v = 0; + if((err=vidix.config_playback())!=0) { + MSG_FATAL("Can't configure playback: %s\n",strerror(err)); + return MPXP_False; + } + MSG_V("using %d buffers\n", vidix.playback.num_frames); + /* configure busmastering */ + if(vo_conf.use_bm) { + if(vidix.cap.flags & FLAG_DMA) { + int psize = getpagesize(); + bm_locked=1; + for(i=0;i<vo_conf.xp_buffs;i++) { + if(!bm_buffs[i]) bm_buffs[i] = new(alignmem,psize) uint8_t[vidix.playback.frame_size]; + if(!(bm_buffs[i])) { + MSG_ERR("Can't allocate memory for busmastering\n"); + return MPXP_False; + } + if(mlock(bm_buffs[i],vidix.playback.frame_size) != 0) { + unsigned j; + MSG_WARN("Can't lock memory for busmastering\n"); + for(j=0;j<i;j++) munlock(bm_buffs[i],vidix.playback.frame_size); + bm_locked=0; + } + } + memset(&vidix.dma,0,sizeof(vidix_dma_t)); + bm_total_frames=bm_slow_frames=0; + } + else + MSG_ERR("Can not configure bus mastering: your driver is not DMA capable\n"); + vo_conf.use_bm = 0; + } + if(vo_conf.use_bm) MSG_OK("using BUSMASTERING\n"); + mem = static_cast<uint8_t*>(vidix.playback.dga_addr); + + if(!video_clean) { + /* clear every frame with correct address and frame_size + only once per session */ + for (i = 0; i < vidix.playback.num_frames; i++) + memset(mem + vidix.playback.offsets[i], 0x80, vidix.playback.frame_size); + video_clean=1; + } + MSG_DBG2("vidix returns pitches %u %u %u\n",vidix.playback.dest.pitch.y,vidix.playback.dest.pitch.u,vidix.playback.dest.pitch.v); + switch(format) { + case IMGFMT_Y800: + case IMGFMT_YVU9: + case IMGFMT_IF09: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YV12: + apitch = vidix.playback.dest.pitch.y-1; + vidix.playback.offset.y = (image_width + apitch) & ~apitch; + apitch = vidix.playback.dest.pitch.v-1; + vidix.playback.offset.v = (image_width + apitch) & ~apitch; + apitch = vidix.playback.dest.pitch.u-1; + vidix.playback.offset.u = (image_width + apitch) & ~apitch; + image_Bpp=1; + break; + case IMGFMT_RGB32: + case IMGFMT_BGR32: + apitch = vidix.playback.dest.pitch.y-1; + vidix.playback.offset.y = (image_width*4 + apitch) & ~apitch; + vidix.playback.offset.u = vidix.playback.offset.v = 0; + image_Bpp=4; + break; + case IMGFMT_RGB24: + case IMGFMT_BGR24: + apitch = vidix.playback.dest.pitch.y-1; + vidix.playback.offset.y = (image_width*3 + apitch) & ~apitch; + vidix.playback.offset.u = vidix.playback.offset.v = 0; + image_Bpp=3; + break; + default: + apitch = vidix.playback.dest.pitch.y-1; + vidix.playback.offset.y = (image_width*2 + apitch) & ~apitch; + vidix.playback.offset.u = vidix.playback.offset.v = 0; + image_Bpp=2; + break; + } + switch(format) { + case IMGFMT_YVU9: + case IMGFMT_IF09: + vidix.playback.offset.u /= 4; + vidix.playback.offset.v /= 4; + break; + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YV12: + vidix.playback.offset.u /= 2; + vidix.playback.offset.v /= 2; + break; + } + return MPXP_Ok; +} + +void Vidix_System::get_surface_caps(dri_surface_cap_t *caps) const +{ + caps->caps = vo_conf.use_bm ? DRI_CAP_TEMP_VIDEO|DRI_CAP_BUSMASTERING : DRI_CAP_VIDEO_MMAPED; + caps->caps |= DRI_CAP_HORZSCALER | DRI_CAP_VERTSCALER; + if((vidix.cap.flags & FLAG_DOWNSCALER) == FLAG_DOWNSCALER) + caps->caps |= DRI_CAP_DOWNSCALER; + if((vidix.cap.flags & FLAG_UPSCALER) == FLAG_UPSCALER) + caps->caps |= DRI_CAP_UPSCALER; + caps->fourcc = vidix.playback.fourcc; + caps->width=vidix.playback.src.w; + caps->height=vidix.playback.src.h; + /* in case of vidix movie fit surface */ + caps->x = caps->y=0; + caps->w=caps->width; + caps->h=caps->height; + caps->strides[0] = vidix.playback.offset.y; + caps->strides[1] = vidix.playback.offset.v; + caps->strides[2] = vidix.playback.offset.u; + caps->strides[3] = 0; +} + +void Vidix_System::get_surface(dri_surface_t *surf) const +{ + if(vo_conf.use_bm) { + surf->planes[0] = bm_buffs[surf->idx] + vidix.playback.offset.y; + surf->planes[1] = bm_buffs[surf->idx] + vidix.playback.offset.v; + surf->planes[2] = bm_buffs[surf->idx] + vidix.playback.offset.u; + } else { + surf->planes[0] = mem + vidix.playback.offsets[surf->idx] + vidix.playback.offset.y; + surf->planes[1] = mem + vidix.playback.offsets[surf->idx] + vidix.playback.offset.v; + surf->planes[2] = mem + vidix.playback.offsets[surf->idx] + vidix.playback.offset.u; + } + surf->planes[3] = 0; +} + +unsigned Vidix_System::get_num_frames() const { return (vo_conf.use_bm==1)?vo_conf.xp_buffs:vidix.playback.num_frames; } + +void Vidix_System::flush_page(unsigned idx) { + if(vo_conf.use_bm > 1) copy_dma(idx,1); +} Copied: mplayerxp/libvo/vidix_system.h (from rev 458, mplayerxp/libvo/vosub_vidix.h) =================================================================== --- mplayerxp/libvo/vidix_system.h (rev 0) +++ mplayerxp/libvo/vidix_system.h 2012-11-27 09:44:49 UTC (rev 459) @@ -0,0 +1,70 @@ +/* + * vidix_system.h + * + * Copyright (C) Nickols_K <nic...@ma...> - 2002 + * + * You can redistribute this file under terms and conditions + * of GNU General Public licence v2. + * + * This file contains vosub_vidix interface to any mplayer's VO driver + */ + +#ifndef __VIDIX_SYSTEM_H_INCLUDED +#define __VIDIX_SYSTEM_H_INCLUDED 1 +#include "xmpcore/xmp_enums.h" + +#include "osdep/mplib.h" +#include "video_out.h" +#include "dri_vo.h" +#include <vidix/vidix.h> +#include <vidix/vidixlibxx.h> + +using namespace vidix; +using namespace mpxp; + +#define NUM_FRAMES MAX_DRI_BUFFERS /* Temporary: driver will overwrite it */ + +struct Vidix_System : public video_private { + public: + Vidix_System(const char *drvname); + virtual ~Vidix_System(); + + MPXP_Rc configure(unsigned src_width,unsigned src_height, + unsigned dest_x,unsigned dest_y,unsigned dst_width, + unsigned dst_height,unsigned format,unsigned dest_bpp, + unsigned vid_w,unsigned vid_h); + int start(); + int stop(); + MPXP_Rc select_frame(unsigned idx); + void flush_page(unsigned idx); + + MPXP_Rc query_fourcc(vo_query_fourcc_t* format); + void get_surface_caps(dri_surface_cap_t *caps) const; + void get_surface(dri_surface_t *surf) const; + unsigned get_num_frames() const; + + MPXP_Rc grkey_support() const; + int grkey_get(vidix_grkey_t *gr_key) const; + int grkey_set(const vidix_grkey_t *gr_key); + int get_video_eq(vo_videq_t *info) const; + int set_video_eq(const vo_videq_t *info); + int get_num_fx(unsigned *info) const; + int get_oem_fx(vidix_oem_fx_t *info) const; + int set_oem_fx(const vidix_oem_fx_t *info); + int get_deint(vidix_deinterlace_t *info) const; + int set_deint(const vidix_deinterlace_t *info); + private: + void copy_dma(unsigned idx,int sync_mode); + + unsigned image_Bpp,image_height,image_width,src_format,forced_fourcc; + + Vidix& vidix; + uint8_t * mem; + int video_on; + +/* bus mastering */ + int bm_locked; /* requires root privelegies */ + uint8_t * bm_buffs[NUM_FRAMES]; + unsigned bm_total_frames,bm_slow_frames; +}; +#endif Modified: mplayerxp/libvo/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo/vo_fbdev.cpp 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/vo_fbdev.cpp 2012-11-27 09:44:49 UTC (rev 459) @@ -31,7 +31,7 @@ #include "osdep/fastmemcpy.h" #include "sub.h" #ifdef CONFIG_VIDIX -#include "vosub_vidix.h" +#include "vidix_system.h" #endif #include "aspect.h" #include "osd.h" @@ -119,20 +119,21 @@ unsigned flags, const char *title, uint32_t format); - virtual void select_frame(unsigned idx); + virtual MPXP_Rc select_frame(unsigned idx); + virtual void get_surface_caps(dri_surface_cap_t *caps) const; + virtual void get_surface(dri_surface_t *surf) const; + virtual MPXP_Rc query_format(vo_query_fourcc_t* format) const; + virtual unsigned get_num_frames() const; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data); private: MPXP_Rc fb_preinit(); - uint32_t parse_sub_device(const char *sd); + const char* parse_sub_device(const char *sd); int parse_fbmode_cfg(const char *cfgfile); int get_token(int num); void vt_set_textarea(int u, int l); void lots_of_printf() const; - void dri_get_surface_caps(dri_surface_cap_t *caps) const; - void dri_get_surface(dri_surface_t *surf) const; - MPXP_Rc query_format(vo_query_fourcc_t* format) const; - FILE * fp; int line_num; char * line; @@ -179,26 +180,24 @@ MPXP_Rc pre_init_err; #ifdef CONFIG_VIDIX /* Name of VIDIX driver */ - const char* vidix_name; - vidix_server_t* vidix_server; - vidix_priv_t* vidix; + Vidix_System* vidix; #endif int fb_preinit_done; MPXP_Rc fb_works; }; -uint32_t FBDev_VO_Interface::parse_sub_device(const char *sd) +const char* FBDev_VO_Interface::parse_sub_device(const char *sd) { const char *param; #ifdef CONFIG_VIDIX - if(memcmp(sd,"vidix",5) == 0) vidix_name = &sd[5]; /* vidix_name will be valid within init() */ + if(memcmp(sd,"vidix",5) == 0) return &sd[5]; /* vidix_name will be valid within init() */ else #endif { param=mrl_parse_line(sd,NULL,NULL,&priv_conf.dev_name,&priv_conf.mode_name); mrl_parse_params(param,fbconf); } - return 0; + return NULL; } MPXP_Rc FBDev_VO_Interface::fb_preinit() @@ -286,20 +285,18 @@ close(dev_fd); if(frame_buffer) munmap(frame_buffer,size); #ifdef CONFIG_VIDIX - if(vidix_name) vidix_term(vidix); - delete vidix_server; - delete vidix; + if(vidix) delete vidix; #endif } FBDev_VO_Interface::FBDev_VO_Interface(const char *arg) :VO_Interface(arg) { - if(arg) parse_sub_device(arg); + const char *vidix_name=NULL; + if(arg) vidix_name=parse_sub_device(arg); #ifdef CONFIG_VIDIX if(vidix_name) { - vidix=vidix_preinit(vidix_name); - if(!(vidix_server=vidix_get_server(vidix))) { + if(!(vidix=new(zeromem) Vidix_System(vidix_name))) { MSG_ERR("Cannot initialze vidix with '%s' argument\n",vidix_name); exit_player("Vidix error"); } @@ -1061,13 +1058,11 @@ else y_offset = 0; #ifdef CONFIG_VIDIX - if(vidix_name) { - if(vidix_init(vidix,width,height,x_offset,y_offset,out_width, + if(vidix) { + if(vidix->configure(width,height,x_offset,y_offset,out_width, out_height,format,bpp, xres,yres) != MPXP_Ok) { MSG_ERR(FBDEV "Can't initialize VIDIX driver\n"); - vidix_name = NULL; - vidix_term(vidix); return MPXP_False; } else MSG_V(FBDEV "Using VIDIX\n"); if ((frame_buffer = (uint8_t *) mmap(0, size, PROT_READ | PROT_WRITE, @@ -1076,7 +1071,7 @@ return MPXP_False; } memset(frame_buffer, 0, line_len * yres); - if(vidix_start(vidix)!=0) { vidix_term(vidix); return MPXP_False; } + if(vidix->start()!=0) return MPXP_False; } else #endif { @@ -1116,6 +1111,9 @@ MPXP_Rc FBDev_VO_Interface::query_format(vo_query_fourcc_t * format) const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->query_fourcc(format); +#endif format->flags=VOCAP_NA; switch(format->fourcc) { case IMGFMT_BGR15: if(bpp == 15) format->flags=VOCAP_SUPPORTED; break; @@ -1127,13 +1125,10 @@ return MPXP_Ok; } -void FBDev_VO_Interface::select_frame(unsigned idx) +MPXP_Rc FBDev_VO_Interface::select_frame(unsigned idx) { #ifdef CONFIG_VIDIX - if(vidix_server) { - vidix_server->select_frame(vidix,idx); - return; - } + if(vidix) return vidix->select_frame(idx); #endif unsigned i, out_offset = 0, in_offset = 0; @@ -1143,10 +1138,14 @@ out_offset += line_len; in_offset += out_width * pixel_size; } + return MPXP_Ok; } -void FBDev_VO_Interface::dri_get_surface_caps(dri_surface_cap_t *caps) const +void FBDev_VO_Interface::get_surface_caps(dri_surface_cap_t *caps) const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->get_surface_caps(caps); +#endif caps->caps = DRI_CAP_TEMP_VIDEO; caps->fourcc = dstFourcc; caps->width=out_width; @@ -1161,32 +1160,33 @@ caps->strides[3] = 0; } -void FBDev_VO_Interface::dri_get_surface(dri_surface_t *surf) const +void FBDev_VO_Interface::get_surface(dri_surface_t *surf) const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->get_surface(surf); +#endif surf->planes[0] = next_frame[surf->idx]; surf->planes[1] = 0; surf->planes[2] = 0; surf->planes[3] = 0; } +unsigned FBDev_VO_Interface::get_num_frames() const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->get_num_frames(); +#endif + return total_fr; +} + MPXP_Rc FBDev_VO_Interface::ctrl(uint32_t request, any_t*data) { + switch(request) { + case VOCTRL_FLUSH_PAGES: #ifdef CONFIG_VIDIX - if(vidix_server) - if(vidix_server->control(vidix,request,data)==MPXP_Ok) return MPXP_Ok; + if(vidix) vidix->flush_page(*(unsigned*)data); + return MPXP_Ok; #endif - switch (request) { - case VOCTRL_QUERY_FORMAT: - return query_format((vo_query_fourcc_t*)data); - case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = total_fr; - return MPXP_True; - case DRI_GET_SURFACE_CAPS: - dri_get_surface_caps(reinterpret_cast<dri_surface_cap_t*>(data)); - return MPXP_True; - case DRI_GET_SURFACE: - dri_get_surface(reinterpret_cast<dri_surface_t*>(data)); - return MPXP_True; + default: break; } return MPXP_NA; } Modified: mplayerxp/libvo/vo_null.cpp =================================================================== --- mplayerxp/libvo/vo_null.cpp 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/vo_null.cpp 2012-11-27 09:44:49 UTC (rev 459) @@ -50,12 +50,14 @@ unsigned flags, const char *title, uint32_t format); - virtual void select_frame(unsigned idx); + virtual MPXP_Rc select_frame(unsigned idx); + virtual void get_surface_caps(dri_surface_cap_t *caps) const; + virtual void get_surface(dri_surface_t *surf) const; + virtual MPXP_Rc query_format(vo_query_fourcc_t* format) const; + virtual unsigned get_num_frames() const; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data); private: - void dri_get_surface_caps(dri_surface_cap_t *caps) const; - void dri_get_surface(dri_surface_t *surf) const; - MPXP_Rc query_format(vo_query_fourcc_t* format) const; uint32_t image_width, image_height,frame_size,fourcc; uint8_t * bm_buffs[MAX_DRI_BUFFERS]; @@ -64,9 +66,10 @@ uint32_t offset_y,offset_u,offset_v; }; -void Null_VO_Interface::select_frame(unsigned idx) +MPXP_Rc Null_VO_Interface::select_frame(unsigned idx) { UNUSED(idx); + return MPXP_Ok; } MPXP_Rc Null_VO_Interface::configure(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height,unsigned flags,const char *title, uint32_t format) @@ -140,7 +143,7 @@ if(arg) MSG_ERR("vo_null: Unknown subdevice: %s\n",arg); } -void Null_VO_Interface::dri_get_surface_caps(dri_surface_cap_t *caps) const +void Null_VO_Interface::get_surface_caps(dri_surface_cap_t *caps) const { caps->caps =DRI_CAP_TEMP_VIDEO | DRI_CAP_HORZSCALER | DRI_CAP_VERTSCALER | @@ -158,7 +161,7 @@ caps->strides[3] = 0; } -void Null_VO_Interface::dri_get_surface(dri_surface_t *surf) const +void Null_VO_Interface::get_surface(dri_surface_t *surf) const { surf->planes[0] = bm_buffs[surf->idx] + offset_y; surf->planes[1] = bm_buffs[surf->idx] + offset_v; @@ -166,6 +169,8 @@ surf->planes[3] = 0; } +unsigned Null_VO_Interface::get_num_frames() const { return num_frames; } + MPXP_Rc Null_VO_Interface::query_format(vo_query_fourcc_t* format) const { /* we must avoid compressed-fourcc here */ switch(format->fourcc) { @@ -214,17 +219,6 @@ MPXP_Rc Null_VO_Interface::ctrl(uint32_t request, any_t*data) { switch (request) { - case VOCTRL_QUERY_FORMAT: - return query_format(reinterpret_cast<vo_query_fourcc_t*>(data)); - case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = num_frames; - return MPXP_True; - case DRI_GET_SURFACE_CAPS: - dri_get_surface_caps(reinterpret_cast<dri_surface_cap_t*>(data)); - return MPXP_True; - case DRI_GET_SURFACE: - dri_get_surface(reinterpret_cast<dri_surface_t*>(data)); - return MPXP_True; case VOCTRL_FLUSH_PAGES: return MPXP_True; } Modified: mplayerxp/libvo/vo_opengl.cpp =================================================================== --- mplayerxp/libvo/vo_opengl.cpp 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/vo_opengl.cpp 2012-11-27 09:44:49 UTC (rev 459) @@ -65,7 +65,12 @@ unsigned flags, const char *title, uint32_t format); - virtual void select_frame(unsigned idx); + virtual MPXP_Rc select_frame(unsigned idx); + virtual void get_surface_caps(dri_surface_cap_t *caps) const; + virtual void get_surface(dri_surface_t *surf) const; + virtual MPXP_Rc query_format(vo_query_fourcc_t* format) const; + virtual unsigned get_num_frames() const; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data); private: void gl_init_fb(unsigned x,unsigned y,unsigned d_width,unsigned d_height) const; @@ -73,9 +78,6 @@ uint32_t check_events(const vo_resize_t*) const; void gl_display_Image(XImage *myximage) const; - void dri_get_surface_caps(dri_surface_cap_t *caps) const; - void dri_get_surface(dri_surface_t *surf) const; - MPXP_Rc query_format(vo_query_fourcc_t* format) const; uint32_t image_width; uint32_t image_height; @@ -239,11 +241,11 @@ myximage->data); } -void OpenGL_VO_Interface::select_frame(unsigned idx) { +MPXP_Rc OpenGL_VO_Interface::select_frame(unsigned idx) { gl_display_Image(glx.Image(idx)); if (num_buffers>1) glx.swap_buffers(); glFlush(); - return; + return MPXP_Ok; } MPXP_Rc OpenGL_VO_Interface::query_format( vo_query_fourcc_t* format ) const @@ -259,7 +261,7 @@ } -void OpenGL_VO_Interface::dri_get_surface_caps(dri_surface_cap_t *caps) const +void OpenGL_VO_Interface::get_surface_caps(dri_surface_cap_t *caps) const { caps->caps =DRI_CAP_TEMP_VIDEO| DRI_CAP_HORZSCALER|DRI_CAP_VERTSCALER| @@ -277,7 +279,7 @@ caps->strides[3] = 0; } -void OpenGL_VO_Interface::dri_get_surface(dri_surface_t *surf) const +void OpenGL_VO_Interface::get_surface(dri_surface_t *surf) const { surf->planes[0] = glx.ImageData(surf->idx); surf->planes[1] = 0; @@ -285,26 +287,17 @@ surf->planes[3] = 0; } +unsigned OpenGL_VO_Interface::get_num_frames() const { return num_buffers; } + MPXP_Rc OpenGL_VO_Interface::ctrl(uint32_t request, any_t*data) { switch (request) { - case VOCTRL_QUERY_FORMAT: - return query_format((vo_query_fourcc_t*)data); case VOCTRL_FULLSCREEN: glx.fullscreen(); vo_rect_t r; glx.get_win_coord(&r); resize(r.w,r.h); return MPXP_True; - case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = num_buffers; - return MPXP_True; - case DRI_GET_SURFACE_CAPS: - dri_get_surface_caps(reinterpret_cast<dri_surface_cap_t*>(data)); - return MPXP_True; - case DRI_GET_SURFACE: - dri_get_surface(reinterpret_cast<dri_surface_t*>(data)); - return MPXP_True; case VOCTRL_CHECK_EVENTS: { vo_resize_t* vrest = (vo_resize_t *)data; vrest->event_type = check_events(vrest); Modified: mplayerxp/libvo/vo_sdl.cpp =================================================================== --- mplayerxp/libvo/vo_sdl.cpp 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/vo_sdl.cpp 2012-11-27 09:44:49 UTC (rev 459) @@ -132,7 +132,7 @@ #include "video_out_internal.h" #include "xmpcore/mp_image.h" #ifdef CONFIG_VIDIX -#include "vosub_vidix.h" +#include "vidix_system.h" #endif #include "vo_msg.h" @@ -206,7 +206,12 @@ unsigned flags, const char *title, uint32_t format); - virtual void select_frame(unsigned idx); + virtual MPXP_Rc select_frame(unsigned idx); + virtual void get_surface_caps(dri_surface_cap_t *caps) const; + virtual void get_surface(dri_surface_t *surf) const; + virtual MPXP_Rc query_format(vo_query_fourcc_t* format) const; + virtual unsigned get_num_frames() const; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data); private: void sdl_open ( ); @@ -219,10 +224,8 @@ uint32_t check_events(const vo_resize_t*); void lock_surfaces(); void unlock_surfaces(); + const char* parse_sub_device(const char *sd) const; - void dri_get_surface_caps(dri_surface_cap_t *caps) const; - void dri_get_surface(dri_surface_t *surf) const; - MPXP_Rc query_format(vo_query_fourcc_t* format) const; char sdl_subdevice[100]; char driver[8]; /* output driver used by sdl */ @@ -249,9 +252,7 @@ uint32_t format; /* source image format (YUV/RGB/...) */ SDL_Rect dirty_off_frame[2]; #ifdef CONFIG_VIDIX - const char * vidix_name; - vidix_server_t* vidix_server; - vidix_priv_t* vidix; + Vidix_System* vidix; #endif #ifdef HAVE_X11 X11_System& x11; @@ -268,6 +269,13 @@ } /** Private SDL Data structure **/ +const char* SDL_VO_Interface::parse_sub_device(const char *sd) const +{ +#ifdef CONFIG_VIDIX + if(memcmp(sd,"vidix",5) == 0) return &sd[5]; /* vidix_name will be valid within init() */ +#endif + return NULL; +} SDL_VO_Interface::~SDL_VO_Interface() { @@ -277,10 +285,7 @@ sdl_close(); pthread_mutex_destroy(&surfaces_mutex); #ifdef CONFIG_VIDIX - if(vidix_name) { - vidix_term(vidix); - delete vidix_server; - } + if(vidix) delete vidix; #endif } @@ -290,10 +295,20 @@ ,x11(*new(zeromem) X11_System(vo_conf.mDisplayName)) #endif { + const char* vidix_name=NULL; num_buffs = 1; surface = NULL; sdl_subdevice[0]='\0'; if(arg) strcpy(sdl_subdevice,arg); + if(arg) vidix_name = parse_sub_device(arg); +#ifdef CONFIG_VIDIX + if(vidix_name) { + if(!(vidix=new(zeromem) Vidix_System(vidix_name))) { + MSG_ERR("Cannot initialze vidix with '%s' argument\n",vidix_name); + exit_player("Vidix error"); + } + } +#endif #ifdef HAVE_X11 x11.saver_off(); #endif @@ -336,27 +351,13 @@ { const SDL_VideoInfo *vidInfo = NULL; MSG_DBG3("SDL: Opening Plugin\n"); -#ifdef CONFIG_VIDIX - if(memcmp(sdl_subdevice,"vidix",5) == 0) { - vidix_name = &sdl_subdevice[5]; /* vidix_name will be valid within init() */ - vidix=vidix_preinit(vidix_name); - if(!(vidix_server=vidix_get_server(vidix))) { - MSG_ERR("Cannot initialze vidix with '%s' argument\n",vidix_name); - exit_player("Vidix error"); - strcpy(driver,"vidix"); - } - } else { -#endif - if(sdl_subdevice[0]) setenv("SDL_VIDEODRIVER", sdl_subdevice, 1); + if(sdl_subdevice[0]) setenv("SDL_VIDEODRIVER", sdl_subdevice, 1); - /* does the user want SDL to try and force Xv */ - if(sdl_forcexv) setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); + /* does the user want SDL to try and force Xv */ + if(sdl_forcexv) setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); - /* does the user want to disable Xv and use software scaling instead */ - if(sdl_noxv) setenv("SDL_VIDEO_YUV_HWACCEL", "0", 1); -#ifdef CONFIG_VIDIX - } -#endif + /* does the user want to disable Xv and use software scaling instead */ + if(sdl_noxv) setenv("SDL_VIDEO_YUV_HWACCEL", "0", 1); /* default to no fullscreen mode, we'll set this as soon we have the avail. modes */ fullmode = -2; @@ -457,9 +458,6 @@ void SDL_VO_Interface::sdl_close () { unsigned i,n; -#ifdef CONFIG_VIDIX - if(vidix_name) vidix_term(vidix); -#endif n=num_buffs; for(i=0;i<n;i++) { /* Cleanup YUV Overlay structure */ @@ -742,25 +740,20 @@ MPXP_Rc retval; num_buffs=vo_conf.xp_buffs; #ifdef CONFIG_VIDIX - if(!vidix_name) { -#endif - for(i=0;i<num_buffs;i++) { - retval = setup_surface(i); - if(retval!=MPXP_Ok) return retval; - } -#ifdef CONFIG_VIDIX - } - else { - if(vidix_init(vidix,width,height,0,y, + if(vidix) { + if(vidix->configure(width,height,0,y, dstwidth,dstheight,format,bpp, XWidth,XHeight) != MPXP_Ok) { MSG_ERR("vo_sdl: Can't initialize VIDIX driver\n"); - vidix_name = NULL; return MPXP_False; } else MSG_V("vo_sdl: Using VIDIX\n"); - if(vidix_start(vidix)!=0) return MPXP_False; - } + if(vidix->start()!=0) return MPXP_False; + } else #endif + for(i=0;i<num_buffs;i++) { + retval = setup_surface(i); + if(retval!=MPXP_Ok) return retval; + } return MPXP_Ok; } @@ -1107,51 +1100,48 @@ * returns : doesn't return **/ -void SDL_VO_Interface::select_frame(unsigned idx) +MPXP_Rc SDL_VO_Interface::select_frame(unsigned idx) { #ifdef CONFIG_VIDIX - if(vidix_server) { - vidix_server->select_frame(vidix,idx); - return; - } + if(vidix) return vidix->select_frame(idx); #endif - if(mode == YUV) { - /* blit to the YUV overlay */ - SDL_DisplayYUVOverlay (overlay[idx], &surface->clip_rect); + if(mode == YUV) { + /* blit to the YUV overlay */ + SDL_DisplayYUVOverlay (overlay[idx], &surface->clip_rect); - /* check if we have a double buffered surface and flip() if we do. */ - if ( surface->flags & SDL_DOUBLEBUF ) - SDL_Flip(surface); + /* check if we have a double buffered surface and flip() if we do. */ + if ( surface->flags & SDL_DOUBLEBUF ) + SDL_Flip(surface); - //SDL_LockYUVOverlay (overlay); // removed because unused!? - } else { - /* blit to the RGB surface */ - if(SDL_BlitSurface (rgbsurface[idx], NULL, surface, NULL)) - MSG_ERR("SDL: Blit failed: %s\n", SDL_GetError()); + //SDL_LockYUVOverlay (overlay); // removed because unused!? + } else { + /* blit to the RGB surface */ + if(SDL_BlitSurface (rgbsurface[idx], NULL, surface, NULL)) + MSG_ERR("SDL: Blit failed: %s\n", SDL_GetError()); - /* update screen */ - if(sdl_forcegl) + /* update screen */ + if(sdl_forcegl) SDL_UpdateRects(surface, 1, &surface->clip_rect); + else { + if(osd_has_changed) { + osd_has_changed = 0; SDL_UpdateRects(surface, 1, &surface->clip_rect); - else - { - if(osd_has_changed) { - osd_has_changed = 0; - SDL_UpdateRects(surface, 1, &surface->clip_rect); - } - else - SDL_UpdateRect(surface, 0, y_screen_top, + } else + SDL_UpdateRect(surface, 0, y_screen_top, surface->clip_rect.w, y_screen_bottom); - } - /* check if we have a double buffered surface and flip() if we do. */ - if(sdl_forcegl) SDL_GL_SwapBuffers(); - else - if(surface->flags & SDL_DOUBLEBUF ) SDL_Flip(surface); } + /* check if we have a double buffered surface and flip() if we do. */ + if(sdl_forcegl) SDL_GL_SwapBuffers(); + else if(surface->flags & SDL_DOUBLEBUF ) SDL_Flip(surface); + } + return MPXP_Ok; } MPXP_Rc SDL_VO_Interface::query_format(vo_query_fourcc_t* format) const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->query_fourcc(format); +#endif if(sdl_forcegl) { if (IMGFMT_IS_BGR(format->fourcc)) { if (rgbfmt_depth(format->fourcc) == (unsigned)bpp && @@ -1183,8 +1173,11 @@ return MPXP_False; } -void SDL_VO_Interface::dri_get_surface_caps(dri_surface_cap_t *caps) const +void SDL_VO_Interface::get_surface_caps(dri_surface_cap_t *caps) const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->get_surface_caps(caps); +#endif caps->caps = DRI_CAP_TEMP_VIDEO | DRI_CAP_UPSCALER | DRI_CAP_DOWNSCALER | DRI_CAP_HORZSCALER | DRI_CAP_VERTSCALER; caps->fourcc = format; @@ -1222,8 +1215,11 @@ } } -void SDL_VO_Interface::dri_get_surface(dri_surface_t *surf) const +void SDL_VO_Interface::get_surface(dri_surface_t *surf) const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->get_surface(surf); +#endif if(mode == YUV) { int i,n; n = std::min(4,overlay[surf->idx]->planes); @@ -1245,24 +1241,16 @@ } } -MPXP_Rc SDL_VO_Interface::ctrl(uint32_t request, any_t*data) -{ +unsigned SDL_VO_Interface::get_num_frames() const { #ifdef CONFIG_VIDIX - if(vidix_server) - if(vidix_server->control(vidix,request,data)==MPXP_Ok) return MPXP_Ok; + if(vidix) return vidix->get_num_frames(); #endif + return num_buffs; +} + +MPXP_Rc SDL_VO_Interface::ctrl(uint32_t request, any_t*data) +{ switch (request) { - case VOCTRL_QUERY_FORMAT: - return query_format((vo_query_fourcc_t*)data); - case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = num_buffs; - return MPXP_True; - case DRI_GET_SURFACE_CAPS: - dri_get_surface_caps(reinterpret_cast<dri_surface_cap_t*>(data)); - return MPXP_True; - case DRI_GET_SURFACE: - dri_get_surface(reinterpret_cast<dri_surface_t*>(data)); - return MPXP_True; case VOCTRL_CHECK_EVENTS: { vo_resize_t * vrest = (vo_resize_t *)data; vrest->event_type = check_events(vrest); @@ -1279,6 +1267,11 @@ } *(uint32_t *)data = VO_EVENT_RESIZE; return MPXP_True; + case VOCTRL_FLUSH_PAGES: +#ifdef CONFIG_VIDIX + if(vidix) vidix->flush_page(*(unsigned*)data); + return MPXP_Ok; +#endif } return MPXP_NA; } Modified: mplayerxp/libvo/vo_vesa.cpp =================================================================== --- mplayerxp/libvo/vo_vesa.cpp 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/vo_vesa.cpp 2012-11-27 09:44:49 UTC (rev 459) @@ -40,7 +40,7 @@ #include "osdep/bswap.h" #include "aspect.h" #ifdef CONFIG_VIDIX -#include "vosub_vidix.h" +#include "vidix_system.h" #endif #include "dri_vo.h" #include "help_mp.h" @@ -70,10 +70,15 @@ unsigned flags, const char *title, uint32_t format); - virtual void select_frame(unsigned idx); + virtual MPXP_Rc select_frame(unsigned idx); + virtual void get_surface_caps(dri_surface_cap_t *caps) const; + virtual void get_surface(dri_surface_t *surf) const; + virtual MPXP_Rc query_format(vo_query_fourcc_t* format) const; + virtual unsigned get_num_frames() const; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data); private: - uint32_t parse_sub_device(const char *sd); + const char* parse_sub_device(const char *sd); int has_dga() const { return win.idx == -1; } int valid_win_frame(unsigned long offset) const { return offset >= win.low && offset < win.high; } any_t* video_ptr(unsigned long offset) const { return win.ptr + offset - win.low; } @@ -93,9 +98,6 @@ void vesa_term(); - void dri_get_surface_caps(dri_surface_cap_t *caps) const; - void dri_get_surface(dri_surface_t *surf) const; - MPXP_Rc query_format(vo_query_fourcc_t* format) const; void (VESA_VO_Interface::*cpy_blk_fnc)(unsigned long,uint8_t *,unsigned long); @@ -116,9 +118,7 @@ uint8_t multi_size; /* total number of buffers */ /* Linux Video Overlay */ #ifdef CONFIG_VIDIX - const char * vidix_name; - vidix_server_t* vidix_server; - vidix_priv_t* vidix; + Vidix_System* vidix; #endif uint32_t subdev_flags; }; @@ -152,23 +152,23 @@ vesa_term(); MSG_DBG3("vo_vesa: uninit was called\n"); #ifdef CONFIG_VIDIX - delete vidix_server; + if(vidix) delete vidix; #endif } VESA_VO_Interface::VESA_VO_Interface(const char *arg) :VO_Interface(arg) { + const char* vidix_name=NULL; MPXP_Rc pre_init_err = MPXP_Ok; subdev_flags = 0xFFFFFFFEUL; cpy_blk_fnc=NULL; MSG_DBG2("vo_vesa: preinit(%s) was called\n",arg); MSG_DBG3("vo_vesa: subdevice %s is being initialized\n",arg); - if(arg) subdev_flags = parse_sub_device(arg); + if(arg) vidix_name = parse_sub_device(arg); #ifdef CONFIG_VIDIX if(vidix_name) { - vidix=vidix_preinit(vidix_name); - if(!(vidix_server=vidix_get_server(vidix))) { + if(!(vidix=new(zeromem) Vidix_System(vidix_name))) { MSG_ERR("Cannot initialze vidix with '%s' argument\n",vidix_name); exit_player("Vidix error"); } @@ -189,9 +189,6 @@ void VESA_VO_Interface::vesa_term() { int err; -#ifdef CONFIG_VIDIX - if(vidix_name) vidix_term(vidix); -#endif if((err=vbeRestoreState(init_state)) != VBE_OK) PRINT_VBE_ERR("vbeRestoreState",err); if((err=vbeSetMode(init_mode,NULL)) != VBE_OK) PRINT_VBE_ERR("vbeSetMode",err); if(has_dga()) vbeUnmapVideoBuffer((unsigned long)win.ptr,win.high); @@ -286,13 +283,10 @@ } } -void VESA_VO_Interface::select_frame(unsigned idx) +MPXP_Rc VESA_VO_Interface::select_frame(unsigned idx) { #ifdef CONFIG_VIDIX - if(vidix_server) { - vidix_server->select_frame(vidix,idx); - return; - } + if(vidix) return vidix->select_frame(idx); #endif MSG_DBG3("vo_vesa: select_frame was called\n"); if(!has_dga()) __vbeCopyData(dga_buffer); @@ -306,23 +300,23 @@ } win.ptr = dga_buffer = video_base + multi_buff[(idx+1)%multi_size]; } + return MPXP_Ok; } #define SUBDEV_NODGA 0x00000001UL #define SUBDEV_FORCEDGA 0x00000002UL -uint32_t VESA_VO_Interface::parse_sub_device(const char *sd) +const char* VESA_VO_Interface::parse_sub_device(const char *sd) { - uint32_t flags; - flags = 0; - if(strcmp(sd,"nodga") == 0) { flags |= SUBDEV_NODGA; flags &= ~(SUBDEV_FORCEDGA); } + subdev_flags = 0; + if(strcmp(sd,"nodga") == 0) { subdev_flags |= SUBDEV_NODGA; subdev_flags &= ~(SUBDEV_FORCEDGA); } else - if(strcmp(sd,"dga") == 0) { flags &= ~(SUBDEV_NODGA); flags |= SUBDEV_FORCEDGA; } + if(strcmp(sd,"dga") == 0) { subdev_flags &= ~(SUBDEV_NODGA); subdev_flags |= SUBDEV_FORCEDGA; } #ifdef CONFIG_VIDIX else - if(memcmp(sd,"vidix",5) == 0) vidix_name = &sd[5]; /* priv.vidix_name will be valid within init() */ + if(memcmp(sd,"vidix",5) == 0) return &sd[5]; /* priv.vidix_name will be valid within init() */ #endif - else { MSG_ERR("vo_vesa: Unknown subdevice: '%s'\n", sd); return 0xFFFFFFFFUL; } - return flags; + else { MSG_ERR("vo_vesa: Unknown subdevice: '%s'\n", sd); subdev_flags = 0xFFFFFFFFUL; } + return NULL; } static int __FASTCALL__ check_depth(unsigned bpp) @@ -344,19 +338,6 @@ return VOCAP_NA; } -MPXP_Rc VESA_VO_Interface::query_format(vo_query_fourcc_t* format) const -{ - MSG_DBG3("vo_vesa: query_format was called: %x (%s)\n",format->fourcc,vo_format_name(format->fourcc)); - switch(format->fourcc) { - case IMGFMT_BGR8: format->flags=check_depth(8); break; - case IMGFMT_BGR15: format->flags=check_depth(15); break; - case IMGFMT_BGR16: format->flags=check_depth(16); break; - case IMGFMT_BGR24: format->flags=check_depth(24); break; - case IMGFMT_BGR32: format->flags=check_depth(32); break; - default: break; - } - return MPXP_Ok; -} void VESA_VO_Interface::paintBkGnd() { @@ -683,7 +664,7 @@ } else { cpy_blk_fnc = &VESA_VO_Interface::__vbeCopyBlock; #ifdef CONFIG_VIDIX - if(!vidix_name) + if(!vidix) #endif { if(!(dga_buffer = new(alignmem,64) uint8_t[vmode_info.XResolution*vmode_info.YResolution*dstBpp])) { @@ -705,16 +686,15 @@ /* Below 'return MPXP_False' is impossible */ MSG_V("vo_vesa: Graphics mode was activated\n"); #ifdef CONFIG_VIDIX - if(vidix_name) { - if(vidix_init(vidix,width,height,x_offset,y_offset,dstW, + if(vidix) { + if(vidix->configure(width,height,x_offset,y_offset,dstW, dstH,format,dstBpp, vmode_info.XResolution,vmode_info.YResolution) != MPXP_Ok) { MSG_ERR("vo_vesa: Can't initialize VIDIX driver\n"); - vidix_name = NULL; vesa_term(); return MPXP_False; } else MSG_V("vo_vesa: Using VIDIX\n"); - if(vidix_start(vidix)!=0) { + if(vidix->start()!=0) { vesa_term(); return MPXP_False; } @@ -742,8 +722,28 @@ return MPXP_Ok; } -void VESA_VO_Interface::dri_get_surface_caps(dri_surface_cap_t *caps) const +MPXP_Rc VESA_VO_Interface::query_format(vo_query_fourcc_t* format) const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->query_fourcc(format); +#endif + MSG_DBG3("vo_vesa: query_format was called: %x (%s)\n",format->fourcc,vo_format_name(format->fourcc)); + switch(format->fourcc) { + case IMGFMT_BGR8: format->flags=check_depth(8); break; + case IMGFMT_BGR15: format->flags=check_depth(15); break; + case IMGFMT_BGR16: format->flags=check_depth(16); break; + case IMGFMT_BGR24: format->flags=check_depth(24); break; + case IMGFMT_BGR32: format->flags=check_depth(32); break; + default: break; + } + return MPXP_Ok; +} + +void VESA_VO_Interface::get_surface_caps(dri_surface_cap_t *caps) const +{ +#ifdef CONFIG_VIDIX + if(vidix) return vidix->get_surface_caps(caps); +#endif caps->caps = has_dga() ? DRI_CAP_VIDEO_MMAPED : DRI_CAP_TEMP_VIDEO; caps->fourcc = dstFourcc; caps->width=has_dga()?vmode_info.XResolution:dstW; @@ -758,32 +758,33 @@ caps->strides[3] = 0; } -void VESA_VO_Interface::dri_get_surface(dri_surface_t *surf) const +void VESA_VO_Interface::get_surface(dri_surface_t *surf) const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->get_surface(surf); +#endif surf->planes[0] = has_dga()?video_base + multi_buff[surf->idx]:dga_buffer; surf->planes[1] = 0; surf->planes[2] = 0; surf->planes[3] = 0; } +unsigned VESA_VO_Interface::get_num_frames() const { +#ifdef CONFIG_VIDIX + if(vidix) return vidix->get_num_frames(); +#endif + return multi_size; +} + MPXP_Rc VESA_VO_Interface::ctrl(uint32_t request, any_t*data) { + switch(request) { + case VOCTRL_FLUSH_PAGES: #ifdef CONFIG_VIDIX - if(vidix_server) - if(vidix_server->control(vidix,request,data)==MPXP_Ok) return MPXP_Ok; + if(vidix) vidix->flush_page(*(unsigned*)data); + return MPXP_Ok; #endif - switch (request) { - case VOCTRL_QUERY_FORMAT: - return query_format(reinterpret_cast<vo_query_fourcc_t*>(data)); - case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = multi_size; - return MPXP_True; - case DRI_GET_SURFACE_CAPS: - dri_get_surface_caps(reinterpret_cast<dri_surface_cap_t*>(data)); - return MPXP_True; - case DRI_GET_SURFACE: - dri_get_surface(reinterpret_cast<dri_surface_t*>(data)); - return MPXP_True; + default: break; } return MPXP_NA; } Modified: mplayerxp/libvo/vo_x11.cpp =================================================================== --- mplayerxp/libvo/vo_x11.cpp 2012-11-26 17:16:03 UTC (rev 458) +++ mplayerxp/libvo/vo_x11.cpp 2012-11-27 09:44:49 UTC (rev 459) @@ -45,8 +45,7 @@ #include "video_out_internal.h" #include "video_out.h" #ifdef CONFIG_VIDIX -#include "vosub_vidix.h" -#include <vidix/vidix.h> +#include "vidix_system.h" #endif #include "dri_vo.h" #include "xmpcore/mp_image.h" @@ -64,17 +63,19 @@ unsigned flags, const char *title, uint32_t format); - virtual void select_frame(unsigned idx); + virtual MPXP_Rc select_frame(unsigned idx); + virtual void get_surface_caps(dri_surface_cap_t *caps) const; + virtual void get_surface(dri_surface_t *surf) const; + MPXP_Rc query_format(vo_query_fourcc_t* format) const; + virtual unsigned get_num_frames() const; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data); private: - uint32_t parse_sub_device(const char *sd); + const char* parse_sub_device(const char *sd); void resize(int x,int y) const; uint32_t check_events(const vo_resize_t*); void display_image(XImage * myximage) const; - void dri_get_surface_caps(dri_surface_cap_t *caps) const; - void dri_get_surface(dri_surface_t *surf) const; - MPXP_Rc query_format(vo_query_fourcc_t* format) const; uint32_t image_width; uint32_t image_height; @@ -89,9 +90,7 @@ /* xp related variables */ unsigned num_buffers; // 1 - default #ifdef CONFIG_VIDIX - const char * vidix_name; - vidix_server_t* vidix_server; - vidix_priv_t* vidix; + Vidix_System* vidix; void resize_vidix() const; #endif uint32_t subdev_flags; @@ -104,30 +103,27 @@ #include <X11/extensions/XShm.h> #endif -uint32_t X11_VO_Interface::parse_sub_device(const char *sd) +const char* X11_VO_Interface::parse_sub_device(const char *sd) { - uint32_t _flags; - _flags = 0; #ifdef CONFIG_VIDIX - if(memcmp(sd,"vidix",5) == 0) vidix_name = &sd[5]; /* priv.vidix_name will be valid within init() */ - else + if(memcmp(sd,"vidix",5) == 0) return &sd[5]; /* vidix_name will be valid within init() */ #endif - { MSG_ERR("vo_x11: Unknown subdevice: '%s'\n", sd); return 0xFFFFFFFFUL; } - return _flags; + MSG_ERR("vo_x11: Unknown subdevice: '%s'\n", sd); + return NULL; } X11_VO_Interface::X11_VO_Interf... [truncated message content] |
From: <nic...@us...> - 2012-11-27 13:18:25
|
Revision: 463 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=463&view=rev Author: nickols_k Date: 2012-11-27 13:18:15 +0000 (Tue, 27 Nov 2012) Log Message: ----------- fix fullscreen mode Modified Paths: -------------- mplayerxp/libvo/video_out.cpp mplayerxp/libvo/vo_fbdev.cpp mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_sdl.cpp mplayerxp/libvo/vo_vesa.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp mplayerxp/libvo/x11_system.cpp mplayerxp/libvo/x11_system.h mplayerxp/mplayerxp.cpp Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/video_out.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -51,6 +51,7 @@ VO_Config::VO_Config() { memset(&subdevice,0,reinterpret_cast<long>(&dbpp) - reinterpret_cast<long>(&subdevice)); movie_aspect=-1.0; + softzoom=1; flip=-1; xp_buffs=64; dbpp=0; Modified: mplayerxp/libvo/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo/vo_fbdev.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/vo_fbdev.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -1047,7 +1047,7 @@ aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); aspect_save_screenres(xres,yres); - aspect(&out_width,&out_height,A_ZOOM); + aspect(&out_width,&out_height,A_NOZOOM); } else if(flags&VOFLAG_FULLSCREEN) { out_width = xres; out_height = yres; Modified: mplayerxp/libvo/vo_opengl.cpp =================================================================== --- mplayerxp/libvo/vo_opengl.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/vo_opengl.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -104,7 +104,6 @@ OpenGL_VO_Interface::~OpenGL_VO_Interface() { unsigned i; -// if (!vo_config_count) return; glFinish(); for(i=0;i<num_buffers;i++) glx.freeMyXImage(i); glx.saver_on(); // screen saver back on @@ -176,7 +175,7 @@ num_buffers=vo_conf.xp_buffs; aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); - aspect(&d_width,&d_height,flags&VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); + aspect(&d_width,&d_height,flags&VOFLAG_FULLSCREEN?A_ZOOM:A_NOZOOM); glx.calcpos(&hint,d_width,d_height,flags); hint.flags = PPosition | PSize; @@ -291,7 +290,7 @@ unsigned OpenGL_VO_Interface::get_num_frames() const { return num_buffers; } MPXP_Rc OpenGL_VO_Interface::toggle_fullscreen() { - glx.fullscreen(); + glx.fullscreen(flags); vo_rect_t r; glx.get_win_coord(r); resize(r.w,r.h); Modified: mplayerxp/libvo/vo_sdl.cpp =================================================================== --- mplayerxp/libvo/vo_sdl.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/vo_sdl.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -509,7 +509,7 @@ /* calculate new video size/aspect */ if(mode == YUV) { if(fulltype&VOFLAG_FULLSCREEN) aspect_save_screenres(XWidth, XHeight); - aspect(&dstwidth, &dstheight, A_ZOOM); + aspect(&dstwidth, &dstheight, A_NOZOOM); } /* try to change to given fullscreenmode */ @@ -652,7 +652,7 @@ } if(X) { aspect_save_screenres(XWidth,XHeight); - aspect(&dstwidth,&dstheight,flags&VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); + aspect(&dstwidth,&dstheight,flags&VOFLAG_FULLSCREEN?A_ZOOM:A_NOZOOM); } windowsize.w = dstwidth; windowsize.h = dstheight; @@ -893,7 +893,7 @@ retval = VO_EVENT_RESIZE; } else if ( keypressed == SDLK_n ) { #ifdef HAVE_X11 - aspect(&dstwidth, &dstheight,flags&VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); + aspect(&dstwidth, &dstheight,flags&VOFLAG_FULLSCREEN?A_ZOOM:A_NOZOOM); #endif if (unsigned(surface->w) != dstwidth || unsigned(surface->h) != dstheight) { if(set_video_mode(dstwidth, dstheight, bpp, sdlflags)!=0) exit_player("SDL set video mode"); Modified: mplayerxp/libvo/vo_vesa.cpp =================================================================== --- mplayerxp/libvo/vo_vesa.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/vo_vesa.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -597,7 +597,7 @@ aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); aspect_save_screenres(vmode_info.XResolution,vmode_info.YResolution); - aspect(&dstW,&dstH,A_ZOOM); + aspect(&dstW,&dstH,A_NOZOOM); } else if(fs_mode) { dstW = vmode_info.XResolution; dstH = vmode_info.YResolution; Modified: mplayerxp/libvo/vo_x11.cpp =================================================================== --- mplayerxp/libvo/vo_x11.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/vo_x11.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -219,9 +219,6 @@ flags=_flags; num_buffers=vo_conf.xp_buffs; - if (!title) - title = mp_strdup("MPlayerXP X11 (XImage/Shm) render"); - in_format=format; depth=x11.depth(); @@ -235,7 +232,7 @@ aspect_save_prescale(d_width,d_height); aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); - aspect(&d_width,&d_height,flags&VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); + aspect(&d_width,&d_height,flags&VOFLAG_FULLSCREEN?A_ZOOM:A_NOZOOM); x11.calcpos(&hint,d_width,d_height,flags); hint.flags=PPosition | PSize; @@ -415,7 +412,7 @@ } MPXP_Rc X11_VO_Interface::toggle_fullscreen() { - x11.fullscreen(); + x11.fullscreen(flags); #ifdef CONFIG_VIDIX if(vidix) resize_vidix(); #endif Modified: mplayerxp/libvo/vo_xv.cpp =================================================================== --- mplayerxp/libvo/vo_xv.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/vo_xv.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -165,7 +165,7 @@ xv.match_visual( &vinfo ); aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); - aspect(&d_width,&d_height,flags&VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); + aspect(&d_width,&d_height,flags&VOFLAG_FULLSCREEN?A_ZOOM:A_NOZOOM); xv.calcpos(&hint,d_width,d_height,flags); hint.flags = PPosition | PSize; @@ -214,7 +214,7 @@ set_gamma_correction(); - aspect(&dwidth,&dheight,flags&VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); + aspect(&dwidth,&dheight,flags&VOFLAG_FULLSCREEN?A_ZOOM:A_NOZOOM); return MPXP_Ok; } @@ -246,7 +246,7 @@ MSG_V( "[xv-resize] dx: %d dy: %d dw: %d dh: %d\n", winc.x,winc.y,winc.w,winc.h); - aspect(&dwidth,&dheight,flags&VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); + aspect(&dwidth,&dheight,flags&VOFLAG_FULLSCREEN?A_ZOOM:A_NOZOOM); } if ( e & VO_EVENT_EXPOSE ) { vo_rect_t r,r2; @@ -321,7 +321,7 @@ unsigned Xv_VO_Interface::get_num_frames() const { return num_buffers; } MPXP_Rc Xv_VO_Interface::toggle_fullscreen() { - xv.fullscreen(); + xv.fullscreen(flags); return MPXP_True; } Modified: mplayerxp/libvo/x11_system.cpp =================================================================== --- mplayerxp/libvo/x11_system.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/x11_system.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -774,9 +774,9 @@ } } -int X11_System::fullscreen() +int X11_System::fullscreen(unsigned& flags) { - int is_fs=(curr.w==vo_conf.screenwidth && curr.h==vo_conf.screenheight); + int is_fs=flags&VOFLAG_FULLSCREEN; ::XUnmapWindow( mDisplay,window ); if ( !is_fs ) { prev=curr; @@ -790,6 +790,7 @@ ::XMoveResizeWindow( mDisplay,window,curr.x,curr.y,curr.w,curr.h ); ::XMapWindow( mDisplay,window ); ::XSync( mDisplay,False ); + flags^=VOFLAG_FULLSCREEN; return !is_fs; } Modified: mplayerxp/libvo/x11_system.h =================================================================== --- mplayerxp/libvo/x11_system.h 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/libvo/x11_system.h 2012-11-27 13:18:15 UTC (rev 463) @@ -57,7 +57,7 @@ void sizehint(int x, int y, int width, int height) const; void calcpos(XSizeHints* hint, unsigned d_width, unsigned d_height, unsigned flags); uint32_t check_events(vo_adjust_size_t adjust_size,vo_data_t* opaque); - int fullscreen(); + int fullscreen(unsigned& flags); void saver_off(); void saver_on(); Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-27 12:43:14 UTC (rev 462) +++ mplayerxp/mplayerxp.cpp 2012-11-27 13:18:15 UTC (rev 463) @@ -1185,15 +1185,16 @@ MPXP_Rc rc=MPXP_Ok; MP_UNIT("init_video_codec"); sh_video->inited=0; + vo_data->flags=0; + /* configure flags */ + if(vo_conf.fullscreen) vo_FS_SET(vo_data); + if(vo_conf.softzoom) vo_ZOOM_SET(vo_data); + if(vo_conf.flip>0) vo_FLIP_SET(vo_data); + if(vo_conf.vidmode) vo_VM_SET(vo_data); if((sh_video->decoder=mpcv_init(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,MPXPSys->libinput()))) sh_video->inited=1; #ifdef ENABLE_WIN32LOADER if(!sh_video->inited) { /* Go through the codec.conf and find the best codec...*/ - vo_data->flags=0; - if(vo_conf.fullscreen) vo_FS_SET(vo_data); - if(vo_conf.softzoom) vo_ZOOM_SET(vo_data); - if(vo_conf.flip>0) vo_FLIP_SET(vo_data); - if(vo_conf.vidmode) vo_VM_SET(vo_data); codecs_reset_selection(0); if(mp_conf.video_codec) { /* forced codec by name: */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-27 15:26:29
|
Revision: 464 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=464&view=rev Author: nickols_k Date: 2012-11-27 15:26:22 +0000 (Tue, 27 Nov 2012) Log Message: ----------- size optimization: new class OSD_Render Modified Paths: -------------- mplayerxp/libvo/osd.cpp mplayerxp/libvo/osd.h mplayerxp/libvo/sub.cpp mplayerxp/libvo/video_out.cpp mplayerxp/postproc/libmenu/menu.cpp Modified: mplayerxp/libvo/osd.cpp =================================================================== --- mplayerxp/libvo/osd.cpp 2012-11-27 13:18:15 UTC (rev 463) +++ mplayerxp/libvo/osd.cpp 2012-11-27 15:26:22 UTC (rev 464) @@ -95,18 +95,68 @@ } static void __FASTCALL__ vo_draw_alpha_uyvy_c(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - (*vo_draw_alpha_yuy2_ptr)(w,h,src,srca,srcstride,dstbase+1,dststride,finalize); + vo_draw_alpha_yuy2_c(w,h,src,srca,srcstride,dstbase+1,dststride,finalize); } -draw_alpha_f vo_draw_alpha_yv12_ptr=NULL; -draw_alpha_f vo_draw_alpha_yuy2_ptr=NULL; -draw_alpha_f vo_draw_alpha_rgb24_ptr=NULL; -draw_alpha_f vo_draw_alpha_rgb32_ptr=NULL; -draw_alpha_f vo_draw_alpha_uyvy_ptr=vo_draw_alpha_uyvy_c; -draw_alpha_f vo_draw_alpha_rgb15_ptr=vo_draw_alpha_rgb15_c; -draw_alpha_f vo_draw_alpha_rgb16_ptr=vo_draw_alpha_rgb16_c; +static void __FASTCALL__ vo_draw_alpha_null(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ + UNUSED(w); + UNUSED(h); + UNUSED(src); + UNUSED(srca); + UNUSED(srcstride); + UNUSED(dstbase); + UNUSED(dststride); + UNUSED(finalize); +} -void vo_draw_alpha_init( void ){ +void OSD_Render::render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) +{ + (*draw_alpha_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); +} + +void OSD_Render::get_draw_alpha(unsigned fmt) { + MSG_DBG2("get_draw_alpha(%s)\n",vo_format_name(fmt)); + switch(fmt) { + case IMGFMT_BGR15: + case IMGFMT_RGB15: + draw_alpha_ptr=draw_alpha_rgb15_ptr; + break; + case IMGFMT_BGR16: + case IMGFMT_RGB16: + draw_alpha_ptr=draw_alpha_rgb16_ptr; + break; + case IMGFMT_BGR24: + case IMGFMT_RGB24: + draw_alpha_ptr=draw_alpha_rgb24_ptr; + break; + case IMGFMT_BGR32: + case IMGFMT_RGB32: + draw_alpha_ptr=draw_alpha_rgb32_ptr; + break; + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_IF09: + case IMGFMT_Y800: + case IMGFMT_Y8: + draw_alpha_ptr=draw_alpha_yv12_ptr; + break; + case IMGFMT_YUY2: + draw_alpha_ptr=draw_alpha_yuy2_ptr; + break; + case IMGFMT_UYVY: + draw_alpha_ptr=draw_alpha_uyvy_ptr; + break; + default: + MSG_ERR("draw alpha for %s fourcc not implemented yet!",vo_format_name(fmt)); + draw_alpha_ptr=vo_draw_alpha_null; + break; + } +} + +OSD_Render::OSD_Render(unsigned fourcc) +{ #ifdef FAST_OSD_TABLE int i; for(i=0;i<256;i++){ @@ -120,10 +170,10 @@ if(gCpuCaps.hasSSE41) { MSG_V("Using SSE4 Optimized OnScreenDisplay\n"); - vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_AVX; - vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_AVX; - vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_AVX; - vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_AVX; + draw_alpha_yv12_ptr=vo_draw_alpha_yv12_AVX; + draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_AVX; + draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_AVX; + draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_AVX; } else #endif @@ -131,10 +181,10 @@ if(gCpuCaps.hasSSE41) { MSG_V("Using SSE4 Optimized OnScreenDisplay\n"); - vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE4; - vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE4; - vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE4; - vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE4; + draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE4; + draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE4; + draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE4; + draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE4; } else #endif @@ -142,10 +192,10 @@ if(gCpuCaps.hasSSSE3) { MSG_V("Using SSSE3 Optimized OnScreenDisplay\n"); - vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSSE3; - vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSSE3; - vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSSE3; - vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSSE3; + draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSSE3; + draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSSE3; + draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSSE3; + draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSSE3; } else #endif @@ -153,10 +203,10 @@ if(gCpuCaps.hasSSE3) { MSG_V("Using SSE3 Optimized OnScreenDisplay\n"); - vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE3; - vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE3; - vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE3; - vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE3; + draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE3; + draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE3; + draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE3; + draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE3; } else #endif @@ -164,10 +214,10 @@ if(gCpuCaps.hasSSE2) { MSG_V("Using SSE2 Optimized OnScreenDisplay\n"); - vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE2; - vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE2; - vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE2; - vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE2; + draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE2; + draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE2; + draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE2; + draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE2; } else #endif @@ -176,10 +226,10 @@ if(gCpuCaps.hasMMX2) { MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); - vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE; - vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE; - vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE; - vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE; + draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE; + draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE; + draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE; + draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE; } else #endif @@ -187,19 +237,25 @@ //if(gCpuCaps.hasMMX) //{ // MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); -// vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_MMX; -// vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_MMX; -// vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_MMX; -// vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_MMX; +// draw_alpha_yv12_ptr=vo_draw_alpha_yv12_MMX; +// draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_MMX; +// draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_MMX; +// draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_MMX; //} //else //#endif #endif { - MSG_V("Using generic OnScreenDisplay\n"); - vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_c; - vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_c; - vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_c; - vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_c; + MSG_V("Using generic OnScreenDisplay\n"); + draw_alpha_yv12_ptr=vo_draw_alpha_yv12_c; + draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_c; + draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_c; + draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_c; } + draw_alpha_uyvy_ptr=vo_draw_alpha_uyvy_c; + draw_alpha_rgb15_ptr=vo_draw_alpha_rgb15_c; + draw_alpha_rgb16_ptr=vo_draw_alpha_rgb16_c; + get_draw_alpha(fourcc); } + +OSD_Render::~OSD_Render(){} Modified: mplayerxp/libvo/osd.h =================================================================== --- mplayerxp/libvo/osd.h 2012-11-27 13:18:15 UTC (rev 463) +++ mplayerxp/libvo/osd.h 2012-11-27 15:26:22 UTC (rev 464) @@ -3,23 +3,23 @@ /* Generic alpha renderers for all YUV modes and RGB depths. */ /* These are "reference implementations", should be optimized later (MMX, etc) */ +class OSD_Render : public Opaque { + public: + OSD_Render(unsigned fourcc); + virtual ~OSD_Render(); -extern void vo_draw_alpha_init( void ); /* build tables */ + void render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); + private: + void get_draw_alpha(unsigned fmt); + typedef void (* __FASTCALL__ draw_alpha_f)(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); + draw_alpha_f draw_alpha_ptr; + draw_alpha_f draw_alpha_yv12_ptr; + draw_alpha_f draw_alpha_yuy2_ptr; + draw_alpha_f draw_alpha_uyvy_ptr; + draw_alpha_f draw_alpha_rgb24_ptr; + draw_alpha_f draw_alpha_rgb32_ptr; + draw_alpha_f draw_alpha_rgb15_ptr; + draw_alpha_f draw_alpha_rgb16_ptr; +}; -typedef void (* __FASTCALL__ draw_alpha_f)(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); - -extern draw_alpha_f vo_draw_alpha_yv12_ptr; -extern draw_alpha_f vo_draw_alpha_yuy2_ptr; -extern draw_alpha_f vo_draw_alpha_uyvy_ptr; -extern draw_alpha_f vo_draw_alpha_rgb24_ptr; -extern draw_alpha_f vo_draw_alpha_rgb32_ptr; -extern draw_alpha_f vo_draw_alpha_rgb15_ptr; -extern draw_alpha_f vo_draw_alpha_rgb16_ptr; -static inline void vo_draw_alpha_yv12(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_yv12_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } -static inline void vo_draw_alpha_yuy2(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_yuy2_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } -static inline void vo_draw_alpha_uyvy(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_uyvy_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } -static inline void vo_draw_alpha_rgb24(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_rgb24_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } -static inline void vo_draw_alpha_rgb32(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_rgb32_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } -static inline void vo_draw_alpha_rgb15(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_rgb15_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } -static inline void vo_draw_alpha_rgb16(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) { (*vo_draw_alpha_rgb16_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } #endif Modified: mplayerxp/libvo/sub.cpp =================================================================== --- mplayerxp/libvo/sub.cpp 2012-11-27 13:18:15 UTC (rev 463) +++ mplayerxp/libvo/sub.cpp 2012-11-27 15:26:22 UTC (rev 464) @@ -34,7 +34,6 @@ static const char * __sub_osd_names_short[] ={ "", "|>", "||", "[]", "<<" , ">>", "", "", "", "", "", ""}; static int vo_osd_changed_status = 0; static rect_highlight_t nav_hl; -static int draw_alpha_init_flag=0; static mp_osd_obj_t* vo_osd_list=NULL; sub_data_t sub_data = { NULL, 0, 0, 100, 0, 0 }; @@ -501,10 +500,6 @@ } void vo_init_osd(void){ - if(!draw_alpha_init_flag){ - draw_alpha_init_flag=1; - vo_draw_alpha_init(); - } if(vo_osd_list) free_osd_list(); // temp hack, should be moved to mplayer/mencoder later new_osd_obj(OSDTYPE_OSD); Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-27 13:18:15 UTC (rev 463) +++ mplayerxp/libvo/video_out.cpp 2012-11-27 15:26:22 UTC (rev 464) @@ -128,7 +128,7 @@ dri_priv_t dri; const vo_info_t* video_out; class VO_Interface* vo_iface; - draw_alpha_f draw_alpha; + OSD_Render* draw_alpha; }; vo_priv_t::vo_priv_t() { @@ -137,6 +137,7 @@ } vo_priv_t::~vo_priv_t() { + if(draw_alpha) delete draw_alpha; delete vo_iface; } @@ -809,50 +810,18 @@ } } -static draw_alpha_f __FASTCALL__ get_draw_alpha(uint32_t fmt) { - MSG_DBG2("get_draw_alpha(%s)\n",vo_format_name(fmt)); - switch(fmt) { - case IMGFMT_BGR15: - case IMGFMT_RGB15: - return vo_draw_alpha_rgb15_ptr; - case IMGFMT_BGR16: - case IMGFMT_RGB16: - return vo_draw_alpha_rgb16_ptr; - case IMGFMT_BGR24: - case IMGFMT_RGB24: - return vo_draw_alpha_rgb24_ptr; - case IMGFMT_BGR32: - case IMGFMT_RGB32: - return vo_draw_alpha_rgb32_ptr; - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_IF09: - case IMGFMT_Y800: - case IMGFMT_Y8: - return vo_draw_alpha_yv12_ptr; - case IMGFMT_YUY2: - return vo_draw_alpha_yuy2_ptr; - case IMGFMT_UYVY: - return vo_draw_alpha_uyvy_ptr; - } - - return NULL; -} - static void __FASTCALL__ dri_draw_osd(any_t*vo,unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) { vo_priv_t& priv=*static_cast<vo_priv_t*>(reinterpret_cast<vo_data_t*>(vo)->vo_priv); int finalize=vo_is_final(reinterpret_cast<vo_data_t*>(vo)); if(x0+w<=priv.dri.cap.width&&_y0+h<=priv.dri.cap.height) { - if(!priv.draw_alpha) priv.draw_alpha=get_draw_alpha(priv.dri.cap.fourcc); + if(!priv.draw_alpha) priv.draw_alpha=new(zeromem) OSD_Render(priv.dri.cap.fourcc); if(priv.draw_alpha) { dri_surface_t surf; surf.idx=idx; priv.vo_iface->get_surface(&surf); - (*priv.draw_alpha)(w,h,src,srca,stride, + priv.draw_alpha->render(w,h,src,srca,stride, surf.planes[0]+priv.dri.cap.strides[0]*_y0+x0*((priv.dri.bpp+7)/8), priv.dri.cap.strides[0],finalize); } Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-11-27 13:18:15 UTC (rev 463) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-11-27 15:26:22 UTC (rev 464) @@ -266,37 +266,6 @@ ///////////////////////////// Helpers //////////////////////////////////// -inline static draw_alpha_f get_draw_alpha(uint32_t fmt) { - switch(fmt) { - case IMGFMT_BGR15: - case IMGFMT_RGB15: - return vo_draw_alpha_rgb15_ptr; - case IMGFMT_BGR16: - case IMGFMT_RGB16: - return vo_draw_alpha_rgb16_ptr; - case IMGFMT_BGR24: - case IMGFMT_RGB24: - return vo_draw_alpha_rgb24_ptr; - case IMGFMT_BGR32: - case IMGFMT_RGB32: - return vo_draw_alpha_rgb32_ptr; - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_IF09: - case IMGFMT_Y800: - case IMGFMT_Y8: - return vo_draw_alpha_yv12_ptr; - case IMGFMT_UYVY: - return vo_draw_alpha_uyvy_ptr; - case IMGFMT_YUY2: - return vo_draw_alpha_yuy2_ptr; - } - - return NULL; -} - // return the real height of a char: static inline int get_height(int c,int h){ int font; @@ -364,15 +333,10 @@ #endif void menu_draw_text(mp_image_t* mpi,const char* txt, int x, int y) { - draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt); + OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); int font; int finalize=vo_is_final(vo_data); - if(!draw_alpha) { - MSG_WARN("[libmenu] Unsupported output format\n"); - return; - } - #ifdef USE_FRIBIDI txt = menu_fribidi(txt); #endif @@ -381,7 +345,7 @@ while (*txt) { int c=utf8_get_char((const char**)&txt); if ((font=vo_data->font->font[c])>=0 && (x + vo_data->font->width[c] <= mpi->w) && (y + vo_data->font->pic_a[font]->h <= mpi->h)) - draw_alpha(vo_data->font->width[c], vo_data->font->pic_a[font]->h, + draw_alpha.render(vo_data->font->width[c], vo_data->font->pic_a[font]->h, vo_data->font->pic_b[font]->bmp+vo_data->font->start[c], vo_data->font->pic_a[font]->bmp+vo_data->font->start[c], vo_data->font->pic_a[font]->w, @@ -401,13 +365,8 @@ int ll = 0; int font; int finalize=vo_is_final(vo_data); - draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt); + OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); - if(!draw_alpha) { - MSG_WARN("[libmenu] Unsupported output format\n"); - return; - } - #ifdef USE_FRIBIDI txt = menu_fribidi(txt); #endif @@ -552,7 +511,7 @@ if(font >= 0) { int cs = (vo_data->font->pic_a[font]->h - vo_data->font->height) / 2; if ((sx + vo_data->font->width[c] < xmax) && (sy + vo_data->font->height < ymax) ) - draw_alpha(vo_data->font->width[c], vo_data->font->height, + draw_alpha.render(vo_data->font->width[c], vo_data->font->height, vo_data->font->pic_b[font]->bmp+vo_data->font->start[c] + cs * vo_data->font->pic_a[font]->w, vo_data->font->pic_a[font]->bmp+vo_data->font->start[c] + @@ -637,14 +596,9 @@ void menu_draw_box(const mp_image_t* mpi,unsigned char grey,unsigned char alpha, int x, int y, int w, int h) { - draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt); + OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); int g; - if(!draw_alpha) { - MSG_WARN("[libmenu] Unsupported output format\n"); - return; - } - if(x > mpi->w || y > mpi->h) return; if(x < 0) w += x, x = 0; @@ -661,7 +615,7 @@ unsigned char pic[stride*h],pic_alpha[stride*h]; memset(pic,g,stride*h); memset(pic_alpha,alpha,stride*h); - draw_alpha(w,h,pic,pic_alpha,stride, + draw_alpha.render(w,h,pic,pic_alpha,stride, mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3), mpi->stride[0],finalize); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-28 07:09:46
|
Revision: 467 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=467&view=rev Author: nickols_k Date: 2012-11-28 07:09:37 +0000 (Wed, 28 Nov 2012) Log Message: ----------- remove some ancient cfg-keys Modified Paths: -------------- mplayerxp/cfg-mplayerxp.h mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_vesa.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp mplayerxp/libvo/x11_system.cpp mplayerxp/libvo/x11_system.h mplayerxp/mplayerxp.h mplayerxp/postproc/vf_scale.cpp Modified: mplayerxp/cfg-mplayerxp.h =================================================================== --- mplayerxp/cfg-mplayerxp.h 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/cfg-mplayerxp.h 2012-11-28 07:09:37 UTC (rev 467) @@ -140,7 +140,6 @@ {NULL, NULL, 0, 0, 0, 0, NULL}, }; - static const config_t subtitle_config[]={ {"on", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, "enables subtitle-steam playback"}, {"off", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, "disables subtitle-stream playback"}, @@ -171,7 +170,7 @@ static const config_t x11_config[]={ {"display", &vo_conf.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, "specifies the hostname and display number of the X server"}, #ifdef HAVE_XINERAMA - {"xinerama", &mp_conf.xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, "tells MPlayerXP the display for movie playback"}, + {"xinerama", &vo_conf.xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, "tells MPlayerXP the display for movie playback"}, #endif {NULL, NULL, 0, 0, 0, 0, NULL}, }; @@ -191,11 +190,9 @@ static const config_t video_config[]={ {"on", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 0, 1, "enables video-steam playback"}, {"off", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 1, 0, "disables video-stream playback"}, - {"width", &vo_conf.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to width (if driver supports)"}, - {"height", &vo_conf.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to height (if driver supports)"}, - {"zoom", &vo_conf.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, "scale output image by given factor"}, - {"screenw", &vo_conf.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "specifies the horizontal resolution of the screen (if supported)"}, - {"screenh", &vo_conf.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "specifies the vertical resolution of the screen (if supported)"}, + {"width", &vo_conf.image_width, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to width (if driver supports)"}, + {"height", &vo_conf.image_height, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to height (if driver supports)"}, + {"zoom", &vo_conf.image_zoom, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, "scale output image by given factor"}, {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, "sets aspect-ratio of movies (autodetect)"}, {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, "unsets aspect-ratio of movies"}, {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, "keeps aspect-ratio of the movie during window resize"}, Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-11-28 07:09:37 UTC (rev 467) @@ -507,9 +507,9 @@ // time to do aspect ratio corrections... if(vo_conf.movie_aspect>-1.0) sh->aspect = vo_conf.movie_aspect; // cmdline overrides autodetect - if(vo_conf.opt_screen_size_x||vo_conf.opt_screen_size_y){ - screen_size_x = vo_conf.opt_screen_size_x; - screen_size_y = vo_conf.opt_screen_size_y; + if(vo_conf.image_width||vo_conf.image_height){ + screen_size_x = vo_conf.image_width; + screen_size_y = vo_conf.image_height; if(!vo_conf.vidmode){ if(!screen_size_x) screen_size_x=1; if(!screen_size_y) screen_size_y=1; @@ -520,15 +520,15 @@ // check source format aspect, calculate prescale ::atmos screen_size_x=sh->src_w; screen_size_y=sh->src_h; - if(vo_conf.screen_size_xy>=0.001){ - if(vo_conf.screen_size_xy<=8){ + if(vo_conf.image_zoom>=0.001){ + if(vo_conf.image_zoom<=8){ // -xy means x+y scale - screen_size_x*=vo_conf.screen_size_xy; - screen_size_y*=vo_conf.screen_size_xy; + screen_size_x*=vo_conf.image_zoom; + screen_size_y*=vo_conf.image_zoom; } else { // -xy means forced width while keeping correct aspect - screen_size_x=vo_conf.screen_size_xy; - screen_size_y=vo_conf.screen_size_xy*sh->src_h/sh->src_w; + screen_size_x=vo_conf.image_zoom; + screen_size_y=vo_conf.image_zoom*sh->src_h/sh->src_w; } } if(sh->aspect>0.01){ @@ -536,7 +536,7 @@ MSG_V("Movie-Aspect is %.2f:1 - prescaling to correct movie aspect.\n",sh->aspect); _w=(int)((float)screen_size_y*sh->aspect); _w+=_w%2; // round // we don't like horizontal downscale || user forced width: - if(_w<screen_size_x || vo_conf.screen_size_xy>8){ + if(_w<screen_size_x || vo_conf.image_zoom>8){ screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect)); screen_size_y+=screen_size_y%2; // round if(screen_size_y<sh->src_h) // Do not downscale verticaly Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libvo/video_out.cpp 2012-11-28 07:09:37 UTC (rev 467) @@ -55,6 +55,7 @@ flip=-1; xp_buffs=64; dbpp=0; + xinerama_screen=0; } VO_Config vo_conf; Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libvo/video_out.h 2012-11-28 07:09:37 UTC (rev 467) @@ -112,6 +112,7 @@ char * subdevice; // currently unused char* mDisplayName; + int xinerama_screen; int vsync; @@ -120,13 +121,10 @@ vo_gamma_t gamma; - unsigned screenwidth; - unsigned screenheight; + int image_width; //opt_screen_size_x + int image_height; //opt_screen_size_y + float image_zoom; //screen_size_xy - int opt_screen_size_x; - int opt_screen_size_y; - - float screen_size_xy; float movie_aspect; int fsmode; int vidmode; Modified: mplayerxp/libvo/vo_opengl.cpp =================================================================== --- mplayerxp/libvo/vo_opengl.cpp 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libvo/vo_opengl.cpp 2012-11-28 07:09:37 UTC (rev 467) @@ -166,7 +166,7 @@ flags=_flags; - aspect.save(width,height,d_width,d_height,vo_conf.screenwidth,vo_conf.screenheight); + aspect.save(width,height,d_width,d_height,glx.screen_width(),glx.screen_height()); aspect.calc(d_width,d_height,flags&VOFLAG_FULLSCREEN?Aspect::ZOOM:Aspect::NOZOOM); image_height= height; Modified: mplayerxp/libvo/vo_vesa.cpp =================================================================== --- mplayerxp/libvo/vo_vesa.cpp 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libvo/vo_vesa.cpp 2012-11-28 07:09:37 UTC (rev 467) @@ -540,10 +540,8 @@ dstW = d_width; dstH = d_height; } - if(vo_conf.screenwidth) w = vo_conf.screenwidth; - else w = std::max(dstW,width); - if(vo_conf.screenheight) h = vo_conf.screenheight; - else h = std::max(dstH,height); + w = std::max(dstW,width); + h = std::max(dstH,height); for(i=0;i < num_modes;i++) { if((err=vbeGetModeInfo(mode_ptr[i],&vmib)) != VBE_OK) { PRINT_VBE_ERR("vbeGetModeInfo",err); Modified: mplayerxp/libvo/vo_x11.cpp =================================================================== --- mplayerxp/libvo/vo_x11.cpp 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libvo/vo_x11.cpp 2012-11-28 07:09:37 UTC (rev 467) @@ -171,7 +171,7 @@ vidix->stop(); if (vidix->configure(image_width, image_height, winc.x, winc.y, winc.w, winc.h, in_format, x11.depth(), - vo_conf.screenwidth, vo_conf.screenheight) != MPXP_Ok) + x11.screen_width(), x11.screen_height()) != MPXP_Ok) { MSG_FATAL( "Can't initialize VIDIX: %s\n",strerror(errno)); delete vidix; @@ -230,7 +230,7 @@ baseAspect= ((1<<16)*d_width + d_height/2)/d_height; - aspect.save(width,height,d_width,d_height,vo_conf.screenwidth,vo_conf.screenheight); + aspect.save(width,height,d_width,d_height,x11.screen_width(),x11.screen_height()); aspect.calc(d_width,d_height,flags&VOFLAG_FULLSCREEN?Aspect::ZOOM:Aspect::NOZOOM); x11.calcpos(&hint,d_width,d_height,flags); @@ -302,7 +302,7 @@ if(vidix->configure(image_width,image_height,winc.x,winc.y, winc.w,winc.h, in_format,x11.depth(), - vo_conf.screenwidth,vo_conf.screenheight) != MPXP_Ok) { + x11.screen_width(),x11.screen_height()) != MPXP_Ok) { MSG_ERR("vo_vesa: Can't initialize VIDIX driver\n"); return MPXP_False; } else MSG_V("vo_vesa: Using VIDIX\n"); Modified: mplayerxp/libvo/vo_xv.cpp =================================================================== --- mplayerxp/libvo/vo_xv.cpp 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libvo/vo_xv.cpp 2012-11-28 07:09:37 UTC (rev 467) @@ -151,7 +151,7 @@ flags=_flags; - aspect.save(width,height,d_width,d_height,vo_conf.screenwidth,vo_conf.screenheight); + aspect.save(width,height,d_width,d_height,xv.screen_width(),xv.screen_height()); aspect.calc(d_width,d_height,flags&VOFLAG_FULLSCREEN?Aspect::ZOOM:Aspect::NOZOOM); image_height = height; Modified: mplayerxp/libvo/x11_system.cpp =================================================================== --- mplayerxp/libvo/x11_system.cpp 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libvo/x11_system.cpp 2012-11-28 07:09:37 UTC (rev 467) @@ -44,7 +44,10 @@ return 0; } -X11_System::X11_System(const char* DisplayName) { +X11_System::X11_System(const char* DisplayName) + :screenwidth(0), + screenheight(0) +{ unsigned bpp; unsigned int mask; // char * DisplayName = ":0.0"; @@ -79,13 +82,11 @@ int num_screens; screens = ::XineramaQueryScreens(mDisplay, &num_screens); - if(mp_conf.xinerama_screen >= num_screens) mp_conf.xinerama_screen = 0; - if (! vo_conf.screenwidth) - vo_conf.screenwidth=screens[mp_conf.xinerama_screen].width; - if (! vo_conf.screenheight) - vo_conf.screenheight=screens[mp_conf.xinerama_screen].height; - xinerama_x = screens[mp_conf.xinerama_screen].x_org; - xinerama_y = screens[mp_conf.xinerama_screen].y_org; + if(vo_conf.xinerama_screen >= num_screens) vo_conf.xinerama_screen = 0; + screenwidth=screens[vo_conf.xinerama_screen].width; + screenheight=screens[vo_conf.xinerama_screen].height; + xinerama_x = screens[vo_conf.xinerama_screen].x_org; + xinerama_y = screens[vo_conf.xinerama_screen].y_org; ::XFree(screens); } else @@ -94,15 +95,13 @@ { int clock; ::XF86VidModeGetModeLine( mDisplay,mScreen,&clock ,&modeline ); - if ( !vo_conf.screenwidth ) vo_conf.screenwidth=modeline.hdisplay; - if ( !vo_conf.screenheight ) vo_conf.screenheight=modeline.vdisplay; + if(!screenwidth) screenwidth=modeline.hdisplay; + if(!screenheight) screenheight=modeline.vdisplay; } #endif - if (! vo_conf.screenwidth) - vo_conf.screenwidth=DisplayWidth( mDisplay,mScreen ); - if (! vo_conf.screenheight) - vo_conf.screenheight=DisplayHeight( mDisplay,mScreen ); + if(!screenwidth) screenwidth=DisplayWidth( mDisplay,mScreen ); + if(!screenheight) screenheight=DisplayHeight( mDisplay,mScreen ); // get color depth (from root window, or the best visual): ::XGetWindowAttributes(mDisplay, mRootWin, &attribs); @@ -148,7 +147,7 @@ if (*dispName==':') mLocalDisplay=1; else mLocalDisplay=0; MSG_OK("X11_System: running %dx%d with depth %d bits/pixel (\"%s\" => %s display)\n", - vo_conf.screenwidth,vo_conf.screenheight, + screenwidth,screenheight, _depth, dispName,mLocalDisplay?"local":"remote"); } @@ -160,11 +159,15 @@ ::XCloseDisplay(mDisplay); } +unsigned X11_System::screen_width() const { return screenwidth; } +unsigned X11_System::screen_height() const { return screenheight; } + void X11_System::get_win_coord(vo_rect_t& r) const { r = curr; } + void X11_System::update_win_coord() { XWindowAttributes xwa; @@ -751,24 +754,24 @@ static uint32_t vm_width; static uint32_t vm_height; #endif - hint->x=(vo_conf.screenwidth-d_width)/2; - hint->y=(vo_conf.screenheight-d_height)/2; + hint->x=(screenwidth-d_width)/2; + hint->y=(screenheight-d_height)/2; hint->width=d_width; hint->height=d_height; #ifdef HAVE_XF86VM if ( flags & VOFLAG_MODESWITCHING ) { vm_width=d_width; vm_height=d_height; vm_switch(vm_width, vm_height,&modeline_width, &modeline_height); - hint->x=(vo_conf.screenwidth-modeline_width)/2; - hint->y=(vo_conf.screenheight-modeline_height)/2; + hint->x=(screenwidth-modeline_width)/2; + hint->y=(screenheight-modeline_height)/2; hint->width=modeline_width; hint->height=modeline_height; } else #endif if ( flags & VOFLAG_FULLSCREEN ) { - hint->width=vo_conf.screenwidth; - hint->height=vo_conf.screenheight; + hint->width=screenwidth; + hint->height=screenheight; hint->x=0; hint->y=0; } @@ -780,7 +783,7 @@ ::XUnmapWindow( mDisplay,window ); if ( !is_fs ) { prev=curr; - curr.x=0; curr.y=0; curr.w=vo_conf.screenwidth; curr.h=vo_conf.screenheight; + curr.x=0; curr.y=0; curr.w=screenwidth; curr.h=screenheight; decoration(0); } else { curr=prev; @@ -893,8 +896,8 @@ MSG_V("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y); ::XF86VidModeLockModeSwitch(mDisplay,mScreen,0); ::XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); - X=(vo_conf.screenwidth-*modeline_width)/2; - Y=(vo_conf.screenheight-*modeline_height)/2; + X=(screenwidth-*modeline_width)/2; + Y=(screenheight-*modeline_height)/2; ::XF86VidModeSetViewPort(mDisplay,mScreen,X,Y); } } @@ -908,8 +911,8 @@ vidmodes=NULL; ::XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes); for (i=0; i<modecount; i++) - if ((vidmodes[i]->hdisplay == vo_conf.screenwidth) && (vidmodes[i]->vdisplay == vo_conf.screenheight)) { - MSG_V("\nReturning to original mode %dx%d\n", vo_conf.screenwidth, vo_conf.screenheight); + if ((vidmodes[i]->hdisplay == screenwidth) && (vidmodes[i]->vdisplay == screenheight)) { + MSG_V("\nReturning to original mode %dx%d\n", screenwidth, screenheight); break; } ::XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[i]); Modified: mplayerxp/libvo/x11_system.h =================================================================== --- mplayerxp/libvo/x11_system.h 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/libvo/x11_system.h 2012-11-28 07:09:37 UTC (rev 467) @@ -35,6 +35,8 @@ X11_System(const char* DisplayName); virtual ~X11_System(); + unsigned screen_width() const; + unsigned screen_height() const; void match_visual(XVisualInfo*) const; virtual XVisualInfo* get_visual() const; virtual void create_window(const XSizeHints& hint,XVisualInfo* visual,int is_vm,unsigned depth,const char*title); @@ -90,6 +92,7 @@ ::GC gc; unsigned _depth; + unsigned screenwidth,screenheight; int dpms_disabled; int timeout_save; Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/mplayerxp.h 2012-11-28 07:09:37 UTC (rev 467) @@ -93,7 +93,6 @@ const char* npp_options; unsigned ao_channels; int z_compression; - int xinerama_screen; float monitor_pixel_aspect; }; extern MP_Config mp_conf; Modified: mplayerxp/postproc/vf_scale.cpp =================================================================== --- mplayerxp/postproc/vf_scale.cpp 2012-11-27 17:19:32 UTC (rev 466) +++ mplayerxp/postproc/vf_scale.cpp 2012-11-28 07:09:37 UTC (rev 467) @@ -291,7 +291,7 @@ break; } } - if(!vo_conf.opt_screen_size_x && !vo_conf.opt_screen_size_y && !(vo_conf.screen_size_xy >= 0.001)){ + if(!vo_conf.image_width && !vo_conf.image_height && !(vo_conf.image_zoom >= 0.001)){ // Compute new d_width and d_height, preserving aspect // while ensuring that both are >= output size in pixels. if (vf->priv->h * d_width > vf->priv->w * d_height) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-28 12:59:13
|
Revision: 473 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=473&view=rev Author: nickols_k Date: 2012-11-28 12:58:58 +0000 (Wed, 28 Nov 2012) Log Message: ----------- [demuxer] suppress warnings like: deleting 'any_t*' is undefined Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_audio.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_demuxers.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_fli.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_nsv.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawvideo.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h Added Paths: ----------- mplayerxp/libmpdemux/demux_realaud.cpp Removed Paths: ------------- mplayerxp/libmpdemux/demux_ra.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/dump.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -74,20 +74,24 @@ #define MUX_HAVE_AUDIO 0x01 #define MUX_HAVE_VIDEO 0x02 #define MUX_HAVE_SUBS 0x04 -typedef struct priv_s { - int my_use_pts; - FILE* mux_file; - muxer_t* muxer; - muxer_stream_t *m_audio,*m_video,*m_subs; - unsigned decoded_frameno; - unsigned a_frameno; - int mux_type; - uint64_t vsize,asize,ssize; - float timer_corr; /* use common time-base */ - float vtimer; - any_t* libinput; -}priv_t; +struct dump_priv_t : public Opaque { + public: + dump_priv_t() {} + virtual ~dump_priv_t() {} + int my_use_pts; + FILE* mux_file; + muxer_t* muxer; + muxer_stream_t *m_audio,*m_video,*m_subs; + unsigned decoded_frameno; + unsigned a_frameno; + int mux_type; + uint64_t vsize,asize,ssize; + float timer_corr; /* use common time-base */ + float vtimer; + any_t* libinput; +}; + void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp) { } @@ -96,7 +100,7 @@ returns: 0 - nothing interested -1 - quit */ -static int check_cmd(priv_t* priv) +static int check_cmd(dump_priv_t* priv) { mp_cmd_t* cmd; int retval; @@ -122,8 +126,8 @@ char stream_dump_name[1024]; /* TODO copy it from demuxer */ if(demuxer->priv) return; - demuxer->priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=reinterpret_cast<priv_t*>(demuxer->priv); + dump_priv_t*priv=new(zeromem) dump_priv_t; + demuxer->priv=priv; priv->libinput=libinput; /* describe other useless dumps */ priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; @@ -221,7 +225,7 @@ void dump_mux_close(demuxer_t *demuxer) { - priv_t* priv=reinterpret_cast<priv_t*>(demuxer->priv); + dump_priv_t* priv=static_cast<dump_priv_t*>(demuxer->priv); demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(d_audio->sh); @@ -281,7 +285,7 @@ void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) { - priv_t* priv=reinterpret_cast<priv_t*>(demuxer->priv); + dump_priv_t* priv=static_cast<dump_priv_t*>(demuxer->priv); demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(d_audio->sh); Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/Makefile 2012-11-28 12:58:58 UTC (rev 473) @@ -31,10 +31,10 @@ demux_null.cpp \ demux_nuv.cpp \ demux_pva.cpp \ - demux_ra.cpp \ demux_rawaudio.cpp \ demux_rawvideo.cpp \ demux_real.cpp \ + demux_realaud.cpp \ demux_roq.cpp \ demux_smjpeg.cpp \ demux_ts.cpp \ Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -30,11 +30,15 @@ } -typedef struct priv_s +struct priv_t : public Opaque { - int verc; -}priv_t; + public: + priv_t() {} + virtual ~priv_t() {} + int verc; +}; + static MPXP_Rc aiff_probe(demuxer_t* demuxer) { char buf[12]; Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_asf.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -43,21 +43,25 @@ ASF_GUID_PREFIX_stream_group =0x7bf875ce }; -typedef struct asf_priv_s +struct asf_priv_t : public Opaque { - ASF_header_t asfh; - ASF_obj_header_t objh; - ASF_file_header_t fileh; - ASF_stream_header_t streamh; - ASF_content_description_t contenth; - int asf_scrambling_h; - int asf_scrambling_w; - int asf_scrambling_b; - int asf_packetsize; - double asf_packetrate; - int asf_movielength; -}asf_priv_t; + public: + asf_priv_t() {} + virtual ~asf_priv_t() {} + ASF_header_t asfh; + ASF_obj_header_t objh; + ASF_file_header_t fileh; + ASF_stream_header_t streamh; + ASF_content_description_t contenth; + int asf_scrambling_h; + int asf_scrambling_w; + int asf_scrambling_b; + int asf_packetsize; + double asf_packetrate; + int asf_movielength; +}; + // the variable string is modify in this function void pack_asf_string(char* string, int length) { int i,j; @@ -119,7 +123,7 @@ static MPXP_Rc asf_probe(demuxer_t *demuxer){ const unsigned char asfhdrguid[16]= {0x30,0x26,0xB2,0x75,0x8E,0x66,0xCF,0x11,0xA6,0xD9,0x00,0xAA,0x00,0x62,0xCE,0x6C}; const unsigned char asf2hdrguid[16]={0xD1,0x29,0xE2,0xD6,0xDA,0x35,0xD1,0x11,0x90,0x34,0x00,0xA0,0xC9,0x03,0x49,0xBE}; - asf_priv_t *apriv; + asf_priv_t* apriv; demuxer->priv=apriv=new(zeromem) asf_priv_t; apriv->asf_scrambling_h=1; apriv->asf_scrambling_w=1; @@ -157,7 +161,7 @@ uint16_t stream_count=0; int best_video = -1; int best_audio = -1; - asf_priv_t *apriv=reinterpret_cast<asf_priv_t*>(demuxer->priv); + asf_priv_t *apriv=static_cast<asf_priv_t*>(demuxer->priv); while(!stream_eof(demuxer->stream)){ int pos,endpos; @@ -415,7 +419,7 @@ static int demux_asf_read_packet(demuxer_t *demux,off_t dataoff,int len,int id,int seq,unsigned long time,unsigned short dur,int offs,int keyframe){ demux_stream_t *ds=NULL; - asf_priv_t *apriv=reinterpret_cast<asf_priv_t*>(demux->priv); + asf_priv_t *apriv=static_cast<asf_priv_t*>(demux->priv); MSG_DBG3("demux_asf.read_packet: id=%d seq=%d len=%d time=%u dur=%u offs=%i key=%i\n",id,seq,len,time,dur,offs,keyframe); @@ -495,7 +499,7 @@ // 1 = successfully read a packet static int asf_demux(demuxer_t *demux,demux_stream_t *ds){ stream_t *stream=demux->stream; -asf_priv_t *apriv=reinterpret_cast<asf_priv_t*>(demux->priv); +asf_priv_t *apriv=static_cast<asf_priv_t*>(demux->priv); int done=0; while(!done) { @@ -685,7 +689,7 @@ static void asf_seek(demuxer_t *demuxer,const seek_args_t* seeka){ demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; - asf_priv_t *apriv=reinterpret_cast<asf_priv_t*>(demuxer->priv); + asf_priv_t *apriv=static_cast<asf_priv_t*>(demuxer->priv); sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); /*================= seek in ASF ==========================*/ Modified: mplayerxp/libmpdemux/demux_audio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_audio.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_audio.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -35,21 +35,25 @@ #define HDR_SIZE 4 -typedef struct da_priv { - int frmt; - float last_pts,pts_per_packet,length; - uint32_t dword; - int pos; - /* Xing's VBR specific extensions */ - int is_xing; - unsigned nframes; - unsigned nbytes; - int scale; - unsigned srate; - int lsf; - unsigned char toc[100]; /* like AVI's indexes */ -} da_priv_t; +struct da_priv_t : public Opaque { + public: + da_priv_t() {} + virtual ~da_priv_t() {} + int frmt; + float last_pts,pts_per_packet,length; + uint32_t dword; + int pos; + /* Xing's VBR specific extensions */ + int is_xing; + unsigned nframes; + unsigned nbytes; + int scale; + unsigned srate; + int lsf; + unsigned char toc[100]; /* like AVI's indexes */ +}; + static int hr_mp3_seek = 0; #define DDCA_MONO 0 @@ -874,7 +878,7 @@ assert(demuxer->stream != NULL); #endif - priv = (da_priv_t*)mp_mallocz(sizeof(da_priv_t)); + priv = new(zeromem) da_priv_t; s = demuxer->stream; stream_reset(s); stream_seek(s,s->start_pos); @@ -1398,7 +1402,7 @@ #endif sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); demux = demuxer; - priv = reinterpret_cast<da_priv_t*>(demux->priv); + priv = static_cast<da_priv_t*>(demux->priv); s = demux->stream; seof=stream_eof(s); @@ -1571,7 +1575,7 @@ static void high_res_mp3_seek(demuxer_t *demuxer,float _time) { uint8_t hdr[4]; int len,nf; - da_priv_t* priv = reinterpret_cast<da_priv_t*>(demuxer->priv); + da_priv_t* priv = static_cast<da_priv_t*>(demuxer->priv); sh_audio_t* sh = (sh_audio_t*)demuxer->audio->sh; nf = _time*sh->rate/1152; @@ -1593,7 +1597,7 @@ uint8_t hdr[8]; int len,nf; unsigned tmp; - da_priv_t* priv = reinterpret_cast<da_priv_t*>(demuxer->priv); + da_priv_t* priv = static_cast<da_priv_t*>(demuxer->priv); sh_audio_t* sh = (sh_audio_t*)demuxer->audio->sh; nf = _time*sh->rate/1152; @@ -1615,7 +1619,7 @@ uint8_t hdr[12]; int len,nf; unsigned tmp; - da_priv_t* priv = reinterpret_cast<da_priv_t*>(demuxer->priv); + da_priv_t* priv = static_cast<da_priv_t*>(demuxer->priv); sh_audio_t* sh = (sh_audio_t*)demuxer->audio->sh; nf = _time*sh->rate/1152; @@ -1642,7 +1646,7 @@ if(!(sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh))) return; s = demuxer->stream; - priv = reinterpret_cast<da_priv_t*>(demuxer->priv); + priv = static_cast<da_priv_t*>(demuxer->priv); if(priv->frmt==RAW_MUSEPACK) { s = demuxer->stream; @@ -1763,11 +1767,10 @@ } static void audio_close(demuxer_t* demuxer) { - da_priv_t* priv = reinterpret_cast<da_priv_t*>(demuxer->priv); + da_priv_t* priv = static_cast<da_priv_t*>(demuxer->priv); - if(!priv) - return; - delete priv; + if(!priv) return; + delete priv; } static MPXP_Rc audio_control(const demuxer_t *demuxer,int cmd,any_t*args) Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -3,6 +3,8 @@ using namespace mpxp; /* AVI file parser for DEMUXER v2.9 by A'rpi/ESP-team */ +#include <algorithm> + #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -21,38 +23,45 @@ #include "demux_msg.h" typedef int (*alt_demuxer_t)(demuxer_t *demux,demux_stream_t *__ds); -typedef struct { - // index stuff: - AVIINDEXENTRY* idx; - int idx_size; - off_t idx_pos; - off_t idx_pos_a; - off_t idx_pos_v; - off_t idx_offset; // ennyit kell hozzaadni az index offset ertekekhez - // bps-based PTS stuff: - int video_pack_no; - int audio_block_size; - off_t audio_block_no; - // interleaved PTS stuff: - int skip_video_frames; - int audio_streams; - float avi_audio_pts; - float avi_video_pts; - float pts_correction; - unsigned int pts_corr_bytes; - unsigned char pts_corrected; - unsigned char pts_has_video; - unsigned int numberofframes; - avisuperindex_chunk *suidx; - unsigned int suidx_size; - int nini; - int is_odml; - alt_demuxer_t alt_demuxer; -} avi_priv_t; +struct avi_priv_t : public Opaque { + public: + avi_priv_t() {} + virtual ~avi_priv_t(); + // index stuff: + AVIINDEXENTRY* idx; + int idx_size; + off_t idx_pos; + off_t idx_pos_a; + off_t idx_pos_v; + off_t idx_offset; // ennyit kell hozzaadni az index offset ertekekhez + // bps-based PTS stuff: + int video_pack_no; + int audio_block_size; + off_t audio_block_no; + // interleaved PTS stuff: + int skip_video_frames; + int audio_streams; + float avi_audio_pts; + float avi_video_pts; + float pts_correction; + unsigned int pts_corr_bytes; + unsigned char pts_corrected; + unsigned char pts_has_video; + unsigned int numberofframes; + avisuperindex_chunk *suidx; + unsigned int suidx_size; + int nini; + int is_odml; + alt_demuxer_t alt_demuxer; +}; + +avi_priv_t::~avi_priv_t() { + if(idx_size > 0) delete idx; +} + #define MAX_PACKS 4096 -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define AVI_IDX_OFFSET(x) ((((uint64_t)(x)->dwFlags&0xffff0000)<<16)+(x)->dwChunkOffset) +inline uint64_t avi_idx_offset(AVIINDEXENTRY* x) { return ((x->dwFlags&0xffff0000)<<16)+x->dwChunkOffset; } static int odml_get_vstream_id(int id, unsigned char res[]) { @@ -70,8 +79,8 @@ } static int avi_idx_cmp(const any_t*elem1,const any_t*elem2) { - register off_t a = AVI_IDX_OFFSET((AVIINDEXENTRY *)elem1); - register off_t b = AVI_IDX_OFFSET((AVIINDEXENTRY *)elem2); + register off_t a = avi_idx_offset((AVIINDEXENTRY *)elem1); + register off_t b = avi_idx_offset((AVIINDEXENTRY *)elem2); return (a > b) - (b > a); } @@ -116,7 +125,7 @@ int stream_id=-1; int idxfix_videostream=0; int idxfix_divx=0; -avi_priv_t* priv=reinterpret_cast<avi_priv_t*>(demuxer->priv); +avi_priv_t* priv=static_cast<avi_priv_t*>(demuxer->priv); off_t list_end=0; //---- AVI header: @@ -240,17 +249,17 @@ case mmioFOURCC('I','D','I','T'): hdr="Digitization Time";break; case ckidAVIMAINHDR: // read 'avih' - stream_read(demuxer->stream,(char*) &avih,MIN(size2,sizeof(avih))); + stream_read(demuxer->stream,(char*) &avih,std::min((unsigned long)size2,sizeof(avih))); le2me_MainAVIHeader(&avih); // swap to machine endian - chunksize-=MIN(size2,sizeof(avih)); + chunksize-=std::min((unsigned long)size2,sizeof(avih)); demuxer->movi_length=avih.dwTotalFrames; if(mp_conf.verbose) print_avih(&avih); else print_avih_flags(&avih); break; case ckidSTREAMHEADER: { // read 'strh' AVIStreamHeader h; - stream_read(demuxer->stream,(char*) &h,MIN(size2,sizeof(h))); + stream_read(demuxer->stream,(char*) &h,std::min((unsigned long)size2,sizeof(h))); le2me_AVIStreamHeader(&h); // swap to machine endian - chunksize-=MIN(size2,sizeof(h)); + chunksize-=std::min((unsigned long)size2,sizeof(h)); ++stream_id; if(h.fccType==mmioFOURCC('i','a','v','s')){ MSG_FATAL("DVDS chunk found!!! Still is not suupported\n"); @@ -587,7 +596,7 @@ if (!(idx->dwFlags & AVIIF_KEYFRAME) && idx->ckid == db) break; } if (i<priv->idx_size && db) { - stream_seek(demuxer->stream, AVI_IDX_OFFSET(idx)); + stream_seek(demuxer->stream, avi_idx_offset(idx)); id = stream_read_dword_le(demuxer->stream); if (id && id != db) // index fcc and real fcc differ? fix it. for (idx = &((AVIINDEXENTRY *)priv->idx)[0], i=0; i<priv->idx_size; i++, idx++){ @@ -767,7 +776,7 @@ if(stream_id==demux->audio->id){ if(!demux->audio->sh){ sh_audio_t* sh; - avi_priv_t *priv=reinterpret_cast<avi_priv_t*>(demux->priv); + avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); demux->audio->sh=sh=reinterpret_cast<sh_audio_t*>(demux->a_streams[stream_id]); MSG_V("Auto-selected AVI audio ID = %d\n",demux->audio->id); if(sh->wf){ @@ -831,7 +840,7 @@ } static int demux_avi_read_packet(demuxer_t *demux,demux_stream_t *ds,unsigned int id,unsigned int len,int idxpos,int flags){ - avi_priv_t *priv=reinterpret_cast<avi_priv_t*>(demux->priv); + avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); int skip; float pts=0; @@ -897,7 +906,7 @@ static int avi_read_nini(demuxer_t *demux,demux_stream_t* ds); static int avi_demux(demuxer_t *demux,demux_stream_t *__ds){ - avi_priv_t *priv=reinterpret_cast<avi_priv_t*>(demux->priv); + avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); if(priv->alt_demuxer) return priv->alt_demuxer(demux,__ds); unsigned int id=0; unsigned int len; @@ -923,7 +932,7 @@ continue; // skip this chunk } - pos = (off_t)priv->idx_offset+AVI_IDX_OFFSET(idx); + pos = (off_t)priv->idx_offset+avi_idx_offset(idx); if((pos<demux->movi_start || pos>=demux->movi_end) && (demux->movi_end>demux->movi_start) && (demux->flags & DEMUXF_SEEKABLE)){ MSG_V("ChunkOffset out of range! idx=0x%X \n",pos); continue; @@ -999,7 +1008,7 @@ // 0 = EOF or no stream found // 1 = successfully read a packet static int avi_read_ni(demuxer_t *demux,demux_stream_t* ds){ -avi_priv_t *priv=reinterpret_cast<avi_priv_t*>(demux->priv); +avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); unsigned int id=0; unsigned int len; int ret=0; @@ -1069,7 +1078,7 @@ // 0 = EOF or no stream found // 1 = successfully read a packet static int avi_read_nini(demuxer_t *demux,demux_stream_t* ds){ -avi_priv_t *priv=reinterpret_cast<avi_priv_t*>(demux->priv); +avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); unsigned int id=0; unsigned int len; int ret=0; @@ -1177,7 +1186,7 @@ for(i=0;i<priv->idx_size;i++){ AVIINDEXENTRY* idx=&((AVIINDEXENTRY *)priv->idx)[i]; demux_stream_t* ds=demux_avi_select_stream(demuxer,idx->ckid); - off_t pos = priv->idx_offset + AVI_IDX_OFFSET(idx); + off_t pos = priv->idx_offset + avi_idx_offset(idx); if(a_pos==-1 && ds==demuxer->audio){ a_pos=pos; if(v_pos!=-1) break; @@ -1300,7 +1309,7 @@ } static void avi_seek(demuxer_t *demuxer,const seek_args_t* seeka){ - avi_priv_t *priv=reinterpret_cast<avi_priv_t*>(demuxer->priv); + avi_priv_t *priv=static_cast<avi_priv_t*>(demuxer->priv); demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); @@ -1480,9 +1489,7 @@ //d_audio->pts=0; // PTS is outdated because of the raw data skipping } mpca_resync_stream(sh_audio->decoder); - // sh_audio->timer=-skip_audio_secs; - } d_video->pts=priv->avi_video_pts; // OSD } @@ -1503,11 +1510,10 @@ static void avi_close(demuxer_t *demuxer) { - avi_priv_t* priv=reinterpret_cast<avi_priv_t*>(demuxer->priv); + avi_priv_t* priv=static_cast<avi_priv_t*>(demuxer->priv); if(!priv) return; - if(priv->idx_size > 0) delete priv->idx; delete priv; } Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -199,11 +199,15 @@ #else -typedef struct { - int image_size; - int image_offset; -} bmp_image_t; +struct bmp_image_t : public Opaque { + public: + bmp_image_t() {} + virtual ~bmp_image_t() {} + int image_size; + int image_offset; +}; + // Check if a file is a BMP file depending on whether starts with 'BM' static MPXP_Rc bmp_probe(demuxer_t *demuxer) { @@ -218,7 +222,7 @@ // 1 = successfully read a packet static int bmp_demux(demuxer_t *demuxer,demux_stream_t *__ds) { - bmp_image_t *bmp_image = reinterpret_cast<bmp_image_t*>(demuxer->priv); + bmp_image_t *bmp_image = static_cast<bmp_image_t*>(demuxer->priv); stream_reset(demuxer->stream); stream_seek(demuxer->stream, bmp_image->image_offset); @@ -291,7 +295,7 @@ } static void bmp_close(demuxer_t* demuxer) { - bmp_image_t *bmp_image = reinterpret_cast<bmp_image_t*>(demuxer->priv); + bmp_image_t *bmp_image = static_cast<bmp_image_t*>(demuxer->priv); if(!bmp_image) return; Modified: mplayerxp/libmpdemux/demux_demuxers.cpp =================================================================== --- mplayerxp/libmpdemux/demux_demuxers.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_demuxers.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -9,33 +9,42 @@ #include "stheader.h" #include "demux_msg.h" -typedef struct dd_priv { - demuxer_t* vd; - demuxer_t* ad; - demuxer_t* sd; -} dd_priv_t; +struct dd_priv_t : public Opaque { + public: + dd_priv_t() {} + virtual ~dd_priv_t(); + demuxer_t* vd; + demuxer_t* ad; + demuxer_t* sd; +}; +dd_priv_t::~dd_priv_t() { + if(vd) FREE_DEMUXER(vd); + if(ad && ad != vd) FREE_DEMUXER(ad); + if(sd && sd != vd && sd != ad) FREE_DEMUXER(sd); +} + demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) { - demuxer_t* ret; - dd_priv_t* priv; + demuxer_t* ret; + dd_priv_t* priv; - ret = (demuxer_t*)mp_calloc(1,sizeof(demuxer_t)); + ret = new(zeromem) demuxer_t; - priv = (dd_priv_t*)mp_malloc(sizeof(dd_priv_t)); - priv->vd = vd; - priv->ad = ad; - priv->sd = sd; - ret->priv = priv; + priv = new(zeromem) dd_priv_t; + priv->vd = vd; + priv->ad = ad; + priv->sd = sd; + ret->priv = priv; - ret->file_format = DEMUXER_TYPE_DEMUXERS; - // Video is the most important :-) - ret->stream = vd->stream; - ret->flags = (vd->flags&DEMUXF_SEEKABLE) && (ad->flags&DEMUXF_SEEKABLE) && (sd->flags&DEMUXF_SEEKABLE); + ret->file_format = DEMUXER_TYPE_DEMUXERS; + // Video is the most important :-) + ret->stream = vd->stream; + ret->flags = (vd->flags&DEMUXF_SEEKABLE) && (ad->flags&DEMUXF_SEEKABLE) && (sd->flags&DEMUXF_SEEKABLE); - ret->video = vd->video; - ret->audio = ad->audio; - ret->sub = sd->sub; + ret->video = vd->video; + ret->audio = ad->audio; + ret->sub = sd->sub; check_pin("demuxer",ad->pin,DEMUX_PIN); check_pin("demuxer",vd->pin,DEMUX_PIN); @@ -44,7 +53,7 @@ } static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) { - dd_priv_t* priv=reinterpret_cast<dd_priv_t*>(demux->priv); + dd_priv_t* priv=static_cast<dd_priv_t*>(demux->priv); if(ds->demuxer == priv->vd) return demux_fill_buffer(priv->vd,ds); @@ -58,7 +67,7 @@ } static void demux_demuxers_seek(demuxer_t *demuxer,const seek_args_t* seeka) { - dd_priv_t* priv=reinterpret_cast<dd_priv_t*>(demuxer->priv); + dd_priv_t* priv=static_cast<dd_priv_t*>(demuxer->priv); float pos; seek_args_t seek_p = { seeka->secs, 1 }; @@ -83,19 +92,11 @@ if(priv->sd != priv->vd) demux_seek(priv->sd,&seek_p); - } static void demux_close_demuxers(demuxer_t* demuxer) { - dd_priv_t* priv = reinterpret_cast<dd_priv_t*>(demuxer->priv); + dd_priv_t* priv = static_cast<dd_priv_t*>(demuxer->priv); - if(priv->vd) - FREE_DEMUXER(priv->vd); - if(priv->ad && priv->ad != priv->vd) - FREE_DEMUXER(priv->ad); - if(priv->sd && priv->sd != priv->vd && priv->sd != priv->ad) - FREE_DEMUXER(priv->sd); - delete priv; demux_info_free(demuxer); delete demuxer; Modified: mplayerxp/libmpdemux/demux_dv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dv.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_dv.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -39,15 +39,19 @@ #define DV_PAL_FRAME_SIZE 144000 #define DV_NTSC_FRAME_SIZE 122000 -typedef struct +struct rawdv_frames_t : public Opaque { - int current_frame; - int frame_size; - off_t current_filepos; - int frame_number; - dv_decoder_t *decoder; -} rawdv_frames_t; + public: + rawdv_frames_t() {} + virtual ~rawdv_frames_t() {}; + int current_frame; + int frame_size; + off_t current_filepos; + int frame_number; + dv_decoder_t *decoder; +}; + static void dv_seek(demuxer_t *demuxer,const seek_args_t* seeka) { rawdv_frames_t *frames = reinterpret_cast<rawdv_frames_t*>(demuxer->priv); @@ -100,7 +104,7 @@ // 1 = successfully read a packet static int dv_demux(demuxer_t *demuxer, demux_stream_t *ds) { - rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv; + rawdv_frames_t *frames = static_cast<rawdv_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); int bytes_read=0; // fprintf(stderr,"demux_rawdv_fill_buffer() seek to %qu, size: %d\n",frames->current_filepos,frames->frame_size); @@ -225,11 +229,10 @@ static void dv_close(demuxer_t* demuxer) { - rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv; + rawdv_frames_t *frames = static_cast<rawdv_frames_t*>(demuxer->priv); - if(frames==0) - return; - delete frames; + if(frames==0) return; + delete frames; } static MPXP_Rc dv_control(const demuxer_t *demuxer,int cmd, any_t*arg) { Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_film.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -33,26 +33,33 @@ typedef struct _film_chunk_t { - off_t chunk_offset; - int chunk_size; - unsigned int syncinfo1; - unsigned int syncinfo2; + off_t chunk_offset; + int chunk_size; + unsigned int syncinfo1; + unsigned int syncinfo2; - float pts; + float pts; } film_chunk_t; -typedef struct _film_data_t -{ - unsigned int total_chunks; - unsigned int current_chunk; - film_chunk_t *chunks; - unsigned int chunks_per_second; - unsigned int film_version; -} film_data_t; +struct film_data_t : public Opaque { + public: + film_data_t() {} + virtual ~film_data_t(); + unsigned int total_chunks; + unsigned int current_chunk; + film_chunk_t *chunks; + unsigned int chunks_per_second; + unsigned int film_version; +}; + +film_data_t::~film_data_t() { + if(chunks) delete chunks; +} + static void film_seek(demuxer_t *demuxer, const seek_args_t* seeka) { - film_data_t *film_data = (film_data_t *)demuxer->priv; + film_data_t *film_data = static_cast<film_data_t*>(demuxer->priv); int new_current_chunk=(seeka->flags&DEMUX_SEEK_SET)?0:film_data->current_chunk; new_current_chunk += seeka->secs *(seeka->flags&DEMUX_SEEK_PERCENTS?film_data->total_chunks:film_data->chunks_per_second); @@ -90,7 +97,7 @@ int cvid_size; sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); sh_audio_t *sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); - film_data_t *film_data = (film_data_t *)demuxer->priv; + film_data_t *film_data = static_cast<film_data_t*>(demuxer->priv); film_chunk_t film_chunk; int length_fix_bytes; Demux_Packet* dp; @@ -210,7 +217,7 @@ int counting_chunks; unsigned int total_audio_bytes = 0; - film_data = (film_data_t *)mp_malloc(sizeof(film_data_t)); + film_data = new(zeromem) film_data_t; film_data->total_chunks = 0; film_data->current_chunk = 0; film_data->chunks = NULL; @@ -426,14 +433,10 @@ } static void film_close(demuxer_t* demuxer) { - film_data_t *film_data = reinterpret_cast<film_data_t*>(demuxer->priv); + film_data_t *film_data = reinterpret_cast<film_data_t*>(demuxer->priv); - if(!film_data) - return; - if(film_data->chunks) - delete film_data->chunks; - delete film_data; - + if(!film_data) return; + delete film_data; } static MPXP_Rc film_control(const demuxer_t *demuxer,int cmd,any_t*args) Modified: mplayerxp/libmpdemux/demux_fli.cpp =================================================================== --- mplayerxp/libmpdemux/demux_fli.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_fli.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -20,15 +20,24 @@ #include "stheader.h" #include "demux_msg.h" -typedef struct _fli_frames_t { - int num_frames; - int current_frame; - off_t *filepos; - unsigned int *frame_size; -} fli_frames_t; +struct fli_frames_t : public Opaque { + public: + fli_frames_t() {} + virtual ~fli_frames_t(); + int num_frames; + int current_frame; + off_t *filepos; + unsigned int *frame_size; +}; + +fli_frames_t::~fli_frames_t() { + if(filepos) delete filepos; + if(frame_size) delete frame_size; +} + static void fli_seek(demuxer_t *demuxer,const seek_args_t* seeka){ - fli_frames_t *frames = reinterpret_cast<fli_frames_t*>(demuxer->priv); + fli_frames_t *frames = static_cast<fli_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); int newpos=(seeka->flags&DEMUX_SEEK_SET)?0:frames->current_frame; newpos+=seeka->secs*(seeka->flags&DEMUX_SEEK_PERCENTS?frames->num_frames:sh_video->fps); @@ -41,7 +50,7 @@ // 0 = EOF or no stream found // 1 = successfully read a packet static int fli_demux(demuxer_t *demuxer,demux_stream_t *__ds){ - fli_frames_t *frames = reinterpret_cast<fli_frames_t*>(demuxer->priv); + fli_frames_t *frames = static_cast<fli_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); // see if the end has been reached @@ -77,7 +86,7 @@ static demuxer_t* fli_open(demuxer_t* demuxer){ sh_video_t *sh_video = NULL; - fli_frames_t *frames = (fli_frames_t *)mp_malloc(sizeof(fli_frames_t)); + fli_frames_t *frames = new(zeromem) fli_frames_t; int frame_number; int speed; unsigned int frame_size; @@ -88,7 +97,7 @@ stream_reset(demuxer->stream); stream_seek(demuxer->stream, 0); - header = (unsigned char*)mp_malloc(sizeof(BITMAPINFOHEADER) + 128); + header = new unsigned char[sizeof(BITMAPINFOHEADER) + 128]; stream_read(demuxer->stream, header + sizeof(BITMAPINFOHEADER), 128); stream_seek(demuxer->stream, 0); @@ -103,7 +112,7 @@ magic_number); delete header; delete frames; - return(NULL); + return NULL; } // fetch the number of frames @@ -179,17 +188,11 @@ } static void fli_close(demuxer_t* demuxer) { - fli_frames_t *frames = reinterpret_cast<fli_frames_t*>(demuxer->priv); + fli_frames_t *frames = static_cast<fli_frames_t*>(demuxer->priv); - if(!frames) - return; + if(!frames) return; - if(frames->filepos) - delete frames->filepos; - if(frames->frame_size) - delete frames->frame_size; - - delete frames; + delete frames; } static MPXP_Rc fli_control(const demuxer_t *demuxer,int cmd,any_t*args) Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -38,16 +38,28 @@ #define BIO_BUFFER_SIZE 32768 -typedef struct lavf_priv_t{ - AVInputFormat *avif; - AVFormatContext *avfc; - AVIOContext *pb; - uint8_t buffer[BIO_BUFFER_SIZE]; - int audio_streams; - int video_streams; - int64_t last_pts; -}lavf_priv_t; +struct lavf_priv_t : public Opaque { + public: + lavf_priv_t() {} + virtual ~lavf_priv_t(); + AVInputFormat *avif; + AVFormatContext *avfc; + AVIOContext *pb; + uint8_t buffer[BIO_BUFFER_SIZE]; + int audio_streams; + int video_streams; + int64_t last_pts; +}; + +lavf_priv_t::~lavf_priv_t() { + if(avfc) { + av_freep(&avfc->key); + avformat_close_input(&avfc); + } + av_freep(&pb); +} + static char *opt_format; static char *opt_cryptokey; extern int ts_prog; @@ -173,8 +185,8 @@ AVProbeData avpd; uint8_t buf[PROBE_BUF_SIZE]; lavf_priv_t *priv; - if(!demuxer->priv) demuxer->priv=new(zeromem) lavf_priv_t; - priv= reinterpret_cast<lavf_priv_t*>(demuxer->priv); + priv=new(zeromem) lavf_priv_t; + demuxer->priv=priv; av_register_all(); if(mp_conf.verbose>1) av_log_set_level(AV_LOG_DEBUG); @@ -216,7 +228,7 @@ static demuxer_t* lavf_open(demuxer_t *demuxer){ AVFormatContext *avfc; - lavf_priv_t *priv= reinterpret_cast<lavf_priv_t*>(demuxer->priv); + lavf_priv_t *priv= static_cast<lavf_priv_t*>(demuxer->priv); unsigned j; int err,i,g; char mp_filename[256]="mpxp:"; @@ -402,7 +414,7 @@ static int lavf_demux(demuxer_t *demux, demux_stream_t *dsds){ UNUSED(dsds); - lavf_priv_t *priv= reinterpret_cast<lavf_priv_t*>(demux->priv); + lavf_priv_t *priv= static_cast<lavf_priv_t*>(demux->priv); AVPacket pkt; Demux_Packet *dp; demux_stream_t *ds; @@ -440,20 +452,9 @@ return 1; } - if(0/*pkt.destruct == av_destruct_packet*/){ - //ok kids, dont try this at home :) - dp=new(zeromem) Demux_Packet(pkt.size); - dp->len=pkt.size; - dp->next=NULL; -// dp->refcount=1; -// dp->master=NULL; - dp->buffer=pkt.data; - pkt.destruct= NULL; - }else{ - dp=new(zeromem) Demux_Packet(pkt.size); - memcpy(dp->buffer, pkt.data, pkt.size); - av_free_packet(&pkt); - } + dp=new(zeromem) Demux_Packet(pkt.size); + memcpy(dp->buffer, pkt.data, pkt.size); + av_free_packet(&pkt); if(pkt.pts != AV_NOPTS_VALUE){ dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base); @@ -467,7 +468,7 @@ } static void lavf_seek(demuxer_t *demuxer,const seek_args_t* seeka){ - lavf_priv_t *priv = reinterpret_cast<lavf_priv_t*>(demuxer->priv); + lavf_priv_t *priv = static_cast<lavf_priv_t*>(demuxer->priv); MSG_DBG2("lavf_demux(%p, %f, %d)\n", demuxer, seeka->secs, seeka->flags); av_seek_frame(priv->avfc, -1, priv->last_pts + seeka->secs*AV_TIME_BASE, seeka->secs < 0 ? AVSEEK_FLAG_BACKWARD : 0); @@ -483,14 +484,10 @@ static void lavf_close(demuxer_t *demuxer) { - lavf_priv_t* priv = reinterpret_cast<lavf_priv_t*>(demuxer->priv); + lavf_priv_t* priv = static_cast<lavf_priv_t*>(demuxer->priv); if (priv){ - if(priv->avfc) { - av_freep(&priv->avfc->key); - avformat_close_input(&priv->avfc); - } - av_freep(&priv->pb); - delete priv; demuxer->priv= NULL; + delete priv; + demuxer->priv=NULL; } } Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -567,51 +567,97 @@ char* name; } demux_chapter_t; -typedef struct mkv_demuxer -{ - off_t segment_start; +struct mkv_demuxer_t : public Opaque { + public: + mkv_demuxer_t() {} + virtual ~mkv_demuxer_t(); - float duration, last_pts; - uint64_t last_filepos; + void free_cached_dps (); + void free_trackentry(mkv_track_t *track); - mkv_track_t **tracks; - int num_tracks; + off_t segment_start; - uint64_t tc_scale, cluster_tc, first_tc; - int has_first_tc; + float duration, last_pts; + uint64_t last_filepos; - uint64_t cluster_size; - uint64_t blockgroup_size; + mkv_track_t **tracks; + unsigned num_tracks; - mkv_index_t *indexes; - int num_indexes; + uint64_t tc_scale, cluster_tc, first_tc; + int has_first_tc; - off_t *parsed_cues; - int parsed_cues_num; - off_t *parsed_seekhead; - int parsed_seekhead_num; + uint64_t cluster_size; + uint64_t blockgroup_size; - uint64_t *cluster_positions; - int num_cluster_pos; + mkv_index_t *indexes; + int num_indexes; - int64_t skip_to_timecode; - int v_skip_to_keyframe, a_skip_to_keyframe; + off_t *parsed_cues; + int parsed_cues_num; + off_t *parsed_seekhead; + int parsed_seekhead_num; - int64_t stop_timecode; + uint64_t *cluster_positions; + int num_cluster_pos; - int last_aid; - int audio_tracks[MAX_A_STREAMS]; + int64_t skip_to_timecode; + int v_skip_to_keyframe, a_skip_to_keyframe; - mkv_attachment_t *attachments; - int num_attachments; + int64_t stop_timecode; + + int last_aid; + int audio_tracks[MAX_A_STREAMS]; + + mkv_attachment_t *attachments; + unsigned num_attachments; /* TODO: move this stuff into demuxer somehow!*/ - demux_chapter_t* chapters; - int num_chapters; + demux_chapter_t* chapters; + int num_chapters; +/* For VobSubs and SSA/ASS */ + mkv_sh_sub_t *sh_sub; +}; - /* For VobSubs and SSA/ASS */ - mkv_sh_sub_t *sh_sub; -} mkv_demuxer_t; +static void demux_mkv_free_encodings(mkv_content_encoding_t *encodings, int numencodings); +/** + * \brief mp_free any data associated with given track + * \param track track of which to mp_free data + */ +void mkv_demuxer_t::free_trackentry(mkv_track_t *track) { + if (track->name) delete track->name; + if (track->codec_id) delete track->codec_id; + if (track->language) delete track->language; + if (track->private_data) delete track->private_data; + if (track->audio_buf) delete track->audio_buf; + if (track->audio_timestamp) delete track->audio_timestamp; +#ifdef USE_ASS + if (track->sh_sub && track->sh_sub->ass_track) ass_free_track (track->sh_sub->ass_track); +#endif + demux_mkv_free_encodings(track->encodings, track->num_encodings); + delete track; +} +mkv_demuxer_t::~mkv_demuxer_t() { + unsigned i; + free_cached_dps (); + if (tracks) { + for (i=0; i<num_tracks; i++) + free_trackentry(tracks[i]); + delete tracks; + } + if (indexes) delete indexes; + if (cluster_positions) delete cluster_positions; + if (parsed_cues) delete parsed_cues; + if (parsed_seekhead) delete parsed_seekhead; + if (attachments) { + for (i = 0; i < num_attachments; ++i) { + if (attachments[i].name) delete attachments[i].name; + if (attachments[i].mime) delete attachments[i].mime; + if (attachments[i].data) delete attachments[i].data; + } + delete attachments; + } +} + static int mkv_add_chapter(mkv_demuxer_t* demuxer, const char* name, uint64_t start, uint64_t end){ if (demuxer->chapters == NULL) demuxer->chapters = new demux_chapter_t[32]; @@ -645,8 +691,7 @@ *array = mp_realloc(*array, (nelem + 32) * elsize); } -static mkv_track_t * -demux_mkv_find_track_by_num (mkv_demuxer_t *d, int n, int type) +static mkv_track_t * demux_mkv_find_track_by_num (mkv_demuxer_t *d, int n, int type) { int i, id; @@ -841,16 +886,14 @@ * * \param demuxer The demuxer for which the cache is to be freed. */ -static void -free_cached_dps (demuxer_t *demuxer) +void mkv_demuxer_t::free_cached_dps () { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; mkv_track_t *track; int i, k; - for (k = 0; k < mkv_d->num_tracks; k++) + for (k = 0; k < num_tracks; k++) { - track = mkv_d->tracks[k]; + track = tracks[k]; for (i = 0; i < track->num_cached_dps; i++) delete track->cached_dps[i]; delete track->cached_dps; track->cached_dps = NULL; @@ -1010,7 +1053,7 @@ static int demux_mkv_read_info (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; uint64_t length, l; int il; @@ -1356,36 +1399,10 @@ return len; } -/** - * \brief mp_free any data associated with given track - * \param track track of which to mp_free data - */ -static void -demux_mkv_free_trackentry(mkv_track_t *track) { - if (track->name) - delete track->name; - if (track->codec_id) - delete track->codec_id; - if (track->language) - delete track->language; - if (track->private_data) - delete track->private_data; - if (track->audio_buf) - delete track->audio_buf; - if (track->audio_timestamp) - delete track->audio_timestamp; -#ifdef USE_ASS - if (track->sh_sub && track->sh_sub->ass_track) - ass_free_track (track->sh_sub->ass_track); -#endif - demux_mkv_free_encodings(track->encodings, track->num_encodings); - delete track; -} - static int demux_mkv_read_trackentry (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; mkv_track_t *track; uint64_t len, length, l; @@ -1559,14 +1576,14 @@ return len; err_out: - demux_mkv_free_trackentry(track); + mkv_d->free_trackentry(track); return 0; } static int demux_mkv_read_tracks (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; uint64_t length, l; int il; @@ -1601,7 +1618,7 @@ static int demux_mkv_read_cues (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; uint64_t length, l, time, track, pos; off_t off; @@ -1717,7 +1734,7 @@ static int demux_mkv_read_chapters (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; uint64_t length, l; int il; @@ -1811,7 +1828,7 @@ if (!name) name = mp_strdup("(unnamed)"); - cid = mkv_add_chapter(reinterpret_cast<mkv_demuxer_t*>(demuxer->priv), name, start, end); + cid = mkv_add_chapter(static_cast<mkv_demuxer_t*>(demuxer->priv), name, start, end); MSG_V( "[mkv] Chapter %u from %02d:%02d:%02d." @@ -1861,7 +1878,7 @@ static int demux_mkv_read_attachments (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; uint64_t length, l; int il; @@ -1976,7 +1993,7 @@ static int demux_mkv_read_seekhead (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; uint64_t length, l, seek_pos, saved_pos, num; uint32_t seek_id; @@ -2109,7 +2126,7 @@ static void display_create_tracks (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *)demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); int i, vid=0, aid=0, sid=0; for (i=0; i<mkv_d->num_tracks; i++) @@ -2330,7 +2347,7 @@ static int demux_mkv_open_audio (demuxer_t *demuxer, mkv_track_t *track, int aid) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); sh_audio_t *sh_a = new_sh_audio_aid(demuxer, track->tnum, aid); Demux_Packet *dp; if(!sh_a) return 1; @@ -2657,7 +2674,7 @@ static void demux_mkv_parse_vobsub_data (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track; int i, m; unsigned size; @@ -2699,7 +2716,7 @@ static void demux_mkv_parse_ass_data (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track; int i, m, size; uint8_t *buffer; @@ -3058,39 +3075,9 @@ static void mkv_close (demuxer_t *demuxer) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); - if (mkv_d) - { - int i; - free_cached_dps (demuxer); - if (mkv_d->tracks) - { - for (i=0; i<mkv_d->num_tracks; i++) - demux_mkv_free_trackentry(mkv_d->tracks[i]); - delete mkv_d->tracks; - } - if (mkv_d->indexes) - delete mkv_d->indexes; - if (mkv_d->cluster_positions) - delete mkv_d->cluster_positions; - if (mkv_d->parsed_cues) - delete mkv_d->parsed_cues; - if (mkv_d->parsed_seekhead) - delete mkv_d->parsed_seekhead; - if (mkv_d->attachments) { - for (i = 0; i < mkv_d->num_attachments; ++i) { - if (mkv_d->attachments[i].name) - delete mkv_d->attachments[i].name; - if (mkv_d->attachments[i].mime) - delete mkv_d->attachments[i].mime; - if (mkv_d->attachments[i].data) - delete mkv_d->attachments[i].data; - } - delete mkv_d->attachments; - } - delete mkv_d; - } + if (mkv_d) delete mkv_d; } static int @@ -3282,7 +3269,7 @@ handle_realvideo (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer, uint32_t size, int block_bref) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); Demux_Packet *dp; uint32_t timestamp = mkv_d->last_pts * 1000; uint32_t *hdr; @@ -3334,7 +3321,7 @@ handle_realaudio (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer, uint32_t size, int block_bref) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); int sps = track->sub_packet_size; int sph = track->sub_packet_h; int cfs = track->coded_framesize; @@ -3492,7 +3479,7 @@ handle_video_bframes (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer, uint32_t size, int block_bref, int block_fref) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); Demux_Packet *dp; dp = new(zeromem) Demux_Packet (size); @@ -3522,7 +3509,7 @@ handle_block (demuxer_t *demuxer, uint8_t *block, uint64_t length, uint64_t block_duration, int64_t block_bref, int64_t block_fref, uint8_t simpleblock) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track = NULL; demux_stream_t *ds = NULL; uint64_t old_length; @@ -3687,7 +3674,7 @@ static int mkv_demux (demuxer_t *demuxer, demux_stream_t *ds) { UNUSED(ds); - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; uint64_t l; int il, tmp; @@ -3834,10 +3821,10 @@ static void mkv_seek (demuxer_t *demuxer,const seek_args_t* seeka) { - free_cached_dps (demuxer); + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); + mkv_d->free_cached_dps (); if (!(seeka->flags & 2)) /* time in secs */ { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; stream_t *s = demuxer->stream; int64_t target_timecode = 0, diff, min_diff=0xFFFFFFFFFFFFFFFLL; int i; @@ -3958,7 +3945,7 @@ MSG_V( "[mkv] seek unsupported flags\n"); else { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; uint64_t target_filepos; mkv_index_t *_index = NULL; @@ -3996,7 +3983,7 @@ static MPXP_Rc mkv_control (const demuxer_t *demuxer, int cmd, any_t*arg) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); switch (cmd) { #if 0 case DEMUXER_CTRL_GET_TIME_LENGTH: @@ -4043,7 +4030,7 @@ demux_mkv_get_sub_lang(demuxer_t *demuxer, int track_num, char *lang, int maxlen) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, track_num, MATROSKA_TRACK_SUBTITLE); if (track && track->language && strcmp(track->language, "und")) strncpy(lang, track->language, maxlen); @@ -4063,7 +4050,7 @@ demux_mkv_get_audio_lang(demuxer_t *demuxer, int track_num, char *lang, int maxlen) { - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; + mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, track_num, MATROSKA_TRACK_AUDIO); if (track && track->language && strcmp(track->language, "und")) strncpy(lang, track->language, maxlen); Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_mov.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -50,8 +50,8 @@ #include <fcntl.h> #endif -#define BE_16(x) be2me_16(x) -#define BE_32(x) be2me_32(x) +inline uint16_t BE_16(uint16_t x) { return be2me_16(x); } +inline uint32_t BE_32(uint32_t x) { return be2me_32(x); } #define char2short(x,y) BE_16(*((uint16_t *)&(((unsigned char *)(x))[(y)]))) #define char2int(x,y) BE_32(*((uint32_t *)&(((unsigned char *)(x))[(y)]))) @@ -286,20 +286,43 @@ #define MOV_MAX_TRACKS 256 #define MOV_MAX_SUBLEN 1024 -typedef struct { - off_t moov_start; - off_t moov_end; - off_t mdat_start; - off_t mdat_end; - int track_db; - mov_track_t* tracks[MOV_MAX_TRACKS]; - int timescale; // movie timescale - int duration; // movie duration (in movie timescale units) +struct mov_priv_t : public Opaque { + public: + mov_priv_t() {}; + virtual ~mov_priv_t(); + + off_t moov_start; + off_t moov_end; + off_t mdat_start; + off_t mdat_end; + int track_db; + mov_track_t* tracks[MOV_MAX_TRACKS]; + int timescale; // movie timescale + int duration; // movie duration (in movie timescale units) /* ---- mov (!!! ALWAYS 0 !!!) ----- */ - unsigned int ss_mul; /**< compression ratio for packet descriptor */ - unsigned int ss_div; /**< compression ratio for packet descriptor */ -} mov_priv_t; + unsigned int ss_mul; /**< compression ratio for packet descriptor */ + unsigned int ss_div; /**< compression ratio for packet descriptor */ +}; +mov_priv_t::~mov_priv_t() { + for (unsigned i = 0; i < MOV_MAX_TRACKS; i++) { + mov_track_t *track = tracks[i]; + if (track) { + delete track->tkdata; + delete track->stdata; + delete track->stream_header; + delete track->samples; + delete track->chunks; + delete track->chunkmap; + delete track->durmap; + delete track->keyframes; + delete track->editlist; + delete track->desc; + delete track; + } + } +} + #define MOV_FOURCC(a,b,c,d) ((a<<24)|(b<<16)|(c<<8)|(d)) static MPXP_Rc mov_probe(demuxer_t* demuxer){ @@ -575,7 +598,7 @@ off_t pos, off_t len, mov_track_t* trak); static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak){ - mov_priv_t* priv=reinterpret_cast<mov_priv_t*>(demuxer->priv); + mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); while(1){ off_t pos; off_t len; @@ -1772,7 +1795,7 @@ } static demuxer_t* mov_open(demuxer_t* demuxer){ - mov_priv_t* priv=reinterpret_cast<mov_priv_t*>(demuxer->priv); + mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); int t_no; int best_a_id=-1, best_a_len=0; int best_v_id=-1, best_v_len=0; @@ -1908,7 +1931,7 @@ // 0 = EOF or no stream found // 1 = successfully read a packet static int mov_demux(demuxer_t *demuxer,demux_stream_t* ds){ - mov_priv_t* priv=reinterpret_cast<mov_priv_t*>(demuxer->priv); + mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); mov_track_t* trak=NULL; float pts; int x; @@ -2039,7 +2062,7 @@ } static void mov_seek(demuxer_t *demuxer,const seek_args_t* seeka){ - mov_priv_t* priv=reinterpret_cast<mov_priv_t*>(demuxer->priv); + mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); demux_stream_t* ds; mov_track_t* trak; @@ -2066,27 +2089,9 @@ static void mov_close(demuxer_t *demuxer) { - mov_priv_t* priv = reinterpret_cast<mov_priv_t*>(demuxer->priv); - int i; - if (!priv) - return; - for (i = 0; i < MOV_MAX_TRACKS; i++) { - mov_track_t *track = priv->tracks[i]; - if (track) { - delete track->tkdata; - delete track->stdata; - delete track->stream_header; - delete track->samples; - delete track->chunks; - delete track->chunkmap; - delete track->durmap; - delete track->keyframes; - delete track->editlist; - delete track->desc; - delete track; - } - } - delete priv; + mov_priv_t* priv = static_cast<mov_priv_t*>(demuxer->priv); + if (!priv) return; + delete priv; } static MPXP_Rc mov_control(const demuxer_t *demuxer,int cmd,any_t*args) Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -44,17 +44,21 @@ #define MPGPES_BAD_PTS -1 typedef int (*alt_demuxer_t)(demuxer_t *demux,demux_stream_t *__ds); -typedef struct mpg_demuxer { - float last_pts; - float final_pts; - int has_valid_timestamps; - unsigned int es_map[0x40]; //es map of stream types (associated to the pes id) from 0xb0 to 0xef - int num_a_streams; - int a_stream_ids[MAX_A_STREAMS]; - int last_sub_pts; - alt_demuxer_t alt_demuxer; -} mpg_demuxer_t; +struct mpg_demuxer_t : public Opaque { + public: + mpg_demuxer_t() {} + virtual ~mpg_demuxer_t() {} + float last_pts; + float final_pts; + int has_valid_timestamps; + unsigned int es_map[0x40]; //es map of stream types (associated to the pes id) from 0xb0 to 0xef + int num_a_streams; + int a_stream_ids[MAX_A_STREAMS]; + int last_sub_pts; + alt_demuxer_t alt_demuxer; +}; + static struct mpg_stat_s { int num_elementary_packets100; int num_elementary_packets101; @@ -93,7 +97,7 @@ static int parse_psm(demuxer_t *demux, int len) { unsigned char c, id, type; unsigned int plen, prog_len, es_map_len; - mpg_demuxer_t *priv = (mpg_demuxer_t *) demux->priv; + mpg_demuxer_t *priv = static_cast<mpg_demuxer_t*>(demux->priv); MSG_DBG2("PARSE_PSM, len=%d\n", len); if(! len) @@ -152,7 +156,7 @@ static void new_audio_stream(demuxer_t *demux, int aid){ if(!demux->a_streams[aid]){ - mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demux->priv; + mpg_demuxer_t *mpg_d=static_cast<mpg_demuxer_t*>(demux->priv); sh_audio_t* sh_a; new_sh_audio(demux,aid); sh_a = (sh_audio_t*)demux->a_streams[aid]; @@ -193,7 +197,7 @@ int pts=MPGPES_BAD_PTS; unsigned int dts=0; demux_stream_t *ds=NULL; - mpg_demuxer_t *priv = (mpg_demuxer_t *) demux->priv; + mpg_demuxer_t *priv = static_cast<mpg_demuxer_t*>(demux->priv); MSG_DBG3("demux_read_packet: %X\n",id); @@ -437,7 +441,7 @@ } static int mpgps_demux(demuxer_t *demux,demux_stream_t *__ds){ - mpg_demuxer_t* mpg_d = reinterpret_cast<mpg_demuxer_t*>(demux->priv); + mpg_demuxer_t* mpg_d = static_cast<mpg_demuxer_t*>(demux->priv); if(mpg_d->alt_demuxer) return mpg_d->alt_demuxer(demux,__ds); unsigned int head=0; int skipped=0; @@ -783,37 +787,37 @@ static demuxer_t* mpgps_open(demuxer_t*demuxer) { - sh_video_t *sh_video=reinterpret_cast<sh_video_t*>(demuxer->video->sh); - mpg_demuxer_t* mpg_d; + sh_video_t *sh_video=reinterpret_cast<sh_video_t*>(demuxer->video->sh); + mpg_demuxer_t* mpg_d=static_cast<mpg_demuxer_t*>(demuxer->priv); - if(!sh_video) MSG_WARN("MPEG: " MSGTR_MissingVideoStream); - else sh_video->ds=demuxer->video; + if(!sh_video) MSG_WARN("MPEG: " MSGTR_MissingVideoStream); + else sh_video->ds=demuxer->video; - mpg_d->has_valid_timestamps = 1; - mpg_d->num_a_streams = 0; + mpg_d->has_valid_timestamps = 1; + mpg_d->num_a_streams = 0; - if(demuxer->audio->id!=-2) { - if(!ds_fill_buffer(demuxer->audio)){ - MSG_WARN("MPEG: " MSGTR_MissingAudioStream); - demuxer->audio->sh=NULL; - } else { - sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); - sh_audio->ds=demuxer->audio; - } - } + if(demuxer->audio->id!=-2) { + if(!ds_fill_buffer(demuxer->audio)){ + MSG_WARN("MPEG: " MSGTR_MissingAudioStream); + demuxer->audio->sh=NULL; + } else { + sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); + sh_audio->ds=demuxer->audio; + } + } check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } static void mpgps_close(demuxer_t*demuxer) { - mpg_demuxer_t* mpg_d = reinterpret_cast<mpg_demuxer_t*>(demuxer->priv); + mpg_demuxer_t* mpg_d = static_cast<mpg_demuxer_t*>(demuxer->priv); if (mpg_d) delete mpg_d; } static MPXP_Rc mpgps_control(const demuxer_t *demuxer,int cmd,any_t*arg) { - mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv; + mpg_demuxer_t *mpg_d=static_cast<mpg_demuxer_t*>(demuxer->priv); switch(cmd) { case DEMUX_CMD_SWITCH_AUDIO: if (mpg_d && mpg_d->num_a_streams > 1 && demuxer->audio && demuxer->audio->sh) { Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-28 10:43:38 UTC (rev 472) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-28 12:58:58 UTC (rev 473) @@ -30,21 +30,25 @@ #define MAX_AV_STREAMS MAX_V_STREAMS+MAX_A_STREAMS+MAX_S_STREAMS -typedef struct { - unsigned nstreams; - mpxpav64FileProperties_t fprop; - mpxpav64StreamProperties_t sprop[MAX_AV_STREAMS]; - uint64_t data_off[MAX_AV_STREAMS]; - // deltas - float prev_pts[MAX_AV_STREAMS]; - float prev_xpts[MAX_AV_STREAMS]; - uint64_t prev_size[MAX_AV_STREAMS]; - uint32_t prev_id; - // index stuff: - any_t* idx[MAX_AV_STREAMS]; - unsigned idx_size[MAX_AV_STREAMS]; -} mpxpav64_priv_t; +struct mpxpav64_priv_t : public Opaque { + public: + mpxpav64_priv_t() {} + virtual ~mpxpav64_priv_t() {} + unsigned nstreams; + mpxpav64FileProperties_t fprop; + mpxpav64StreamProperties_t sprop[MAX_AV_STREAMS]; + uint64_t data_off[MAX_AV_STREAMS]; + // deltas + float prev_pts[MAX_AV_STREAMS]; + float prev_xpts[MAX_AV_STREAMS]; + uint64_t prev_size[MAX_AV_STREAMS]; + uint32_t prev_id; + // index stuff: + any_t* idx[MAX_AV_STREAMS]; + unsigned idx_size[MAX_AV_STREAMS]; +}; + #define le2me_ImageDesc(h) { \ (h)->idSize = le2me_32((h)->idSize); \ (h)->cType = le2me_32((h)->cType); \ @@ -67,30 +71,7 @@ } #define MAX_PACKS 4096 -#define MIN(a,b) (((a)<(b))?(a):(b)) -#if 0 -/* -According to : -"MPEG Extension to AVI File Format "Editable MPEG FileFormat" -Draft Version 1.1 of 5/13/94" -*/ -static float avi_aspects[]= -{ - 1.0000, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935, - 0.9375, 0.9815, 1.0255, 1.0695, 1.1250, 1.1575, 1.2015 -}; - -static float get_avi_aspect(unsigned char id) -{ - if(id>0&&id<15) - { - return avi_aspects[id-1]; - } - else return 1.0; -} -#endif - static void print_FileProp(mpxpav64FileProperties_t *fp) { MSG_V("\n========== mpxpav64FileProperties_t =================\n" @@ -159,7 +140,7 @@ { uint64_t i,fpos,iid; stream_t *s=demuxer->stream; - mpxpav64_priv_t *priv=reinterpret_cast<mpxpav64_priv_t*>(demuxer->priv); + mpxpav64_priv_t *priv=static_cast<mpxpav64_priv_t*>(demuxer->priv); unsigned sid; int is_valid; fpos=stream_tell(s); @@ -202,7 +183,7 @@ } static int mpxpav64_read_st64v(demuxer_t *demuxer,unsigned hsize,unsigned id){ - mpxpav64_priv_t *priv=reinterpret_cast<mpxpav64_priv_t*>(demuxer->priv); + mpxpav64_priv_t *priv=static_cast<mpxpav64_priv_t*>(demuxer->priv); stream_t *s=demuxer->stream; uint32_t fourcc,fsize; int have_bih=0; @@ -327,7 +308,7 @@ static int mpxpav64_read_st64(demuxer_t *demuxer,unsigned hsize,unsigned id){ stream_t *s=demuxer->stream; - mpxpav64_priv_t *priv=reinterpret_cast<mpxpav64_priv_t*>(demuxer->priv); + mpxpav64_priv_t *priv=static_cast<mpxpav64_priv_t*>(demuxer->priv); uint64_t idx_off; uint32_t fourcc,hoff; hoff=stream_tell(s); @@ -379,7 +360,7 @@ #ifdef USE_ICONV static void mpxpav64_read_fcnt(demuxer_t* demuxer,unsigned fsize) { - mpxpav64_priv_t *priv=reinterpret_cast<mpxpav64_priv_t*>(demuxer->priv); + mpxpav64_priv_t *priv=static_cast<mpxpav64_priv_t*>(demuxer->priv); stream_t *s=demuxer->stream; int64_t hoff; const char * codepage; @@ -439,7 +420,7 @@ static void mpxpav64_reset_prevs(demuxer_t *demuxer) { - mpxpav64_priv_t* priv=reinterpret_cast<mpxpav64_priv_t*>(demuxer->priv); + mpxpav64_priv_t* priv... [truncated message content] |
From: <nic...@us...> - 2012-11-28 15:49:37
|
Revision: 476 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=476&view=rev Author: nickols_k Date: 2012-11-28 15:49:24 +0000 (Wed, 28 Nov 2012) Log Message: ----------- [stream] suppress warnings like: deleting 'any_t*' is undefined Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/dump.h mplayerxp/libmpdemux/demux_demuxers.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpstream/cdd.h mplayerxp/libmpstream/cdda.cpp mplayerxp/libmpstream/network.h mplayerxp/libmpstream/s_cdd.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/libmpstream/s_dvdread.cpp mplayerxp/libmpstream/s_file.cpp mplayerxp/libmpstream/s_ftp.cpp mplayerxp/libmpstream/s_lavc.cpp mplayerxp/libmpstream/s_network.cpp mplayerxp/libmpstream/s_oss.cpp mplayerxp/libmpstream/s_tv.cpp mplayerxp/libmpstream/s_vcdnav.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libmpstream/stream.h mplayerxp/libmpstream/tvi/tv.h mplayerxp/mplayerxp.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/dump.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -92,7 +92,7 @@ any_t* libinput; }; -void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp) +void __FASTCALL__ dump_stream_event_handler(stream_t *s,const stream_packet_t*sp) { } Modified: mplayerxp/dump.h =================================================================== --- mplayerxp/dump.h 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/dump.h 2012-11-28 15:49:24 UTC (rev 476) @@ -10,6 +10,6 @@ void dump_mux_init(demuxer_t *demuxer,any_t*libinput); void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames); void dump_mux_close(demuxer_t *demuxer); - void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp); + void __FASTCALL__ dump_stream_event_handler(stream_t *s,const stream_packet_t*sp); } //namespace #endif Modified: mplayerxp/libmpdemux/demux_demuxers.cpp =================================================================== --- mplayerxp/libmpdemux/demux_demuxers.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpdemux/demux_demuxers.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -20,9 +20,9 @@ }; dd_priv_t::~dd_priv_t() { - if(vd) FREE_DEMUXER(vd); - if(ad && ad != vd) FREE_DEMUXER(ad); - if(sd && sd != vd && sd != ad) FREE_DEMUXER(sd); + if(vd) { free_demuxer(vd); vd=NULL; } + if(ad && ad != vd) { free_demuxer(ad); ad=NULL; } + if(sd && sd != vd && sd != ad) { free_demuxer(sd); sd=NULL; } } demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) { Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -114,9 +114,9 @@ int demux_aid_vid_mismatch = 0; -demux_stream_t* new_demuxer_stream(struct demuxer_s *demuxer,int id){ - demux_stream_t* ds=(demux_stream_t*)mp_malloc(sizeof(demux_stream_t)); - rnd_fill(ds->antiviral_hole,offsetof(demux_stream_t,pin)-offsetof(demux_stream_t,antiviral_hole)); +demux_stream_t* new_demuxer_stream(demuxer_t *demuxer,int id){ + demux_stream_t* ds=new(zeromem) demux_stream_t; + rnd_fill(ds->antiviral_hole,reinterpret_cast<long>(&ds->pin)-reinterpret_cast<long>(&ds->antiviral_hole)); ds->pin=DS_PIN; ds->buffer_pos=ds->buffer_size=0; ds->buffer=NULL; @@ -143,8 +143,8 @@ } demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){ - demuxer_t *d=(demuxer_t*)mp_mallocz(sizeof(demuxer_t)); - rnd_fill(d->antiviral_hole,offsetof(demuxer_t,pin)-offsetof(demuxer_t,antiviral_hole)); + demuxer_t *d=new(zeromem) demuxer_t; + rnd_fill(d->antiviral_hole,reinterpret_cast<long>(&d->pin)-reinterpret_cast<long>(&d->antiviral_hole)); d->pin=DEMUX_PIN; d->stream=stream; d->movi_start=stream->start_pos; @@ -246,15 +246,13 @@ if(demuxer->driver) demuxer->driver->close(demuxer); - // mp_free streams: + // free streams: for(i=0;i<MAX_A_STREAMS;i++) if(demuxer->a_streams[i]) free_sh_audio(reinterpret_cast<sh_audio_t*>(demuxer->a_streams[i])); for(i=0;i<MAX_V_STREAMS;i++) if(demuxer->v_streams[i]) free_sh_video(reinterpret_cast<sh_video_t*>(demuxer->v_streams[i])); - //if(sh_audio) free_sh_audio(sh_audio); - //if(sh_video) free_sh_video(sh_video); - // mp_free demuxers: - FREE_DEMUXER_STREAM(demuxer->audio); - FREE_DEMUXER_STREAM(demuxer->video); - FREE_DEMUXER_STREAM(demuxer->sub); + // free demuxers: + free_demuxer_stream(demuxer->audio); demuxer->audio=NULL; + free_demuxer_stream(demuxer->video); demuxer->video=NULL; + free_demuxer_stream(demuxer->sub); demuxer->sub=NULL; demux_info_free(demuxer); delete demuxer; } @@ -547,11 +545,11 @@ break; } MSG_V("False\n"); - FREE_DEMUXER(demuxer); + free_demuxer(demuxer); demuxer=NULL; } if(!demuxer || !demuxer->driver) { MSG_ERR(MSGTR_FormatNotRecognized); - FREE_DEMUXER(demuxer); + if(demuxer) { free_demuxer(demuxer); demuxer=NULL; } return NULL; } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpdemux/demuxer.h 2012-11-28 15:49:24 UTC (rev 476) @@ -55,37 +55,42 @@ DS_PIN=RND_NUMBER1+RND_CHAR1 }; -typedef struct demux_stream_s { - int id; /**< stream ID (for multiple audio/video streams) */ - char antiviral_hole[RND_CHAR2]; - unsigned pin; /**< personal identification number */ - int buffer_pos; /**< current buffer position */ - int buffer_size; /**< current buffer size */ - unsigned char* buffer; /**< current buffer */ - float pts; /**< current buffer's PTS */ - int pts_bytes; /**< number of bytes read after last pts stamp */ - int eof; /**< end of demuxed stream? (true if all buffer empty) */ - off_t pos; /**< position in the input stream (file) */ - off_t dpos; /**< position in the demuxed stream */ - int pack_no; /**< serial number of packet */ - int flags; /**< flags of current packet (keyframe etc) */ +struct demuxer_t; +struct demux_stream_t : public Opaque { + public: + demux_stream_t() {} + virtual ~demux_stream_t() {} + + int id; /**< stream ID (for multiple audio/video streams) */ + char antiviral_hole[RND_CHAR2]; + unsigned pin; /**< personal identification number */ + int buffer_pos; /**< current buffer position */ + int buffer_size; /**< current buffer size */ + unsigned char* buffer; /**< current buffer */ + float pts; /**< current buffer's PTS */ + int pts_bytes; /**< number of bytes read after last pts stamp */ + int eof; /**< end of demuxed stream? (true if all buffer empty) */ + off_t pos; /**< position in the input stream (file) */ + off_t dpos; /**< position in the demuxed stream */ + int pack_no; /**< serial number of packet */ + int flags; /**< flags of current packet (keyframe etc) */ /*---------------*/ - int packs; /**< number of packets in buffer */ - int bytes; /**< total bytes of packets in buffer */ - Demux_Packet* first; /**< read to current buffer from here */ - Demux_Packet* last; /**< append new packets from input stream to here */ - Demux_Packet* current; /**< needed for refcounting of the buffer */ - struct demuxer_s* demuxer; /**< parent demuxer structure (stream handler) */ + int packs; /**< number of packets in buffer */ + int bytes; /**< total bytes of packets in buffer */ + Demux_Packet* first; /**< read to current buffer from here */ + Demux_Packet* last; /**< append new packets from input stream to here */ + Demux_Packet* current; /**< needed for refcounting of the buffer */ + demuxer_t* demuxer; /**< parent demuxer structure (stream handler) */ /* ---- asf ----- */ - Demux_Packet* asf_packet; /**< read asf fragments here */ - int asf_seq; /**< sequence id associated with asf_packet */ + Demux_Packet* asf_packet; /**< read asf fragments here */ + int asf_seq; /**< sequence id associated with asf_packet */ /*---------------*/ - any_t* sh; /**< Stream header associated with this stream (@see st_header.h for detail) */ + any_t* sh; /**< Stream header associated with this stream (@see st_header.h for detail) */ /*---------------*/ - float prev_pts; /**< PTS of previous packet (DVD's PTS correction) */ - float pts_corr; /**< PTS correction (DVD's PTS correction) */ - int pts_flags; /**< PTS flags like trigger for correction applying (DVD's PTS correction) */ -} demux_stream_t __attribute__ ((packed)); + float prev_pts; /**< PTS of previous packet (DVD's PTS correction) */ + float pts_corr; /**< PTS correction (DVD's PTS correction) */ + int pts_flags; /**< PTS flags like trigger for correction applying (DVD's PTS correction) */ +} __attribute__ ((packed)); enum { MAX_A_STREAMS =256, @@ -101,29 +106,33 @@ }; struct demuxer_info_t; -typedef struct demuxer_s { - char antiviral_hole[RND_CHAR3]; - unsigned pin; /**< personal identification number */ - stream_t* stream; /**< stream for movie reading */ - demux_stream_t* audio; /**< audio buffer/demuxer */ - demux_stream_t* video; /**< video buffer/demuxer */ - demux_stream_t* sub; /**< DVD's subtitle buffer/demuxer */ - any_t* a_streams[MAX_A_STREAMS]; /**< audio streams (sh_audio_t) for multilanguage movies */ - any_t* v_streams[MAX_V_STREAMS]; /**< video streams (sh_video_t) for multipicture movies */ - char s_streams[MAX_S_STREAMS]; /**< DVD's subtitles (flag) streams for multilanguage movies */ - off_t filepos; /**< current pos. of input stream */ - off_t movi_start; /**< real start of movie within of stream */ - off_t movi_end; /**< real end of movie within of stream */ - unsigned movi_length; /**< length of movie in secs. Optional!*/ - unsigned flags; /**< set of DEMUXF_* bits */ - unsigned file_format; /**< file format: DEMUXER_TYPE_*(mpeg/avi/asf). Will be replaced with properties in the further versions */ - int synced; /**< indicates stream synchronisation. TODO: mpg->priv */ +struct demuxer_t : public Opaque { + public: + demuxer_t() {} + virtual ~demuxer_t() {} - Opaque* priv; /**< private data of demuxer's driver.*/ - demuxer_info_t* info; /**< human-readable info from stream/movie (like movie name,author,duration)*/ - const struct demuxer_driver_s* driver; /**< driver associated with this demuxer */ -} demuxer_t __attribute__ ((packed)); + char antiviral_hole[RND_CHAR3]; + unsigned pin; /**< personal identification number */ + stream_t* stream; /**< stream for movie reading */ + demux_stream_t* audio; /**< audio buffer/demuxer */ + demux_stream_t* video; /**< video buffer/demuxer */ + demux_stream_t* sub; /**< DVD's subtitle buffer/demuxer */ + any_t* a_streams[MAX_A_STREAMS]; /**< audio streams (sh_audio_t) for multilanguage movies */ + any_t* v_streams[MAX_V_STREAMS]; /**< video streams (sh_video_t) for multipicture movies */ + char s_streams[MAX_S_STREAMS]; /**< DVD's subtitles (flag) streams for multilanguage movies */ + off_t filepos; /**< current pos. of input stream */ + off_t movi_start; /**< real start of movie within of stream */ + off_t movi_end; /**< real end of movie within of stream */ + unsigned movi_length; /**< length of movie in secs. Optional!*/ + unsigned flags; /**< set of DEMUXF_* bits */ + unsigned file_format; /**< file format: DEMUXER_TYPE_*(mpeg/avi/asf). Will be replaced with properties in the further versions */ + int synced; /**< indicates stream synchronisation. TODO: mpg->priv */ + Opaque* priv; /**< private data of demuxer's driver.*/ + demuxer_info_t* info; /**< human-readable info from stream/movie (like movie name,author,duration)*/ + const struct demuxer_driver_s* driver; /**< driver associated with this demuxer */ +} __attribute__ ((packed)); + enum { DEMUX_SEEK_CUR =0x00, DEMUX_SEEK_SET =0x01, @@ -180,12 +189,10 @@ MPXP_Rc (*control)(const demuxer_t *d,int cmd,any_t*arg); }demuxer_driver_t; -demux_stream_t* new_demuxer_stream(struct demuxer_s *demuxer,int id); +demux_stream_t* new_demuxer_stream(demuxer_t *demuxer,int id); demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id); void free_demuxer_stream(demux_stream_t *ds); -#define FREE_DEMUXER_STREAM(d) { free_demuxer_stream(d); d=NULL; } void free_demuxer(demuxer_t *demuxer); -#define FREE_DEMUXER(d) { free_demuxer(d); d=NULL; } void ds_add_packet(demux_stream_t *ds,Demux_Packet* dp); void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags); Modified: mplayerxp/libmpstream/cdd.h =================================================================== --- mplayerxp/libmpstream/cdd.h 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/cdd.h 2012-11-28 15:49:24 UTC (rev 476) @@ -53,7 +53,11 @@ lsn_t end_sector; }my_track_t; -typedef struct { +struct cdda_priv : public Opaque { + public: + cdda_priv(); + virtual ~cdda_priv(); + cdrom_drive_t* cd; my_track_t tracks[256]; /* hope that's enough */ unsigned min; @@ -62,7 +66,7 @@ lsn_t sector; lsn_t start_sector; lsn_t end_sector; -} cdda_priv; +}; cd_info_t* __FASTCALL__ cd_info_new(); void __FASTCALL__ cd_info_free(cd_info_t *cd_info); Modified: mplayerxp/libmpstream/cdda.cpp =================================================================== --- mplayerxp/libmpstream/cdda.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/cdda.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -82,7 +82,7 @@ unsigned char arr[256]; int st_inited; - priv = (cdda_priv*)mp_mallocz(sizeof(cdda_priv)); + priv = new(zeromem) cdda_priv; priv->cd = cdio_cddap_identify(dev,mp_conf.verbose?1:0,NULL); @@ -172,7 +172,7 @@ } int __FASTCALL__ read_cdda(const stream_t* s,char *buf,track_t *tr) { - cdda_priv* p = (cdda_priv*)s->priv; + cdda_priv* p = static_cast<cdda_priv*>(s->priv); track_t i=255; if(cdio_cddap_read(p->cd, buf, p->sector, 1)==0) { @@ -196,7 +196,7 @@ } void __FASTCALL__ seek_cdda(stream_t* s,off_t pos,track_t *tr) { - cdda_priv* p = (cdda_priv*)s->priv; + cdda_priv* p = static_cast<cdda_priv*>(s->priv); long sec; long seeked_track=0; track_t j=255; @@ -213,14 +213,18 @@ } off_t __FASTCALL__ tell_cdda(const stream_t* s) { - const cdda_priv* p = (const cdda_priv*)s->priv; + const cdda_priv* p = static_cast<const cdda_priv*>(s->priv); return p->sector*CDIO_CD_FRAMESIZE_RAW; } void __FASTCALL__ close_cdda(stream_t* s) { - cdda_priv* p = (cdda_priv*)s->priv; - cdio_cddap_close(p->cd); + cdda_priv* p = static_cast<cdda_priv*>(s->priv); delete p; } +cdda_priv::cdda_priv() {} +cdda_priv::~cdda_priv() { + cdio_cddap_close(cd); +} + #endif Modified: mplayerxp/libmpstream/network.h =================================================================== --- mplayerxp/libmpstream/network.h 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/network.h 2012-11-28 15:49:24 UTC (rev 476) @@ -45,9 +45,9 @@ any_t* libinput; /**< provides possibility to inperrupt network streams */ } streaming_ctrl_t; -struct stream_s; -extern void fixup_network_stream_cache(struct stream_s *s); -extern int streaming_start(any_t* libinput,struct stream_s *stream, int *demuxer_type, URL_t *url); +struct stream_t; +extern void fixup_network_stream_cache(stream_t *s); +extern int streaming_start(any_t* libinput,stream_t *stream, int *demuxer_type, URL_t *url); extern int streaming_bufferize( streaming_ctrl_t *streaming_ctrl,unsigned char *buffer, int size); extern streaming_ctrl_t *streaming_ctrl_new(any_t* libinput); extern void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl ); Modified: mplayerxp/libmpstream/s_cdd.cpp =================================================================== --- mplayerxp/libmpstream/s_cdd.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_cdd.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -86,7 +86,7 @@ static MPXP_Rc __FASTCALL__ cdd_ctrl(const stream_t *s,unsigned cmd,any_t*args) { - cdda_priv *p=reinterpret_cast<cdda_priv*>(s->priv); + cdda_priv *p=static_cast<cdda_priv*>(s->priv); switch(cmd) { case SCTRL_TXT_GET_STREAM_NAME: { if(track_idx!=255) Modified: mplayerxp/libmpstream/s_dvdnav.cpp =================================================================== --- mplayerxp/libmpstream/s_dvdnav.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_dvdnav.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -27,32 +27,40 @@ #define DVD_BLOCK_SIZE 2048 -typedef struct { - dvdnav_t * dvdnav; /* handle to libdvdnav stuff */ - char * filename; /* path */ - int ignore_timers; /* should timers be skipped? */ - int sleeping; /* are we sleeping? */ - unsigned int sleep_until; /* timer */ - int started; /* Has mplayer initialization finished? */ - unsigned char prebuf[STREAM_BUFFER_SIZE]; /* prefill buffer */ - int prelen; /* length of prefill buffer */ - off_t cpos; - float vobu_s_pts,vobu_e_pts; - int menu_mode; - dvdnav_highlight_event_t hlev; -} dvdnav_priv_t; +struct dvdnav_priv_t : public Opaque { + public: + dvdnav_priv_t() {} + virtual ~dvdnav_priv_t(); + dvdnav_t* dvdnav; /* handle to libdvdnav stuff */ + char* filename; /* path */ + int ignore_timers; /* should timers be skipped? */ + int sleeping; /* are we sleeping? */ + unsigned int sleep_until; /* timer */ + int started; /* Has mplayer initialization finished? */ + unsigned char prebuf[STREAM_BUFFER_SIZE]; /* prefill buffer */ + int prelen; /* length of prefill buffer */ + off_t cpos; + float vobu_s_pts,vobu_e_pts; + int menu_mode; + dvdnav_highlight_event_t hlev; +}; + +dvdnav_priv_t::~dvdnav_priv_t() { + dvdnav_close(dvdnav); +} + typedef struct { - int event; /* event number fromd dvdnav_events.h */ - any_t* details; /* event details */ - int len; /* bytes in details */ + int event; /* event number fromd dvdnav_events.h */ + any_t* details; /* event details */ + int len; /* bytes in details */ } dvdnav_event_t; static int dvd_nav_still=0; /* are we on a still picture? */ static int dvd_nav_skip_opening=0; /* skip opening stalls? */ static void __FASTCALL__ dvdnav_stream_ignore_timers(stream_t * stream, int ignore) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(stream->priv); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(stream->priv); dvdnav_priv->ignore_timers=ignore; } @@ -107,7 +115,7 @@ } static void __FASTCALL__ dvdnav_stream_sleep(const stream_t * stream, int seconds) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(stream->priv); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(stream->priv); if (!dvdnav_priv->started) return; @@ -129,7 +137,7 @@ } static int __FASTCALL__ dvdnav_stream_sleeping(const stream_t * stream) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(stream->priv); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(stream->priv); unsigned int now; if (!dvdnav_priv) return 0; @@ -249,7 +257,7 @@ } static void __FASTCALL__ dvdnav_stream_read(stream_t * stream, dvdnav_event_t*de) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(stream->priv); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(stream->priv); int event = DVDNAV_NOP; int done; @@ -377,7 +385,7 @@ static off_t __FASTCALL__ __dvdnav_seek(stream_t *stream,off_t pos) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(stream->priv); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(stream->priv); uint32_t newpos=0; uint32_t length=1; uint32_t sector; @@ -404,14 +412,13 @@ static off_t __FASTCALL__ __dvdnav_tell(const stream_t *stream) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(stream->priv); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(stream->priv); return (off_t)dvdnav_priv->cpos; } static void __FASTCALL__ __dvdnav_close(stream_t *stream) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(stream->priv); - dvdnav_close(dvdnav_priv->dvdnav); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(stream->priv); delete dvdnav_priv; if(tevent) { delete tevent->details; delete tevent; } } @@ -422,7 +429,7 @@ * \param hl : - highlight struct pointer */ static void mp_dvdnav_get_highlight (const stream_t *stream, rect_highlight_t *hl) { - dvdnav_priv_t *priv = reinterpret_cast<dvdnav_priv_t*>(stream->priv); + dvdnav_priv_t *priv = static_cast<dvdnav_priv_t*>(stream->priv); int button; dvdnav_highlight_area_t ha; pci_t *pnavpci = NULL; @@ -441,7 +448,7 @@ static void __FASTCALL__ dvdnav_event_handler(const stream_t* s,const stream_packet_t*sp) { demux_stream_t *d_audio=s->demuxer->audio; - dvdnav_priv_t *priv=reinterpret_cast<dvdnav_priv_t*>(s->priv); + dvdnav_priv_t *priv=static_cast<dvdnav_priv_t*>(s->priv); switch(sp->type) { case DVDNAV_BLOCK_OK: /* be silent about this one */ break; @@ -562,7 +569,7 @@ static void __FASTCALL__ dvdnav_cmd_handler(const stream_t* s,unsigned cmd) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(s->priv); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(s->priv); int button; pci_t *pci = dvdnav_get_current_nav_pci(dvdnav_priv->dvdnav); switch (cmd) { @@ -604,7 +611,7 @@ static MPXP_Rc __FASTCALL__ __dvdnav_ctrl(const stream_t *s,unsigned cmd,any_t*args) { - dvdnav_priv_t *dvdnav_priv=reinterpret_cast<dvdnav_priv_t*>(s->priv); + dvdnav_priv_t *dvdnav_priv=static_cast<dvdnav_priv_t*>(s->priv); switch(cmd) { case SCTRL_TXT_GET_STREAM_NAME: { const char *title_str; Modified: mplayerxp/libmpstream/s_dvdread.cpp =================================================================== --- mplayerxp/libmpstream/s_dvdread.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_dvdread.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -41,43 +41,47 @@ #endif typedef struct { - int id; // 0 - 31 mpeg; 128 - 159 ac3; 160 - 191 pcm - int language; - int type; - int channels; + int id; // 0 - 31 mpeg; 128 - 159 ac3; 160 - 191 pcm + int language; + int type; + int channels; } stream_language_t; -typedef struct { - dvd_reader_t *dvd; - dvd_file_t *title; - ifo_handle_t *vmg_file; - tt_srpt_t *tt_srpt; - ifo_handle_t *vts_file; - vts_ptt_srpt_t *vts_ptt_srpt; - pgc_t *cur_pgc; - /* title sets */ - unsigned first_title,cur_title,last_title; -// - int cur_cell; - int last_cell; - int cur_pack; - int cell_last_pack; -// Navi: - int packs_left; - dsi_t dsi_pack; - pci_t pci_pack; - int angle_seek; - float vobu_s_pts,vobu_e_pts; -// audio datas - int nr_of_channels; - stream_language_t audio_streams[32]; -// subtitles - int nr_of_subtitles; - stream_language_t subtitles[32]; +struct dvd_priv_t : public Opaque { + public: + dvd_priv_t() {} + virtual ~dvd_priv_t() {} - off_t spos; -} dvd_priv_t; + dvd_reader_t *dvd; + dvd_file_t *title; + ifo_handle_t *vmg_file; + tt_srpt_t *tt_srpt; + ifo_handle_t *vts_file; + vts_ptt_srpt_t *vts_ptt_srpt; + pgc_t *cur_pgc; + /* title sets */ + unsigned first_title,cur_title,last_title; + // + int cur_cell; + int last_cell; + int cur_pack; + int cell_last_pack; + // Navi: + int packs_left; + dsi_t dsi_pack; + pci_t pci_pack; + int angle_seek; + float vobu_s_pts,vobu_e_pts; + // audio datas + int nr_of_channels; + stream_language_t audio_streams[32]; + // subtitles + int nr_of_subtitles; + stream_language_t subtitles[32]; + off_t spos; +}; + static int dvd_chapter=1; static int dvd_last_chapter=0; static int dvd_angle=1; /**< some DVD discs contain scenes that can be viewed from multiple angles */ @@ -121,13 +125,13 @@ { dvd_priv_t *d; if (!stream) return -1; - d = reinterpret_cast<dvd_priv_t*>(stream->priv); + d = static_cast<dvd_priv_t*>(stream->priv); if (!d) return -1; return d->nr_of_subtitles; } static int __FASTCALL__ dvd_aid_from_lang(const stream_t *stream, const char* lang){ - dvd_priv_t *d=reinterpret_cast<dvd_priv_t*>(stream->priv); + dvd_priv_t *d=static_cast<dvd_priv_t*>(stream->priv); int code,i; while(lang && strlen(lang)>=2){ code=lang[1]|(lang[0]<<8); @@ -145,7 +149,7 @@ } static int __FASTCALL__ dvd_sid_from_lang(const stream_t *stream, const char* lang){ - dvd_priv_t *d=reinterpret_cast<dvd_priv_t*>(stream->priv); + dvd_priv_t *d=static_cast<dvd_priv_t*>(stream->priv); int code,i; while(lang && strlen(lang)>=2){ code=lang[1]|(lang[0]<<8); @@ -166,7 +170,7 @@ { dvd_priv_t *d; if (!stream) return 0; - d = reinterpret_cast<dvd_priv_t*>(stream->priv); + d = static_cast<dvd_priv_t*>(stream->priv); if (!d) return 0; if (id >= d->nr_of_subtitles) return 0; return d->subtitles[id].language; @@ -749,7 +753,7 @@ static int __FASTCALL__ __dvdread_read(stream_t *stream,stream_packet_t *sp) { - dvd_priv_t *d=reinterpret_cast<dvd_priv_t*>(stream->priv); + dvd_priv_t *d=static_cast<dvd_priv_t*>(stream->priv); off_t pos=dvd_read_sector(stream,d,reinterpret_cast<unsigned char*>(sp->buf)); sp->type=0; if(pos>=0){ @@ -761,7 +765,7 @@ static off_t __FASTCALL__ __dvdread_seek(stream_t *stream,off_t newpos) { - dvd_priv_t *d=reinterpret_cast<dvd_priv_t*>(stream->priv); + dvd_priv_t *d=static_cast<dvd_priv_t*>(stream->priv); off_t pos=newpos/2048; dvd_seek(stream,d,pos); d->spos=pos*2048; @@ -770,20 +774,20 @@ static off_t __FASTCALL__ __dvdread_tell(const stream_t *stream) { - dvd_priv_t *d = reinterpret_cast<dvd_priv_t*>(stream->priv); + dvd_priv_t *d = static_cast<dvd_priv_t*>(stream->priv); return d->spos; } static void __FASTCALL__ __dvdread_close(stream_t *stream) { - dvd_priv_t *d=reinterpret_cast<dvd_priv_t*>(stream->priv); + dvd_priv_t *d=static_cast<dvd_priv_t*>(stream->priv); dvd_close(d); delete d; } static unsigned int * __FASTCALL__ dvdread_stream_get_palette(const stream_t *stream) { - dvd_priv_t *d=reinterpret_cast<dvd_priv_t*>(stream->priv); + dvd_priv_t *d=static_cast<dvd_priv_t*>(stream->priv); if(d) if(d->cur_pgc) return d->cur_pgc->palette; Modified: mplayerxp/libmpstream/s_file.cpp =================================================================== --- mplayerxp/libmpstream/s_file.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_file.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -16,23 +16,31 @@ #include "mplayerxp.h" #include "stream.h" +#include "stream_msg.h" -typedef struct file_priv_s -{ - int was_open; - off_t spos; -}file_priv_t; +struct file_priv_t : public Opaque { + public: + file_priv_t() {} + virtual ~file_priv_t() {} + int was_open; + off_t spos; +}; static MPXP_Rc __FASTCALL__ file_open(any_t*libinput,stream_t *stream,const char *filename,unsigned flags) { UNUSED(flags); UNUSED(libinput); - if(!(stream->priv = mp_malloc(sizeof(file_priv_t)))) return MPXP_False; + file_priv_t* priv = new(zeromem) file_priv_t; + stream->priv=priv; if(strcmp(filename,"-")==0) stream->fd=0; else stream->fd=open(filename,O_RDONLY); - if(stream->fd<0) { delete stream->priv; return MPXP_False; } - ((file_priv_t*)stream->priv)->was_open = stream->fd==0?0:1; + if(stream->fd<0) { + MSG_ERR("[s_file] Cannot open file: '%s'\n",filename); + delete stream->priv; + return MPXP_False; + } + priv->was_open = stream->fd==0?0:1; stream->end_pos = lseek(stream->fd,0,SEEK_END); lseek(stream->fd,0,SEEK_SET); if(stream->end_pos == -1) stream->type = STREAMTYPE_STREAM; @@ -41,7 +49,7 @@ with full speed 1.04% for -nocache */ /* Note: Please locate sector_size changinf after all read/write operations of open() function */ stream->sector_size=mp_conf.s_cache_size?mp_conf.s_cache_size*1024/10:STREAM_BUFFER_SIZE; - ((file_priv_t*)stream->priv)->spos = 0; + priv->spos = 0; check_pin("stream",stream->pin,STREAM_PIN); return MPXP_Ok; } @@ -60,7 +68,7 @@ /* Should we repeate read() again on these errno: `EAGAIN', `EIO' ??? */ - file_priv_t*p=reinterpret_cast<file_priv_t*>(stream->priv); + file_priv_t*p=static_cast<file_priv_t*>(stream->priv); sp->type=0; sp->len = TEMP_FAILURE_RETRY(read(stream->fd,sp->buf,sp->len)); if(sp->len>0) p->spos += sp->len; @@ -76,20 +84,20 @@ static off_t __FASTCALL__ file_seek(stream_t*stream,off_t pos) { - file_priv_t*p=reinterpret_cast<file_priv_t*>(stream->priv); + file_priv_t*p=static_cast<file_priv_t*>(stream->priv); p->spos=TEMP_FAILURE_RETRY64(lseek(stream->fd,pos,SEEK_SET)); return p->spos; } static off_t __FASTCALL__ file_tell(const stream_t*stream) { - file_priv_t*p=reinterpret_cast<file_priv_t*>(stream->priv); + file_priv_t*p=static_cast<file_priv_t*>(stream->priv); return p->spos; } static void __FASTCALL__ file_close(stream_t *stream) { - int was_open = reinterpret_cast<file_priv_t*>(stream->priv)->was_open; + int was_open = static_cast<file_priv_t*>(stream->priv)->was_open; if(was_open) close(stream->fd); delete stream->priv; } Modified: mplayerxp/libmpstream/s_ftp.cpp =================================================================== --- mplayerxp/libmpstream/s_ftp.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_ftp.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -23,21 +23,34 @@ #include "url.h" #include "stream_msg.h" -struct stream_priv_s { - const char* user; - const char* pass; - const char* host; - int port; - const char* filename; - URL_t *url; +struct ftp_priv_t; +static int __FASTCALL__ FtpSendCmd(const char *cmd,ftp_priv_t *nControl,char* rsp); - char *cput,*cget; - int handle; - int cavail,cleft; - char *buf; - off_t spos; +struct ftp_priv_t : public Opaque { + public: + ftp_priv_t() {} + virtual ~ftp_priv_t(); + + const char* user; + const char* pass; + const char* host; + int port; + const char* filename; + URL_t *url; + + char *cput,*cget; + int handle; + int cavail,cleft; + char *buf; + off_t spos; }; +ftp_priv_t::~ftp_priv_t() { + FtpSendCmd("QUIT",this,NULL); + if(handle) closesocket(handle); + if(buf) delete buf; +} + #define BUFSIZE 8192 #define TELNET_IAC 255 /* interpret as command: */ @@ -63,7 +76,7 @@ * * return -1 on error or bytecount */ -static int __FASTCALL__ readline(char *buf,int max,struct stream_priv_s *ctl) +static int __FASTCALL__ readline(char *buf,int max,ftp_priv_t *ctl) { int x,retval = 0; char *end,*bp=buf; @@ -133,7 +146,7 @@ * return 0 if first char doesn't match * return 1 if first char matches */ -static int __FASTCALL__ readresp(struct stream_priv_s* ctl,char* rsp) +static int __FASTCALL__ readresp(ftp_priv_t* ctl,char* rsp) { static char response[256]; char match[5]; @@ -163,7 +176,7 @@ } -static int __FASTCALL__ FtpSendCmd(const char *cmd, struct stream_priv_s *nControl,char* rsp) +static int __FASTCALL__ FtpSendCmd(const char *cmd,ftp_priv_t *nControl,char* rsp) { int l = strlen(cmd); int hascrlf = cmd[l - 2] == '\r' && cmd[l - 1] == '\n'; @@ -188,7 +201,7 @@ return FtpSendCmd("\r\n", nControl, rsp); } -static int __FASTCALL__ FtpOpenPort(any_t* libinput,struct stream_priv_s* p) { +static int __FASTCALL__ FtpOpenPort(any_t* libinput,ftp_priv_t* p) { int resp,fd; char rsp_txt[256]; char* par,str[128]; @@ -219,7 +232,7 @@ } static int __FASTCALL__ FtpOpenData(stream_t* s,size_t newpos) { - struct stream_priv_s* p = reinterpret_cast<struct stream_priv_s*>(s->priv); + ftp_priv_t* p = static_cast<ftp_priv_t*>(s->priv); int resp; char str[256],rsp_txt[256]; @@ -263,12 +276,12 @@ } MSG_V("ftp read: %u bytes\n",sp->len); r = recv(s->fd,sp->buf,sp->len,0); - ((struct stream_priv_s *)s->priv)->spos+=r; + (static_cast<ftp_priv_t *>(s->priv))->spos+=r; return (r <= 0) ? -1 : r; } static off_t __FASTCALL__ ftp_seek(stream_t *s,off_t newpos) { - struct stream_priv_s* p = reinterpret_cast<struct stream_priv_s*>(s->priv); + ftp_priv_t* p = static_cast<ftp_priv_t*>(s->priv); int resp; char rsp_txt[256]; @@ -325,33 +338,25 @@ static off_t __FASTCALL__ ftp_tell(const stream_t*stream) { - struct stream_priv_s*p=reinterpret_cast<struct stream_priv_s*>(stream->priv); + ftp_priv_t*p=static_cast<ftp_priv_t*>(stream->priv); return p->spos; } static void __FASTCALL__ ftp_close(stream_t *s) { - struct stream_priv_s* p = reinterpret_cast<struct stream_priv_s*>(s->priv); - - if(!p) return; - - if(s->fd > 0) { - closesocket(s->fd); - s->fd = 0; - } - - FtpSendCmd("QUIT",p,NULL); - - if(p->handle) closesocket(p->handle); - if(p->buf) delete p->buf; - - delete p; + ftp_priv_t* p = static_cast<ftp_priv_t*>(s->priv); + if(s->fd > 0) { + closesocket(s->fd); + s->fd = 0; + } + if(!p) return; + delete p; } static MPXP_Rc __FASTCALL__ ftp_open(any_t*libinput,stream_t *stream,const char *filename,unsigned flags) { int len = 0,resp; - struct stream_priv_s* p; + ftp_priv_t* p; URL_t* url; char str[256],rsp_txt[256]; char *uname; @@ -368,7 +373,7 @@ MSG_ERR("[ftp] Bad url\n"); return MPXP_False; } - stream->priv=p=new(zeromem) struct stream_priv_s; + stream->priv=p=new(zeromem) ftp_priv_t; p->user=url->username?url->username:"anonymous"; p->pass=url->password?url->password:"no@spam"; p->host=url->hostname; Modified: mplayerxp/libmpstream/s_lavc.cpp =================================================================== --- mplayerxp/libmpstream/s_lavc.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_lavc.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -9,19 +9,25 @@ #include "stream.h" #include "stream_msg.h" +struct lavc_priv_t : public Opaque { + public: + lavc_priv_t() {} + virtual ~lavc_priv_t(); -typedef struct lavc_priv_s -{ - URLContext *ctx; - off_t spos; -}lavc_priv_t; + URLContext *ctx; + off_t spos; +}; +lavc_priv_t::~lavc_priv_t() { + if(ctx) ffurl_close(ctx); +} + static int lavc_int_cb(any_t*op) { return 0; } /* non interrupt blicking */ static AVIOInterruptCB int_cb = { lavc_int_cb, NULL }; static int __FASTCALL__ lavc_read(stream_t *s, stream_packet_t*sp) { - lavc_priv_t*p=reinterpret_cast<lavc_priv_t*>(s->priv); + lavc_priv_t*p=static_cast<lavc_priv_t*>(s->priv); sp->len = ffurl_read_complete(p->ctx, reinterpret_cast<unsigned char*>(sp->buf), sp->len); if(sp->len>0) p->spos += sp->len; return sp->len; @@ -29,7 +35,7 @@ static off_t __FASTCALL__ lavc_seek(stream_t *s, off_t newpos) { - lavc_priv_t*p=reinterpret_cast<lavc_priv_t*>(s->priv); + lavc_priv_t*p=static_cast<lavc_priv_t*>(s->priv); p->spos = newpos; p->spos = ffurl_seek(p->ctx, newpos, SEEK_SET); return p->spos; @@ -37,7 +43,7 @@ static off_t lavc_tell(const stream_t *s) { - lavc_priv_t*p=reinterpret_cast<lavc_priv_t*>(s->priv); + lavc_priv_t*p=static_cast<lavc_priv_t*>(s->priv); return p->spos; } @@ -51,8 +57,7 @@ static void __FASTCALL__ lavc_close(stream_t *stream) { - lavc_priv_t*p=reinterpret_cast<lavc_priv_t*>(stream->priv); - ffurl_close(p->ctx); + lavc_priv_t*p=static_cast<lavc_priv_t*>(stream->priv); delete p; } Modified: mplayerxp/libmpstream/s_network.cpp =================================================================== --- mplayerxp/libmpstream/s_network.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_network.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -21,12 +21,19 @@ extern int stream_open_mf(char * filename,stream_t * stream); -typedef struct network_priv_s -{ - URL_t *url; - off_t spos; -}network_priv_t; +struct network_priv_t : public Opaque { + public: + network_priv_t() {} + virtual ~network_priv_t(); + URL_t *url; + off_t spos; +}; + +network_priv_t::~network_priv_t() { + delete url; +} + static MPXP_Rc __FASTCALL__ network_open(any_t* libinput,stream_t *stream,const char *filename,unsigned flags) { URL_t* url; @@ -39,9 +46,11 @@ return MPXP_False; } MSG_INFO(MSGTR_ConnToServer, url->hostname); - stream->priv=mp_malloc(sizeof(network_priv_t)); - ((network_priv_t*)stream->priv)->url = url; - ((network_priv_t*)stream->priv)->spos = 0; + network_priv_t* priv; + priv=new(zeromem) network_priv_t; + stream->priv=priv; + priv->url = url; + priv->spos = 0; stream->type = STREAMTYPE_STREAM; stream->sector_size=STREAM_BUFFER_SIZE; return MPXP_Ok; @@ -52,7 +61,7 @@ static int __FASTCALL__ network_read(stream_t *stream,stream_packet_t*sp) { - network_priv_t *p=reinterpret_cast<network_priv_s*>(stream->priv); + network_priv_t *p=static_cast<network_priv_t*>(stream->priv); sp->type=0; if( stream->streaming_ctrl!=NULL ) { sp->len=stream->streaming_ctrl->streaming_read(stream->fd,sp->buf,STREAM_BUFFER_SIZE, stream->streaming_ctrl); @@ -66,7 +75,7 @@ static off_t __FASTCALL__ network_seek(stream_t *stream,off_t pos) { off_t newpos=0; - network_priv_t *p=reinterpret_cast<network_priv_s*>(stream->priv); + network_priv_t *p=static_cast<network_priv_t*>(stream->priv); if( stream->streaming_ctrl!=NULL ) { newpos=stream->streaming_ctrl->streaming_seek( stream->fd, pos, stream->streaming_ctrl ); if( newpos<0 ) { @@ -80,13 +89,12 @@ static off_t __FASTCALL__ network_tell(const stream_t *stream) { - network_priv_t *p=reinterpret_cast<network_priv_s*>(stream->priv); + network_priv_t *p=static_cast<network_priv_t*>(stream->priv); return p->spos; } static void __FASTCALL__ network_close(stream_t *stream) { - delete reinterpret_cast<network_priv_s*>(stream->priv)->url; delete stream->priv; if(stream->fd>0) close(stream->fd); } Modified: mplayerxp/libmpstream/s_oss.cpp =================================================================== --- mplayerxp/libmpstream/s_oss.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_oss.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -27,14 +27,17 @@ #include "stream_msg.h" -typedef struct oss_priv_s -{ - unsigned nchannels; /* 1,2,6 */ - unsigned samplerate; /* 32000, 44100, 48000 */ - mpaf_format_e sampleformat; /* S32_LE, S16_BE, ... */ - off_t spos; -}oss_priv_t; +struct oss_priv_t : public Opaque { + public: + oss_priv_t() {} + virtual ~oss_priv_t() {} + unsigned nchannels; /* 1,2,6 */ + unsigned samplerate; /* 32000, 44100, 48000 */ + mpaf_format_e sampleformat; /* S32_LE, S16_BE, ... */ + off_t spos; +}; + static MPXP_Rc __FASTCALL__ oss_open(any_t*libinput,stream_t *stream,const char *filename,unsigned flags) { char *args; @@ -140,7 +143,7 @@ /* Should we repeate read() again on these errno: `EAGAIN', `EIO' ??? */ - oss_priv_t*p=reinterpret_cast<oss_priv_t*>(stream->priv); + oss_priv_t*p=static_cast<oss_priv_t*>(stream->priv); sp->type=0; sp->len = TEMP_FAILURE_RETRY(read(stream->fd,sp->buf,sp->len)); if(!errno) p->spos+=sp->len; @@ -150,14 +153,14 @@ static off_t __FASTCALL__ oss_seek(stream_t*stream,off_t pos) { UNUSED(pos); - oss_priv_t *p=reinterpret_cast<oss_priv_t*>(stream->priv); + oss_priv_t *p=static_cast<oss_priv_t*>(stream->priv); errno=ENOSYS; return p->spos; } static off_t __FASTCALL__ oss_tell(const stream_t*stream) { - oss_priv_t *p=reinterpret_cast<oss_priv_t*>(stream->priv); + oss_priv_t *p=static_cast<oss_priv_t*>(stream->priv); return p->spos; } @@ -171,7 +174,7 @@ static MPXP_Rc __FASTCALL__ oss_ctrl(const stream_t *s,unsigned cmd,any_t*args) { int rval; - oss_priv_t *oss_priv = reinterpret_cast<oss_priv_t*>(s->priv); + oss_priv_t *oss_priv = static_cast<oss_priv_t*>(s->priv); if(args) *(int *)args=0; switch(cmd) { case SCTRL_AUD_GET_CHANNELS: Modified: mplayerxp/libmpstream/s_tv.cpp =================================================================== --- mplayerxp/libmpstream/s_tv.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_tv.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -23,36 +23,61 @@ #include "mrl.h" /* some default values */ -static int tv_param_audiorate = 44100; -static int tv_param_noaudio = 0; +struct tv_param : public Opaque { + public: + tv_param(); + virtual ~tv_param() {} + + int audiorate; + int noaudio; #ifdef HAVE_TV_BSDBT848 -static int tv_param_immediate = 0; + int immediate; #endif -static const char *tv_param_freq = NULL; -static const char *tv_param_channel = NULL; -static const char *tv_param_norm = "pal"; -static const char *tv_param_chanlist = "europe-east"; -static const char *tv_param_device = NULL; -static const char *tv_param_driver = "dummy"; -static int tv_param_width = -1; -static int tv_param_height = -1; -static int tv_param_input = 0; /* used in v4l and bttv */ -static const char *tv_param_outfmt = "yv12"; -static float tv_param_fps = -1.0; + const char *freq; + const char *channel; + const char *norm; + const char *chanlist; + const char *device; + const char *driver; + int width; + int height; + int input; /* used in v4l and bttv */ + const char *outfmt; + float fps; +}; +static tv_param tv_param; +tv_param::tv_param() { + audiorate = 44100; + noaudio = 0; +#ifdef HAVE_TV_BSDBT848 + immediate = 0; +#endif + freq = NULL; + channel = NULL; + norm = "pal"; + chanlist = "europe-east"; + device = NULL; + driver = "dummy"; + width = -1; + height = -1; + input = 0; /* used in v4l and bttv */ + outfmt = "yv12"; + fps = -1.0; +} static const mrl_config_t tvopts_conf[]={ - {"driver", &tv_param_driver, MRL_TYPE_STRING, 0, 0 }, - {"device", &tv_param_device, MRL_TYPE_STRING, 0, 0 }, - {"freq", &tv_param_freq, MRL_TYPE_STRING, 0, 0 }, - {"channel", &tv_param_channel, MRL_TYPE_STRING, 0, 0 }, - {"chanlist", &tv_param_chanlist, MRL_TYPE_STRING, 0, 0 }, - {"norm", &tv_param_norm, MRL_TYPE_STRING, 0, 0 }, - {"width", &tv_param_width, MRL_TYPE_INT, 0, 4096 }, - {"height", &tv_param_height, MRL_TYPE_INT, 0, 4096 }, - {"input", &tv_param_input, MRL_TYPE_INT, 0, 20 }, - {"outfmt", &tv_param_outfmt, MRL_TYPE_STRING, 0, 0 }, - {"fps", &tv_param_fps, MRL_TYPE_FLOAT, 0, 100.0 }, - {NULL, NULL, 0, 0, 0 } + {"driver", &tv_param.driver, MRL_TYPE_STRING, 0, 0 }, + {"device", &tv_param.device, MRL_TYPE_STRING, 0, 0 }, + {"freq", &tv_param.freq, MRL_TYPE_STRING, 0, 0 }, + {"channel", &tv_param.channel, MRL_TYPE_STRING, 0, 0 }, + {"chanlist", &tv_param.chanlist, MRL_TYPE_STRING, 0, 0 }, + {"norm", &tv_param.norm, MRL_TYPE_STRING, 0, 0 }, + {"width", &tv_param.width, MRL_TYPE_INT, 0, 4096 }, + {"height", &tv_param.height, MRL_TYPE_INT, 0, 4096 }, + {"input", &tv_param.input, MRL_TYPE_INT, 0, 20 }, + {"outfmt", &tv_param.outfmt, MRL_TYPE_STRING, 0, 0 }, + {"fps", &tv_param.fps, MRL_TYPE_FLOAT, 0, 100.0 }, + {NULL, NULL, 0, 0, 0 } }; #include "tvi/tv.h" @@ -88,7 +113,7 @@ /* ================== ADD AUDIO PACKET =================== */ - if (ds==demux->audio && tv_param_noaudio == 0 && + if (ds==demux->audio && tv_param.noaudio == 0 && tvh->functions->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) { @@ -126,66 +151,66 @@ return 0; } - if (!strcasecmp(tv_param_outfmt, "yv12")) + if (!strcasecmp(tv_param.outfmt, "yv12")) picture_format = IMGFMT_YV12; - else if (!strcasecmp(tv_param_outfmt, "i420")) + else if (!strcasecmp(tv_param.outfmt, "i420")) picture_format = IMGFMT_I420; - else if (!strcasecmp(tv_param_outfmt, "uyvy")) + else if (!strcasecmp(tv_param.outfmt, "uyvy")) picture_format = IMGFMT_UYVY; - else if (!strcasecmp(tv_param_outfmt, "yuy2")) + else if (!strcasecmp(tv_param.outfmt, "yuy2")) picture_format = IMGFMT_YUY2; - else if (!strcasecmp(tv_param_outfmt, "rgb32")) + else if (!strcasecmp(tv_param.outfmt, "rgb32")) picture_format = IMGFMT_RGB32; - else if (!strcasecmp(tv_param_outfmt, "rgb24")) + else if (!strcasecmp(tv_param.outfmt, "rgb24")) picture_format = IMGFMT_RGB24; - else if (!strcasecmp(tv_param_outfmt, "rgb16")) + else if (!strcasecmp(tv_param.outfmt, "rgb16")) picture_format = IMGFMT_RGB16; - else if (!strcasecmp(tv_param_outfmt, "rgb15")) + else if (!strcasecmp(tv_param.outfmt, "rgb15")) picture_format = IMGFMT_RGB15; else { - MSG_ERR( "Unknown format given: %s\n", tv_param_outfmt); + MSG_ERR( "Unknown format given: %s\n", tv_param.outfmt); MSG_V( "Using default: Planar YV12\n"); picture_format = IMGFMT_YV12; } funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_SET_FORMAT, &picture_format); /* set width */ - if (tv_param_width != -1) + if (tv_param.width != -1) { - if (funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_CHK_WIDTH, &tv_param_width) == TVI_CONTROL_TRUE) - funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_SET_WIDTH, &tv_param_width); + if (funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_CHK_WIDTH, &tv_param.width) == TVI_CONTROL_TRUE) + funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_SET_WIDTH, &tv_param.width); else { - MSG_ERR( "Unable set requested width: %d\n", tv_param_width); - funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_GET_WIDTH, &tv_param_width); + MSG_ERR( "Unable set requested width: %d\n", tv_param.width); + funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_GET_WIDTH, &tv_param.width); } } /* set height */ - if (tv_param_height != -1) + if (tv_param.height != -1) { - if (funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_CHK_HEIGHT, &tv_param_height) == TVI_CONTROL_TRUE) - funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_SET_HEIGHT, &tv_param_height); + if (funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_CHK_HEIGHT, &tv_param.height) == TVI_CONTROL_TRUE) + funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_SET_HEIGHT, &tv_param.height); else { - MSG_ERR( "Unable set requested height: %d\n", tv_param_height); - funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_GET_HEIGHT, &tv_param_height); + MSG_ERR( "Unable set requested height: %d\n", tv_param.height); + funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_VID_GET_HEIGHT, &tv_param.height); } } /* set some params got from cmdline */ - funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_SPC_SET_INPUT, &tv_param_input); + funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_SPC_SET_INPUT, &tv_param.input); /* select video norm */ - if (!strcasecmp(tv_param_norm, "pal")) + if (!strcasecmp(tv_param.norm, "pal")) tvh->norm = TV_NORM_PAL; - else if (!strcasecmp(tv_param_norm, "ntsc")) + else if (!strcasecmp(tv_param.norm, "ntsc")) tvh->norm = TV_NORM_NTSC; - else if (!strcasecmp(tv_param_norm, "secam")) + else if (!strcasecmp(tv_param.norm, "secam")) tvh->norm = TV_NORM_SECAM; - MSG_V( "Selected norm: %s\n", tv_param_norm); + MSG_V( "Selected norm: %s\n", tv_param.norm); funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_TUN_SET_NORM, &tvh->norm); if (funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE) @@ -197,7 +222,7 @@ /* select channel list */ for (i = 0; chanlists[i].name != NULL; i++) { - if (!strcasecmp(chanlists[i].name, tv_param_chanlist)) + if (!strcasecmp(chanlists[i].name, tv_param.chanlist)) { tvh->chanlist = i; tvh->chanlist_s = chanlists[i].list; @@ -207,21 +232,21 @@ if (tvh->chanlist == -1) MSG_WARN( "Unable to find selected channel list! (%s)\n", - tv_param_chanlist); + tv_param.chanlist); else MSG_V( "Selected channel list: %s (including %d channels)\n", chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count); - if (tv_param_freq && tv_param_channel) + if (tv_param.freq && tv_param.channel) { MSG_WARN( "You can't set frequency and channel simultanly!\n"); goto done; } /* we need to set frequency */ - if (tv_param_freq) + if (tv_param.freq) { - unsigned long freq = atof(tv_param_freq)*16; + unsigned long freq = atof(tv_param.freq)*16; /* set freq in MHz */ funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_TUN_SET_FREQ, &freq); @@ -231,15 +256,15 @@ freq, (float)freq/16); } - if (tv_param_channel) + if (tv_param.channel) { struct CHANLIST cl; - MSG_V( "Requested channel: %s\n", tv_param_channel); + MSG_V( "Requested channel: %s\n", tv_param.channel); for (i = 0; i < chanlists[tvh->chanlist].count; i++) { cl = tvh->chanlist_s[i]; - if (!strcasecmp(cl.name, tv_param_channel)) + if (!strcasecmp(cl.name, tv_param.channel)) { tvh->channel = i; MSG_V( "Selected channel: %s (freq: %.3f)\n", @@ -278,17 +303,17 @@ else sh_video->fps = tmp; } - if (tv_param_fps != -1.0f) - sh_video->fps = tv_param_fps; + if (tv_param.fps != -1.0f) + sh_video->fps = tv_param.fps; MSG_V("fps: %f, frametime: %f\n", sh_video->fps, 1.0f/sh_video->fps); #ifdef HAVE_TV_BSDBT848 /* If playback only mode, go to immediate mode, fail silently */ - if(tv_param_immediate == 1) + if(tv_param.immediate == 1) { funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_IMMEDIATE, 0); - tv_param_noaudio = 1; + tv_param.noaudio = 1; } #endif @@ -308,7 +333,7 @@ /* here comes audio init */ - if (tv_param_noaudio == 0 && funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) + if (tv_param.noaudio == 0 && funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) { int audio_format; int sh_audio_format; @@ -316,7 +341,7 @@ /* yeah, audio is present */ funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_AUD_SET_SAMPLERATE, - &tv_param_audiorate); + &tv_param.audiorate); if (funcs->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE) goto no_audio; @@ -384,18 +409,18 @@ extern tvi_handle_t *tvi_init_v4l(const char *device); tvi_handle_t * __FASTCALL__ tv_begin(void) { - if (!strcmp(tv_param_driver, "dummy")) - return (tvi_handle_t *)tvi_init_dummy(tv_param_device); + if (!strcmp(tv_param.driver, "dummy")) + return (tvi_handle_t *)tvi_init_dummy(tv_param.device); #ifdef HAVE_TV_V4L - if (!strcmp(tv_param_driver, "v4l")) - return (tvi_handle_t *)tvi_init_v4l(tv_param_device); + if (!strcmp(tv_param.driver, "v4l")) + return (tvi_handle_t *)tvi_init_v4l(tv_param.device); #endif #ifdef HAVE_TV_BSDBT848 - if (!strcmp(tv_param_driver, "bsdbt848")) - return (tvi_handle_t *)tvi_init_bsdbt848(tv_param_device); + if (!strcmp(tv_param.driver, "bsdbt848")) + return (tvi_handle_t *)tvi_init_bsdbt848(tv_param.device); #endif - MSG_ERR( "No such driver: %s\n", tv_param_driver); + MSG_ERR( "No such driver: %s\n", tv_param.driver); return(NULL); } @@ -501,7 +526,7 @@ { if (tvh->functions->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE) { -// unsigned long freq = atof(tv_param_freq)*16; +// unsigned long freq = atof(tv_param.freq)*16; /* set freq in MHz */ tvh->functions->control(reinterpret_cast<priv_s*>(tvh->priv), TVI_CONTROL_TUN_SET_FREQ, &freq); Modified: mplayerxp/libmpstream/s_vcdnav.cpp =================================================================== --- mplayerxp/libmpstream/s_vcdnav.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/s_vcdnav.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -23,28 +23,38 @@ } vcdsector_t; typedef struct { - lsn_t start_LSN; /* LSN where play item starts */ - size_t size; /* size in sector units of play item. */ + lsn_t start_LSN; /* LSN where play item starts */ + size_t size; /* size in sector units of play item. */ } vcd_item_info_t; -typedef struct vcd_priv_s -{ - vcdinfo_obj_t* fd; - unsigned ntracks; - vcd_item_info_t *track; - unsigned nentries; - vcd_item_info_t *entry; - unsigned nsegments; - vcd_item_info_t *segment; - unsigned nlids; - lsn_t start; - lsn_t lsn; - unsigned total; - /* cache */ - vcdsector_t vcd_sector; - lsn_t vcd_sector_lsn; -}vcd_priv_t; +struct vcd_priv_t : public Opaque { + public: + vcd_priv_t() {} + virtual ~vcd_priv_t(); + vcdinfo_obj_t* fd; + unsigned ntracks; + vcd_item_info_t *track; + unsigned nentries; + vcd_item_info_t *entry; + unsigned nsegments; + vcd_item_info_t *segment; + unsigned nlids; + lsn_t start; + lsn_t lsn; + unsigned total; + /* cache */ + vcdsector_t vcd_sector; + lsn_t vcd_sector_lsn; +}; + +vcd_priv_t::~vcd_priv_t() { + vcdinfo_close(fd); + if(track) delete track; + if(entry) delete entry; + if(segment) delete segment; +} + static void __FASTCALL__ _cdio_detect_media(char *device) { CdIo_t *img; @@ -162,7 +172,7 @@ static int __FASTCALL__ _vcdnav_read(stream_t *stream,stream_packet_t*sp) { - vcd_priv_t *p=reinterpret_cast<vcd_priv_t*>(stream->priv); + vcd_priv_t *p=static_cast<vcd_priv_t*>(stream->priv); CdIo *img=vcdinfo_get_cd_image(p->fd); MSG_DBG2("vcdnav_read: lsn=%i total=%i\n",p->lsn,p->total); if(sp) sp->type=0; @@ -224,7 +234,7 @@ static off_t __FASTCALL__ _vcdnav_seek(stream_t *stream,off_t pos) { - vcd_priv_t *p=reinterpret_cast<vcd_priv_t*>(stream->priv); + vcd_priv_t *p=static_cast<vcd_priv_t*>(stream->priv); lsn_t oldlsn=p->lsn; CdIo *img = vcdinfo_get_cd_image(p->fd); p->lsn=pos/sizeof(vcdsector_t); @@ -239,20 +249,16 @@ static off_t __FASTCALL__ _vcdnav_tell(const stream_t *stream) { - vcd_priv_t *p=reinterpret_cast<vcd_priv_t*>(stream->priv); + vcd_priv_t *p=static_cast<vcd_priv_t*>(stream->priv); MSG_DBG2("vcdnav_tell: lsn=%i\n",p->lsn); return p->lsn*sizeof(vcdsector_t); } static void __FASTCALL__ _vcdnav_close(stream_t*stream) { - vcd_priv_t*priv=reinterpret_cast<vcd_priv_t*>(stream->priv); + vcd_priv_t*priv=static_cast<vcd_priv_t*>(stream->priv); MSG_DBG2("vcdnav_close\n"); - vcdinfo_close(((vcd_priv_t *)stream->priv)->fd); - if(priv->track) delete priv->track; - if(priv->entry) delete priv->entry; - if(priv->segment) delete priv->segment; - delete stream->priv; + delete priv; } static MPXP_Rc __FASTCALL__ _vcdnav_ctrl(const stream_t *s,unsigned cmd,any_t*args) { UNUSED(s); Modified: mplayerxp/libmpstream/stream.cpp =================================================================== --- mplayerxp/libmpstream/stream.cpp 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/stream.cpp 2012-11-28 15:49:24 UTC (rev 476) @@ -219,7 +219,7 @@ } stream_t* __FASTCALL__ new_memory_stream(const unsigned char* data,int len){ - stream_t *s=(stream_t*)mp_mallocz(sizeof(stream_t)+len); + stream_t *s=new(zeromem) stream_t; if(s==NULL) return NULL; s->fd=-1; s->pin=STREAM_PIN; @@ -227,7 +227,7 @@ s->buf_pos=0; s->buf_len=len; s->start_pos=0; s->end_pos=len; s->sector_size=1; - s->buffer=(unsigned char *)mp_malloc(len); + s->buffer=new unsigned char [len]; if(s->buffer==NULL) { delete s; return NULL; } stream_reset(s); s->pos=len; @@ -236,15 +236,15 @@ } stream_t* __FASTCALL__ new_stream(int type){ - stream_t *s=(stream_t*)mp_mallocz(sizeof(stream_t)); + stream_t *s=new(zeromem) stream_t; if(s==NULL) return NULL; - rnd_fill(s->antiviral_hole,offsetof(stream_t,pin)-offsetof(stream_t,antiviral_hole)); + rnd_fill(s->antiviral_hole,reinterpret_cast<long>(&s->pin)-reinterpret_cast<long>(&s->antiviral_hole)); s->pin=STREAM_PIN; s->fd=-1; s->type=type; s->sector_size=STREAM_BUFFER_SIZE; - s->buffer=(unsigned char*)mp_malloc(STREAM_BUFFER_SIZE); + s->buffer=new unsigned char [STREAM_BUFFER_SIZE]; if(s->buffer==NULL) { delete s; return NULL; } stream_reset(s); return s; Modified: mplayerxp/libmpstream/stream.h =================================================================== --- mplayerxp/libmpstream/stream.h 2012-11-28 13:39:34 UTC (rev 475) +++ mplayerxp/libmpstream/stream.h 2012-11-28 15:49:24 UTC (rev 476) @@ -5,6 +5,8 @@ #include <sys/types.h> #include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; #include "xmpcore/xmp_enums.h" enum { @@ -37,39 +39,44 @@ int len; /**< length of buffer */ }stream_packet_t; -struct stream_s; -typedef void (* __FASTCALL__ stream_callback)(struct stream_s *s,const stream_packet_t *); +struct stream_t; +typedef void (* __FASTCALL__ stream_callback)(stream_t *s,const stream_packet_t*); enum { STREAM_PIN=RND_NUMBER2+RND_CHAR3 }; struct cache_vars_s; +struct demuxer_t; /** Stream description */ -typedef struct stream_s { - char antiviral_hole[RND_CHAR3]; - unsigned pin; /**< personal identification number */ - int fd; /**< file handler */ - off_t pos; /**< SOF offset from begin of stream */ - int eof; /**< indicates EOF */ - int type; /**< properties of the stream (see STREAMTYPE_ for detail) */ - int file_format; /**< detected file format (by http:// protocol for example) */ - unsigned int buf_pos; /**< position whitin of small cache */ - unsigned int buf_len; /**< length of small cache */ - unsigned char *buffer;/**< buffer of small cache */ - off_t start_pos; /**< real start of stream (without internet's headers) */ - off_t end_pos; /**< real end of stream (media may be not fully filled) */ - unsigned sector_size; /**< alignment of read operations (1 for file, VCD_SECTOR_SIZE for VCDs) */ - struct demuxer_s* demuxer; /* parent demuxer */ - struct cache_vars_s* cache_data; /**< large cache */ - any_t* priv; /**< private data used by stream driver */ - float stream_pts; /**< PTS correction for idiotics DVD's discontinuities */ +struct stream_t : public Opaque { + public: + stream_t() {} + virtual ~stream_t() {} + + char antiviral_hole[RND_CHAR3]; + unsigned pin; /**< personal identification number */ + int fd; /**< file handler */ + off_t pos; /**< SOF offset from begin of stream */ + int eof; /**< indicates EOF */ + int type; /**< properties of the stream (see STREAMTYPE_ for detail) */ + int file_format; /**< detected file format (by http:// protocol for example) */ + unsigned int buf_pos; /**< position whitin of small cache */ + unsigned int buf_len; /**< length of small cache */ + unsigned char* buffer;/**< buffer of small cache */ + off_t start_pos; /**< real start of stream (without internet's headers) */ + off_t end_pos; /**< real end of stream (media may be not fully filled) */ + unsigned sector_size; /**< alignment of read operations (1 for file, VCD_SECTOR_SIZE for VCDs) */ + demuxer_t* demuxer; /* parent demuxer */ + struct cache_vars_s* cache_data; /**< large cache */ + Opaque* priv; /**< private data used by stream driver */ + float stream_pts; /**< PTS correction for idiotics DVD's discontinuities */ #ifdef HAVE_STREAMING - streaming_ctrl_t *streaming_ctrl; /**< callback for internet streaming control */ + streaming_ctrl_t*streaming_ctrl; /**< callback for internet streaming control */ #endif - const struct stream_driver_s *driver; /**< low-level stream driver */ - stream_callback event_handler; /**< callback for streams which provide events */ -} stream_t __attribute__ ((packed)); + const struct stream_driver_s *driver; /**< low-level stream driver */ + stream_c... [truncated message content] |
From: <nic...@us...> - 2012-11-29 05:55:22
|
Revision: 480 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=480&view=rev Author: nickols_k Date: 2012-11-29 05:55:12 +0000 (Thu, 29 Nov 2012) Log Message: ----------- make demuxer and stream internals Modified Paths: -------------- mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_audio.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_fli.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_nsv.cpp mplayerxp/libmpdemux/demux_null.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_rawvideo.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_smjpeg.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_packet.cpp mplayerxp/libmpdemux/demuxer_packet.h mplayerxp/libmpstream/cache2.cpp mplayerxp/libmpstream/s_cdd.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/libmpstream/s_dvdread.cpp mplayerxp/libmpstream/s_file.cpp mplayerxp/libmpstream/s_ftp.cpp mplayerxp/libmpstream/s_lavc.cpp mplayerxp/libmpstream/s_network.cpp mplayerxp/libmpstream/s_null.cpp mplayerxp/libmpstream/s_oss.cpp mplayerxp/libmpstream/s_rtsp.cpp mplayerxp/libmpstream/s_tv.cpp mplayerxp/libmpstream/s_udp.cpp mplayerxp/libmpstream/s_vcdnav.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libmpstream/stream.h mplayerxp/mplayerxp.cpp Added Paths: ----------- mplayerxp/libmpdemux/demuxer_internal.h mplayerxp/libmpstream/stream_internal.h Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -7,6 +7,7 @@ #include "osdep/bswap.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "libmpconf/cfgparser.h" #include "libmpcodecs/dec_audio.h" @@ -191,7 +192,7 @@ if(stream_eof(demuxer->stream)) return 0; - Demux_Packet* dp = new(zeromem) Demux_Packet(l); + Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(l); dp->pts = spos / (float)(sh_audio->wf->nAvgBytesPerSec); dp->pos = spos; dp->flags = DP_NONKEYFRAME; Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_asf.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -13,6 +13,7 @@ #include "libmpstream/stream.h" #include "asf.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" #include "aviprint.h" @@ -459,7 +460,7 @@ ds->asf_packet=NULL; } else { // append data to it! - Demux_Packet* dp=ds->asf_packet; + Demuxer_Packet* dp=ds->asf_packet; if(dp->len!=offs && offs!=-1) MSG_V("warning! fragment.len=%d BUT next fragment offset=%d \n",dp->len,offs); dp->resize(dp->len+len); stream_seek(demux->stream,dataoff); @@ -476,7 +477,7 @@ MSG_V("warning! broken fragment or incomplete seeking, %d bytes missing \n",offs); return 0; } - Demux_Packet& dp=*new(zeromem) Demux_Packet(len); + Demuxer_Packet& dp=*new(zeromem) Demuxer_Packet(len); stream_seek(demux->stream,dataoff); len=stream_read(demux->stream,dp.buffer,len); dp.resize(len); Modified: mplayerxp/libmpdemux/demux_audio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_audio.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_audio.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -13,6 +13,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "genres.h" #include "libmpcodecs/dec_audio.h" @@ -1446,7 +1447,7 @@ return 0; if(len>4) { - Demux_Packet* dp = new(zeromem) Demux_Packet(len); + Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(len); memcpy(dp->buffer,hdr,4); len=stream_read(s,dp->buffer + 4,len-4); dp->resize(len+4); @@ -1475,7 +1476,7 @@ return 0; if(len>8) { - Demux_Packet* dp = new(zeromem) Demux_Packet(len); + Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(len); memcpy(dp->buffer,hdr,8); len=stream_read(s,dp->buffer+8,len-8); dp->resize(len+8); @@ -1504,7 +1505,7 @@ return 0; if(len>16) { - Demux_Packet* dp = new(zeromem) Demux_Packet(len); + Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(len); memcpy(dp->buffer,hdr,16); len=stream_read(s,dp->buffer+16,len-16); dp->resize(len+16); @@ -1521,7 +1522,7 @@ case RAW_SND_AU: case RAW_WAV : { int l = sh_audio->wf->nAvgBytesPerSec; - Demux_Packet* dp =new(zeromem) Demux_Packet(l); + Demuxer_Packet* dp =new(zeromem) Demuxer_Packet(l); l=stream_read(s,dp->buffer,l); dp->resize(l); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; @@ -1532,7 +1533,7 @@ } case RAW_VOC : { int l = 65536; - Demux_Packet* dp =new(zeromem) Demux_Packet(l); + Demuxer_Packet* dp =new(zeromem) Demuxer_Packet(l); l=stream_read(s,dp->buffer,l); dp->resize(l); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; @@ -1550,7 +1551,7 @@ if (s->eof) return 0; bit_len = mpc_get_bits(priv, s, 20); - Demux_Packet* dp=new(zeromem) Demux_Packet((bit_len + 7) / 8); + Demuxer_Packet* dp=new(zeromem) Demuxer_Packet((bit_len + 7) / 8); for (l = 0; l < (bit_len / 8); l++) dp->buffer[l] = mpc_get_bits(priv, s, 8); bit_len %= 8; Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -13,6 +13,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -15,6 +15,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "libvo/img_format.h" @@ -101,7 +102,7 @@ uint8_t *dst,*src; npal_colors = img->format->palette ? img->format->palette->ncolors : 0; fake_24 = img->format->BitsPerPixel == 8 && npal_colors > 0; - Demux_Packet* dp = new(zeromem) Demux_Packet(fake_24 ? len*3 : len); + Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(fake_24 ? len*3 : len); dst = dp->buffer; src =reinterpret_cast<uint8_t*>(img->pixels); if(fake_24) Modified: mplayerxp/libmpdemux/demux_dv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dv.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_dv.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -34,6 +34,7 @@ #include "demux_msg.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #define DV_PAL_FRAME_SIZE 144000 @@ -113,7 +114,7 @@ // seem to do it, even though it takes a file offset as a parameter stream_seek(demuxer->stream, frames->current_filepos); - Demux_Packet* dp_video=new(zeromem) Demux_Packet(frames->frame_size); + Demuxer_Packet* dp_video=new(zeromem) Demuxer_Packet(frames->frame_size); bytes_read=stream_read(demuxer->stream,dp_video->buffer,frames->frame_size); if (bytes_read<frames->frame_size) return 0; @@ -123,7 +124,7 @@ if (demuxer->audio && demuxer->audio->id>=-1) { - Demux_Packet* dp_audio=dp_video->clone(); + Demuxer_Packet* dp_audio=dp_video->clone(); ds_add_packet(demuxer->audio,dp_audio); } ds_add_packet(demuxer->video,dp_video); Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_film.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -23,6 +23,7 @@ #include "osdep/bswap.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "demux_msg.h" @@ -100,7 +101,7 @@ film_data_t *film_data = static_cast<film_data_t*>(demuxer->priv); film_chunk_t film_chunk; int length_fix_bytes; - Demux_Packet* dp; + Demuxer_Packet* dp; // see if the end has been reached if (film_data->current_chunk >= film_data->total_chunks) @@ -117,7 +118,7 @@ if (film_chunk.syncinfo1 == 0xFFFFFFFF) { if(demuxer->audio->id>=-1){ // audio not disabled - dp = new(zeromem) Demux_Packet(film_chunk.chunk_size); + dp = new(zeromem) Demuxer_Packet(film_chunk.chunk_size); if (stream_read(demuxer->stream, dp->buffer, film_chunk.chunk_size) != film_chunk.chunk_size) return 0; dp->pts = film_chunk.pts; @@ -153,7 +154,7 @@ length_fix_bytes = 6; // account for the fix bytes when allocating the buffer - dp = new(zeromem) Demux_Packet(film_chunk.chunk_size - length_fix_bytes); + dp = new(zeromem) Demuxer_Packet(film_chunk.chunk_size - length_fix_bytes); // these CVID data chunks have a few extra bytes; skip them if (stream_read(demuxer->stream, dp->buffer, 10) != 10) Modified: mplayerxp/libmpdemux/demux_fli.cpp =================================================================== --- mplayerxp/libmpdemux/demux_fli.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_fli.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -17,6 +17,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -24,6 +24,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "help_mp.h" @@ -416,7 +417,7 @@ UNUSED(dsds); lavf_priv_t *priv= static_cast<lavf_priv_t*>(demux->priv); AVPacket pkt; - Demux_Packet *dp; + Demuxer_Packet *dp; demux_stream_t *ds; int id; MSG_DBG2("lavf_demux()\n"); @@ -452,7 +453,7 @@ return 1; } - dp=new(zeromem) Demux_Packet(pkt.size); + dp=new(zeromem) Demuxer_Packet(pkt.size); memcpy(dp->buffer, pkt.data, pkt.size); av_free_packet(&pkt); Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -26,6 +26,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "matroska.h" @@ -534,7 +535,7 @@ in display order (the timecodes, not the frames themselves!). In this case demux packets have to be cached with the help of these variables. */ int reorder_timecodes; - Demux_Packet **cached_dps; + Demuxer_Packet **cached_dps; int num_cached_dps, num_allocated_dps; float max_pts; @@ -2349,7 +2350,7 @@ { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); sh_audio_t *sh_a = new_sh_audio_aid(demuxer, track->tnum, aid); - Demux_Packet *dp; + Demuxer_Packet *dp; if(!sh_a) return 1; mkv_d->audio_tracks[mkv_d->last_aid] = track->tnum; @@ -2638,12 +2639,12 @@ if (size < 4 || ptr[0] != 'f' || ptr[1] != 'L' || ptr[2] != 'a' || ptr[3] != 'C') { - dp = new(zeromem) Demux_Packet (4); + dp = new(zeromem) Demuxer_Packet (4); memcpy (dp->buffer, "fLaC", 4); } else { - dp = new(zeromem) Demux_Packet (size); + dp = new(zeromem) Demuxer_Packet (size); memcpy (dp->buffer, ptr, size); } dp->pts = 0; @@ -3170,7 +3171,7 @@ handle_subtitles(demuxer_t *demuxer, mkv_track_t *track, char *block, int64_t size, uint64_t block_duration, uint64_t timecode) { - Demux_Packet *dp; + Demuxer_Packet *dp; char *ptr1; int i; @@ -3200,7 +3201,7 @@ sub_data.utf8 = 1; size -= ptr1 - block; - dp = new(zeromem) Demux_Packet(size); + dp = new(zeromem) Demuxer_Packet(size); memcpy(dp->buffer, ptr1, size); dp->pts = timecode / 1000.0f; #if 0 @@ -3270,7 +3271,7 @@ uint32_t size, int block_bref) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); - Demux_Packet *dp; + Demuxer_Packet *dp; uint32_t timestamp = mkv_d->last_pts * 1000; uint32_t *hdr; uint8_t chunks; @@ -3282,7 +3283,7 @@ chunks = *buffer++; isize = --size - (chunks+1)*8; - dp = new(zeromem) Demux_Packet (REALHEADER_SIZE + size); + dp = new(zeromem) Demuxer_Packet (REALHEADER_SIZE + size); memcpy (dp->buffer + REALHEADER_SIZE, buffer + (chunks+1)*8, isize); #ifdef WORDS_BIGENDIAN p = (uint8_t *)(dp->buffer + REALHEADER_SIZE + isize); @@ -3327,7 +3328,7 @@ int cfs = track->coded_framesize; int w = track->audiopk_size; int spc = track->sub_packet_cnt; - Demux_Packet *dp; + Demuxer_Packet *dp; int x; if ((track->a_formattag == mmioFOURCC('2', '8', '_', '8')) || @@ -3389,7 +3390,7 @@ // Release all the audio packets for (x = 0; x < sph*w/apk_usize; x++) { - dp = new(zeromem) Demux_Packet(apk_usize); + dp = new(zeromem) Demuxer_Packet(apk_usize); memcpy(dp->buffer, track->audio_buf + x * apk_usize, apk_usize); /* Put timestamp only on packets that correspond to original audio packets in file */ dp->pts = (x * apk_usize % w) ? 0 : track->audio_timestamp[x * apk_usize / w]; @@ -3399,7 +3400,7 @@ } } } else { // Not a codec that require reordering - dp = new(zeromem) Demux_Packet (size); + dp = new(zeromem) Demuxer_Packet (size); memcpy(dp->buffer, buffer, size); if (track->ra_pts == mkv_d->last_pts && !mkv_d->a_skip_to_keyframe) dp->pts = 0; @@ -3480,9 +3481,9 @@ uint32_t size, int block_bref, int block_fref) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); - Demux_Packet *dp; + Demuxer_Packet *dp; - dp = new(zeromem) Demux_Packet (size); + dp = new(zeromem) Demuxer_Packet (size); memcpy(dp->buffer, buffer, size); dp->pos = demuxer->filepos; dp->pts = mkv_d->last_pts; @@ -3494,9 +3495,9 @@ dp->flags = 0x10; if ((track->num_cached_dps + 1) > track->num_allocated_dps) { - track->cached_dps = (Demux_Packet **) + track->cached_dps = (Demuxer_Packet **) mp_realloc(track->cached_dps, (track->num_cached_dps + 10) * - sizeof(Demux_Packet *)); + sizeof(Demuxer_Packet *)); track->num_allocated_dps += 10; } track->cached_dps[track->num_cached_dps] = dp; @@ -3635,11 +3636,11 @@ { int modified; unsigned size = lace_size[i]; - Demux_Packet *dp; + Demuxer_Packet *dp; uint8_t *buffer; modified = demux_mkv_decode (track, block, &buffer, &size, 1); if (buffer) { - dp = new(zeromem) Demux_Packet (size); + dp = new(zeromem) Demuxer_Packet (size); memcpy (dp->buffer, buffer, size); if (modified) delete buffer; Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_mov.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -31,6 +31,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" @@ -2005,7 +2006,7 @@ } if(trak->pos==0 && trak->stream_header_len>0){ // we have to append the stream header... - Demux_Packet* dp=new(zeromem) Demux_Packet(x+trak->stream_header_len); + Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(x+trak->stream_header_len); memcpy(dp->buffer,trak->stream_header,trak->stream_header_len); dp->pos=stream_tell(demuxer->stream)-trak->stream_header_len; x=stream_read(demuxer->stream,dp->buffer+trak->stream_header_len,x); Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -19,6 +19,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "parse_es.h" #include "stheader.h" #include "mp3_hdr.h" @@ -399,7 +400,7 @@ } if(pts==MPGPES_BAD_PTS && ds->asf_packet) { - Demux_Packet* dp=ds->asf_packet; + Demuxer_Packet* dp=ds->asf_packet; dp->resize(dp->len+len); stream_read(demux->stream,dp->buffer+dp->len,len); } @@ -407,7 +408,7 @@ { sh_video_t *sh; if(ds->asf_packet) ds_add_packet(ds,ds->asf_packet); - Demux_Packet* dp=new(zeromem) Demux_Packet(len); + Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); len=stream_read(demux->stream,dp->buffer,len); dp->resize(len); dp->pts=pts/90000.0f; Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -15,6 +15,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "loader/qtx/qtxsdk/components.h" #include "nls/nls.h" @@ -556,7 +557,7 @@ } if(ds){ off_t pos=0LL; - Demux_Packet* dp=new(zeromem) Demux_Packet(len); + Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); if(mp_conf.verbose>1) pos=stream_tell(s); len=stream_read(s,dp->buffer,len); dp->resize(len); Modified: mplayerxp/libmpdemux/demux_nsv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nsv.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_nsv.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -21,6 +21,7 @@ #include "help_mp.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_null.cpp =================================================================== --- mplayerxp/libmpdemux/demux_null.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_null.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -6,6 +6,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "libmpconf/cfgparser.h" Modified: mplayerxp/libmpdemux/demux_nuv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nuv.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_nuv.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -20,6 +20,7 @@ #include "help_mp.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "nuppelvideo.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -20,6 +20,7 @@ #include "help_mp.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "aviprint.h" #include "libmpcodecs/codecs_ld.h" @@ -528,7 +529,7 @@ // return 1 if the packet was added, 0 otherwise static int demux_ogg_add_packet(demux_stream_t* ds,ogg_stream_t* os,int id,ogg_packet* pack) { demuxer_t* d = ds->demuxer; - Demux_Packet* dp; + Demuxer_Packet* dp; unsigned char* data; float pts = 0; int flags = 0; @@ -584,7 +585,7 @@ clear_sub = -1; } /// Send the packet - dp = new(zeromem) Demux_Packet(pack->bytes-(data-pack->packet)); + dp = new(zeromem) Demuxer_Packet(pack->bytes-(data-pack->packet)); memcpy(dp->buffer,data,pack->bytes-(data-pack->packet)); dp->pts = pts; dp->flags = flags?DP_KEYFRAME:DP_NONKEYFRAME; @@ -1187,7 +1188,7 @@ ogg_demuxer_t *ogg_d; stream_t* s; uint32_t hdrsizes[3]; - Demux_Packet *dp; + Demuxer_Packet *dp; sh_audio_t *sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); int np; unsigned char *p = NULL,*buf; @@ -1243,15 +1244,15 @@ /// Add the header packets in the ogg demuxer audio stream // Initial header - dp = new(zeromem) Demux_Packet(hdrsizes[0]); + dp = new(zeromem) Demuxer_Packet(hdrsizes[0]); memcpy(dp->buffer,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t),hdrsizes[0]); ds_add_packet(od->audio,dp); /// Comments - dp = new(zeromem) Demux_Packet(hdrsizes[1]); + dp = new(zeromem) Demuxer_Packet(hdrsizes[1]); memcpy(dp->buffer,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0],hdrsizes[1]); ds_add_packet(od->audio,dp); /// Code book - dp = new(zeromem) Demux_Packet(hdrsizes[2]); + dp = new(zeromem) Demuxer_Packet(hdrsizes[2]); memcpy(dp->buffer,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0]+hdrsizes[1],hdrsizes[2]); ds_add_packet(od->audio,dp); Modified: mplayerxp/libmpdemux/demux_pva.cpp =================================================================== --- mplayerxp/libmpdemux/demux_pva.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_pva.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -33,6 +33,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" @@ -188,7 +189,7 @@ static int pva_demux(demuxer_t * demux,demux_stream_t *__ds) { uint8_t done=0; - Demux_Packet * dp; + Demuxer_Packet * dp; pva_priv_t* priv=static_cast<pva_priv_t*>(demux->priv); pva_payload_t current_payload; @@ -224,7 +225,7 @@ } if(done) { int l; - dp=new(zeromem) Demux_Packet(current_payload.size); + dp=new(zeromem) Demuxer_Packet(current_payload.size); dp->pts=priv->last_video_pts; dp->flags=DP_NONKEYFRAME; l=stream_read(demux->stream,dp->buffer,current_payload.size); @@ -253,7 +254,7 @@ if(demux->audio->id!=0) done=0; if(done) { int l; - dp=new(zeromem) Demux_Packet(current_payload.size); + dp=new(zeromem) Demuxer_Packet(current_payload.size); dp->pts=priv->last_audio_pts; if(current_payload.offset != stream_tell(demux->stream)) stream_seek(demux->stream,current_payload.offset); @@ -276,7 +277,7 @@ off_t next_offset,pva_payload_start; unsigned char buffer[256]; #ifndef PVA_NEW_PREBYTES_CODE - Demux_Packet * dp; //hack to deliver the preBytes (see PVA doc) + Demuxer_Packet * dp; //hack to deliver the preBytes (see PVA doc) #endif pva_priv_t* priv=static_cast<pva_priv_t*>(d->priv); Modified: mplayerxp/libmpdemux/demux_rawaudio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -7,6 +7,7 @@ #include "mplayerxp.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "libmpconf/cfgparser.h" #include "libmpcodecs/dec_audio.h" @@ -47,10 +48,10 @@ sh_audio_t* sh_audio; WAVEFORMATEX* w; - demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_CHANNELS,&channels); - demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_SAMPLERATE,&samplerate); - demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_SAMPLESIZE,&samplesize); - demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_FORMAT,&wtag); + stream_control(demuxer->stream,SCTRL_AUD_GET_CHANNELS,&channels); + stream_control(demuxer->stream,SCTRL_AUD_GET_SAMPLERATE,&samplerate); + stream_control(demuxer->stream,SCTRL_AUD_GET_SAMPLESIZE,&samplesize); + stream_control(demuxer->stream,SCTRL_AUD_GET_FORMAT,&wtag); sh_audio = new_sh_audio(demuxer,0); sh_audio->wf = w = (WAVEFORMATEX*)mp_malloc(sizeof(WAVEFORMATEX)); w->wFormatTag = sh_audio->wtag = wtag; @@ -82,7 +83,7 @@ if(stream_eof(demuxer->stream)) return 0; - Demux_Packet* dp = new(zeromem) Demux_Packet(l); + Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(l); dp->pts = spos / (float)(sh_audio->wf->nAvgBytesPerSec); dp->pos = spos; dp->flags=DP_NONKEYFRAME; Modified: mplayerxp/libmpdemux/demux_rawvideo.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -8,6 +8,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "libmpconf/cfgparser.h" @@ -80,10 +81,10 @@ case 7: priv.width=1408;priv.height=1152;break; case 8: priv.width=352; priv.height=240; break; } - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_WIDTH,&priv.width); - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_HEIGHT,&priv.height); - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_FORMAT,&priv.format); - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_FPS,&priv.fps); + stream_control(demuxer->stream,SCTRL_VID_GET_WIDTH,&priv.width); + stream_control(demuxer->stream,SCTRL_VID_GET_HEIGHT,&priv.height); + stream_control(demuxer->stream,SCTRL_VID_GET_FORMAT,&priv.format); + stream_control(demuxer->stream,SCTRL_VID_GET_FPS,&priv.fps); if(!priv.width || !priv.height){ MSG_ERR("rawvideo: width or height not specified!\n"); Modified: mplayerxp/libmpdemux/demux_real.cpp =================================================================== --- mplayerxp/libmpdemux/demux_real.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_real.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -30,6 +30,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" #include "aviprint.h" @@ -415,7 +416,7 @@ int flags; int version; int reserved; - Demux_Packet *dp; + Demuxer_Packet *dp; while(1){ @@ -514,7 +515,7 @@ sub_packet_lengths[i] = stream_read_word(demuxer->stream); for (i = 0; i < sub_packets; i++) { int l; - Demux_Packet *dp = new(zeromem) Demux_Packet(sub_packet_lengths[i]); + Demuxer_Packet *dp = new(zeromem) Demuxer_Packet(sub_packet_lengths[i]); l=stream_read(demuxer->stream, dp->buffer, sub_packet_lengths[i]); dp->resize(l); dp->pts = pts; @@ -526,7 +527,7 @@ delete sub_packet_lengths; return 1; } - dp = new(zeromem) Demux_Packet(len); + dp = new(zeromem) Demuxer_Packet(len); len=stream_read(demuxer->stream, dp->buffer, len); dp->resize(len); if (priv->audio_need_keyframe == 1) { @@ -566,7 +567,7 @@ // we need a more complicated, 2nd level demuxing, as the video // frames are stored fragmented in the video chunks :( sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(ds->sh); - Demux_Packet *dp; + Demuxer_Packet *dp; int vpkg_header, vpkg_length, vpkg_offset; int vpkg_seqnum=-1; int vpkg_subseq=0; @@ -707,7 +708,7 @@ } } // create new packet! - dp = new(zeromem) Demux_Packet(sizeof(dp_hdr_t)+vpkg_length+8*(1+2*(vpkg_header&0x3F))); + dp = new(zeromem) Demuxer_Packet(sizeof(dp_hdr_t)+vpkg_length+8*(1+2*(vpkg_header&0x3F))); // the timestamp seems to be in milliseconds dp->pts = 0; // timestamp/1000.0f; //timestamp=0; dp->pos = demuxer->filepos; Modified: mplayerxp/libmpdemux/demux_realaud.cpp =================================================================== --- mplayerxp/libmpdemux/demux_realaud.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_realaud.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -15,6 +15,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" #include "libao2/afmt.h" @@ -77,7 +78,7 @@ len = wf->nBlockAlign; demuxer->filepos = stream_tell(demuxer->stream); - Demux_Packet *dp = new(zeromem) Demux_Packet(len); + Demuxer_Packet *dp = new(zeromem) Demuxer_Packet(len); len=stream_read(demuxer->stream, dp->buffer, len); dp->resize(len); Modified: mplayerxp/libmpdemux/demux_roq.cpp =================================================================== --- mplayerxp/libmpdemux/demux_roq.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_roq.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -19,6 +19,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_smjpeg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_smjpeg.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -23,6 +23,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_ts.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ts.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_ts.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -34,6 +34,7 @@ #include "help_mp.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "parse_es.h" #include "stheader.h" #include "libmpcodecs/dec_audio.h" @@ -122,7 +123,7 @@ typedef struct { demux_stream_t *ds; - Demux_Packet *pack; + Demuxer_Packet *pack; int offset, buffer_size; } av_fifo_t; @@ -2515,7 +2516,7 @@ } -static int fill_packet(demuxer_t *demuxer, demux_stream_t *ds, Demux_Packet **dp, int *dp_offset, TS_stream_info *si) +static int fill_packet(demuxer_t *demuxer, demux_stream_t *ds, Demuxer_Packet **dp, int *dp_offset, TS_stream_info *si) { int ret = 0; @@ -2590,7 +2591,7 @@ stream_t *stream = demuxer->stream; unsigned char *p; demux_stream_t *ds = NULL; - Demux_Packet **dp = NULL; + Demuxer_Packet **dp = NULL; int *dp_offset = 0, *buffer_size = 0; int32_t progid=0, pid_type, bad, ts_error; int junk = 0, rap_flag = 0; @@ -2603,7 +2604,7 @@ { bad = ts_error = 0; ds = (demux_stream_t*) NULL; - dp = (Demux_Packet **) NULL; + dp = (Demuxer_Packet **) NULL; dp_offset = buffer_size = NULL; rap_flag = 0; mp4_dec = NULL; @@ -2819,7 +2820,7 @@ { if(*buffer_size > MAX_PACK_BYTES) *buffer_size = MAX_PACK_BYTES; - *dp = new(zeromem) Demux_Packet(*buffer_size); //es->size + *dp = new(zeromem) Demuxer_Packet(*buffer_size); //es->size *dp_offset = 0; if(! *dp) { Modified: mplayerxp/libmpdemux/demux_ty.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ty.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_ty.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -44,6 +44,7 @@ #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "parse_es.h" #include "stheader.h" #include "sub_cc.h" @@ -291,7 +292,7 @@ static void demux_ty_CopyToDemuxPacket( demux_stream_t *ds, unsigned char *buffer, int size, off_t pos, int64_t pts ) { - Demux_Packet *dp = new(zeromem) Demux_Packet( size ); + Demuxer_Packet *dp = new(zeromem) Demuxer_Packet( size ); memcpy( dp->buffer, buffer, size ); if (pts != -1) dp->pts = pts / 90000.0; Modified: mplayerxp/libmpdemux/demux_viv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_viv.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_viv.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -16,6 +16,7 @@ #include "help_mp.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" #include "demux_msg.h" @@ -420,7 +421,7 @@ ds->asf_packet=NULL; } else { // append data to it! - Demux_Packet* dp=ds->asf_packet; + Demuxer_Packet* dp=ds->asf_packet; dp->resize(dp->len+len); //memcpy(dp->buffer+dp->len,data,len); stream_read(demux->stream,dp->buffer+dp->len,len); @@ -432,7 +433,7 @@ } } // create new packet: - Demux_Packet* dp=new(zeromem) Demux_Packet(len); + Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); //memcpy(dp->buffer,data,len); len=stream_read(demux->stream,dp->buffer,len); dp->resize(len); Modified: mplayerxp/libmpdemux/demux_vqf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_vqf.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_vqf.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -9,6 +9,7 @@ #include "osdep/bswap.h" #include "libmpstream/stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "libmpconf/cfgparser.h" #include "libmpcodecs/dec_audio.h" @@ -191,12 +192,12 @@ sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); int l = sh_audio->wf->nAvgBytesPerSec; off_t spos = stream_tell(demuxer->stream); - Demux_Packet* dp; + Demuxer_Packet* dp; if(stream_eof(demuxer->stream)) return 0; - dp = new(zeromem) Demux_Packet(l); + dp = new(zeromem) Demuxer_Packet(l); dp->pts = spos / (float)(sh_audio->wf->nAvgBytesPerSec); dp->pos = spos; dp->flags = DP_NONKEYFRAME; Modified: mplayerxp/libmpdemux/demux_y4m.cpp =================================================================== --- mplayerxp/libmpdemux/demux_y4m.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demux_y4m.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -18,6 +18,7 @@ //#include "stream.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "stheader.h" #include "osdep/bswap.h" #include "demux_msg.h" @@ -77,7 +78,7 @@ static int y4m_demux(demuxer_t *demux,demux_stream_t *__ds) { UNUSED(__ds); demux_stream_t *ds=demux->video; - Demux_Packet *dp; + Demuxer_Packet *dp; y4m_priv_t *priv=static_cast<y4m_priv_t*>(demux->priv); y4m_frame_info_t fi; unsigned char *buf[3]; @@ -87,7 +88,7 @@ size = ((sh_video_t*)ds->sh)->src_w*((sh_video_t*)ds->sh)->src_h; - dp = new(zeromem) Demux_Packet(3*size/2); + dp = new(zeromem) Demuxer_Packet(3*size/2); /* swap U and V components */ buf[0] = dp->buffer; Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -23,6 +23,7 @@ #include "demux_msg.h" #include "demuxer.h" +#include "demuxer_internal.h" #include "libmpstream/stream.h" #include "stheader.h" #include "mplayerxp.h" @@ -257,8 +258,8 @@ } } -void ds_add_packet(demux_stream_t *ds,Demux_Packet* dp){ -// Demux_Packet* dp=new_demux_packet(len); +void ds_add_packet(demux_stream_t *ds,Demuxer_Packet* dp){ +// Demuxer_Packet* dp=new_demux_packet(len); // stream_read(stream,dp->buffer,len); // dp->pts=pts; //(float)pts/90000.0f; // dp->pos=pos; @@ -285,7 +286,7 @@ } void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags){ - Demux_Packet* dp=new(zeromem) Demux_Packet(len); + Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); len=stream_read(stream,dp->buffer,len); dp->resize(len); dp->pts=pts; //(float)pts/90000.0f; @@ -323,7 +324,7 @@ check_pin("demuxer",ds->pin,DS_PIN); while(1){ if(ds->packs){ - Demux_Packet *p=ds->first; + Demuxer_Packet *p=ds->first; // copy useful data: ds->buffer=p->buffer; ds->buffer_pos=0; @@ -390,9 +391,9 @@ } void ds_free_packs(demux_stream_t *ds){ - Demux_Packet *dp=ds->first; + Demuxer_Packet *dp=ds->first; while(dp){ - Demux_Packet *dn=dp->next; + Demuxer_Packet *dn=dp->next; delete dp; dp=dn; } @@ -412,11 +413,11 @@ } void ds_free_packs_until_pts(demux_stream_t *ds,float pts){ - Demux_Packet *dp=ds->first; + Demuxer_Packet *dp=ds->first; unsigned packs,bytes; packs=bytes=0; while(dp){ - Demux_Packet *dn=dp->next; + Demuxer_Packet *dn=dp->next; if(dp->pts >= pts) break; packs++; bytes+=dp->len; @@ -597,10 +598,8 @@ for(i=0;i<sizeof(stream_txt_ids)/sizeof(struct s_stream_txt_ids);i++) if(!demux_info_get(demuxer,stream_txt_ids[i].demuxer_id)) { char stream_name[256]; - if(demuxer->stream->driver->control) { - if(demuxer->stream->driver->control(demuxer->stream,stream_txt_ids[i].stream_id,stream_name) == MPXP_Ok) { + if(stream_control(demuxer->stream,stream_txt_ids[i].stream_id,stream_name) == MPXP_Ok) { demux_info_add(demuxer,stream_txt_ids[i].demuxer_id,stream_name); - } } } stream->demuxer=demuxer; Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demuxer.h 2012-11-29 05:55:12 UTC (rev 480) @@ -77,12 +77,12 @@ /*---------------*/ int packs; /**< number of packets in buffer */ int bytes; /**< total bytes of packets in buffer */ - Demux_Packet* first; /**< read to current buffer from here */ - Demux_Packet* last; /**< append new packets from input stream to here */ - Demux_Packet* current; /**< needed for refcounting of the buffer */ + Demuxer_Packet* first; /**< read to current buffer from here */ + Demuxer_Packet* last; /**< append new packets from input stream to here */ + Demuxer_Packet* current; /**< needed for refcounting of the buffer */ demuxer_t* demuxer; /**< parent demuxer structure (stream handler) */ /* ---- asf ----- */ - Demux_Packet* asf_packet; /**< read asf fragments here */ + Demuxer_Packet* asf_packet; /**< read asf fragments here */ int asf_seq; /**< sequence id associated with asf_packet */ /*---------------*/ any_t* sh; /**< Stream header associated with this stream (@see st_header.h for detail) */ @@ -106,6 +106,7 @@ }; struct demuxer_info_t; +struct demuxer_driver_t; struct demuxer_t : public Opaque { public: demuxer_t() {} @@ -130,7 +131,7 @@ Opaque* priv; /**< private data of demuxer's driver.*/ demuxer_info_t* info; /**< human-readable info from stream/movie (like movie name,author,duration)*/ - const struct demuxer_driver_s* driver; /**< driver associated with this demuxer */ + const demuxer_driver_t* driver; /**< driver associated with this demuxer */ } __attribute__ ((packed)); enum { @@ -150,52 +151,13 @@ DEMUX_CMD_SWITCH_VIDEO =2, DEMUX_CMD_SWITCH_SUBS =3 }; -/** Demuxer's driver interface */ -typedef struct demuxer_driver_s -{ - const char* short_name; /**< for forcing through comand line */ - const char* name; /**< Name of driver ("Matroska MKV parser") */ - const char* defext; /**< Default file extension for this movie type */ - const config_t* options;/**< Optional: MPlayerXP's option related */ - /** Probing stream. - * @param d _this demuxer - **/ - MPXP_Rc (*probe)(demuxer_t *d); - /** Opens stream. - * @param d _this demxuer - **/ - demuxer_t* (*open)(demuxer_t *d); - /** Reads and demuxes stream. - * @param d _this demuxer - * @param ds pointer to stream associated with demuxer - * @return 0 - EOF or no stream found; 1 - if packet was successfully readed */ - int (*demux)(demuxer_t *d,demux_stream_t *ds); - /** Seeks within of stream. - * @param d _thid demuxer - * @param rel_seek_secs position in seconds from begin of stream - * @param flags 0x01 - seek from start else seek_cur, 0x02 - rel_seek_secs indicates pos in percents/100 else in seconds - * @note this function is optional and maybe NULL - **/ - void (*seek)(demuxer_t *d,const seek_args_t* seeka); - /** Closes driver - * @param d _this demuxer - **/ - void (*close)(demuxer_t *d); - /** Control interface to demuxer - * @param d _this demuxer - * @param cmd command to be execute (one of DEMUX_CMD_*) - * @param arg optional arguments for thsis command - * @return one of DEMUX_* states - **/ - MPXP_Rc (*control)(const demuxer_t *d,int cmd,any_t*arg); -}demuxer_driver_t; demux_stream_t* new_demuxer_stream(demuxer_t *demuxer,int id); demuxer_t* new_demuxer(stream_t *stream,int a_id,int v_id,int s_id); void free_demuxer_stream(demux_stream_t *ds); void free_demuxer(demuxer_t *demuxer); -void ds_add_packet(demux_stream_t *ds,Demux_Packet* dp); +void ds_add_packet(demux_stream_t *ds,Demuxer_Packet* dp); void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags); int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds); Added: mplayerxp/libmpdemux/demuxer_internal.h =================================================================== --- mplayerxp/libmpdemux/demuxer_internal.h (rev 0) +++ mplayerxp/libmpdemux/demuxer_internal.h 2012-11-29 05:55:12 UTC (rev 480) @@ -0,0 +1,43 @@ +#ifndef __DEMUXER_INTERNAL_H_INCLUDED +#define __DEMUXER_INTERNAL_H_INCLUDED 1 + +/** Demuxer's driver interface */ +struct demuxer_driver_t +{ + const char* short_name; /**< for forcing through comand line */ + const char* name; /**< Name of driver ("Matroska MKV parser") */ + const char* defext; /**< Default file extension for this movie type */ + const config_t* options;/**< Optional: MPlayerXP's option related */ + /** Probing stream. + * @param d _this demuxer + **/ + MPXP_Rc (*probe)(demuxer_t *d); + /** Opens stream. + * @param d _this demxuer + **/ + demuxer_t* (*open)(demuxer_t *d); + /** Reads and demuxes stream. + * @param d _this demuxer + * @param ds pointer to stream associated with demuxer + * @return 0 - EOF or no stream found; 1 - if packet was successfully readed */ + int (*demux)(demuxer_t *d,demux_stream_t *ds); + /** Seeks within of stream. + * @param d _thid demuxer + * @param rel_seek_secs position in seconds from begin of stream + * @param flags 0x01 - seek from start else seek_cur, 0x02 - rel_seek_secs indicates pos in percents/100 else in seconds + * @note this function is optional and maybe NULL + **/ + void (*seek)(demuxer_t *d,const seek_args_t* seeka); + /** Closes driver + * @param d _this demuxer + **/ + void (*close)(demuxer_t *d); + /** Control interface to demuxer + * @param d _this demuxer + * @param cmd command to be execute (one of DEMUX_CMD_*) + * @param arg optional arguments for thsis command + * @return one of DEMUX_* states + **/ + MPXP_Rc (*control)(const demuxer_t *d,int cmd,any_t*arg); +}; +#endif Property changes on: mplayerxp/libmpdemux/demuxer_internal.h ___________________________________________________________________ Added: svn:eol-style + native Modified: mplayerxp/libmpdemux/demuxer_packet.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_packet.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demuxer_packet.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -2,7 +2,7 @@ #include "osdep/fastmemcpy.h" #include <string.h> -Demux_Packet::Demux_Packet(unsigned _len) +Demuxer_Packet::Demuxer_Packet(unsigned _len) :pts(0), pos(0), flags(0), @@ -12,11 +12,11 @@ buffer=new unsigned char [len]; } -Demux_Packet::~Demux_Packet(){ +Demuxer_Packet::~Demuxer_Packet(){ if(buffer) delete buffer; } -void Demux_Packet::resize(unsigned newlen) +void Demuxer_Packet::resize(unsigned newlen) { if(len!=newlen) { if(newlen) buffer=(unsigned char *)mp_realloc(buffer,newlen); @@ -28,8 +28,8 @@ } } -Demux_Packet* Demux_Packet::clone() const { - Demux_Packet* dp=new Demux_Packet(len); +Demuxer_Packet* Demuxer_Packet::clone() const { + Demuxer_Packet* dp=new Demuxer_Packet(len); dp->pts=pts; dp->pos=pos; dp->flags=flags; Modified: mplayerxp/libmpdemux/demuxer_packet.h =================================================================== --- mplayerxp/libmpdemux/demuxer_packet.h 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpdemux/demuxer_packet.h 2012-11-29 05:55:12 UTC (rev 480) @@ -11,20 +11,20 @@ }; /** Describes demuxer's packet */ -class Demux_Packet : public Opaque { +class Demuxer_Packet : public Opaque { public: - Demux_Packet(unsigned len); - virtual ~Demux_Packet(); + Demuxer_Packet(unsigned len); + virtual ~Demuxer_Packet(); void resize(unsigned newlen); - Demux_Packet* clone() const; + Demuxer_Packet* clone() const; unsigned len; /**< length of packet's data */ float pts; /**< Presentation Time-Stamp (PTS) of data */ off_t pos; /**< Position in index (AVI) or file (MPG) */ unsigned char* buffer; /**< buffer of packet's data */ unsigned flags; /**< 1 - indicates keyframe, 0 - regular frame */ - Demux_Packet* next; /**< pointer to the next packet in chain */ + Demuxer_Packet* next; /**< pointer to the next packet in chain */ }; #endif Modified: mplayerxp/libmpstream/cache2.cpp =================================================================== --- mplayerxp/libmpstream/cache2.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/cache2.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -18,6 +18,7 @@ #include <pthread.h> #include "stream.h" +#include "stream_internal.h" #include "xmpcore/sig_hand.h" #include "osdep/timer.h" #include "osdep/cpudetect.h" @@ -152,7 +153,7 @@ MSG_DBG2("%02X ",(int)(unsigned char)c->packets[cidx].sp.buf[i]); } MSG_DBG2("\n"); - if(c->stream->driver->control(c->stream,SCTRL_EOF,NULL)==MPXP_Ok) legacy_eof=1; + if(stream_control(c->stream,SCTRL_EOF,NULL)==MPXP_Ok) legacy_eof=1; else legacy_eof=0; if(c->packets[cidx].sp.len < 0 || (c->packets[cidx].sp.len == 0 && c->packets[cidx].sp.type == 0) || legacy_eof || seek_eof) { /* EOF */ @@ -617,6 +618,10 @@ else return nc_stream_skip(s,len); } +MPXP_Rc __FASTCALL__ stream_control(const stream_t *s,unsigned cmd,any_t*param) +{ + return nc_stream_control(s,cmd,param); +} void __FASTCALL__ stream_reset(stream_t *s) { Modified: mplayerxp/libmpstream/s_cdd.cpp =================================================================== --- mplayerxp/libmpstream/s_cdd.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_cdd.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -10,6 +10,7 @@ #include <stdlib.h> #include <string.h> #include "stream.h" +#include "stream_internal.h" #include "stream_msg.h" #ifdef HAVE_LIBCDIO Modified: mplayerxp/libmpstream/s_dvdnav.cpp =================================================================== --- mplayerxp/libmpstream/s_dvdnav.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_dvdnav.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -9,6 +9,7 @@ #include <string.h> #include <math.h> #include "stream.h" +#include "stream_internal.h" #include "help_mp.h" #include "libmpdemux/demuxer.h" #include "libmpsub/spudec.h" Modified: mplayerxp/libmpstream/s_dvdread.cpp =================================================================== --- mplayerxp/libmpstream/s_dvdread.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_dvdread.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -16,6 +16,7 @@ #include <string.h> #include <ctype.h> #include "stream.h" +#include "stream_internal.h" #include "help_mp.h" #include "stream_msg.h" Modified: mplayerxp/libmpstream/s_file.cpp =================================================================== --- mplayerxp/libmpstream/s_file.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_file.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -16,6 +16,7 @@ #include "mplayerxp.h" #include "stream.h" +#include "stream_internal.h" #include "stream_msg.h" struct file_priv_t : public Opaque { Modified: mplayerxp/libmpstream/s_ftp.cpp =================================================================== --- mplayerxp/libmpstream/s_ftp.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_ftp.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -18,6 +18,7 @@ #endif #include "stream.h" +#include "stream_internal.h" #include "help_mp.h" #include "tcp.h" #include "url.h" Modified: mplayerxp/libmpstream/s_lavc.cpp =================================================================== --- mplayerxp/libmpstream/s_lavc.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_lavc.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -7,6 +7,7 @@ #include "mp_conf_lavc.h" #include "libmpcodecs/codecs_ld.h" #include "stream.h" +#include "stream_internal.h" #include "stream_msg.h" struct lavc_priv_t : public Opaque { Modified: mplayerxp/libmpstream/s_network.cpp =================================================================== --- mplayerxp/libmpstream/s_network.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_network.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -12,6 +12,7 @@ #endif #include <unistd.h> #include "stream.h" +#include "stream_internal.h" #include "help_mp.h" #include "stream_msg.h" Modified: mplayerxp/libmpstream/s_null.cpp =================================================================== --- mplayerxp/libmpstream/s_null.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_null.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -5,6 +5,7 @@ s_null - not a driver. */ #include "stream.h" +#include "stream_internal.h" static MPXP_Rc __FASTCALL__ null_open(any_t*libinput,stream_t *stream,const char *filename,unsigned flags) { UNUSED(filename); Modified: mplayerxp/libmpstream/s_oss.cpp =================================================================== --- mplayerxp/libmpstream/s_oss.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_oss.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -23,6 +23,7 @@ #include "libao2/audio_out.h" #include "loader/wine/mmreg.h" #include "stream.h" +#include "stream_internal.h" #include "mrl.h" #include "stream_msg.h" Modified: mplayerxp/libmpstream/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream/s_rtsp.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_rtsp.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -18,6 +18,7 @@ #endif #include "stream.h" +#include "stream_internal.h" #include "help_mp.h" #include "url.h" #include "tcp.h" Modified: mplayerxp/libmpstream/s_tv.cpp =================================================================== --- mplayerxp/libmpstream/s_tv.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_tv.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -18,6 +18,7 @@ #include <stdlib.h> #include <string.h> #include "stream.h" +#include "stream_internal.h" #include "input2/input.h" #include "libao2/afmt.h" #include "mrl.h" @@ -106,7 +107,7 @@ int __FASTCALL__ demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds, tvi_handle_t *tvh) { - Demux_Packet* dp; + Demuxer_Packet* dp; u_int len; len = 0; @@ -119,7 +120,7 @@ { len = tvh->functions->get_audio_framesize(reinterpret_cast<priv_s*>(tvh->priv)); - dp=new(zeromem) Demux_Packet(len); + dp=new(zeromem) Demuxer_Packet(len); dp->pts=tvh->functions->grab_audio_frame(reinterpret_cast<priv_s*>(tvh->priv), dp->buffer,len); ds_add_packet(demux->audio,dp); } @@ -130,7 +131,7 @@ TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE) { len = tvh->functions->get_video_framesize(reinterpret_cast<priv_s*>(tvh->priv)); - dp=new(zeromem) Demux_Packet(len); + dp=new(zeromem) Demuxer_Packet(len); dp->pts=tvh->functions->grab_video_frame(reinterpret_cast<priv_s*>(tvh->priv), dp->buffer, len); ds_add_packet(demux->video,dp); } Modified: mplayerxp/libmpstream/s_udp.cpp =================================================================== --- mplayerxp/libmpstream/s_udp.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_udp.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -18,6 +18,7 @@ #endif #include "stream.h" +#include "stream_internal.h" #include "help_mp.h" #include "udp.h" #include "url.h" Modified: mplayerxp/libmpstream/s_vcdnav.cpp =================================================================== --- mplayerxp/libmpstream/s_vcdnav.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/s_vcdnav.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -9,6 +9,7 @@ #include <string.h> #include <stdio.h> #include "stream.h" +#include "stream_internal.h" #include "stream_msg.h" #include <libvcd/inf.h> Modified: mplayerxp/libmpstream/stream.cpp =================================================================== --- mplayerxp/libmpstream/stream.cpp 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/stream.cpp 2012-11-29 05:55:12 UTC (rev 480) @@ -21,6 +21,7 @@ #include "osdep/fastmemcpy.h" #include "stream.h" +#include "stream_internal.h" #include "libmpdemux/demuxer.h" #include "stream_msg.h" @@ -395,3 +396,6 @@ return 1; } +MPXP_Rc __FASTCALL__ nc_stream_control(const stream_t *s,unsigned cmd,any_t*param) { + return s->driver->control(s,cmd,param); +} Modified: mplayerxp/libmpstream/stream.h =================================================================== --- mplayerxp/libmpstream/stream.h 2012-11-29 05:19:09 UTC (rev 479) +++ mplayerxp/libmpstream/stream.h 2012-11-29 05:55:12 UTC (rev 480) @@ -93,6 +93,7 @@ extern int __FASTCALL__ nc_stream_seek(stream_t *s,off_t pos); extern int __FASTCALL__ nc_stream_skip(stream_t *s,off_t len); +extern MPXP_Rc __FASTCALL__ nc_stream_control(const stream_t *s,unsigned cmd,any_t*param); /* this block describes interface to cache/non-cache stream functions */ extern int __FASTCALL__ stream_read_char(stream_t *s); @@ -102,6 +103,7 @@ extern int __FASTCALL__ stream_skip(stream_t *s,off_t len); extern int __FASTCALL__ stream_eof(stream_t *s); extern void __FASTCALL__ stream_set_eof(stream_t *s,int eof); +extern MPXP_Rc __FASTCALL__ stream_control(const stream_t *s,unsigned cmd,any_t*param); void __FASTCALL__ stream_reset(stream_t *s); stream_t* __FASTCALL__ new_stream(int type); @@ -163,67 +165,6 @@ SCTRL_EOF =10000 }; -/** Stream-driver interface */ -typedef struct stream_driver_s -{ - const char *mrl; /**< MRL of stream driver */ - const char *descr; /**< description of the driver */ - /** Opens stream with given name - * @param libinput points libinput2 - * @param _this points structure to be filled by driver - * @param filename points MRL of stream (vcdnav://, file://, http://, ...) - * @param flags currently unused and filled as 0 - **/ - MPXP_Rc (* __FASTCALL__ open)(any_t* libinput,stream_t *_this,const char *filename,unsigned flags); - /** Reads next packet from stream - * @param _this points structure which identifies stream - * @param sp points to packet where stream data should be stored - * @return length of readed information - **/ - int (* __FASTCALL__ read)(stream_t *_this,stream_packet_t * sp); - - /** Seeks on new stream position - * @param _this points structure which identifies stream - * @param off SOF offset from begin of stream - * @return real offset after seeking - **/ - off_t (* __FASTCALL__ seek)(stream_t *_this,off_t off); - - /** Tells stream position - * @param _this points structure which identifies stream - * @return current offset from begin of stream - **/ - off_t (* __FASTCALL__ tell)(const stream_t *_this); - - /** Closes stream - * @param _this points structure which identifies stream - **/ - void (* __FASTCALL__ close)(stream_t *_this); - - /** Pass to driver player's commands (like ioctl) - * @param _this points structure which identifies stream - * @param cmd contains the command (for detail see SCTRL_* definitions) - * @return result of command processing - **/ - MPXP_Rc (* __FASTCALL__ control)(const stream_t *_this,unsigned cmd,any_t*param); -}stream_driver_t; - void print_stream_drivers(void); - -typedef struct stream_info_st { - const char *info; - const char *name; - const char *author; - const char *comment; - /// mode isn't used atm (ie always READ) but it shouldn't be ignored - /// opts is at least in it's defaults settings and may have been - /// altered by url parsing if enabled and the options string parsing. - int (*open)(struct stream_s* st, int mode, any_t* opts, int* file_format); - char* protocols[MAX_STREAM_PROTOCOLS]; - any_t* opts; - int opts_url; /* If this is 1 we will parse the url as an option string - * too. Otherwise options are only parsed from the - * options string given to open_stream_plugin */ -} stream_info_t; #endif // __STREAM_H Added: mplayerxp/libmpstream/stream_internal.h =================================================================== --- mplayerxp/libmpstream/stream_internal.h (rev 0) +++ mplayerxp/libmpstream/stream_internal.h 2012-11-29 05:55:12 UTC (rev 480) @@ -0,0 +1,65 @@ +#ifndef __STEAM_INTERNAL_H_INCLUDED +#define __STEAM_INTERNAL_H_INCLUDED 1 + +/** Stream-driver interface */ +typedef struct stream_driver_s +{ + const char *mrl; /**< MRL of stream driver */ + const char *descr; /**< description of the driver */ + /** Opens stream with given name + * @param libinput points libinput2 + * @param _this points structure to be filled by driver + * @param filename points MRL of stream (vcdnav://, file://, http://, ...) + * @param flags currently unused and filled as 0 + **/ + MPXP_Rc (* __FASTCALL__ open)(any_t* libinput,stream_t *_this,const char *filename,unsigned flags); + + /** Reads next packet from stream + * @param _this points structure which identifies stream + * @param sp points to packet where stream data should be stored + * @return length of readed information + **/ + int (* __FASTCALL__ read)(stream_t *_this,stream_packet_t * sp); + + /** Seeks on new stream position + * @param _this points structure which identifies stream + * @param off SOF offset from begin of stream + * @return real offset after seeking + **/ + off_t (* __FASTCALL__ seek)(stream_t *_this,off_t off); + + /** Tells stream position + * @param _this points structure which identifies stream + * @return current offset from begin of stream + **/ + off_t (* __FASTCALL__ tell)(const stream_t *_this); + + /** Closes stream + * @param _this points structure which identifies stream + **/ + void (* __FASTCALL__ close)(stream_t *_this); + + /** Pass to driver player's commands (like ioctl) + * @param _this points structure which identifies stream + * @param cmd contains the... [truncated message content] |
From: <nic...@us...> - 2012-11-29 07:05:24
|
Revision: 481 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=481&view=rev Author: nickols_k Date: 2012-11-29 07:05:15 +0000 (Thu, 29 Nov 2012) Log Message: ----------- namespace + constantization + new logic for Demuxer_Packet Modified Paths: -------------- mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_audio.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_packet.cpp mplayerxp/libmpdemux/demuxer_packet.h mplayerxp/libmpstream/s_tv.cpp mplayerxp/libvo/aspect.cpp mplayerxp/libvo/aspect.h mplayerxp/libvo/osd_render.cpp mplayerxp/libvo/osd_render.h mplayerxp/libvo/video_out.cpp mplayerxp/postproc/libmenu/menu.cpp Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -197,7 +197,7 @@ dp->pos = spos; dp->flags = DP_NONKEYFRAME; - l=stream_read(demuxer->stream,dp->buffer,l); + l=stream_read(demuxer->stream,dp->buffer(),l); dp->resize(l); ds_add_packet(ds,dp); Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_asf.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -455,18 +455,17 @@ // closed segment, finalize packet: if(ds==demux->audio) if(apriv->asf_scrambling_h>1 && apriv->asf_scrambling_w>1) - asf_descrambling(apriv,ds->asf_packet->buffer,ds->asf_packet->len); + asf_descrambling(apriv,ds->asf_packet->buffer(),ds->asf_packet->length()); ds_add_packet(ds,ds->asf_packet); ds->asf_packet=NULL; } else { // append data to it! Demuxer_Packet* dp=ds->asf_packet; - if(dp->len!=offs && offs!=-1) MSG_V("warning! fragment.len=%d BUT next fragment offset=%d \n",dp->len,offs); - dp->resize(dp->len+len); + if(dp->length()!=unsigned(offs) && offs!=-1) MSG_V("warning! fragment.len=%d BUT next fragment offset=%d \n",dp->length(),offs); + dp->resize(dp->length()+len); stream_seek(demux->stream,dataoff); - stream_read(demux->stream,dp->buffer+dp->len,len); - MSG_DBG3("data appended! %d+%d\n",dp->len,len); - dp->len+=len; + stream_read(demux->stream,dp->buffer()+dp->length(),len); + MSG_DBG3("data appended! %d+%d\n",dp->length(),len); // we are ready now. return 1; } @@ -477,16 +476,16 @@ MSG_V("warning! broken fragment or incomplete seeking, %d bytes missing \n",offs); return 0; } - Demuxer_Packet& dp=*new(zeromem) Demuxer_Packet(len); + Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); stream_seek(demux->stream,dataoff); - len=stream_read(demux->stream,dp.buffer,len); - dp.resize(len); - dp.pts=time*0.001f; - dp.flags=keyframe?DP_KEYFRAME:DP_NONKEYFRAME; - dp.pos=demux->filepos; - ds->asf_packet=&dp; + len=stream_read(demux->stream,dp->buffer(),len); + dp->resize(len); + dp->pts=time*0.001f; + dp->flags=keyframe?DP_KEYFRAME:DP_NONKEYFRAME; + dp->pos=demux->filepos; + ds->asf_packet=dp; ds->asf_seq=seq; - MSG_DBG2("ASF: reading %s PTS %u %f %i\n",ds==demux->audio?"audio":"video",time,dp.pts,keyframe); + MSG_DBG2("ASF: reading %s PTS %u %f %i\n",ds==demux->audio?"audio":"video",time,dp->pts,keyframe); // we are ready now. return 1; } Modified: mplayerxp/libmpdemux/demux_audio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_audio.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_audio.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -1448,9 +1448,9 @@ if(len>4) { Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(len); - memcpy(dp->buffer,hdr,4); - len=stream_read(s,dp->buffer + 4,len-4); + memcpy(dp->buffer(),hdr,4); dp->resize(len+4); + len=stream_read(s,dp->buffer() + 4,len-4); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + len/(float)sh_audio->i_bps; dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; @@ -1477,9 +1477,9 @@ if(len>8) { Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(len); - memcpy(dp->buffer,hdr,8); - len=stream_read(s,dp->buffer+8,len-8); + memcpy(dp->buffer(),hdr,8); dp->resize(len+8); + len=stream_read(s,dp->buffer()+8,len-8); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + len/(float)sh_audio->i_bps; dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; @@ -1506,9 +1506,9 @@ if(len>16) { Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(len); - memcpy(dp->buffer,hdr,16); - len=stream_read(s,dp->buffer+16,len-16); dp->resize(len+16); + memcpy(dp->buffer(),hdr,16); + len=stream_read(s,dp->buffer()+16,len-16); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + len/(float)sh_audio->i_bps; dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; @@ -1523,7 +1523,7 @@ case RAW_WAV : { int l = sh_audio->wf->nAvgBytesPerSec; Demuxer_Packet* dp =new(zeromem) Demuxer_Packet(l); - l=stream_read(s,dp->buffer,l); + l=stream_read(s,dp->buffer(),l); dp->resize(l); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; @@ -1534,7 +1534,7 @@ case RAW_VOC : { int l = 65536; Demuxer_Packet* dp =new(zeromem) Demuxer_Packet(l); - l=stream_read(s,dp->buffer,l); + l=stream_read(s,dp->buffer(),l); dp->resize(l); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; @@ -1553,10 +1553,10 @@ bit_len = mpc_get_bits(priv, s, 20); Demuxer_Packet* dp=new(zeromem) Demuxer_Packet((bit_len + 7) / 8); for (l = 0; l < (bit_len / 8); l++) - dp->buffer[l] = mpc_get_bits(priv, s, 8); + dp->buffer()[l] = mpc_get_bits(priv, s, 8); bit_len %= 8; if (bit_len) - dp->buffer[l] = mpc_get_bits(priv, s, bit_len) << (8 - bit_len); + dp->buffer()[l] = mpc_get_bits(priv, s, bit_len) << (8 - bit_len); if (priv->last_pts < 0) priv->last_pts = 0; else Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -840,7 +840,7 @@ return (len1<len2)? len1 : len2; } -static int demux_avi_read_packet(demuxer_t *demux,demux_stream_t *ds,unsigned int id,unsigned int len,int idxpos,int flags){ +static int demux_avi_read_packet(demuxer_t *demux,demux_stream_t *ds,unsigned int id,unsigned int len,int idxpos,dp_flags_e flags){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); int skip; float pts=0; @@ -915,7 +915,7 @@ demux_stream_t *ds; do{ - int flags=DP_KEYFRAME; + dp_flags_e flags=DP_KEYFRAME; AVIINDEXENTRY *idx=NULL; if(priv->idx_size>0 && priv->idx_pos<priv->idx_size){ off_t pos; @@ -1015,7 +1015,7 @@ int ret=0; do{ - int flags=DP_KEYFRAME; + dp_flags_e flags=DP_KEYFRAME; AVIINDEXENTRY *idx=NULL; int idx_pos=0; demux->filepos=stream_tell(demux->stream); Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -103,7 +103,7 @@ npal_colors = img->format->palette ? img->format->palette->ncolors : 0; fake_24 = img->format->BitsPerPixel == 8 && npal_colors > 0; Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(fake_24 ? len*3 : len); - dst = dp->buffer; + dst = dp->buffer(); src =reinterpret_cast<uint8_t*>(img->pixels); if(fake_24) { Modified: mplayerxp/libmpdemux/demux_dv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dv.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_dv.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -115,12 +115,12 @@ stream_seek(demuxer->stream, frames->current_filepos); Demuxer_Packet* dp_video=new(zeromem) Demuxer_Packet(frames->frame_size); - bytes_read=stream_read(demuxer->stream,dp_video->buffer,frames->frame_size); + bytes_read=stream_read(demuxer->stream,dp_video->buffer(),frames->frame_size); if (bytes_read<frames->frame_size) return 0; dp_video->pts=frames->current_frame/sh_video->fps; dp_video->pos=frames->current_filepos; - dp_video->flags=0; + dp_video->flags=DP_NONKEYFRAME; if (demuxer->audio && demuxer->audio->id>=-1) { Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_film.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -119,7 +119,7 @@ { if(demuxer->audio->id>=-1){ // audio not disabled dp = new(zeromem) Demuxer_Packet(film_chunk.chunk_size); - if (stream_read(demuxer->stream, dp->buffer, film_chunk.chunk_size) != + if (stream_read(demuxer->stream, dp->buffer(), film_chunk.chunk_size) != film_chunk.chunk_size) return 0; dp->pts = film_chunk.pts; dp->pos = film_chunk.chunk_offset; @@ -130,13 +130,13 @@ // 16-bit: big-endian -> little-endian if (sh_audio->wf->wBitsPerSample == 8) for (i = 0; i < film_chunk.chunk_size; i++) - dp->buffer[i] += 128; + dp->buffer()[i] += 128; else for (i = 0; i < film_chunk.chunk_size; i += 2) { - byte_swap = dp->buffer[i]; - dp->buffer[i] = dp->buffer[i + 1]; - dp->buffer[i + 1] = byte_swap; + byte_swap = dp->buffer()[i]; + dp->buffer()[i] = dp->buffer()[i + 1]; + dp->buffer()[i + 1] = byte_swap; } // append packet to DS stream @@ -157,24 +157,24 @@ dp = new(zeromem) Demuxer_Packet(film_chunk.chunk_size - length_fix_bytes); // these CVID data chunks have a few extra bytes; skip them - if (stream_read(demuxer->stream, dp->buffer, 10) != 10) + if (stream_read(demuxer->stream, dp->buffer(), 10) != 10) return 0; stream_skip(demuxer->stream, length_fix_bytes); - if (stream_read(demuxer->stream, dp->buffer + 10, + if (stream_read(demuxer->stream, dp->buffer() + 10, film_chunk.chunk_size - (10 + length_fix_bytes)) != (film_chunk.chunk_size - (10 + length_fix_bytes))) return 0; dp->pts = film_chunk.pts; dp->pos = film_chunk.chunk_offset; - dp->flags = (film_chunk.syncinfo1 & 0x80000000) ? 1 : 0; + dp->flags = (film_chunk.syncinfo1 & 0x80000000) ? DP_KEYFRAME : DP_NONKEYFRAME; // fix the CVID chunk size cvid_size = film_chunk.chunk_size - length_fix_bytes; - dp->buffer[1] = (cvid_size >> 16) & 0xFF; - dp->buffer[2] = (cvid_size >> 8) & 0xFF; - dp->buffer[3] = (cvid_size >> 0) & 0xFF; + dp->buffer()[1] = (cvid_size >> 16) & 0xFF; + dp->buffer()[2] = (cvid_size >> 8) & 0xFF; + dp->buffer()[3] = (cvid_size >> 0) & 0xFF; // append packet to DS stream ds_add_packet(demuxer->video, dp); Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -454,7 +454,7 @@ } dp=new(zeromem) Demuxer_Packet(pkt.size); - memcpy(dp->buffer, pkt.data, pkt.size); + memcpy(dp->buffer(), pkt.data, pkt.size); av_free_packet(&pkt); if(pkt.pts != AV_NOPTS_VALUE){ Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -2640,15 +2640,15 @@ ptr[2] != 'a' || ptr[3] != 'C') { dp = new(zeromem) Demuxer_Packet (4); - memcpy (dp->buffer, "fLaC", 4); + memcpy (dp->buffer(), "fLaC", 4); } else { dp = new(zeromem) Demuxer_Packet (size); - memcpy (dp->buffer, ptr, size); + memcpy (dp->buffer(), ptr, size); } dp->pts = 0; - dp->flags = 0; + dp->flags = DP_NONKEYFRAME; ds_add_packet (demuxer->audio, dp); } else if (track->a_formattag == mmioFOURCC('W', 'V', 'P', 'K')) @@ -3202,7 +3202,7 @@ sub_data.utf8 = 1; size -= ptr1 - block; dp = new(zeromem) Demuxer_Packet(size); - memcpy(dp->buffer, ptr1, size); + memcpy(dp->buffer(), ptr1, size); dp->pts = timecode / 1000.0f; #if 0 dp->endpts = (timecode + block_duration) / 1000.0f; @@ -3284,9 +3284,9 @@ chunks = *buffer++; isize = --size - (chunks+1)*8; dp = new(zeromem) Demuxer_Packet (REALHEADER_SIZE + size); - memcpy (dp->buffer + REALHEADER_SIZE, buffer + (chunks+1)*8, isize); + memcpy (dp->buffer() + REALHEADER_SIZE, buffer + (chunks+1)*8, isize); #ifdef WORDS_BIGENDIAN - p = (uint8_t *)(dp->buffer + REALHEADER_SIZE + isize); + p = (uint8_t *)(dp->buffer() + REALHEADER_SIZE + isize); for (i = 0; i<(chunks+1)*8; i+=4) { p[i] = *((uint8_t *)buffer+i+3); p[i+1] = *((uint8_t *)buffer+i+2); @@ -3294,10 +3294,10 @@ p[i+3] = *((uint8_t *)buffer+i); } #else - memcpy (dp->buffer + REALHEADER_SIZE + isize, buffer, (chunks+1)*8); + memcpy (dp->buffer() + REALHEADER_SIZE + isize, buffer, (chunks+1)*8); #endif - hdr = (uint32_t *)dp->buffer; + hdr = reinterpret_cast<uint32_t*>(dp->buffer()); *hdr++ = chunks; // number of chunks *hdr++ = timestamp; // timestamp from packet header *hdr++ = isize; // length of actual data @@ -3310,10 +3310,10 @@ track->rv_kf_pts = timestamp; } else - dp->pts = real_fix_timestamp (track, dp->buffer + REALHEADER_SIZE, + dp->pts = real_fix_timestamp (track, dp->buffer() + REALHEADER_SIZE, timestamp); dp->pos = demuxer->filepos; - dp->flags = block_bref ? 0 : 0x10; + dp->flags = block_bref ? DP_NONKEYFRAME : DP_KEYFRAME; ds_add_packet(demuxer->video, dp); } @@ -3391,17 +3391,17 @@ for (x = 0; x < sph*w/apk_usize; x++) { dp = new(zeromem) Demuxer_Packet(apk_usize); - memcpy(dp->buffer, track->audio_buf + x * apk_usize, apk_usize); + memcpy(dp->buffer(), track->audio_buf + x * apk_usize, apk_usize); /* Put timestamp only on packets that correspond to original audio packets in file */ dp->pts = (x * apk_usize % w) ? 0 : track->audio_timestamp[x * apk_usize / w]; dp->pos = track->audio_filepos; // all equal - dp->flags = x ? 0 : 0x10; // Mark first packet as keyframe + dp->flags = x ? DP_NONKEYFRAME : DP_KEYFRAME; // Mark first packet as keyframe ds_add_packet(demuxer->audio, dp); } } } else { // Not a codec that require reordering dp = new(zeromem) Demuxer_Packet (size); - memcpy(dp->buffer, buffer, size); + memcpy(dp->buffer(), buffer, size); if (track->ra_pts == mkv_d->last_pts && !mkv_d->a_skip_to_keyframe) dp->pts = 0; else @@ -3409,7 +3409,7 @@ track->ra_pts = mkv_d->last_pts; dp->pos = demuxer->filepos; - dp->flags = block_bref ? 0 : 0x10; + dp->flags = block_bref ? DP_NONKEYFRAME : DP_KEYFRAME; ds_add_packet (demuxer->audio, dp); } } @@ -3484,7 +3484,7 @@ Demuxer_Packet *dp; dp = new(zeromem) Demuxer_Packet (size); - memcpy(dp->buffer, buffer, size); + memcpy(dp->buffer(), buffer, size); dp->pos = demuxer->filepos; dp->pts = mkv_d->last_pts; if ((track->num_cached_dps > 0) && (dp->pts < track->max_pts)) @@ -3492,7 +3492,7 @@ if (block_fref == 0) /* I or P frame */ flush_cached_dps (demuxer, track); if (block_bref != 0) /* I frame, don't cache it */ - dp->flags = 0x10; + dp->flags = DP_KEYFRAME; if ((track->num_cached_dps + 1) > track->num_allocated_dps) { track->cached_dps = (Demuxer_Packet **) @@ -3641,10 +3641,10 @@ modified = demux_mkv_decode (track, block, &buffer, &size, 1); if (buffer) { dp = new(zeromem) Demuxer_Packet (size); - memcpy (dp->buffer, buffer, size); + memcpy (dp->buffer(), buffer, size); if (modified) delete buffer; - dp->flags = (block_bref == 0 && block_fref == 0) ? 0x10 : 0; + dp->flags = (block_bref == 0 && block_fref == 0) ? DP_KEYFRAME : DP_NONKEYFRAME; /* If default_duration is 0, assume no pts value is known * for packets after the first one (rather than all pts * values being the same) */ Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_mov.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -2007,10 +2007,10 @@ if(trak->pos==0 && trak->stream_header_len>0){ // we have to append the stream header... Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(x+trak->stream_header_len); - memcpy(dp->buffer,trak->stream_header,trak->stream_header_len); + memcpy(dp->buffer(),trak->stream_header,trak->stream_header_len); dp->pos=stream_tell(demuxer->stream)-trak->stream_header_len; - x=stream_read(demuxer->stream,dp->buffer+trak->stream_header_len,x); dp->resize(x+trak->stream_header_len); + x=stream_read(demuxer->stream,dp->buffer()+trak->stream_header_len,x); delete trak->stream_header; trak->stream_header = NULL; trak->stream_header_len = 0; Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -401,20 +401,20 @@ if(pts==MPGPES_BAD_PTS && ds->asf_packet) { Demuxer_Packet* dp=ds->asf_packet; - dp->resize(dp->len+len); - stream_read(demux->stream,dp->buffer+dp->len,len); + dp->resize(dp->length()+len); + stream_read(demux->stream,dp->buffer()+dp->length(),len); } else { sh_video_t *sh; if(ds->asf_packet) ds_add_packet(ds,ds->asf_packet); Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); - len=stream_read(demux->stream,dp->buffer,len); + len=stream_read(demux->stream,dp->buffer(),len); dp->resize(len); dp->pts=pts/90000.0f; if(ds==demux->video) sh=(sh_video_t *)ds->sh; else sh=NULL; - dp->flags=sh?is_mpg_keyframe(sh->fourcc,id,dp->buffer):DP_NONKEYFRAME; + dp->flags=sh?is_mpg_keyframe(sh->fourcc,id,dp->buffer())?DP_KEYFRAME:DP_NONKEYFRAME:DP_NONKEYFRAME; dp->pos=demux->filepos; ds->asf_packet=dp; if (ds==ds->demuxer->sub) { Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -46,7 +46,7 @@ uint64_t prev_size[MAX_AV_STREAMS]; uint32_t prev_id; // index stuff: - any_t* idx[MAX_AV_STREAMS]; + uint64_t* idx[MAX_AV_STREAMS]; unsigned idx_size[MAX_AV_STREAMS]; }; @@ -157,9 +157,9 @@ { is_valid=1; priv->idx_size[id]=iid>>2; /* 32-bit in file */ - priv->idx[id]=mp_malloc(priv->idx_size[id]<<3); /* 64-bit in memory */ + priv->idx[id]=new uint64_t [priv->idx_size[id]]; /* 64-bit in memory */ for(i=0;i<priv->idx_size[id];i++) - ((uint64_t *)priv->idx[id])[i]=stream_read_dword_le(s); + priv->idx[id][i]=stream_read_dword_le(s); } else MSG_ERR("Index offset doesn't match to stream %u != %u\n",sid,id); } @@ -172,9 +172,9 @@ { is_valid=1; priv->idx_size[id]=iid>>3; - priv->idx[id]=mp_malloc(priv->idx_size[id]<<3); + priv->idx[id]=new uint64_t [priv->idx_size[id]]; for(i=0;i<priv->idx_size[id];i++) - ((uint64_t *)priv->idx[id])[i]=stream_read_qword_le(s); + priv->idx[id][i]=stream_read_qword_le(s); } else MSG_ERR("Index offset doesn't match to stream %u != %u\n",sid,id); } @@ -559,7 +559,7 @@ off_t pos=0LL; Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); if(mp_conf.verbose>1) pos=stream_tell(s); - len=stream_read(s,dp->buffer,len); + len=stream_read(s,dp->buffer(),len); dp->resize(len); dp->pts=pts; dp->flags=keyframe?DP_KEYFRAME:DP_NONKEYFRAME; @@ -798,9 +798,9 @@ { for(i=0;i<n;i++) { - if(newpos<=((uint64_t*)priv->idx[demuxer->video->id])[i]) + if(newpos<=priv->idx[demuxer->video->id][i]) { - newpos=((uint64_t*)priv->idx[demuxer->video->id])[i]; + newpos=priv->idx[demuxer->video->id][i]; break; } } @@ -809,9 +809,9 @@ { for(i=n-1;i;i--) { - if(newpos>=((uint64_t*)priv->idx[demuxer->video->id])[i]) + if(newpos>=priv->idx[demuxer->video->id][i]) { - newpos=((uint64_t*)priv->idx[demuxer->video->id])[i]; + newpos=priv->idx[demuxer->video->id][i]; break; } } Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -586,12 +586,12 @@ } /// Send the packet dp = new(zeromem) Demuxer_Packet(pack->bytes-(data-pack->packet)); - memcpy(dp->buffer,data,pack->bytes-(data-pack->packet)); + memcpy(dp->buffer(),data,pack->bytes-(data-pack->packet)); dp->pts = pts; dp->flags = flags?DP_KEYFRAME:DP_NONKEYFRAME; ds_add_packet(ds,dp); MSG_DBG2("New dp: %p ds=%p pts=%5.3f len=%d flag=%d \n", - dp, ds, pts, dp->len, flags); + dp, ds, pts, dp->length(), flags); return 1; } @@ -1245,15 +1245,15 @@ /// Add the header packets in the ogg demuxer audio stream // Initial header dp = new(zeromem) Demuxer_Packet(hdrsizes[0]); - memcpy(dp->buffer,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t),hdrsizes[0]); + memcpy(dp->buffer(),((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t),hdrsizes[0]); ds_add_packet(od->audio,dp); /// Comments dp = new(zeromem) Demuxer_Packet(hdrsizes[1]); - memcpy(dp->buffer,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0],hdrsizes[1]); + memcpy(dp->buffer(),((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0],hdrsizes[1]); ds_add_packet(od->audio,dp); /// Code book dp = new(zeromem) Demuxer_Packet(hdrsizes[2]); - memcpy(dp->buffer,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0]+hdrsizes[1],hdrsizes[2]); + memcpy(dp->buffer(),((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0]+hdrsizes[1],hdrsizes[2]); ds_add_packet(od->audio,dp); // Finish setting up the ogg demuxer Modified: mplayerxp/libmpdemux/demux_pva.cpp =================================================================== --- mplayerxp/libmpdemux/demux_pva.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_pva.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -228,7 +228,7 @@ dp=new(zeromem) Demuxer_Packet(current_payload.size); dp->pts=priv->last_video_pts; dp->flags=DP_NONKEYFRAME; - l=stream_read(demux->stream,dp->buffer,current_payload.size); + l=stream_read(demux->stream,dp->buffer(),current_payload.size); dp->resize(l); ds_add_packet(demux->video,dp); } else { @@ -258,7 +258,7 @@ dp->pts=priv->last_audio_pts; if(current_payload.offset != stream_tell(demux->stream)) stream_seek(demux->stream,current_payload.offset); - l=stream_read(demux->stream,dp->buffer,current_payload.size); + l=stream_read(demux->stream,dp->buffer(),current_payload.size); dp->resize(l); ds_add_packet(demux->audio,dp); } else { Modified: mplayerxp/libmpdemux/demux_rawaudio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -88,7 +88,7 @@ dp->pos = spos; dp->flags=DP_NONKEYFRAME; - l=stream_read(demuxer->stream,dp->buffer,l); + l=stream_read(demuxer->stream,dp->buffer(),l); dp->resize(l); ds_add_packet(ds,dp); Modified: mplayerxp/libmpdemux/demux_real.cpp =================================================================== --- mplayerxp/libmpdemux/demux_real.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_real.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -516,7 +516,7 @@ for (i = 0; i < sub_packets; i++) { int l; Demuxer_Packet *dp = new(zeromem) Demuxer_Packet(sub_packet_lengths[i]); - l=stream_read(demuxer->stream, dp->buffer, sub_packet_lengths[i]); + l=stream_read(demuxer->stream, dp->buffer(), sub_packet_lengths[i]); dp->resize(l); dp->pts = pts; priv->a_pts = pts; @@ -528,7 +528,7 @@ return 1; } dp = new(zeromem) Demuxer_Packet(len); - len=stream_read(demuxer->stream, dp->buffer, len); + len=stream_read(demuxer->stream, dp->buffer(), len); dp->resize(len); if (priv->audio_need_keyframe == 1) { dp->pts = 0; @@ -537,7 +537,7 @@ dp->pts = pts; priv->a_pts=pts; dp->pos = demuxer->filepos; - dp->flags = (flags & 0x2) ? 0x10 : 0; + dp->flags = (flags & 0x2) ? DP_KEYFRAME : DP_NONKEYFRAME; ds_add_packet(ds, dp); } // we will not use audio index if we use -idx and have a video @@ -640,14 +640,14 @@ if(ds->asf_packet){ dp=ds->asf_packet; - dp_hdr=(dp_hdr_t*)dp->buffer; - dp_data=dp->buffer+sizeof(dp_hdr_t); - extra=(uint32_t*)(dp->buffer+dp_hdr->chunktab); + dp_hdr=(dp_hdr_t*)dp->buffer(); + dp_data=dp->buffer()+sizeof(dp_hdr_t); + extra=(uint32_t*)(dp->buffer()+dp_hdr->chunktab); MSG_DBG2("we have an incomplete packet (oldseq=%d new=%d)\n",ds->asf_seq,vpkg_seqnum); // we have an incomplete packet: if(ds->asf_seq!=vpkg_seqnum){ // this fragment is for new packet, close the old one - MSG_DBG2("closing probably incomplete packet, len: %d \n",dp->len); + MSG_DBG2("closing probably incomplete packet, len: %d \n",dp->length()); if(priv->video_after_seek){ dp->pts=timestamp; priv->kf_base = 0; @@ -662,22 +662,21 @@ // append data to it! ++dp_hdr->chunks; MSG_DBG2("[chunks=%d subseq=%d]\n",dp_hdr->chunks,vpkg_subseq); - if(dp_hdr->chunktab+8*(1+dp_hdr->chunks)>dp->len){ + if(dp_hdr->chunktab+8*(1+dp_hdr->chunks)>dp->length()){ // increase buffer size, this should not happen! MSG_WARN("chunktab buffer too small!!!!!\n"); - dp->len=dp_hdr->chunktab+8*(4+dp_hdr->chunks); - dp->resize(dp->len); + dp->resize(dp_hdr->chunktab+8*(4+dp_hdr->chunks)); // re-calc pointers: - dp_hdr=(dp_hdr_t*)dp->buffer; - dp_data=dp->buffer+sizeof(dp_hdr_t); - extra=(uint32_t*)(dp->buffer+dp_hdr->chunktab); + dp_hdr=(dp_hdr_t*)dp->buffer(); + dp_data=dp->buffer()+sizeof(dp_hdr_t); + extra=(uint32_t*)(dp->buffer()+dp_hdr->chunktab); } extra[2*dp_hdr->chunks+0]=1; extra[2*dp_hdr->chunks+1]=dp_hdr->len; if(0x80==(vpkg_header&0xc0)){ // last fragment! if(dp_hdr->len!=vpkg_length-vpkg_offset) - MSG_V("warning! assembled.len=%d frag.len=%d total.len=%d \n",dp->len,vpkg_offset,vpkg_length-vpkg_offset); + MSG_V("warning! assembled.len=%d frag.len=%d total.len=%d \n",dp->length(),vpkg_offset,vpkg_length-vpkg_offset); stream_read(demuxer->stream, dp_data+dp_hdr->len, vpkg_offset); if((dp_data[dp_hdr->len]&0x20) && (sh_video->fourcc==0x30335652)) --dp_hdr->chunks; else dp_hdr->len+=vpkg_offset; @@ -699,7 +698,7 @@ } // non-last fragment: if(dp_hdr->len!=vpkg_offset) - MSG_V("warning! assembled.len=%d offset=%d frag.len=%d total.len=%d \n",dp->len,vpkg_offset,len,vpkg_length); + MSG_V("warning! assembled.len=%d offset=%d frag.len=%d total.len=%d \n",dp->length(),vpkg_offset,len,vpkg_length); stream_read(demuxer->stream, dp_data+dp_hdr->len, len); if((dp_data[dp_hdr->len]&0x20) && (sh_video->fourcc==0x30335652)) --dp_hdr->chunks; else dp_hdr->len+=len; @@ -714,12 +713,12 @@ dp->pos = demuxer->filepos; dp->flags = (flags & 0x2) ? DP_KEYFRAME : DP_NONKEYFRAME; ds->asf_seq = vpkg_seqnum; - dp_hdr=(dp_hdr_t*)dp->buffer; + dp_hdr=(dp_hdr_t*)dp->buffer(); dp_hdr->chunks=0; dp_hdr->timestamp=timestamp; dp_hdr->chunktab=sizeof(dp_hdr_t)+vpkg_length; - dp_data=dp->buffer+sizeof(dp_hdr_t); - extra=(uint32_t*)(dp->buffer+dp_hdr->chunktab); + dp_data=dp->buffer()+sizeof(dp_hdr_t); + extra=(uint32_t*)(dp->buffer()+dp_hdr->chunktab); extra[0]=1; extra[1]=0; // offset of the first chunk if(0x00==(vpkg_header&0xc0)){ // first fragment: Modified: mplayerxp/libmpdemux/demux_realaud.cpp =================================================================== --- mplayerxp/libmpdemux/demux_realaud.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_realaud.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -79,7 +79,7 @@ demuxer->filepos = stream_tell(demuxer->stream); Demuxer_Packet *dp = new(zeromem) Demuxer_Packet(len); - len=stream_read(demuxer->stream, dp->buffer, len); + len=stream_read(demuxer->stream, dp->buffer(), len); dp->resize(len); if(sh->i_bps) Modified: mplayerxp/libmpdemux/demux_ts.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ts.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_ts.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -2843,7 +2843,7 @@ *buffer_size = *dp_offset + buf_size + TS_FEC_PACKET_SIZE; (*dp)->resize(*buffer_size); } - p = &((*dp)->buffer[*dp_offset]); + p = &((*dp)->buffer()[*dp_offset]); } len = stream_read(stream, p, buf_size); @@ -2945,7 +2945,7 @@ memmove(p, es->start, es->size); *dp_offset += es->size; - (*dp)->flags = 0; + (*dp)->flags = DP_NONKEYFRAME; (*dp)->pos = stream_tell(demuxer->stream); (*dp)->pts = es->pts; Modified: mplayerxp/libmpdemux/demux_ty.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ty.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_ty.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -293,11 +293,11 @@ unsigned char *buffer, int size, off_t pos, int64_t pts ) { Demuxer_Packet *dp = new(zeromem) Demuxer_Packet( size ); - memcpy( dp->buffer, buffer, size ); + memcpy( dp->buffer(), buffer, size ); if (pts != -1) dp->pts = pts / 90000.0; dp->pos = pos; - dp->flags = 0; + dp->flags = DP_NONKEYFRAME; ds_add_packet( ds, dp ); } Modified: mplayerxp/libmpdemux/demux_viv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_viv.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_viv.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -422,11 +422,10 @@ } else { // append data to it! Demuxer_Packet* dp=ds->asf_packet; - dp->resize(dp->len+len); + dp->resize(dp->length()+len); //memcpy(dp->buffer+dp->len,data,len); - stream_read(demux->stream,dp->buffer+dp->len,len); - MSG_DBG3("data appended! %d+%d\n",dp->len,len); - dp->len+=len; + stream_read(demux->stream,dp->buffer()+dp->length(),len); + MSG_DBG3("data appended! %d+%d\n",dp->length(),len); // we are ready now. if((c&0xF0)==0x20) --ds->asf_seq; // hack! return 1; @@ -435,7 +434,7 @@ // create new packet: Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); //memcpy(dp->buffer,data,len); - len=stream_read(demux->stream,dp->buffer,len); + len=stream_read(demux->stream,dp->buffer(),len); dp->resize(len); dp->pts=audio_rate?((float)audio_pos/(float)audio_rate):0; dp->flags=DP_NONKEYFRAME; Modified: mplayerxp/libmpdemux/demux_vqf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_vqf.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_vqf.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -202,7 +202,7 @@ dp->pos = spos; dp->flags = DP_NONKEYFRAME; - l=stream_read(demuxer->stream,dp->buffer,l); + l=stream_read(demuxer->stream,dp->buffer(),l); dp->resize(l); ds_add_packet(ds,dp); Modified: mplayerxp/libmpdemux/demux_y4m.cpp =================================================================== --- mplayerxp/libmpdemux/demux_y4m.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demux_y4m.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -91,9 +91,9 @@ dp = new(zeromem) Demuxer_Packet(3*size/2); /* swap U and V components */ - buf[0] = dp->buffer; - buf[1] = dp->buffer + 5*size/4; - buf[2] = dp->buffer + size; + buf[0] = dp->buffer(); + buf[1] = dp->buffer() + 5*size/4; + buf[2] = dp->buffer() + size; if (priv->is_older) { Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -264,9 +264,9 @@ // dp->pts=pts; //(float)pts/90000.0f; // dp->pos=pos; // append packet to DS stream: - if(dp->len>0) { + if(dp->length()>0) { ++ds->packs; - ds->bytes+=dp->len; + ds->bytes+=dp->length(); if(ds->last) { // next packet in stream ds->last->next=dp; @@ -277,17 +277,17 @@ } MSG_DBG2("DEMUX: Append packet to %s, len=%d pts=%5.3f pos=%u [packs: A=%d V=%d]\n", (ds==ds->demuxer->audio)?"d_audio":"d_video", - dp->len,dp->pts,(unsigned int)dp->pos,ds->demuxer->audio->packs,ds->demuxer->video->packs); + dp->length(),dp->pts,(unsigned int)dp->pos,ds->demuxer->audio->packs,ds->demuxer->video->packs); } else MSG_DBG2("DEMUX: Skip packet for %s, len=%d pts=%5.3f pos=%u [packs: A=%d V=%d]\n", (ds==ds->demuxer->audio)?"d_audio":"d_video", - dp->len,dp->pts,(unsigned int)dp->pos,ds->demuxer->audio->packs,ds->demuxer->video->packs); + dp->length(),dp->pts,(unsigned int)dp->pos,ds->demuxer->audio->packs,ds->demuxer->video->packs); } -void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags){ +void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,dp_flags_e flags){ Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); - len=stream_read(stream,dp->buffer,len); + len=stream_read(stream,dp->buffer(),len); dp->resize(len); dp->pts=pts; //(float)pts/90000.0f; dp->pos=pos; @@ -326,20 +326,20 @@ if(ds->packs){ Demuxer_Packet *p=ds->first; // copy useful data: - ds->buffer=p->buffer; + ds->buffer=p->buffer(); ds->buffer_pos=0; - ds->buffer_size=p->len; + ds->buffer_size=p->length(); ds->pos=p->pos; - ds->dpos+=p->len; // !!! + ds->dpos+=p->length(); // !!! ++ds->pack_no; if(p->pts){ ds->pts=p->pts; ds->pts_bytes=0; } - ds->pts_bytes+=p->len; // !!! + ds->pts_bytes+=p->length(); // !!! ds->flags=p->flags; // mp_free packet: - ds->bytes-=p->len; + ds->bytes-=p->length(); ds->current=p; ds->first=p->next; if(!ds->first) ds->last=NULL; @@ -420,7 +420,7 @@ Demuxer_Packet *dn=dp->next; if(dp->pts >= pts) break; packs++; - bytes+=dp->len; + bytes+=dp->length(); delete dp; dp=dn; } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demuxer.h 2012-11-29 07:05:15 UTC (rev 481) @@ -158,7 +158,7 @@ void free_demuxer(demuxer_t *demuxer); void ds_add_packet(demux_stream_t *ds,Demuxer_Packet* dp); -void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags); +void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,dp_flags_e flags); int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds); int ds_fill_buffer(demux_stream_t *ds); Modified: mplayerxp/libmpdemux/demuxer_packet.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_packet.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demuxer_packet.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -2,39 +2,42 @@ #include "osdep/fastmemcpy.h" #include <string.h> -Demuxer_Packet::Demuxer_Packet(unsigned _len) - :pts(0), +namespace mpxp { +Demuxer_Packet::Demuxer_Packet(unsigned len) + :type(Demuxer_Packet::Generic), + pts(0), pos(0), - flags(0), + flags(DP_NONKEYFRAME), + lang_id(0), next(NULL) { - len=_len; - buffer=new unsigned char [len]; + _len=len; + _buf=new uint8_t [_len]; } Demuxer_Packet::~Demuxer_Packet(){ - if(buffer) delete buffer; + if(_buf) delete _buf; } void Demuxer_Packet::resize(unsigned newlen) { - if(len!=newlen) { - if(newlen) buffer=(unsigned char *)mp_realloc(buffer,newlen); + if(_len!=newlen) { + if(newlen) _buf=(uint8_t *)mp_realloc(_buf,newlen); else { - if(buffer) delete buffer; - buffer=NULL; + if(_buf) delete _buf; + _buf=NULL; } - len=newlen; + _len=newlen; } } Demuxer_Packet* Demuxer_Packet::clone() const { - Demuxer_Packet* dp=new Demuxer_Packet(len); + Demuxer_Packet* dp=new Demuxer_Packet(_len); dp->pts=pts; dp->pos=pos; dp->flags=flags; dp->next=next; - memcpy(dp->buffer,buffer,len); + memcpy(dp->buffer(),_buf,_len); return dp; } - +} // namespace mpxp Modified: mplayerxp/libmpdemux/demuxer_packet.h =================================================================== --- mplayerxp/libmpdemux/demuxer_packet.h 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpdemux/demuxer_packet.h 2012-11-29 07:05:15 UTC (rev 481) @@ -3,28 +3,55 @@ #include "mp_config.h" #include "osdep/mplib.h" using namespace mpxp; +#include <stdint.h> #include <unistd.h> -enum { - DP_NONKEYFRAME =0x00000000UL, - DP_KEYFRAME =0x00000001UL -}; +namespace mpxp { + enum dp_flags_e { + DP_NONKEYFRAME =0x00000000UL, + DP_KEYFRAME =0x00000001UL, -/** Describes demuxer's packet */ -class Demuxer_Packet : public Opaque { - public: - Demuxer_Packet(unsigned len); - virtual ~Demuxer_Packet(); + DP_FULL_FRAME =0x00000000UL, + DP_START_OF_FRAME =0x10000000UL, + DP_PART_OF_FRAME =0x20000000UL, + DP_EOF_OF_FRAME =0x30000000UL, + }; + inline dp_flags_e operator~(dp_flags_e a) { return static_cast<dp_flags_e>(~static_cast<unsigned>(a)); } + inline dp_flags_e operator|(dp_flags_e a, dp_flags_e b) { return static_cast<dp_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } + inline dp_flags_e operator&(dp_flags_e a, dp_flags_e b) { return static_cast<dp_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } + inline dp_flags_e operator^(dp_flags_e a, dp_flags_e b) { return static_cast<dp_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } + inline dp_flags_e operator|=(dp_flags_e a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline dp_flags_e operator&=(dp_flags_e a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline dp_flags_e operator^=(dp_flags_e a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } - void resize(unsigned newlen); - Demuxer_Packet* clone() const; + /** Describes demuxer's packet */ + class Demuxer_Packet : public Opaque { + public: + Demuxer_Packet(unsigned len); + virtual ~Demuxer_Packet(); - unsigned len; /**< length of packet's data */ - float pts; /**< Presentation Time-Stamp (PTS) of data */ - off_t pos; /**< Position in index (AVI) or file (MPG) */ - unsigned char* buffer; /**< buffer of packet's data */ - unsigned flags; /**< 1 - indicates keyframe, 0 - regular frame */ - Demuxer_Packet* next; /**< pointer to the next packet in chain */ + void resize(unsigned newlen); + Demuxer_Packet* clone() const; + + unsigned length() const { return _len; } + uint8_t* buffer() { return _buf; } + const uint8_t* buffer() const { return _buf; } + + enum dp_type_e { + Generic=0, + Video, + Audio, + Sub + }; + dp_type_e type; /**< type of packet's data */ + float pts; /**< Presentation Time-Stamp (PTS) of data */ + off_t pos; /**< Position in index (AVI) or file (MPG) */ + dp_flags_e flags; /**< 1 - indicates keyframe, 0 - regular frame */ + int lang_id;/**< language of this packet */ + Demuxer_Packet* next; /**< pointer to the next packet in chain */ + private: + unsigned _len; /**< length of packet's data */ + uint8_t* _buf; /**< buffer of packet's data */ }; - +} // namespacee mpxp #endif Modified: mplayerxp/libmpstream/s_tv.cpp =================================================================== --- mplayerxp/libmpstream/s_tv.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libmpstream/s_tv.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -121,7 +121,7 @@ len = tvh->functions->get_audio_framesize(reinterpret_cast<priv_s*>(tvh->priv)); dp=new(zeromem) Demuxer_Packet(len); - dp->pts=tvh->functions->grab_audio_frame(reinterpret_cast<priv_s*>(tvh->priv), dp->buffer,len); + dp->pts=tvh->functions->grab_audio_frame(reinterpret_cast<priv_s*>(tvh->priv), dp->buffer(),len); ds_add_packet(demux->audio,dp); } @@ -132,7 +132,7 @@ { len = tvh->functions->get_video_framesize(reinterpret_cast<priv_s*>(tvh->priv)); dp=new(zeromem) Demuxer_Packet(len); - dp->pts=tvh->functions->grab_video_frame(reinterpret_cast<priv_s*>(tvh->priv), dp->buffer, len); + dp->pts=tvh->functions->grab_video_frame(reinterpret_cast<priv_s*>(tvh->priv), dp->buffer(), len); ds_add_packet(demux->video,dp); } Modified: mplayerxp/libvo/aspect.cpp =================================================================== --- mplayerxp/libvo/aspect.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libvo/aspect.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -11,6 +11,8 @@ #endif #include "vo_msg.h" +namespace mpxp { + Aspect::Aspect(float mon_pix_aspect) { monitor_pixel_aspect = mon_pix_aspect; } Aspect::~Aspect() { } @@ -88,4 +90,4 @@ MSG_DBG2("aspect(3) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); #endif } - +} // namesapce mpxp Modified: mplayerxp/libvo/aspect.h =================================================================== --- mplayerxp/libvo/aspect.h 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libvo/aspect.h 2012-11-29 07:05:15 UTC (rev 481) @@ -4,32 +4,34 @@ #include <stdint.h> #include "mp_config.h" -class Aspect : public Opaque { - public: - Aspect(float moitor_pixel_aspect); - virtual ~Aspect(); +namespace mpxp { + class Aspect : public Opaque { + public: + Aspect(float moitor_pixel_aspect); + virtual ~Aspect(); - void __FASTCALL__ save(uint32_t orgw, uint32_t orgh, + void __FASTCALL__ save(uint32_t orgw, uint32_t orgh, uint32_t prew, uint32_t preh, uint32_t scrw, uint32_t scrh); - void __FASTCALL__ save_image(uint32_t orgw, uint32_t orgh, + void __FASTCALL__ save_image(uint32_t orgw, uint32_t orgh, uint32_t prew, uint32_t preh); - void __FASTCALL__ save_screen(uint32_t scrw, uint32_t scrh); - enum zoom_e { - NOZOOM=0, - ZOOM - }; - void __FASTCALL__ calc(uint32_t& srcw, uint32_t& srch, zoom_e zoom); - private: - uint32_t orgw; // real width - uint32_t orgh; // real height - uint32_t prew; // prescaled width - uint32_t preh; // prescaled height - uint32_t screenw; // horizontal resolution - uint32_t screenh; // vertical resolution - float monitor_aspect; - float monitor_pixel_aspect; -}; + void __FASTCALL__ save_screen(uint32_t scrw, uint32_t scrh); + enum zoom_e { + NOZOOM=0, + ZOOM + }; + void __FASTCALL__ calc(uint32_t& srcw, uint32_t& srch, zoom_e zoom); + private: + uint32_t orgw; // real width + uint32_t orgh; // real height + uint32_t prew; // prescaled width + uint32_t preh; // prescaled height + uint32_t screenw; // horizontal resolution + uint32_t screenh; // vertical resolution + float monitor_aspect; + float monitor_pixel_aspect; + }; +} // namespace mpxp #endif Modified: mplayerxp/libvo/osd_render.cpp =================================================================== --- mplayerxp/libvo/osd_render.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libvo/osd_render.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -26,6 +26,7 @@ #define PVECTOR_ACCEL_H "osd_render_template.h" #include "pvector/pvector_inc.h" +namespace mpxp { #ifdef FAST_OSD_TABLE static unsigned short fast_osd_15bpp_table[256]; static unsigned short fast_osd_16bpp_table[256]; @@ -109,7 +110,7 @@ UNUSED(finalize); } -void OSD_Render::render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) +void OSD_Render::render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) const { (*draw_alpha_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); } @@ -259,3 +260,4 @@ } OSD_Render::~OSD_Render(){} +} // namesapce mpxp Modified: mplayerxp/libvo/osd_render.h =================================================================== --- mplayerxp/libvo/osd_render.h 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libvo/osd_render.h 2012-11-29 07:05:15 UTC (rev 481) @@ -3,23 +3,25 @@ /* Generic alpha renderers for all YUV modes and RGB depths. */ /* These are "reference implementations", should be optimized later (MMX, etc) */ -class OSD_Render : public Opaque { - public: - OSD_Render(unsigned fourcc); - virtual ~OSD_Render(); +namespace mpxp { + class OSD_Render : public Opaque { + public: + OSD_Render(unsigned fourcc); + virtual ~OSD_Render(); - void render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); - private: - void get_draw_alpha(unsigned fmt); - typedef void (* __FASTCALL__ draw_alpha_f)(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); - draw_alpha_f draw_alpha_ptr; - draw_alpha_f draw_alpha_yv12_ptr; - draw_alpha_f draw_alpha_yuy2_ptr; - draw_alpha_f draw_alpha_uyvy_ptr; - draw_alpha_f draw_alpha_rgb24_ptr; - draw_alpha_f draw_alpha_rgb32_ptr; - draw_alpha_f draw_alpha_rgb15_ptr; - draw_alpha_f draw_alpha_rgb16_ptr; -}; + void render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) const; + private: + void get_draw_alpha(unsigned fmt); + typedef void (* __FASTCALL__ draw_alpha_f)(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); + draw_alpha_f draw_alpha_ptr; + draw_alpha_f draw_alpha_yv12_ptr; + draw_alpha_f draw_alpha_yuy2_ptr; + draw_alpha_f draw_alpha_uyvy_ptr; + draw_alpha_f draw_alpha_rgb24_ptr; + draw_alpha_f draw_alpha_rgb32_ptr; + draw_alpha_f draw_alpha_rgb15_ptr; + draw_alpha_f draw_alpha_rgb16_ptr; + }; +} // namespace mpxp #endif Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/libvo/video_out.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -129,7 +129,7 @@ dri_priv_t dri; const vo_info_t* video_out; class VO_Interface* vo_iface; - OSD_Render* draw_alpha; + const OSD_Render* draw_alpha; }; vo_priv_t::vo_priv_t() { Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-11-29 05:55:12 UTC (rev 480) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-11-29 07:05:15 UTC (rev 481) @@ -333,7 +333,7 @@ #endif void menu_draw_text(mp_image_t* mpi,const char* txt, int x, int y) { - OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); + const OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); int font; int finalize=vo_is_final(vo_data); @@ -365,7 +365,7 @@ int ll = 0; int font; int finalize=vo_is_final(vo_data); - OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); + const OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); #ifdef USE_FRIBIDI txt = menu_fribidi(txt); @@ -596,7 +596,7 @@ void menu_draw_box(const mp_image_t* mpi,unsigned char grey,unsigned char alpha, int x, int y, int w, int h) { - OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); + const OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); int g; if(x > mpi->w || y > mpi->h) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-29 10:25:56
|
Revision: 483 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=483&view=rev Author: nickols_k Date: 2012-11-29 10:25:47 +0000 (Thu, 29 Nov 2012) Log Message: ----------- simplify Video_Output initialization Modified Paths: -------------- mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/mplayerxp.cpp Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-29 09:44:34 UTC (rev 482) +++ mplayerxp/libvo/video_out.cpp 2012-11-29 10:25:47 UTC (rev 483) @@ -51,7 +51,6 @@ namespace mpxp{ VO_Config::VO_Config() { - memset(&subdevice,0,reinterpret_cast<long>(&dbpp) - reinterpret_cast<long>(&subdevice)); movie_aspect=-1.0; softzoom=1; flip=-1; @@ -164,34 +163,38 @@ MSG_INFO("\n"); } -MPXP_Rc Video_Output::_register(const char *driver_name) const +const vo_info_t* Video_Output::get_info() const { vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + return priv.video_out; +} + +MPXP_Rc Video_Output::init(const char *driver_name) const +{ + char* drv_name = NULL; + char * subdev = NULL; + if(driver_name) { + drv_name=mp_strdup(driver_name); + subdev = strchr(drv_name,':'); + if(subdev) { *subdev='\0'; subdev++; } + } + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); unsigned i; - if(!driver_name) priv.video_out=vo_infos[0]; + if(!drv_name) priv.video_out=vo_infos[0]; else for (i=0; vo_infos[i] != &null_vo_info; i++){ const vo_info_t *info = vo_infos[i]; - if(strcmp(info->short_name,driver_name) == 0){ + if(strcmp(info->short_name,drv_name) == 0){ priv.video_out = vo_infos[i]; break; } } - return priv.video_out?MPXP_Ok:MPXP_False; -} - -const vo_info_t* Video_Output::get_info() const -{ - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); - return priv.video_out; -} - -MPXP_Rc Video_Output::init(const char *subdevice) const -{ - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); - MSG_DBG3("dri_vo_dbg: vo_init(%s)\n",subdevice); priv.frame_counter=0; - priv.vo_iface=priv.video_out->query_interface(subdevice); + if(priv.video_out) { + priv.vo_iface=priv.video_out->query_interface(subdev); + } + if(drv_name) delete drv_name; + if(subdev) delete subdev; return priv.vo_iface?MPXP_Ok:MPXP_False; } Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-29 09:44:34 UTC (rev 482) +++ mplayerxp/libvo/video_out.h 2012-11-29 10:25:47 UTC (rev 483) @@ -116,7 +116,6 @@ VO_Config(); ~VO_Config() {} - char * subdevice; // currently unused char* mDisplayName; int xinerama_screen; @@ -166,37 +165,36 @@ void FLIP_UNSET() { flags&=~VOFLAG_FLIPPING; } void FLIP_REVERT() { flags^=VOFLAG_FLIPPING; } - MPXP_Rc init(const char *subdevice_name) const; - void print_help() const; - MPXP_Rc _register(const char *driver_name) const; - const vo_info_t* get_info() const; - MPXP_Rc configure(uint32_t width, uint32_t height, uint32_t d_width, + virtual MPXP_Rc init(const char *driver_name) const; + virtual void print_help() const; + virtual const vo_info_t* get_info() const; + virtual MPXP_Rc configure(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, vo_flags_e fullscreen,const char *title, uint32_t format); - uint32_t query_format(uint32_t* fourcc,unsigned src_w,unsigned src_h) const; + virtual uint32_t query_format(uint32_t* fourcc,unsigned src_w,unsigned src_h) const; - MPXP_Rc reset() const; - MPXP_Rc fullscreen() const; - MPXP_Rc screenshot(unsigned idx) const; - MPXP_Rc pause() const; - MPXP_Rc resume() const; + virtual MPXP_Rc reset() const; + virtual MPXP_Rc fullscreen() const; + virtual MPXP_Rc screenshot(unsigned idx) const; + virtual MPXP_Rc pause() const; + virtual MPXP_Rc resume() const; - MPXP_Rc get_surface(mp_image_t* mpi) const; - MPXP_Rc get_surface_caps(dri_surface_cap_t*) const; + virtual MPXP_Rc get_surface(mp_image_t* mpi) const; + virtual MPXP_Rc get_surface_caps(dri_surface_cap_t*) const; - int check_events() const; - unsigned get_num_frames() const; - MPXP_Rc draw_slice(const mp_image_t *mpi) const; - void select_frame(unsigned idx) const; - void flush_page(unsigned decoder_idx) const; - void draw_osd(unsigned idx) const; - void draw_spudec_direct(unsigned idx) const; - MPXP_Rc ctrl(uint32_t request, any_t*data) const; - int is_final() const; + virtual int check_events() const; + virtual unsigned get_num_frames() const; + virtual MPXP_Rc draw_slice(const mp_image_t *mpi) const; + virtual void select_frame(unsigned idx) const; + virtual void flush_page(unsigned decoder_idx) const; + virtual void draw_osd(unsigned idx) const; + virtual void draw_spudec_direct(unsigned idx) const; + virtual MPXP_Rc ctrl(uint32_t request, any_t*data) const; + virtual int is_final() const; - int adjust_size(unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) const; - void dri_remove_osd(unsigned idx,int x0,int _y0, int w,int h) const; - void dri_draw_osd(unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) const; + virtual int adjust_size(unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) const; + virtual void dri_remove_osd(unsigned idx,int x0,int _y0, int w,int h) const; + virtual void dri_draw_osd(unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) const; char antiviral_hole[RND_CHAR4]; vo_flags_e flags; Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-29 09:44:34 UTC (rev 482) +++ mplayerxp/mplayerxp.cpp 2012-11-29 10:25:47 UTC (rev 483) @@ -879,28 +879,13 @@ char* rs=NULL; unsigned i; // check video_out driver name: - if (mp_conf.video_driver) - if ((i=strcspn(mp_conf.video_driver, ":")) > 0) { - size_t i2 = strlen(mp_conf.video_driver); - if (mp_conf.video_driver[i] == ':') { - vo_conf.subdevice = (char *)mp_malloc(i2-i); - if (vo_conf.subdevice != NULL) - strncpy(vo_conf.subdevice, (char *)(mp_conf.video_driver+i+1), i2-i); - mp_conf.video_driver[i] = '\0'; - } - } - MP_UNIT("vo_register"); - MPXPSys->vo_inited = (vo_data->_register(mp_conf.video_driver)!=NULL)?1:0; + MP_UNIT("vo_init"); + MPXPSys->vo_inited = (vo_data->init(mp_conf.video_driver)!=NULL)?1:0; if(!MPXPSys->vo_inited){ MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); exit_player(MSGTR_Exit_error); } - MP_UNIT("vo_init"); - if(vo_data->init(vo_conf.subdevice)!=MPXP_Ok) { - MSG_FATAL("Error opening/initializing the selected video_out (-vo) device!\n"); - exit_player(MSGTR_Exit_error); - } // check audio_out driver name: MP_UNIT("ao_init"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-29 12:48:02
|
Revision: 485 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=485&view=rev Author: nickols_k Date: 2012-11-29 12:47:49 +0000 (Thu, 29 Nov 2012) Log Message: ----------- c++-ization: decrease number of typedef Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpdemux/stheader.h mplayerxp/postproc/af.h mplayerxp/postproc/af_ao2.cpp mplayerxp/postproc/af_channels.cpp mplayerxp/postproc/af_control.h mplayerxp/postproc/af_crystality.cpp mplayerxp/postproc/af_delay.cpp mplayerxp/postproc/af_dyn.cpp mplayerxp/postproc/af_echo3d.cpp mplayerxp/postproc/af_equalizer.cpp mplayerxp/postproc/af_export.cpp mplayerxp/postproc/af_extrastereo.cpp mplayerxp/postproc/af_ffenc.cpp mplayerxp/postproc/af_format.cpp mplayerxp/postproc/af_hrtf.cpp mplayerxp/postproc/af_karaoke.cpp mplayerxp/postproc/af_lp.cpp mplayerxp/postproc/af_pan.cpp mplayerxp/postproc/af_raw.cpp mplayerxp/postproc/af_resample.cpp mplayerxp/postproc/af_scaletempo.cpp mplayerxp/postproc/af_sinesuppress.cpp mplayerxp/postproc/af_sub.cpp mplayerxp/postproc/af_surround.cpp mplayerxp/postproc/af_tools.cpp mplayerxp/postproc/af_volnorm.cpp mplayerxp/postproc/af_volume.cpp mplayerxp/postproc/aflib.h mplayerxp/postproc/mpc_info.h mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.cpp mplayerxp/postproc/vf_2xsai.cpp mplayerxp/postproc/vf_aspect.cpp mplayerxp/postproc/vf_delogo.cpp mplayerxp/postproc/vf_denoise3d.cpp mplayerxp/postproc/vf_dint.cpp mplayerxp/postproc/vf_down3dright.cpp mplayerxp/postproc/vf_eq.cpp mplayerxp/postproc/vf_expand.cpp mplayerxp/postproc/vf_flip.cpp mplayerxp/postproc/vf_format.cpp mplayerxp/postproc/vf_framestep.cpp mplayerxp/postproc/vf_il.cpp mplayerxp/postproc/vf_menu.cpp mplayerxp/postproc/vf_mirror.cpp mplayerxp/postproc/vf_noise.cpp mplayerxp/postproc/vf_ow.cpp mplayerxp/postproc/vf_palette.cpp mplayerxp/postproc/vf_panscan.cpp mplayerxp/postproc/vf_perspective.cpp mplayerxp/postproc/vf_pp.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_rectangle.cpp mplayerxp/postproc/vf_rgb2bgr.cpp mplayerxp/postproc/vf_rotate.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/postproc/vf_smartblur.cpp mplayerxp/postproc/vf_softpulldown.cpp mplayerxp/postproc/vf_swapuv.cpp mplayerxp/postproc/vf_test.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/postproc/vf_vo.cpp mplayerxp/postproc/vf_yuvcsp.cpp mplayerxp/postproc/vf_yuy2.cpp mplayerxp/postproc/vf_yvu9.cpp Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -584,6 +584,6 @@ } void mpcodecs_draw_slice(sh_video_t *sh, mp_image_t*mpi) { - struct vf_instance_s* vf = sh->vfilter; + vf_instance_t* vf = sh->vfilter; vf->put_slice(vf,mpi); } Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/libmpdemux/stheader.h 2012-11-29 12:47:49 UTC (rev 485) @@ -13,7 +13,7 @@ #endif #include "xmpcore/mp_image.h" -struct af_stream_s; +struct af_stream_t; typedef struct sh_audio_s { int aid; demux_stream_t* ds; @@ -42,7 +42,7 @@ unsigned a_buffer_size; /* filter buffer */ - struct af_stream_s* afilter; + af_stream_t* afilter; int afilter_inited; unsigned af_bps; // == samplerate*samplesize*channels (after filters bytes/sec) char* af_buffer; @@ -63,7 +63,7 @@ unsigned char* codecdata; unsigned codecdata_len; } sh_audio_t; -struct vf_instance_s; +struct vf_instance_t; typedef struct sh_video_s { int vid; demux_stream_t* ds; @@ -83,7 +83,7 @@ float aspect; unsigned int outfmtidx; // TODO: replace with out_fourcc /* vfilter chan */ - struct vf_instance_s*vfilter; + vf_instance_t* vfilter; int vfilter_inited; int vf_flags; unsigned active_slices; // used in dec_video+vd_ffmpeg only!!! Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af.h 2012-11-29 12:47:49 UTC (rev 485) @@ -8,14 +8,14 @@ #include "xmpcore/xmp_enums.h" #include "xmpcore/mp_aframe.h" -struct af_instance_s; +struct af_instance_t; // Fraction, used to calculate buffer lengths -typedef struct frac_s +struct frac_t { int n; // Numerator int d; // Denominator -} frac_t; +}; // Flags used for defining the behavior of an audio filter enum { @@ -24,45 +24,45 @@ }; /* Audio filter information not specific for current instance, but for a specific filter */ -typedef struct af_info_s +struct af_info_t { const char *info; const char *name; const char *author; const char *comment; const unsigned flags; - MPXP_Rc (* __FASTCALL__ open)(struct af_instance_s* vf); -} af_info_t; + MPXP_Rc (* __FASTCALL__ open)(af_instance_t* vf); +}; enum { AF_PIN=RND_NUMBER6+RND_CHAR6 }; -typedef struct af_conf_s { +struct af_conf_t { /*------ stream description ----------*/ unsigned rate; /* rate of audio */ unsigned nch; /* number of channels */ mpaf_format_e format;/* PCM format of audio */ -}af_conf_t; +}; // Linked list of audio filters -typedef struct af_instance_s { +struct af_instance_t { const af_info_t* info; char antiviral_hole[RND_CHAR6]; unsigned pin; // personal identification number - MPXP_Rc (* __FASTCALL__ config_af)(struct af_instance_s* af, const af_conf_t* arg); - MPXP_Rc (* __FASTCALL__ control_af)(struct af_instance_s* af, int cmd, any_t* arg); - void (* __FASTCALL__ uninit)(struct af_instance_s* af); - mp_aframe_t* (* __FASTCALL__ play)(struct af_instance_s* af,const mp_aframe_t* data); + MPXP_Rc (* __FASTCALL__ config_af)(af_instance_t* af, const af_conf_t* arg); + MPXP_Rc (* __FASTCALL__ control_af)(af_instance_t* af, int cmd, any_t* arg); + void (* __FASTCALL__ uninit)(af_instance_t* af); + mp_aframe_t* (* __FASTCALL__ play)(af_instance_t* af,const mp_aframe_t* data); any_t* setup; // setup data for this specific instance and filter af_conf_t conf; // configuration for outgoing data stream - struct af_instance_s* next; - struct af_instance_s* prev; + af_instance_t* next; + af_instance_t* prev; any_t* parent; double delay; // Delay caused by the filter [ms] frac_t mul; /* length multiplier: how much does this instance change the length of the buffer. */ -}af_instance_t __attribute__ ((packed)); +}__attribute__ ((packed)); // Initialization flags extern int* af_cpu_speed; @@ -87,14 +87,14 @@ #endif // Configuration switches -typedef struct af_cfg_s{ +struct af_cfg_t{ int force; // Initialization type char* list; /* list of names of filters that are added to filter list during first initialization of stream */ -}af_cfg_t; +}; // Current audio stream -typedef struct af_stream_s +struct af_stream_t { char antiviral_hole[RND_CHAR7]; // The first and last filter in the list @@ -106,7 +106,7 @@ // Configuration for this stream af_cfg_t cfg; any_t* parent; -}af_stream_t; +}; /********************************************* @@ -170,7 +170,7 @@ /* Helper function used to convert from sample time to ms */ MPXP_Rc __FASTCALL__ af_to_ms(int n, int* in, float* out, int rate); /* Helper function for testing the output format */ -MPXP_Rc __FASTCALL__ af_test_output(struct af_instance_s* af,const af_conf_t* out); +MPXP_Rc __FASTCALL__ af_test_output(af_instance_t* af,const af_conf_t* out); /** Print a list of all available audio filters */ void af_help(void); Modified: mplayerxp/postproc/af_ao2.cpp =================================================================== --- mplayerxp/postproc/af_ao2.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_ao2.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -58,11 +58,10 @@ return 2; } -typedef struct fmt_cvs_s -{ +struct fmt_cvt_t { unsigned base_fourcc; unsigned cvt_fourcc[20]; -}fmt_cvt_t; +}; static fmt_cvt_t cvt_list[] = { @@ -103,14 +102,14 @@ return AFMT_S16_LE; } -typedef struct af_ao2_s{ +struct af_ao2_t{ unsigned rate; unsigned nch; mpaf_format_e format; -}af_ao2_t; +}; // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af, const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af, const af_conf_t* arg) { af_ao2_t* s = reinterpret_cast<af_ao2_t*>(af->setup); /* Sanity check */ @@ -121,7 +120,7 @@ return af_test_output(af,arg); } -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_ao2_t* s = reinterpret_cast<af_ao2_t*>(af->setup); UNUSED(arg); @@ -140,13 +139,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* data) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* data) { // Do something necessary to get rid of annoying warning during compile if(!af) MSG_ERR("EEEK: Argument af == NULL in af_dummy.c play()."); Modified: mplayerxp/postproc/af_channels.cpp =================================================================== --- mplayerxp/postproc/af_channels.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_channels.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -19,12 +19,12 @@ #define FR 0 #define TO 1 -typedef struct af_channels_s{ +struct af_channels_t{ int route[AF_NCH][2]; int nr; int router; int ich; -}af_channels_t; +}; // Local function for copying data static void __FASTCALL__ af_copy(const any_t* in, any_t* out, int ins, int inos,int outs, int outos, int len, int bps) @@ -122,7 +122,7 @@ return MPXP_Ok; } -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_channels_t* s = reinterpret_cast<af_channels_t*>(af->setup); // Set default channel assignment @@ -156,7 +156,7 @@ return check_routes(s,arg->nch,af->conf.nch); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_channels_t* s = reinterpret_cast<af_channels_t*>(af->setup); switch(cmd){ @@ -244,13 +244,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* in) { af_channels_t*s = reinterpret_cast<af_channels_t*>(af->setup); int i; Modified: mplayerxp/postproc/af_control.h =================================================================== --- mplayerxp/postproc/af_control.h 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_control.h 2012-11-29 12:47:49 UTC (rev 485) @@ -32,7 +32,7 @@ AF_CONTROL_PROP_MASK =(0xF<<5) }; -typedef struct af_control_info_s{ +struct af_control_info_t{ unsigned def; // Control enumrification const char* name; // Name of argument const char* info; // Description of what it does @@ -44,17 +44,16 @@ size_t sz; // Size of argument in bytes unsigned ch; // Channel number (for future use) any_t* arg; // Data (for future use) -}af_control_info_t; +}; - /********************************************* // Extended control_af used with arguments that operates on only one // channel at the time */ -typedef struct af_control_ext_s{ +struct af_control_ext_t{ any_t* arg; // Argument unsigned ch; // Chanel number -}af_control_ext_t; +}; /********************************************* // Control parameters @@ -137,12 +136,12 @@ /* Equalizer plugin header file defines struct used for setting or getting the gain of a specific channel and frequency */ -typedef struct equalizer_s +struct equalizer_t { float gain; // Gain in dB -15 - 15 unsigned channel;// Channel number 0 - 5 int band; // Frequency band 0 - 9 -}equalizer_t; +}; /* The different frequency bands are: nr. center frequency Modified: mplayerxp/postproc/af_crystality.cpp =================================================================== --- mplayerxp/postproc/af_crystality.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_crystality.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -79,7 +79,7 @@ /*#define SAMPLE_MAX 2147483647 - for S32LE */ /* Data for specific instances of this filter */ -typedef struct af_crystality_s +struct af_crystality_t { int bext_level; int echo_level; @@ -102,7 +102,7 @@ lowp_t lp_reverb[2]; lowp_t lp_bass[2]; float hf_div; -} af_crystality_t; +}; static void __FASTCALL__ set_defaults(af_crystality_t *s) { @@ -479,7 +479,7 @@ return out; } -static MPXP_Rc __FASTCALL__ af_config(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ af_config(af_instance_t* af,const af_conf_t* arg) { af_crystality_t* s = reinterpret_cast<af_crystality_t*>(af->setup); unsigned i_bps,fmt; @@ -501,7 +501,7 @@ return af_test_output(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_crystality_t* s = (af_crystality_t*)af->setup; @@ -524,13 +524,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* in) { af_crystality_t* s = reinterpret_cast<af_crystality_t*>(af->setup); mp_aframe_t* out,*tmp; Modified: mplayerxp/postproc/af_delay.cpp =================================================================== --- mplayerxp/postproc/af_delay.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_delay.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -19,16 +19,16 @@ #define UPDATEQI(qi) qi=(qi+1)&(L-1) // Data for specific instances of this filter -typedef struct af_delay_s +struct af_delay_t { any_t* q[AF_NCH]; // Circular queues used for delaying audio signal int wi[AF_NCH]; // Write index int ri; // Read index float d[AF_NCH]; // Delay [ms] -}af_delay_t; +}; // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_delay_t* s = reinterpret_cast<af_delay_t*>(af->setup); @@ -74,7 +74,7 @@ return MPXP_Unknown; } -static MPXP_Rc __FASTCALL__ af_config(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ af_config(af_instance_t* af,const af_conf_t* arg) { af_delay_t* s = reinterpret_cast<af_delay_t*>(af->setup); unsigned i; @@ -95,7 +95,7 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { int i; for(i=0;i<AF_NCH;i++) @@ -106,7 +106,7 @@ } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* in) { mp_aframe_t* c=new_mp_aframe_genome(in); mp_alloc_aframe(c); Modified: mplayerxp/postproc/af_dyn.cpp =================================================================== --- mplayerxp/postproc/af_dyn.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_dyn.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -23,12 +23,12 @@ #include "mplayerxp.h" #include "af.h" -typedef struct af_dyn_s +struct af_dyn_t { float gain; -}af_dyn_t; +}; -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { // Sanity check if(!arg) return MPXP_Error; @@ -42,7 +42,7 @@ // Data for specific instances of this filter // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_dyn_t* s = (af_dyn_t*)af->setup; switch(cmd){ @@ -58,13 +58,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* ind) { unsigned i = 0; float* in = (float*)ind->audio;// Audio data Modified: mplayerxp/postproc/af_echo3d.cpp =================================================================== --- mplayerxp/postproc/af_echo3d.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_echo3d.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -39,7 +39,7 @@ #define DELAY3 14000 /* Data for specific instances of this filter */ -typedef struct af_crystality_s +struct af_crystality_t { int echos; int echo_level; @@ -54,7 +54,7 @@ unsigned buf_size; unsigned _bufPos; unsigned bufPos[3]; -} af_crystality_t; +}; static void __FASTCALL__ set_defaults(af_crystality_t *s) { @@ -150,7 +150,7 @@ return out; } -static MPXP_Rc __FASTCALL__ af_config(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ af_config(af_instance_t* af,const af_conf_t* arg) { af_crystality_t* s = (af_crystality_t*)af->setup; // Sanity check @@ -165,7 +165,7 @@ return af_test_output(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_crystality_t* s = (af_crystality_t*)af->setup; @@ -184,14 +184,14 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(((af_crystality_t *)af->setup)->buf) delete ((af_crystality_t *)af->setup)->buf; if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* in) { return echo3d(reinterpret_cast<af_crystality_t*>(af->setup),in); } Modified: mplayerxp/postproc/af_equalizer.cpp =================================================================== --- mplayerxp/postproc/af_equalizer.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_equalizer.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -54,7 +54,7 @@ #define G_MIN -12.0f // Data for specific instances of this filter -typedef struct af_equalizer_s +struct af_equalizer_t { float a[KM][L]; // A weights float b[KM][L]; // B weights @@ -62,7 +62,7 @@ float g[AF_NCH][KM]; // Gain factor for each channel and band unsigned K; // Number of used eq bands unsigned channels; // Number of channels -} af_equalizer_t; +}; // 2nd order Band-pass Filter design static void __FASTCALL__ bp2(float* a, float* b, float fc, float q){ @@ -76,7 +76,7 @@ b[1] = -1.0050; } -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_equalizer_t* s = (af_equalizer_t*)af->setup; unsigned k =0; @@ -107,7 +107,7 @@ return af_test_output(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_equalizer_t* s = (af_equalizer_t*)af->setup; @@ -165,13 +165,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* ind) { af_equalizer_t* s = (af_equalizer_t*)af->setup; // Setup uint32_t ci = af->conf.nch; // Index for channels Modified: mplayerxp/postproc/af_export.cpp =================================================================== --- mplayerxp/postproc/af_export.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_export.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -36,7 +36,7 @@ #define SIZE_HEADER (2 * sizeof(int) + sizeof(unsigned long long)) // Data for specific instances of this filter -typedef struct af_export_s +struct af_export_t { unsigned long long count; // Used for sync uint8_t* buf[AF_NCH]; // Buffers for storing the data before it is exported @@ -45,15 +45,14 @@ int fd; // File descriptor to shared memory area char* filename; // File to export data any_t* mmap_area; // MMap shared area -} af_export_t; +}; - /* Initialization and runtime control_af af audio filter instance cmd control_af command arg argument */ -static MPXP_Rc __FASTCALL__ af_config(struct af_instance_s* af, const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ af_config(af_instance_t* af, const af_conf_t* arg) { af_export_t* s = reinterpret_cast<af_export_t*>(af->setup); unsigned i=0; @@ -117,7 +116,7 @@ // Use test_output to return FALSE if necessary return af_test_output(af, arg); } -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_export_t* s = reinterpret_cast<af_export_t*>(af->setup); @@ -166,7 +165,7 @@ /* Free allocated memory and clean up other stuff too. af audio filter instance */ -static void __FASTCALL__ uninit( struct af_instance_s* af ) +static void __FASTCALL__ uninit( af_instance_t* af ) { if(af->setup){ af_export_t* s = reinterpret_cast<af_export_t*>(af->setup); @@ -192,7 +191,7 @@ af audio filter instance data audio data */ -static mp_aframe_t* __FASTCALL__ play( struct af_instance_s* af,const mp_aframe_t* data) +static mp_aframe_t* __FASTCALL__ play( af_instance_t* af,const mp_aframe_t* data) { const mp_aframe_t*c = data; // Current working data af_export_t*s = reinterpret_cast<af_export_t*>(af->setup); // Setup for this instance Modified: mplayerxp/postproc/af_extrastereo.cpp =================================================================== --- mplayerxp/postproc/af_extrastereo.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_extrastereo.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -24,12 +24,12 @@ #include "pp_msg.h" // Data for specific instances of this filter -typedef struct af_extrastereo_s +struct af_extrastereo_t { float mul; -}af_extrastereo_t; +}; -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { // Sanity check if(!arg) return MPXP_Error; @@ -44,7 +44,7 @@ return af_test_output(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_extrastereo_t* s = (af_extrastereo_t*)af->setup; @@ -70,13 +70,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* ind) { af_extrastereo_t *s = reinterpret_cast<af_extrastereo_t*>(af->setup); unsigned i = 0; Modified: mplayerxp/postproc/af_ffenc.cpp =================================================================== --- mplayerxp/postproc/af_ffenc.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_ffenc.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -14,7 +14,7 @@ #define MIN_LIBAVCODEC_VERSION_INT ((51<<16)+(0<<8)+0) // Data for specific instances of this filter -typedef struct af_ffenc_s +struct af_ffenc_t { char cname[256]; unsigned brate; @@ -24,7 +24,7 @@ unsigned frame_size; uint8_t *tail; unsigned tail_size; -}af_ffenc_t; +}; static void print_encoders(void) { @@ -79,7 +79,7 @@ return 0; } -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_ffenc_t *s=reinterpret_cast<af_ffenc_t*>(af->setup); if(!s->acodec_inited) { @@ -116,7 +116,7 @@ return MPXP_Ok; } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_ffenc_t *s=reinterpret_cast<af_ffenc_t*>(af->setup); switch(cmd){ @@ -143,7 +143,7 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { af_ffenc_t *s=reinterpret_cast<af_ffenc_t*>(af->setup); avcodec_close(s->lavc_context); @@ -153,7 +153,7 @@ } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* in) { unsigned tlen,ilen,olen,delta; af_ffenc_t *s=reinterpret_cast<af_ffenc_t*>(af->setup); Modified: mplayerxp/postproc/af_format.cpp =================================================================== --- mplayerxp/postproc/af_format.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_format.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -31,11 +31,11 @@ /* Functions used by play to convert the input audio to the correct format */ typedef mp_aframe_t* (*convert_audio_t)(const af_instance_t* af,const mp_aframe_t* in); -typedef struct af_format_s +struct af_format_t { mpaf_format_e fmt; std::vector<convert_audio_t> cvt_chain; -}af_format_t; +}; // Switch endianess static void endian(const mp_aframe_t* in, mp_aframe_t* out); @@ -142,7 +142,7 @@ ,out->len); } -static mp_aframe_t* change_endian(const struct af_instance_s* af,const mp_aframe_t* in) { +static mp_aframe_t* change_endian(const af_instance_t* af,const mp_aframe_t* in) { mp_aframe_t* out; out=new_mp_aframe_genome(in); mp_alloc_aframe(out); @@ -151,7 +151,7 @@ return out; } -static mp_aframe_t* convert_audio_f(const struct af_instance_s* af,const mp_aframe_t*in) { +static mp_aframe_t* convert_audio_f(const af_instance_t* af,const mp_aframe_t*in) { mp_aframe_t* out; out=new_mp_aframe_genome(in); out->len=af_lencalc(af->mul,in); @@ -168,7 +168,7 @@ return out; } -static mp_aframe_t* convert_audio_i(const struct af_instance_s* af,const mp_aframe_t*in) { +static mp_aframe_t* convert_audio_i(const af_instance_t* af,const mp_aframe_t*in) { mp_aframe_t* out; out=new_mp_aframe_genome(in); out->len=af_lencalc(af->mul,in); @@ -178,7 +178,7 @@ return out; } -static mp_aframe_t* convert_si2us(const struct af_instance_s* af,const mp_aframe_t*in) { +static mp_aframe_t* convert_si2us(const af_instance_t* af,const mp_aframe_t*in) { mp_aframe_t* out; out=new_mp_aframe_genome(in); mp_alloc_aframe(out); @@ -187,7 +187,7 @@ return out; } -static mp_aframe_t* convert_us2si(const struct af_instance_s* af,const mp_aframe_t*in) { +static mp_aframe_t* convert_us2si(const af_instance_t* af,const mp_aframe_t*in) { mp_aframe_t* out; out=new_mp_aframe_genome(in); mp_alloc_aframe(out); @@ -196,7 +196,7 @@ return out; } -static MPXP_Rc build_cvt_chain(struct af_instance_s* af,const af_conf_t* in) { +static MPXP_Rc build_cvt_chain(af_instance_t* af,const af_conf_t* in) { af_format_t* s = reinterpret_cast<af_format_t*>(af->setup); s->cvt_chain.clear(); @@ -230,7 +230,7 @@ return MPXP_Ok; } -static MPXP_Rc __FASTCALL__ af_config(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ af_config(af_instance_t* af,const af_conf_t* arg) { af_format_t* s = reinterpret_cast<af_format_t*>(af->setup); // Make sure this filter isn't redundant @@ -247,7 +247,7 @@ return build_cvt_chain(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_format_t* s = reinterpret_cast<af_format_t*>(af->setup); char buf1[256],buf2[256]; @@ -277,7 +277,7 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) { af_format_t* s = reinterpret_cast<af_format_t*>(af->setup); @@ -287,7 +287,7 @@ } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af, const mp_aframe_t* data) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af, const mp_aframe_t* data) { af_format_t* s = reinterpret_cast<af_format_t*>(af->setup); mp_aframe_t* out=NULL,* in=const_cast<mp_aframe_t*>(data); Modified: mplayerxp/postproc/af_hrtf.cpp =================================================================== --- mplayerxp/postproc/af_hrtf.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_hrtf.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -22,7 +22,7 @@ typedef float real_t; -typedef struct af_hrtf_s { +struct af_hrtf_t { /* Lengths */ int dlbuflen, hrflen, basslen; /* L, C, R, Ls, Rs channels */ @@ -56,7 +56,7 @@ float adapt_lrprr_gain, adapt_lrmrr_gain; /* Cyclic position on the ring buffer */ int cyc_pos; -} af_hrtf_t; +}; /* Convolution on a ring buffer * nx: length of the ring buffer @@ -266,7 +266,7 @@ s->ba_r[k] = in[4] + in[1] + in[3]; } -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_hrtf_t *s = reinterpret_cast<af_hrtf_t*>(af->setup); MPXP_Rc test_output_res; @@ -299,7 +299,7 @@ return test_output_res; } /* Initialization and runtime control_af */ -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s *af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t *af, int cmd, any_t* arg) { af_hrtf_t *s = reinterpret_cast<af_hrtf_t*>(af->setup); char mode; @@ -354,7 +354,7 @@ } /* Deallocate memory */ -static void __FASTCALL__ uninit(struct af_instance_s *af) +static void __FASTCALL__ uninit(af_instance_t *af) { if(af->setup) { af_hrtf_t *s = reinterpret_cast<af_hrtf_t*>(af->setup); @@ -387,7 +387,7 @@ 2. A bass compensation is introduced to ensure that 0-200 Hz are not damped (without any real 3D acoustical image, however). */ -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s *af,const mp_aframe_t *ind) +static mp_aframe_t* __FASTCALL__ play(af_instance_t *af,const mp_aframe_t *ind) { af_hrtf_t* s = reinterpret_cast<af_hrtf_t*>(af->setup); real_t* in = reinterpret_cast<real_t*>(ind->audio); // Input audio data Modified: mplayerxp/postproc/af_karaoke.cpp =================================================================== --- mplayerxp/postproc/af_karaoke.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_karaoke.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -20,14 +20,14 @@ // Data for specific instances of this filter // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af->conf.rate = arg->rate; af->conf.nch = arg->nch; af->conf.format = MPAF_NE|MPAF_F|MPAF_BPS_4; return af_test_output(af,arg); } -static MPXP_Rc control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc control_af(af_instance_t* af, int cmd, any_t* arg) { UNUSED(af); UNUSED(cmd); @@ -36,13 +36,13 @@ } // Deallocate memory -static void uninit(struct af_instance_s* af) +static void uninit(af_instance_t* af) { UNUSED(af); } // Filter data through filter -static mp_aframe_t* play(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* play(af_instance_t* af,const mp_aframe_t* ind) { const mp_aframe_t*c = ind; // Current working data float* in = reinterpret_cast<float*>(c->audio); // Audio data Modified: mplayerxp/postproc/af_lp.cpp =================================================================== --- mplayerxp/postproc/af_lp.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_lp.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -10,13 +10,12 @@ #include "af.h" #include "pp_msg.h" -typedef struct s_lp -{ +struct af_lp_t { unsigned fin; unsigned fake_out; -}af_lp_t; +}; -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_lp_t* s = (af_lp_t*)af->setup; memcpy(&af->conf,arg,sizeof(af_conf_t)); @@ -27,7 +26,7 @@ } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_lp_t* s = (af_lp_t*)af->setup; switch(cmd){ @@ -57,13 +56,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* data) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* data) { // Do something necessary to get rid of annoying warning during compile if(!af) MSG_ERR("EEEK: Argument af == NULL in af_lp.c play()."); Modified: mplayerxp/postproc/af_pan.cpp =================================================================== --- mplayerxp/postproc/af_pan.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_pan.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -25,13 +25,13 @@ #include "pp_msg.h" // Data for specific instances of this filter -typedef struct af_pan_s +struct af_pan_t { float level[AF_NCH][AF_NCH]; // Gain level for each channel -}af_pan_t; +}; // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_pan_t* s = reinterpret_cast<af_pan_t*>(af->setup); @@ -100,7 +100,7 @@ return MPXP_Unknown; } -static MPXP_Rc __FASTCALL__ af_config(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ af_config(af_instance_t* af,const af_conf_t* arg) { // Sanity check if(!arg) return MPXP_Error; @@ -115,13 +115,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* ind) { const mp_aframe_t*c= ind; // Current working data af_pan_t* s = reinterpret_cast<af_pan_t*>(af->setup); // Setup for this instance Modified: mplayerxp/postproc/af_raw.cpp =================================================================== --- mplayerxp/postproc/af_raw.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_raw.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -45,20 +45,20 @@ }; // Data for specific instances of this filter -typedef struct af_raw_s +struct af_raw_t { char* filename; // File to export data int wav_mode; struct WaveHeader wavhdr; FILE *fd; -} af_raw_t; +}; /* Initialization and runtime control_af af audio filter instance cmd control_af command arg argument */ -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_raw_t* s = reinterpret_cast<af_raw_t*>(af->setup); char *pt; @@ -97,7 +97,7 @@ return MPXP_Ok; } -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_raw_t* s = reinterpret_cast<af_raw_t*>(af->setup); @@ -115,7 +115,7 @@ /* Free allocated memory and clean up other stuff too. af audio filter instance */ -static void __FASTCALL__ uninit( struct af_instance_s* af ) +static void __FASTCALL__ uninit( af_instance_t* af ) { af_raw_t* s = reinterpret_cast<af_raw_t*>(af->setup); if(s) { @@ -142,7 +142,7 @@ af audio filter instance data audio data */ -static mp_aframe_t* __FASTCALL__ play( struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* __FASTCALL__ play( af_instance_t* af,const mp_aframe_t* ind) { af_raw_t* s = reinterpret_cast<af_raw_t*>(af->setup); // Setup for this instance if(s->fd) fwrite(ind->audio,ind->len,1,s->fd); Modified: mplayerxp/postproc/af_resample.cpp =================================================================== --- mplayerxp/postproc/af_resample.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_resample.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -64,14 +64,14 @@ } // local data -typedef struct af_resample_s { +struct af_resample_t { struct SwrContext* ctx; unsigned irate; unsigned inch; unsigned ifmt; -} af_resample_t; +}; -static MPXP_Rc __FASTCALL__ af_config(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ af_config(af_instance_t* af,const af_conf_t* arg) { af_resample_t* s = (af_resample_t*)af->setup; enum AVSampleFormat avfmt; @@ -117,7 +117,7 @@ return rv; } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_resample_t* s = (af_resample_t*)af->setup; switch(cmd){ @@ -140,7 +140,7 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { af_resample_t* s = (af_resample_t*)af->setup; if(s->ctx) swr_free(&s->ctx); @@ -149,7 +149,7 @@ } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* in) { int rc; mp_aframe_t* out = new_mp_aframe_genome(in); Modified: mplayerxp/postproc/af_scaletempo.cpp =================================================================== --- mplayerxp/postproc/af_scaletempo.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_scaletempo.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -44,7 +44,7 @@ #include "pp_msg.h" // Data for specific instances of this filter -typedef struct af_scaletempo_s +struct af_scaletempo_t { // stride float scale; @@ -65,13 +65,13 @@ int bytes_standing; int8_t* buf_overlap; int8_t* table_blend; - void (*output_overlap)(struct af_scaletempo_s* s, int8_t* out_buf, int bytes_off); + void (*output_overlap)(af_scaletempo_t* s, int8_t* out_buf, int bytes_off); // best overlap int frames_search; int num_channels; int8_t* buf_pre_corr; int8_t* table_window; - int (*best_overlap_offset)(struct af_scaletempo_s* s); + int (*best_overlap_offset)(af_scaletempo_t* s); short shift_corr; // command line float scale_nominal; @@ -80,9 +80,9 @@ float ms_search; short speed_tempo; short speed_pitch; -} af_scaletempo_t; +}; -static int fill_queue(struct af_instance_s* af,const mp_aframe_t* data, int offset) +static int fill_queue(af_instance_t* af,const mp_aframe_t* data, int offset) { af_scaletempo_t* s = reinterpret_cast<af_scaletempo_t*>(af->setup); int bytes_in = data->len - offset; @@ -167,7 +167,7 @@ } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* ind) { af_scaletempo_t* s = reinterpret_cast<af_scaletempo_t*>(af->setup); unsigned offset_in; @@ -223,7 +223,7 @@ return out; } -static MPXP_Rc __FASTCALL__ af_config(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ af_config(af_instance_t* af,const af_conf_t* arg) { af_scaletempo_t* s = reinterpret_cast<af_scaletempo_t*>(af->setup); float srate = arg->rate / 1000; @@ -327,7 +327,7 @@ return af_test_output(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_scaletempo_t* s = reinterpret_cast<af_scaletempo_t*>(af->setup); switch(cmd){ @@ -409,7 +409,7 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { af_scaletempo_t* s = reinterpret_cast<af_scaletempo_t*>(af->setup); delete s->buf_queue; @@ -421,7 +421,7 @@ } // Allocate memory and set function pointers -static MPXP_Rc __FASTCALL__ af_open(struct af_instance_s* af){ +static MPXP_Rc __FASTCALL__ af_open(af_instance_t* af){ af_scaletempo_t* s; af->config_af = af_config; Modified: mplayerxp/postproc/af_sinesuppress.cpp =================================================================== --- mplayerxp/postproc/af_sinesuppress.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_sinesuppress.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -25,7 +25,7 @@ #include "pp_msg.h" // Data for specific instances of this filter -typedef struct af_sinesuppress_s +struct af_sinesuppress_t { double freq; double decay; @@ -33,15 +33,15 @@ double imag; double ref; double pos; -}af_sinesuppress_t; +}; -static mp_aframe_t* play_s16(struct af_instance_s* af,const mp_aframe_t* data); +static mp_aframe_t* play_s16(af_instance_t* af,const mp_aframe_t* data); #if 0 -static mp_aframe_t* play_float(struct af_instance_s* af,const mp_aframe_t* data); +static mp_aframe_t* play_float(af_instance_t* af,const mp_aframe_t* data); #endif // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { // Sanity check if(!arg) return MPXP_Error; @@ -61,7 +61,7 @@ return af_test_output(af,arg); } -static MPXP_Rc control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc control_af(af_instance_t* af, int cmd, any_t* arg) { af_sinesuppress_t* s = (af_sinesuppress_t*)af->setup; @@ -83,13 +83,13 @@ } // Deallocate memory -static void uninit(struct af_instance_s* af) +static void uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* play_s16(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* play_s16(af_instance_t* af,const mp_aframe_t* ind) { af_sinesuppress_t *s = reinterpret_cast<af_sinesuppress_t*>(af->setup); unsigned i = 0; @@ -122,7 +122,7 @@ } #if 0 -static mp_aframe_t* play_float(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* play_float(af_instance_t* af,const mp_aframe_t* ind) { af_sinesuppress_t *s = af->setup; unsigned i = 0; Modified: mplayerxp/postproc/af_sub.cpp =================================================================== --- mplayerxp/postproc/af_sub.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_sub.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -35,26 +35,26 @@ #define Q 1.0 // Analog domain biquad section -typedef struct{ +struct biquad_t{ float a[3]; // Numerator coefficients float b[3]; // Denominator coefficients -} biquad_t; +}; // S-parameters for designing 4th order Butterworth filter static biquad_t sp[2] = {{{1.0,0.0,0.0},{1.0,0.765367,1.0}}, {{1.0,0.0,0.0},{1.0,1.847759,1.0}}}; // Data for specific instances of this filter -typedef struct af_sub_s +struct af_sub_t { float w[2][4]; // Filter taps for low-pass filter float q[2][2]; // Circular queues float fc; // Cutoff frequency [Hz] for low-pass filter float k; // Filter gain; unsigned ch; // Channel number which to insert the filtered data -}af_sub_t; +}; -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_sub_t* s = reinterpret_cast<af_sub_t*>(af->setup); // Sanity check @@ -74,7 +74,7 @@ return af_test_output(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_sub_t* s = reinterpret_cast<af_sub_t*>(af->setup); @@ -121,13 +121,13 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* ind) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* ind) { af_sub_t* s = reinterpret_cast<af_sub_t*>(af->setup); // Setup for this instance float* in = reinterpret_cast<float*>(ind->audio);// Audio data Modified: mplayerxp/postproc/af_surround.cpp =================================================================== --- mplayerxp/postproc/af_surround.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_surround.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -69,7 +69,7 @@ #define UPDATEQI(qi) qi=(qi+1)&(LD-1) // instance data -typedef struct af_surround_s +struct af_surround_t { float lq[2*L]; // Circular queue for filtering left rear channel float rq[2*L]; // Circular queue for filtering right rear channel @@ -80,9 +80,9 @@ int i; // Position in circular buffer int wi; // Write index for delay queue int ri; // Read index for delay queue -}af_surround_t; +}; -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_surround_t *s = reinterpret_cast<af_surround_t*>(af->setup); float fc; @@ -122,7 +122,7 @@ return MPXP_Ok; } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_surround_t *s = reinterpret_cast<af_surround_t*>(af->setup); switch(cmd){ @@ -146,7 +146,7 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } @@ -163,7 +163,7 @@ //static int amp_L = 0, amp_R = 0, amp_C = 0, amp_S = 0; // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* ind){ +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* ind){ af_surround_t*s = (af_surround_t*)af->setup; float* m = steering_matrix[0]; float* in = reinterpret_cast<float*>(ind->audio); // Input audio data Modified: mplayerxp/postproc/af_tools.cpp =================================================================== --- mplayerxp/postproc/af_tools.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_tools.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -70,7 +70,7 @@ } /* Helper function for testing the output format */ -MPXP_Rc __FASTCALL__ af_test_output(struct af_instance_s* af,const af_conf_t* out) +MPXP_Rc __FASTCALL__ af_test_output(af_instance_t* af,const af_conf_t* out) { if((af->conf.format != out->format) || (af->conf.rate != out->rate) || Modified: mplayerxp/postproc/af_volnorm.cpp =================================================================== --- mplayerxp/postproc/af_volnorm.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_volnorm.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -56,7 +56,7 @@ #define SMOOTH_LASTAVG 0.06 // Data for specific instances of this filter -typedef struct af_volume_s +struct af_volnorm_t { int method; // method used float mul; @@ -68,9 +68,9 @@ float avg; // average level of the sample int len; // sample size (weight) } mem[NSAMPLES]; -}af_volnorm_t; +}; -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { // Sanity check if(!arg) return MPXP_Error; @@ -89,7 +89,7 @@ return af_test_output(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_volnorm_t* s = (af_volnorm_t*)af->setup; @@ -111,7 +111,7 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } @@ -289,7 +289,7 @@ } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* in) { af_volnorm_t *s = reinterpret_cast<af_volnorm_t*>(af->setup); mp_aframe_t* out; Modified: mplayerxp/postproc/af_volume.cpp =================================================================== --- mplayerxp/postproc/af_volume.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/af_volume.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -41,7 +41,7 @@ #include "pp_msg.h" // Data for specific instances of this filter -typedef struct af_volume_s +struct af_volume_t { int enable[AF_NCH]; // Enable/disable / channel float pow[AF_NCH]; // Estimated power level [dB] @@ -50,9 +50,9 @@ float time; // Forgetting factor for power estimate int soft; // Enable/disable soft clipping int fast; // Use fix-point volume control_af -}af_volume_t; +}; -static MPXP_Rc __FASTCALL__ config_af(struct af_instance_s* af,const af_conf_t* arg) +static MPXP_Rc __FASTCALL__ config_af(af_instance_t* af,const af_conf_t* arg) { af_volume_t* s = (af_volume_t*)af->setup; // Sanity check @@ -74,7 +74,7 @@ return af_test_output(af,arg); } // Initialization and runtime control_af -static MPXP_Rc __FASTCALL__ control_af(struct af_instance_s* af, int cmd, any_t* arg) +static MPXP_Rc __FASTCALL__ control_af(af_instance_t* af, int cmd, any_t* arg) { af_volume_t* s = (af_volume_t*)af->setup; @@ -131,14 +131,14 @@ } // Deallocate memory -static void __FASTCALL__ uninit(struct af_instance_s* af) +static void __FASTCALL__ uninit(af_instance_t* af) { if(af->setup) delete af->setup; } // Filter data through filter -static mp_aframe_t* __FASTCALL__ play(struct af_instance_s* af,const mp_aframe_t* in) +static mp_aframe_t* __FASTCALL__ play(af_instance_t* af,const mp_aframe_t* in) { af_volume_t*s = (af_volume_t*)af->setup; // Setup for this instance unsigned ch = 0; // Channel counter Modified: mplayerxp/postproc/aflib.h =================================================================== --- mplayerxp/postproc/aflib.h 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/aflib.h 2012-11-29 12:47:49 UTC (rev 485) @@ -86,10 +86,10 @@ ! --------------- */ -typedef struct highpstuff { +struct highp_t { double A, B; float previ, prevo; -} highp_t; +}; /* Private data for Lowpass effect -------------- @@ -97,10 +97,10 @@ ! -------------- */ -typedef struct lowpstuff { +struct lowp_t { double A, B, C; float prev, pprev; -} lowp_t; +}; /* Private data for Bandpass effect --------- @@ -108,12 +108,12 @@ ! ! ------ ------- */ -typedef struct bandstuff { +struct bandp_t { double A, B, C; double prev, pprev; int noise; /* 50 bytes of data, 52 bytes long for allocation purposes. */ -} bandp_t; +}; extern void __FASTCALL__ lowp_init(lowp_t *lp, unsigned center, unsigned rate); extern void __FASTCALL__ highp_init(highp_t *hp, unsigned center, unsigned rate); Modified: mplayerxp/postproc/mpc_info.h =================================================================== --- mplayerxp/postproc/mpc_info.h 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/mpc_info.h 2012-11-29 12:47:49 UTC (rev 485) @@ -1,7 +1,7 @@ #ifndef MP_CODEC_INFO_T #define MP_CODEC_INFO_T -typedef struct mp_codec_info_s +struct mp_codec_info_t { /* codec long name ("Autodesk FLI/FLC Animation decoder" */ const char *name; @@ -13,6 +13,6 @@ const char *author; /* any additional comments */ const char *comment; -} mp_codec_info_t; +}; #endif Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/vf.cpp 2012-11-29 12:47:49 UTC (rev 485) @@ -281,7 +281,7 @@ //============================================================================ // By default vf doesn't accept MPEGPES -static int __FASTCALL__ vf_default_query_format(struct vf_instance_s* vf, unsigned int fmt,unsigned w,unsigned h){ +static int __FASTCALL__ vf_default_query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h){ if(fmt == IMGFMT_MPEGPES) return 0; return 1;//vf_next_query_format(vf,fmt,w,h); } @@ -373,7 +373,7 @@ } } -int __FASTCALL__ vf_next_config(struct vf_instance_s* vf, +int __FASTCALL__ vf_next_config(vf_instance_t* vf, int width, int height, int d_width, int d_height, vo_flags_e voflags, unsigned int outfmt){ int miss; @@ -409,11 +409,11 @@ return vf->next->config_vf(vf->next,width,height,d_width,d_height,voflags,outfmt); } -MPXP_Rc __FASTCALL__ vf_next_control(struct vf_instance_s* vf, int request, any_t* data){ +MPXP_Rc __FASTCALL__ vf_next_control(vf_instance_t* vf, int request, any_t* data){ return vf->next->control_vf(vf->next,request,data); } -int __FASTCALL__ vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt,unsigned width,unsigned height){ +int __FASTCALL__ vf_next_query_format(vf_instance_t* vf, unsigned int fmt,unsigned width,unsigned height){ int flags=vf->next?vf->next->query_format(vf->next,fmt,width,height):(int)vf->default_caps; if(flags) flags|=vf->default_caps; check_pin("vfilter",vf->pin,VF_PIN); @@ -429,7 +429,7 @@ return vf->query_format(vf,fmt,width,height); } -int __FASTCALL__ vf_next_put_slice(struct vf_instance_s* vf,mp_image_t *mpi){ +int __FASTCALL__ vf_next_put_slice(vf_instance_t* vf,mp_image_t *mpi){ int rc; rc = vf->next->put_slice(vf->next,mpi); free_mp_image(mpi); @@ -541,7 +541,7 @@ return flags; } -static int __FASTCALL__ dummy_config(struct vf_instance_s* vf, +static int __FASTCALL__ dummy_config(vf_instance_t* vf, int width, int height, int d_width, int d_height, vo_flags_e voflags, unsigned int outfmt){ return 1; Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-11-29 11:31:45 UTC (rev 484) +++ mplayerxp/postproc/vf.h 2012-11-29 12:47:49 UTC (rev 485) @@ -6,8 +6,8 @@ #include "libmpdemux/stheader.h" #include "libvo/video_out.h" // for vo_flags_e -struct vf_instance_s; -struct vf_priv_s; +struct vf_instance_t; +struct vf_priv_t; enum { VF_FLAGS_THREADS =0x00000001UL, /**< Thread safe plugin (requires to be applied within of threads) */ @@ -15,79 +15,79 @@ VF_FLAGS_SLICES =0x00000004UL /**< really can draw slices (requires to be applied on SMP etc) */ }; -typedef struct vf_info_s { +struct vf_info_t { const char *info; const char *name; const char *author; const char *comment; const unsigned flags; - MPXP_Rc (* __FASTCALL__ open)(struct vf_instance_s* vf,const char* args); -} vf_info_t; + MPXP_Rc (* __FASTCALL__ open)(vf_instance_t* vf,const char* args); +}; -typedef struct vf_image_context_s { +struct vf_image_context_t { unsigned char* static_planes[2]; int static_idx; -} vf_image_context_t; +}; enum { VF_PIN=RND_NUMBER7+RND_CHAR7 }; -typedef int (* __FASTCALL__ vf_config_fun_t)(struct vf_instance_s* vf, +typedef int (* __FASTCALL__ vf_config_fun_t)(vf_instance_t* vf, int width, int height, int d_width, int d_height, vo_flags_e flags, unsigned int outfmt); -typedef struct vf_instance_s { - const vf_info_t* info; +struct vf_instance_t { + const vf_info_t* info; char antiviral_hole[RND_CHAR5]; unsigned pin; // personal identification number // funcs: - int (* __FASTCALL__ config_vf)(struct vf_instance_s* vf, + int (* __FASTCALL__ config_vf)(vf_instance_t* vf, int width, int height, int d_width, int d_height, vo_flags_e flags, unsigned int outfmt); - MPXP_Rc (* __FASTCALL__ control_vf)(struct vf_instance_s* vf, + MPXP_Rc (* __FASTCALL__ control_vf)(vf_instance_t* vf, int request, any_t* data); - int (* __FASTCALL__ query_format)(struct vf_instance_s* vf, + int (* __FASTCALL__ query_format)(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h); - void (* __FASTCALL__ get_image)(struct vf_instance_s* vf, + void (* __FASTCALL__ get_image)(vf_instance_t* vf, mp_image_t *mpi); - int (* __FASTCALL__ put_slice)(struct vf_instance_s* vf, + int (* __FASTCALL__ put_slice)(vf_instance_t* vf, mp_image_t *mpi); - void (* __FASTCALL__ start_slice)(struct vf_instance_s* vf, + void (* __FASTCALL__ start_slice)(vf_instance_t* vf, mp_image_t *mpi); - void (* __FASTCALL__ uninit)(struct vf_instance_s* vf); + void (* __FASTCALL__ uninit)(vf_instance_t* vf); // optional: maybe NULL - void (* __FASTCALL__ print_conf)(struct vf_instance_s* vf); ... [truncated message content] |
From: <nic...@us...> - 2012-11-30 07:29:11
|
Revision: 489 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=489&view=rev Author: nickols_k Date: 2012-11-30 07:29:04 +0000 (Fri, 30 Nov 2012) Log Message: ----------- first stage of full redesign of project: move audio->decoder_t from sh_audio Modified Paths: -------------- mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_audio.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/stheader.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -213,7 +213,6 @@ pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?(demuxer->movi_end - demuxer->movi_start):sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->nch * afmt2bps(sh_audio->afmt))); stream_seek(s,pos); - mpca_resync_stream(sh_audio->decoder); } static void aiff_close(demuxer_t* demuxer) Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_asf.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -710,7 +710,6 @@ if(sh_audio && !d_audio->eof){ ds_free_packs_until_pts(d_audio,d_video->pts); ds_fill_buffer(d_audio); - mpca_resync_stream(sh_audio->decoder); } } Modified: mplayerxp/libmpdemux/demux_audio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_audio.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_audio.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -1698,7 +1698,6 @@ if(len > 0) high_res_mp3_seek(demuxer,len); sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - mpca_resync_stream(sh_audio->decoder); return; } @@ -1735,7 +1734,6 @@ if(len > 0) high_res_ac3_seek(demuxer,len); sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - mpca_resync_stream(sh_audio->decoder); return; } case RAW_DCA: { @@ -1748,7 +1746,6 @@ if(len > 0) high_res_ddca_seek(demuxer,len); sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - mpca_resync_stream(sh_audio->decoder); return; } case RAW_VOC: @@ -1760,11 +1757,7 @@ priv->last_pts -= sh_audio->wf->nAvgBytesPerSec/(float)sh_audio->i_bps; break; } - stream_seek(s,pos); - - mpca_resync_stream(sh_audio->decoder); - } static void audio_close(demuxer_t* demuxer) { Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -1490,10 +1490,8 @@ demux_read_data(d_audio,NULL,skip_audio_bytes); //d_audio->pts=0; // PTS is outdated because of the raw data skipping } - mpca_resync_stream(sh_audio->decoder); -// sh_audio->timer=-skip_audio_secs; } - d_video->pts=priv->avi_video_pts; // OSD + d_video->pts=priv->avi_video_pts; // OSD } #define formtypeON2 mmioFOURCC('O', 'N', '2', 'f') @@ -1521,6 +1519,9 @@ static MPXP_Rc avi_control(const demuxer_t *demuxer,int cmd,any_t*args) { + UNUSED(demuxer); + UNUSED(cmd); + UNUSED(args); return MPXP_Unknown; } Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -578,7 +578,7 @@ ds_fill_buffer(d_video); if(sh_audio){ ds_fill_buffer(d_audio); - mpca_resync_stream(sh_audio->decoder); +// mpca_resync_stream(sh_audio->decoder); } while(1){ @@ -587,7 +587,7 @@ float a_pts=d_audio->pts; a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; if(d_video->pts>a_pts){ - mpca_skip_frame(sh_audio->decoder); // sync audio +// mpca_skip_frame(sh_audio->decoder); // sync audio continue; } } Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -824,16 +824,12 @@ if(newpos<(uint64_t)demuxer->movi_start) newpos=demuxer->movi_start; if(newpos>(uint64_t)demuxer->movi_end) goto cant_seek; stream_seek(demuxer->stream,newpos); - if(!has_idx) - { - if(mpxpav64_sync(demuxer)) - { + if(!has_idx) { + if(mpxpav64_sync(demuxer)) { if(mp_conf.verbose) MSG_V("MPXPAV64_SEEK: newpos after sync %016llX\n",stream_tell(demuxer->stream)); mpxpav64_reset_prevs(demuxer); - mpca_resync_stream(((sh_audio_t*)demuxer->audio->sh)->decoder); } - else - { + else { cant_seek: MSG_WARN("MPXPAV64_SEEK: can't find CLUSTER0\n"); stream_seek(demuxer->stream,cpos); Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -1440,8 +1440,6 @@ vo_osd_changed(OSDTYPE_SUBTITLE); clear_sub = -1; demux_ogg_add_packet(ds,os,ds->id,&op); - if(sh_audio) - mpca_resync_stream(sh_audio->decoder); return; } } Modified: mplayerxp/libmpdemux/demux_rawaudio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -104,7 +104,6 @@ pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->nch * afmt2bps(sh_audio->afmt))); stream_seek(s,pos); - mpca_resync_stream(sh_audio->decoder); } static void rawaudio_close(demuxer_t* demuxer) { UNUSED(demuxer); } Modified: mplayerxp/libmpdemux/demux_real.cpp =================================================================== --- mplayerxp/libmpdemux/demux_real.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_real.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -1589,8 +1589,6 @@ stream_seek(demuxer->stream, next_offset); real_demux(demuxer,NULL); - if (sh_audio) - mpca_resync_stream(sh_audio->decoder); return; } Modified: mplayerxp/libmpdemux/demux_ts.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ts.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_ts.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -3116,20 +3116,16 @@ ds_fill_buffer(d_audio); } - while(sh_video != NULL) - { - if(sh_audio && !d_audio->eof && d_video->pts && d_audio->pts) - { + while(sh_video != NULL) { + if(sh_audio && !d_audio->eof && d_video->pts && d_audio->pts) { float a_pts=d_audio->pts; a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - if(d_video->pts > a_pts) - { - mpca_skip_frame(sh_audio->decoder); // sync audio + if(d_video->pts > a_pts) { +// mpca_skip_frame( sh_audio->decoder); // sync audio continue; } } - i = sync_video_packet(d_video); if((sh_video->fourcc == VIDEO_MPEG1) || (sh_video->fourcc == VIDEO_MPEG2)) { Modified: mplayerxp/libmpdemux/demux_ty.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ty.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_ty.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -805,7 +805,7 @@ (float)sh_audio->i_bps; if( d_video->pts > a_pts ) { - mpca_skip_frame( sh_audio->decoder); // sync audio +// mpca_skip_frame( sh_audio->decoder); // sync audio continue; } } Modified: mplayerxp/libmpdemux/demux_vqf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_vqf.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/demux_vqf.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -218,7 +218,6 @@ pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->nch * afmt2bps(sh_audio->afmt))); stream_seek(s,pos); - mpca_resync_stream(sh_audio->decoder); } static void vqf_close(demuxer_t* demuxer) { UNUSED(demuxer); } Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/libmpdemux/stheader.h 2012-11-30 07:29:04 UTC (rev 489) @@ -23,8 +23,6 @@ uint32_t wtag; // analogue of fourcc for sound unsigned i_bps; // == bitrate (compressed bytes/sec) - any_t* decoder; - // output format: float timer; // value of old a_frame unsigned rate; // sample rate Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/mplayerxp.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -198,7 +198,9 @@ } MP_Config mp_conf; -MPXPContext::MPXPContext() { +MPXPContext::MPXPContext() + :audio(*new(zeromem) audio_processing_t) +{ seek_time=-1; bench=new(zeromem) time_usage_t; use_pts_fix2=-1; @@ -345,7 +347,7 @@ if(mask&INITED_ACODEC){ inited_flags&=~INITED_ACODEC; MP_UNIT("uninit_acodec"); - mpca_uninit(sh_audio->decoder); + mpca_uninit(MPXPCtx->audio.decoder); sh_audio=NULL; } @@ -706,7 +708,7 @@ if(sh_audio){ MP_UNIT("seek_audio_reset"); - mpca_resync_stream(sh_audio->decoder); + mpca_resync_stream(MPXPCtx->audio.decoder); ao_reset(ao_data); // stop audio, throwing away buffered data } @@ -753,9 +755,7 @@ void mpxp_resync_audio_stream(void) { - MPXPSystem*MPXPSys=MPXPCtx->MPXPSys; - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys->demuxer()->audio->sh); - mpca_resync_stream(sh_audio->decoder); + mpca_resync_stream(MPXPCtx->audio.decoder); } static void __FASTCALL__ mpxp_stream_event_handler(stream_t *s,const stream_packet_t *sp) @@ -1107,7 +1107,7 @@ demux_stream_t *d_audio=MPXPSys->demuxer()->audio; sh_audio->codec=NULL; mpca=mpca_init(sh_audio); // try auto-probe first - if(mpca) { sh_audio->decoder=mpca; found=1; } + if(mpca) { MPXPCtx->audio.decoder=mpca; found=1; } #ifdef ENABLE_WIN32LOADER if(!found) { // Go through the codec.conf and find the best codec... @@ -1648,7 +1648,7 @@ static void mpxp_config_malloc(int argc,char *argv[]) { - int i,level; + int i; mp_conf.malloc_debug=0; mp_malloc_e flg=MPA_FLG_RANDOMIZER; for(i=0;i<argc;i++) { @@ -1890,10 +1890,11 @@ goto dump_file; } + /* is it non duplicate block fro find_acodec() ??? */ if(sh_audio){ MSG_V("Initializing audio codec...\n"); - if(!sh_audio->decoder) { - if(mpca_init(sh_audio)==NULL){ + if(!MPXPCtx->audio.decoder) { + if((MPXPCtx->audio.decoder=mpca_init(sh_audio))==NULL){ MSG_ERR(MSGTR_CouldntInitAudioCodec); d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/mplayerxp.h 2012-11-30 07:29:04 UTC (rev 489) @@ -121,6 +121,10 @@ double total_start; }time_usage_t; + struct audio_processing_t { + any_t* decoder; + }; + struct MPXPSystem; /* non-configurable through command line stuff */ struct MPXPContext { @@ -138,6 +142,7 @@ time_usage_t* bench; struct MPXPSystem* MPXPSys; any_t* msg_priv; + audio_processing_t& audio; }; extern MPXPContext* MPXPCtx; Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -276,7 +276,7 @@ for( l = 0, l2 = len, ret = 0; l < len && l2 >= audio_buffer.sh_audio->audio_out_minsize; ) { float pts; - ret = mpca_decode( audio_buffer.sh_audio->decoder, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); + ret = mpca_decode(MPXPCtx->audio.decoder, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); if( ret <= 0 ) break; Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-30 06:39:23 UTC (rev 488) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-30 07:29:04 UTC (rev 489) @@ -65,7 +65,7 @@ ret=read_audio_buffer(sh_audio,(unsigned char *)&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); } else { - ret=mpca_decode(sh_audio->decoder,(unsigned char *)&sh_audio->a_buffer[sh_audio->a_buffer_len], + ret=mpca_decode(MPXPCtx->audio.decoder,(unsigned char *)&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); } if(ret>0) sh_audio->a_buffer_len+=ret; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-30 08:43:44
|
Revision: 490 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=490&view=rev Author: nickols_k Date: 2012-11-30 08:43:33 +0000 (Fri, 30 Nov 2012) Log Message: ----------- add minimal antiviral protection Modified Paths: -------------- mplayerxp/libmpdemux/demux_audio.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/stheader.h mplayerxp/mplayerxp.h Modified: mplayerxp/libmpdemux/demux_audio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_audio.cpp 2012-11-30 07:29:04 UTC (rev 489) +++ mplayerxp/libmpdemux/demux_audio.cpp 2012-11-30 08:43:33 UTC (rev 490) @@ -1013,6 +1013,8 @@ } sh_audio = new_sh_audio(demuxer,0); MSG_DBG2("mp3_header off: st_pos=%lu n=%lu HDR_SIZE=%u\n",st_pos,n,HDR_SIZE); + demuxer->movi_start = stream_tell(s); + demuxer->movi_end = s->end_pos; switch(frmt) { case RAW_FLAC: { @@ -1110,6 +1112,7 @@ sh_audio->i_bps=mp3_brate; sh_audio->rate=mp3_samplerate; sh_audio->nch=mp3_channels; + demuxer->movi_start-=4; if(!read_mp3v1_tags(demuxer,hdr,pos)) return 0; /* id3v1 may coexist with id3v2 */ break; case RAW_MP3: @@ -1117,6 +1120,7 @@ sh_audio->i_bps=mp3_brate; sh_audio->rate=mp3_samplerate; sh_audio->nch=mp3_channels; + demuxer->movi_start-=4; if(!read_mp3v1_tags(demuxer,hdr,pos)) return 0; /* id3v1 may coexist with id3v2 */ break; case RAW_AC3: Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-30 07:29:04 UTC (rev 489) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-30 08:43:33 UTC (rev 490) @@ -4001,8 +4001,8 @@ if (demuxer->audio && demuxer->audio->sh) { sh_audio_t *sh = reinterpret_cast<sh_audio_t*>(demuxer->a_streams[demuxer->audio->id]); int aid = *(int*)arg; - if (aid < 0) aid = (sh->aid + 1) % mkv_d->last_aid; - if (aid != sh->aid) { + if (aid < 0) aid = (sh->id + 1) % mkv_d->last_aid; + if (aid != sh->id) { mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, aid, MATROSKA_TRACK_AUDIO); if (track) { demuxer->audio->id = track->tnum; @@ -4010,7 +4010,7 @@ ds_free_packs(demuxer->audio); } } - *(int*)arg = sh->aid; + *(int*)arg = sh->id; } else *(int*)arg = -2; return MPXP_Ok; default: return MPXP_Unknown; Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-11-30 07:29:04 UTC (rev 489) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-11-30 08:43:33 UTC (rev 490) @@ -192,7 +192,7 @@ sh->audio_out_minsize=8192;/* default size, maybe not enough for Win32/ACM*/ MSG_V("ID_AUDIO_ID=%d\n", aid); } - ((sh_audio_t *)demuxer->a_streams[id])->aid = aid; + ((sh_audio_t *)demuxer->a_streams[id])->id = aid; check_pin("demuxer",demuxer->pin,DEMUX_PIN); return reinterpret_cast<sh_audio_t*>(demuxer->a_streams[id]); } @@ -227,7 +227,7 @@ demuxer->v_streams[id]=mp_calloc(1, sizeof(sh_video_t)); MSG_V("ID_VIDEO_ID=%d\n", vid); } - ((sh_video_t *)demuxer->v_streams[id])->vid = vid; + ((sh_video_t *)demuxer->v_streams[id])->id = vid; check_pin("demuxer",demuxer->pin,DEMUX_PIN); return reinterpret_cast<sh_video_t*>(demuxer->v_streams[id]); } Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-11-30 07:29:04 UTC (rev 489) +++ mplayerxp/libmpdemux/stheader.h 2012-11-30 08:43:33 UTC (rev 490) @@ -13,12 +13,23 @@ #endif #include "xmpcore/mp_image.h" -struct af_stream_t; -typedef struct sh_audio_s { - int aid; +struct standard_header : public Opaque { + public: + standard_header() {} + virtual ~standard_header() {} + + int id; demux_stream_t* ds; struct codecs_st* codec; int inited; +}; + +struct af_stream_t; +struct sh_audio_t : public standard_header { + public: + sh_audio_t() {} + virtual ~sh_audio_t() {} + // input format uint32_t wtag; // analogue of fourcc for sound unsigned i_bps; // == bitrate (compressed bytes/sec) @@ -60,13 +71,14 @@ any_t* context; // codec-specific stuff (usually HANDLE or struct pointer) unsigned char* codecdata; unsigned codecdata_len; -} sh_audio_t; +}; + struct vf_instance_t; -typedef struct sh_video_s { - int vid; - demux_stream_t* ds; - struct codecs_st* codec; - int inited; +struct sh_video_t : public standard_header { + public: + sh_video_t() {} + virtual ~sh_video_t() {} + // input format uint32_t fourcc; int is_static; /* default: 0 - means movie; 1 - means picture (.jpg ...)*/ @@ -92,7 +104,7 @@ BITMAPINFOHEADER* bih; // in format any_t* context; // codec-specific stuff (usually HANDLE or struct pointer) any_t* ImageDesc; // for quicktime codecs -} sh_video_t; +}; sh_audio_t* get_sh_audio(demuxer_t *demuxer,int id); sh_video_t* get_sh_video(demuxer_t *demuxer,int id); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-11-30 07:29:04 UTC (rev 489) +++ mplayerxp/mplayerxp.h 2012-11-30 08:43:33 UTC (rev 490) @@ -127,9 +127,9 @@ struct MPXPSystem; /* non-configurable through command line stuff */ - struct MPXPContext { + struct MPXPContext :public Opaque { MPXPContext(); - ~MPXPContext() {} + virtual ~MPXPContext() {} int rtc_fd; int seek_time; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-30 15:24:22
|
Revision: 493 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=493&view=rev Author: nickols_k Date: 2012-11-30 15:24:08 +0000 (Fri, 30 Nov 2012) Log Message: ----------- convert struct demux_stream_t into class Demuxer_Stream Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_audio.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_demuxers.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_fli.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_nsv.cpp mplayerxp/libmpdemux/demux_null.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_rawvideo.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_smjpeg.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_internal.h mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpdemux/demuxer_r.h mplayerxp/libmpdemux/parse_es.cpp mplayerxp/libmpdemux/parse_es.h mplayerxp/libmpdemux/stheader.h mplayerxp/libmpdemux/video.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/libmpstream/s_tv.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/mplayerxp.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_adecoder.h mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Added Paths: ----------- mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpdemux/demuxer_stream.h Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/dump.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -226,8 +226,8 @@ void dump_mux_close(demuxer_t *demuxer) { dump_priv_t* priv=static_cast<dump_priv_t*>(demuxer->priv); - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; + Demuxer_Stream *d_audio=demuxer->audio; + Demuxer_Stream *d_video=demuxer->video; sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(d_audio->sh); sh_video_t* shv=reinterpret_cast<sh_video_t*>(d_video->sh); if(priv) { @@ -286,8 +286,8 @@ void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) { dump_priv_t* priv=static_cast<dump_priv_t*>(demuxer->priv); - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; + Demuxer_Stream *d_audio=demuxer->audio; + Demuxer_Stream *d_video=demuxer->video; sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(d_audio->sh); sh_video_t* shv=reinterpret_cast<sh_video_t*>(d_video->sh); float frame_time,a_duration; @@ -452,7 +452,7 @@ { if(sha) priv->timer_corr+=d_audio->pts; if(priv->m_audio->wf->nAvgBytesPerSec) - priv->timer_corr+=((float)ds_tell_pts(d_audio))/((float)priv->m_audio->wf->nAvgBytesPerSec); + priv->timer_corr+=((float)d_audio->tell_pts())/((float)priv->m_audio->wf->nAvgBytesPerSec); } MSG_STATUS("Done %u frames (video(%X-%ix%i): %llu bytes audio(%X-%ix%ix%i): %llu bytes)\n" ,priv->decoded_frameno Modified: mplayerxp/libmpcodecs/dec_audio.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -382,5 +382,5 @@ MPXP_Rc rc=MPXP_True; if(sh_audio) if(sh_audio->inited && priv->mpadec) rc=priv->mpadec->control_ad(sh_audio,ADCTRL_SKIP_FRAME,NULL); - if(rc!=MPXP_True) ds_fill_buffer(sh_audio->ds); + if(rc!=MPXP_True) sh_audio->ds->fill_buffer(); } Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -342,7 +342,7 @@ #endif static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned xp_idx) { - demux_stream_t *d_dvdsub=sh_video->ds->demuxer->sub; + Demuxer_Stream *d_dvdsub=sh_video->ds->demuxer->sub; #ifdef USE_SUB // find sub if(MPXPCtx->subtitles && v_pts>0){ Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/Makefile 2012-11-30 15:24:08 UTC (rev 493) @@ -49,8 +49,8 @@ CXXSRCS += mux_mpxp64.cpp mux_raw.cpp #SRCS+= mux_lavf.c -CXXSRCS+= demuxer.cpp demuxer_packet.cpp demuxer_r.cpp mpdemux.cpp -CXXSRCS+= muxer.cpp +CXXSRCS+= demuxer.cpp demuxer_packet.cpp demuxer_stream.cpp demuxer_r.cpp +CXXSRCS+= muxer.cpp mpdemux.cpp OBJS = $(SRCS:.c=.o) CXXOBJS = $(CXXSRCS:.cpp=.o) Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -184,7 +184,7 @@ return demuxer; } -static int aiff_demux(demuxer_t* demuxer, demux_stream_t *ds) { +static int aiff_demux(demuxer_t* demuxer, Demuxer_Stream *ds) { sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); int l = sh_audio->wf->nAvgBytesPerSec; off_t spos = stream_tell(demuxer->stream); @@ -199,7 +199,7 @@ l=stream_read(demuxer->stream,dp->buffer(),l); dp->resize(l); - ds_add_packet(ds,dp); + ds->add_packet(dp); return 1; } Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_asf.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -364,12 +364,12 @@ } else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video; { - demux_stream_t *d_video=demuxer->video; - demux_stream_t *d_audio=demuxer->audio; + Demuxer_Stream *d_video=demuxer->video; + Demuxer_Stream *d_audio=demuxer->audio; stream_reset(demuxer->stream); stream_seek(demuxer->stream,demuxer->movi_start); if(d_video->id != -2) { - if(!ds_fill_buffer(d_video)){ + if(!d_video->fill_buffer()){ MSG_WARN("ASF: " MSGTR_MissingVideoStream); demuxer->video->sh=NULL; } else { @@ -385,7 +385,7 @@ } if(d_audio->id!=-2){ MSG_V("ASF: Searching for audio stream (id:%d)\n",d_audio->id); - if(!ds_fill_buffer(d_audio)){ + if(!d_audio->fill_buffer()){ MSG_WARN("ASF: " MSGTR_MissingAudioStream); demuxer->audio->sh=NULL; } else { @@ -419,7 +419,7 @@ static int demux_asf_read_packet(demuxer_t *demux,off_t dataoff,int len,int id,int seq,unsigned long time,unsigned short dur,int offs,int keyframe){ - demux_stream_t *ds=NULL; + Demuxer_Stream *ds=NULL; asf_priv_t *apriv=static_cast<asf_priv_t*>(demux->priv); MSG_DBG3("demux_asf.read_packet: id=%d seq=%d len=%d time=%u dur=%u offs=%i key=%i\n",id,seq,len,time,dur,offs,keyframe); @@ -456,7 +456,7 @@ if(ds==demux->audio) if(apriv->asf_scrambling_h>1 && apriv->asf_scrambling_w>1) asf_descrambling(apriv,ds->asf_packet->buffer(),ds->asf_packet->length()); - ds_add_packet(ds,ds->asf_packet); + ds->add_packet(ds->asf_packet); ds->asf_packet=NULL; } else { // append data to it! @@ -497,7 +497,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int asf_demux(demuxer_t *demux,demux_stream_t *ds){ +static int asf_demux(demuxer_t *demux,Demuxer_Stream *ds){ stream_t *stream=demux->stream; asf_priv_t *apriv=static_cast<asf_priv_t*>(demux->priv); int done=0; @@ -687,8 +687,8 @@ static void asf_seek(demuxer_t *demuxer,const seek_args_t* seeka){ - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; + Demuxer_Stream *d_audio=demuxer->audio; + Demuxer_Stream *d_video=demuxer->video; asf_priv_t *apriv=static_cast<asf_priv_t*>(demuxer->priv); sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); @@ -704,12 +704,12 @@ stream_seek(demuxer->stream,newpos); /*!!! FIXME: this loop is too long sometime !!!*/ - while(ds_fill_buffer(d_video)) + while(d_video->fill_buffer()) if(d_video->flags&1) break; /* found a keyframe! */ if(sh_audio && !d_audio->eof){ - ds_free_packs_until_pts(d_audio,d_video->pts); - ds_fill_buffer(d_audio); + d_audio->free_packs_until_pts(d_video->pts); + d_audio->fill_buffer(); } } Modified: mplayerxp/libmpdemux/demux_audio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_audio.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_audio.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -1394,7 +1394,7 @@ return out & mask; } -static int audio_demux(demuxer_t *demuxer,demux_stream_t *ds) { +static int audio_demux(demuxer_t *demuxer,Demuxer_Stream *ds) { sh_audio_t* sh_audio; demuxer_t* demux; da_priv_t* priv; @@ -1456,9 +1456,9 @@ dp->resize(len+4); len=stream_read(s,dp->buffer() + 4,len-4); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + len/(float)sh_audio->i_bps; - dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + dp->pts = priv->last_pts - (demux->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; - ds_add_packet(ds,dp); + ds->add_packet(dp); } else stream_skip(s,len); return 1; @@ -1485,9 +1485,9 @@ dp->resize(len+8); len=stream_read(s,dp->buffer()+8,len-8); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + len/(float)sh_audio->i_bps; - dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + dp->pts = priv->last_pts - (demux->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; - ds_add_packet(ds,dp); + ds->add_packet(dp); } else stream_skip(s,len); return 1; @@ -1514,9 +1514,9 @@ memcpy(dp->buffer(),hdr,16); len=stream_read(s,dp->buffer()+16,len-16); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + len/(float)sh_audio->i_bps; - dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + dp->pts = priv->last_pts - (demux->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; - ds_add_packet(ds,dp); + ds->add_packet(dp); } else stream_skip(s,len); return 1; @@ -1530,9 +1530,9 @@ l=stream_read(s,dp->buffer(),l); dp->resize(l); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; - dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + dp->pts = priv->last_pts - (demux->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; - ds_add_packet(ds,dp); + ds->add_packet(dp); return 1; } case RAW_VOC : { @@ -1541,9 +1541,9 @@ l=stream_read(s,dp->buffer(),l); dp->resize(l); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; - dp->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + dp->pts = priv->last_pts - (demux->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; - ds_add_packet(ds,dp); + ds->add_packet(dp); return 1; } case RAW_MUSEPACK: { @@ -1565,10 +1565,10 @@ priv->last_pts = 0; else priv->last_pts += priv->pts_per_packet; - dp->pts = priv->last_pts - (ds_tell_pts(demux->audio) - + dp->pts = priv->last_pts - (demux->audio->tell_pts() - sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; - ds_add_packet(ds, dp); + ds->add_packet(dp); return 1; } default: @@ -1701,7 +1701,7 @@ } if(len > 0) high_res_mp3_seek(demuxer,len); - sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + sh_audio->timer = priv->last_pts - (demuxer->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; return; } @@ -1715,7 +1715,7 @@ pos = demuxer->movi_start; priv->last_pts = (pos-demuxer->movi_start)/(float)sh_audio->i_bps; - sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + sh_audio->timer = priv->last_pts - (demuxer->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; frmt=priv->frmt; if(frmt==RAW_WAV) @@ -1737,7 +1737,7 @@ } if(len > 0) high_res_ac3_seek(demuxer,len); - sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + sh_audio->timer = priv->last_pts - (demuxer->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; return; } case RAW_DCA: { @@ -1749,7 +1749,7 @@ } if(len > 0) high_res_ddca_seek(demuxer,len); - sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + sh_audio->timer = priv->last_pts - (demuxer->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; return; } case RAW_VOC: Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -23,7 +23,7 @@ #include "aviprint.h" #include "demux_msg.h" -typedef int (*alt_demuxer_t)(demuxer_t *demux,demux_stream_t *__ds); +typedef int (*alt_demuxer_t)(demuxer_t *demux,Demuxer_Stream *__ds); struct avi_priv_t : public Opaque { public: avi_priv_t() {} @@ -763,7 +763,7 @@ #undef MIN // Select ds from ID -static demux_stream_t* demux_avi_select_stream(demuxer_t *demux,unsigned int id){ +static Demuxer_Stream* demux_avi_select_stream(demuxer_t *demux,unsigned int id){ int stream_id=avi_stream_id(id); if(demux->video->id==-1) @@ -840,7 +840,7 @@ return (len1<len2)? len1 : len2; } -static int demux_avi_read_packet(demuxer_t *demux,demux_stream_t *ds,unsigned int id,unsigned int len,int idxpos,dp_flags_e flags){ +static int demux_avi_read_packet(demuxer_t *demux,Demuxer_Stream *ds,unsigned int id,unsigned int len,int idxpos,dp_flags_e flags){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); int skip; float pts=0; @@ -893,7 +893,7 @@ if(ds){ MSG_DBG2("DEMUX_AVI: Read %d data bytes from packet %04X\n",len,id); - ds_read_packet(ds,demux->stream,len,pts,idxpos,flags); + ds->read_packet(demux->stream,len,pts,idxpos,flags); skip-=len; } if(skip){ @@ -903,16 +903,16 @@ return ds?1:0; } -static int avi_read_ni(demuxer_t *demux,demux_stream_t* ds); -static int avi_read_nini(demuxer_t *demux,demux_stream_t* ds); +static int avi_read_ni(demuxer_t *demux,Demuxer_Stream* ds); +static int avi_read_nini(demuxer_t *demux,Demuxer_Stream* ds); -static int avi_demux(demuxer_t *demux,demux_stream_t *__ds){ +static int avi_demux(demuxer_t *demux,Demuxer_Stream *__ds){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); if(priv->alt_demuxer) return priv->alt_demuxer(demux,__ds); unsigned int id=0; unsigned int len; int ret=0; - demux_stream_t *ds; + Demuxer_Stream *ds; do{ dp_flags_e flags=DP_KEYFRAME; @@ -1008,7 +1008,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int avi_read_ni(demuxer_t *demux,demux_stream_t* ds){ +static int avi_read_ni(demuxer_t *demux,Demuxer_Stream* ds){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); unsigned int id=0; unsigned int len; @@ -1078,7 +1078,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int avi_read_nini(demuxer_t *demux,demux_stream_t* ds){ +static int avi_read_nini(demuxer_t *demux,Demuxer_Stream* ds){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); unsigned int id=0; unsigned int len; @@ -1132,8 +1132,8 @@ extern demuxer_t* init_avi_with_ogg(demuxer_t* demuxer); extern demuxer_driver_t demux_ogg; static demuxer_t* avi_open(demuxer_t* demuxer){ - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; + Demuxer_Stream *d_audio=demuxer->audio; + Demuxer_Stream *d_video=demuxer->video; sh_audio_t *sh_audio=NULL; sh_video_t *sh_video=NULL; avi_priv_t* priv=new(zeromem) avi_priv_t; @@ -1186,7 +1186,7 @@ off_t v_pos=-1; for(i=0;i<priv->idx_size;i++){ AVIINDEXENTRY* idx=&((AVIINDEXENTRY *)priv->idx)[i]; - demux_stream_t* ds=demux_avi_select_stream(demuxer,idx->ckid); + Demuxer_Stream* ds=demux_avi_select_stream(demuxer,idx->ckid); off_t pos = priv->idx_offset + avi_idx_offset(idx); if(a_pos==-1 && ds==demuxer->audio){ a_pos=pos; @@ -1206,7 +1206,7 @@ sh_audio=NULL; } } else demuxer->flags &= ~DEMUXF_SEEKABLE; - if(!ds_fill_buffer(d_video)){ + if(!d_video->fill_buffer()){ MSG_ERR("AVI: " MSGTR_MissingVideoStreamBug); return NULL; } @@ -1214,7 +1214,7 @@ sh_video->ds=d_video; if(d_audio->id!=-2){ MSG_V("AVI: Searching for audio stream (id:%d)\n",d_audio->id); - if(!priv->audio_streams || !ds_fill_buffer(d_audio)){ + if(!priv->audio_streams || !d_audio->fill_buffer()){ MSG_V("AVI: " MSGTR_MissingAudioStream); sh_audio=NULL; } else { @@ -1312,8 +1312,8 @@ static void avi_seek(demuxer_t *demuxer,const seek_args_t* seeka){ avi_priv_t *priv=static_cast<avi_priv_t*>(demuxer->priv); - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; + Demuxer_Stream *d_audio=demuxer->audio; + Demuxer_Stream *d_video=demuxer->video; sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); sh_video_t *sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); float skip_audio_secs=0; @@ -1487,7 +1487,7 @@ (int)priv->skip_video_frames,skip_audio_bytes,skip_audio_secs); if(skip_audio_bytes){ - demux_read_data(d_audio,NULL,skip_audio_bytes); + d_audio->read_data(NULL,skip_audio_bytes); //d_audio->pts=0; // PTS is outdated because of the raw data skipping } } Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -93,8 +93,9 @@ return img ? MPXP_Ok : MPXP_False; } -static int bmp_demux(demuxer_t *demuxer,demux_stream_t *__ds) +static int bmp_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) { + UNUSED(__ds); unsigned lsize=((img->format->BitsPerPixel+7)/8)*img->w; unsigned j,len=lsize*img->h; unsigned npal_colors; @@ -134,7 +135,7 @@ src+=img->pitch; } } - ds_add_packet(demuxer->video,dp); + demuxer->video->add_packet(dp); /* return value: 0 = EOF or no stream found 1 = successfully read a packet */ @@ -144,8 +145,6 @@ static demuxer_t* bmp_open(demuxer_t* demuxer) { sh_video_t *sh_video = NULL; - unsigned int filesize; - unsigned int data_offset; unsigned npal_colors; // create a new video stream header sh_video = new_sh_video(demuxer, 0); @@ -194,6 +193,7 @@ static void bmp_close(demuxer_t* demuxer) { + UNUSED(demuxer); if(img) SDL_FreeSurface(img); demux_rw_close_stream(&my_rw); } @@ -221,7 +221,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int bmp_demux(demuxer_t *demuxer,demux_stream_t *__ds) +static int bmp_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) { bmp_image_t *bmp_image = static_cast<bmp_image_t*>(demuxer->priv); Modified: mplayerxp/libmpdemux/demux_demuxers.cpp =================================================================== --- mplayerxp/libmpdemux/demux_demuxers.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_demuxers.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -52,7 +52,7 @@ return ret; } -static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) { +static int demux_demuxers_fill_buffer(demuxer_t *demux,Demuxer_Stream *ds) { dd_priv_t* priv=static_cast<dd_priv_t*>(demux->priv); if(ds->demuxer == priv->vd) @@ -85,7 +85,7 @@ demux_seek(priv->ad,&seek_p); // In case the demuxer don't set pts if(!demuxer->audio->pts) - demuxer->audio->pts = pos-((ds_tell_pts(demuxer->audio)-sh->a_in_buffer_len)/(float)sh->i_bps); + demuxer->audio->pts = pos-((demuxer->audio->tell_pts()-sh->a_in_buffer_len)/(float)sh->i_bps); if(sh->timer) sh->timer = 0; } Modified: mplayerxp/libmpdemux/demux_dv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dv.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_dv.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -103,7 +103,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int dv_demux(demuxer_t *demuxer, demux_stream_t *ds) +static int dv_demux(demuxer_t *demuxer, Demuxer_Stream *ds) { rawdv_frames_t *frames = static_cast<rawdv_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); @@ -125,9 +125,9 @@ if (demuxer->audio && demuxer->audio->id>=-1) { Demuxer_Packet* dp_audio=dp_video->clone(); - ds_add_packet(demuxer->audio,dp_audio); + demuxer->audio->add_packet(dp_audio); } - ds_add_packet(demuxer->video,dp_video); + demuxer->video->add_packet(dp_video); // get the next frame ready frames->current_filepos+=frames->frame_size; frames->current_frame++; Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_film.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -91,8 +91,9 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int film_demux(demuxer_t *demuxer,demux_stream_t *__ds) +static int film_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) { + UNUSED(__ds); int i; unsigned char byte_swap; int cvid_size; @@ -140,7 +141,7 @@ } // append packet to DS stream - ds_add_packet(demuxer->audio, dp); + demuxer->audio->add_packet(dp); } } else @@ -177,13 +178,14 @@ dp->buffer()[3] = (cvid_size >> 0) & 0xFF; // append packet to DS stream - ds_add_packet(demuxer->video, dp); + demuxer->video->add_packet(dp); } else { - ds_read_packet(demuxer->video, demuxer->stream, film_chunk.chunk_size, - film_chunk.pts, - film_chunk.chunk_offset, (film_chunk.syncinfo1 & 0x80000000) ? DP_KEYFRAME : DP_NONKEYFRAME); + demuxer->video->read_packet(demuxer->stream, film_chunk.chunk_size, + film_chunk.pts, + film_chunk.chunk_offset, + (film_chunk.syncinfo1 & 0x80000000) ? DP_KEYFRAME : DP_NONKEYFRAME); } } film_data->current_chunk++; Modified: mplayerxp/libmpdemux/demux_fli.cpp =================================================================== --- mplayerxp/libmpdemux/demux_fli.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_fli.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -50,7 +50,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int fli_demux(demuxer_t *demuxer,demux_stream_t *__ds){ +static int fli_demux(demuxer_t *demuxer,Demuxer_Stream *__ds){ fli_frames_t *frames = static_cast<fli_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); @@ -62,12 +62,11 @@ // first, position the file properly since ds_read_packet() doesn't // seem to do it, even though it takes a file offset as a parameter stream_seek(demuxer->stream, frames->filepos[frames->current_frame]); - ds_read_packet(demuxer->video, - demuxer->stream, - frames->frame_size[frames->current_frame], - frames->current_frame/sh_video->fps, - frames->filepos[frames->current_frame], - DP_NONKEYFRAME /* what flags? -> demuxer.h (alex) */ + demuxer->video->read_packet(demuxer->stream, + frames->frame_size[frames->current_frame], + frames->current_frame/sh_video->fps, + frames->filepos[frames->current_frame], + DP_NONKEYFRAME /* what flags? -> demuxer.h (alex) */ ); // get the next frame ready @@ -198,6 +197,9 @@ static MPXP_Rc fli_control(const demuxer_t *demuxer,int cmd,any_t*args) { + UNUSED(demuxer); + UNUSED(cmd); + UNUSED(args); return MPXP_Unknown; } Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -413,12 +413,12 @@ return demuxer; } -static int lavf_demux(demuxer_t *demux, demux_stream_t *dsds){ +static int lavf_demux(demuxer_t *demux, Demuxer_Stream *dsds){ UNUSED(dsds); lavf_priv_t *priv= static_cast<lavf_priv_t*>(demux->priv); AVPacket pkt; Demuxer_Packet *dp; - demux_stream_t *ds; + Demuxer_Stream *ds; int id; MSG_DBG2("lavf_demux()\n"); @@ -464,7 +464,7 @@ dp->pos=demux->filepos; dp->flags= (pkt.flags&AV_PKT_FLAG_KEY)?DP_KEYFRAME:DP_NONKEYFRAME; // append packet to DS stream: - ds_add_packet(ds,dp); + ds->add_packet(dp); return 1; } Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -2649,7 +2649,7 @@ } dp->pts = 0; dp->flags = DP_NONKEYFRAME; - ds_add_packet (demuxer->audio, dp); + demuxer->audio->add_packet(dp); } else if (track->a_formattag == mmioFOURCC('W', 'V', 'P', 'K')) { /* do nothing, still works */ } @@ -3207,7 +3207,7 @@ #if 0 dp->endpts = (timecode + block_duration) / 1000.0f; #endif - ds_add_packet(demuxer->sub, dp); + demuxer->sub->add_packet(dp); } // Taken from demux_real.c. Thanks to the original developpers :) @@ -3315,7 +3315,7 @@ dp->pos = demuxer->filepos; dp->flags = block_bref ? DP_NONKEYFRAME : DP_KEYFRAME; - ds_add_packet(demuxer->video, dp); + demuxer->video->add_packet(dp); } static void @@ -3396,7 +3396,7 @@ dp->pts = (x * apk_usize % w) ? 0 : track->audio_timestamp[x * apk_usize / w]; dp->pos = track->audio_filepos; // all equal dp->flags = x ? DP_NONKEYFRAME : DP_KEYFRAME; // Mark first packet as keyframe - ds_add_packet(demuxer->audio, dp); + demuxer->audio->add_packet(dp); } } } else { // Not a codec that require reordering @@ -3410,7 +3410,7 @@ dp->pos = demuxer->filepos; dp->flags = block_bref ? DP_NONKEYFRAME : DP_KEYFRAME; - ds_add_packet (demuxer->audio, dp); + demuxer->audio->add_packet (dp); } } @@ -3452,7 +3452,7 @@ } while (!ok); for (i = 0; i < track->num_cached_dps; i++) - ds_add_packet (demuxer->video, track->cached_dps[i]); + demuxer->video->add_packet (track->cached_dps[i]); track->num_cached_dps = 0; } @@ -3512,7 +3512,7 @@ { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track = NULL; - demux_stream_t *ds = NULL; + Demuxer_Stream *ds = NULL; uint64_t old_length; int64_t tc; uint32_t *lace_size; @@ -3650,7 +3650,7 @@ * values being the same) */ if (i == 0 || track->default_duration) dp->pts = mkv_d->last_pts + i * track->default_duration; - ds_add_packet (ds, dp); + ds->add_packet (dp); } } block += lace_size[i]; @@ -3672,7 +3672,7 @@ return 0; } -static int mkv_demux (demuxer_t *demuxer, demux_stream_t *ds) +static int mkv_demux (demuxer_t *demuxer, Demuxer_Stream *ds) { UNUSED(ds); mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); @@ -4007,7 +4007,7 @@ if (track) { demuxer->audio->id = track->tnum; sh = reinterpret_cast<sh_audio_t*>(demuxer->a_streams[demuxer->audio->id]); - ds_free_packs(demuxer->audio); + demuxer->audio->free_packs(); } } *(int*)arg = sh->id; Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_mov.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -453,8 +453,7 @@ //stream_read(demuxer->stream,s,slen); //FIXME: also store type & data_rate ? - ds_read_packet(demuxer->video, - demuxer->stream, + demuxer->video->read_packet(demuxer->stream, slen, 0, stream_tell(demuxer->stream), @@ -1922,7 +1921,7 @@ * \return the mov track info structure belonging to the stream, * NULL if not found */ -static mov_track_t *stream_track(mov_priv_t *priv, demux_stream_t *ds) { +static mov_track_t *stream_track(mov_priv_t *priv, Demuxer_Stream *ds) { if (ds && (ds->id >= 0) && (ds->id < priv->track_db)) return priv->tracks[ds->id]; return NULL; @@ -1931,7 +1930,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int mov_demux(demuxer_t *demuxer,demux_stream_t* ds){ +static int mov_demux(demuxer_t *demuxer,Demuxer_Stream* ds){ mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); mov_track_t* trak=NULL; float pts; @@ -2016,9 +2015,9 @@ trak->stream_header_len = 0; dp->pts=pts; dp->flags=DP_NONKEYFRAME; - ds_add_packet(ds,dp); + ds->add_packet(dp); } else - ds_read_packet(ds,demuxer->stream,x,pts,pos,DP_NONKEYFRAME); + ds->read_packet(demuxer->stream,x,pts,pos,DP_NONKEYFRAME); ++trak->pos; return 1; @@ -2064,7 +2063,7 @@ static void mov_seek(demuxer_t *demuxer,const seek_args_t* seeka){ mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); - demux_stream_t* ds; + Demuxer_Stream* ds; mov_track_t* trak; ds=demuxer->video; Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -44,7 +44,7 @@ #define MPGPES_BAD_PTS -1 -typedef int (*alt_demuxer_t)(demuxer_t *demux,demux_stream_t *__ds); +typedef int (*alt_demuxer_t)(demuxer_t *demux,Demuxer_Stream *__ds); struct mpg_demuxer_t : public Opaque { public: mpg_demuxer_t() {} @@ -197,7 +197,7 @@ unsigned char c=0; int pts=MPGPES_BAD_PTS; unsigned int dts=0; - demux_stream_t *ds=NULL; + Demuxer_Stream *ds=NULL; mpg_demuxer_t *priv = static_cast<mpg_demuxer_t*>(demux->priv); MSG_DBG3("demux_read_packet: %X\n",id); @@ -407,7 +407,7 @@ else { sh_video_t *sh; - if(ds->asf_packet) ds_add_packet(ds,ds->asf_packet); + if(ds->asf_packet) ds->add_packet(ds->asf_packet); Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); len=stream_read(demux->stream,dp->buffer(),len); dp->resize(len); @@ -419,7 +419,7 @@ ds->asf_packet=dp; if (ds==ds->demuxer->sub) { // Add sub packets at ones - ds_add_packet(ds,ds->asf_packet); + ds->add_packet(ds->asf_packet); ds->asf_packet=NULL; } } @@ -432,15 +432,15 @@ return 0; } -static int mpges_demux(demuxer_t *demux,demux_stream_t *__ds){ +static int mpges_demux(demuxer_t *demux,Demuxer_Stream *__ds){ /* Elementary video stream */ if(stream_eof(demux->stream)) return 0; demux->filepos=stream_tell(demux->stream); - ds_read_packet(demux->video,demux->stream,STREAM_BUFFER_SIZE,0,demux->filepos,DP_NONKEYFRAME); + demux->video->read_packet(demux->stream,STREAM_BUFFER_SIZE,0,demux->filepos,DP_NONKEYFRAME); return 1; } -static int mpgps_demux(demuxer_t *demux,demux_stream_t *__ds){ +static int mpgps_demux(demuxer_t *demux,Demuxer_Stream *__ds){ mpg_demuxer_t* mpg_d = static_cast<mpg_demuxer_t*>(demux->priv); if(mpg_d->alt_demuxer) return mpg_d->alt_demuxer(demux,__ds); unsigned int head=0; @@ -544,8 +544,8 @@ } static void mpgps_seek(demuxer_t *demuxer,const seek_args_t* seeka){ - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; + Demuxer_Stream *d_audio=demuxer->audio; + Demuxer_Stream *d_video=demuxer->video; sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); sh_video_t *sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); @@ -575,9 +575,9 @@ // re-sync video: videobuf_code_len=0; // reset ES stream buffer - ds_fill_buffer(d_video); + d_video->fill_buffer(); if(sh_audio){ - ds_fill_buffer(d_audio); + d_audio->fill_buffer(); // mpca_resync_stream(sh_audio->decoder); } @@ -585,7 +585,7 @@ int i; if(sh_audio && !d_audio->eof && d_video->pts && d_audio->pts){ float a_pts=d_audio->pts; - a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + a_pts+=(d_audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; if(d_video->pts>a_pts){ // mpca_skip_frame(sh_audio->decoder); // sync audio continue; @@ -797,7 +797,7 @@ mpg_d->num_a_streams = 0; if(demuxer->audio->id!=-2) { - if(!ds_fill_buffer(demuxer->audio)){ + if(!demuxer->audio->fill_buffer()){ MSG_WARN("MPEG: " MSGTR_MissingAudioStream); demuxer->audio->sh=NULL; } else { @@ -821,7 +821,7 @@ switch(cmd) { case DEMUX_CMD_SWITCH_AUDIO: if (mpg_d && mpg_d->num_a_streams > 1 && demuxer->audio && demuxer->audio->sh) { - demux_stream_t *d_audio = demuxer->audio; + Demuxer_Stream *d_audio = demuxer->audio; sh_audio_t *sh_audio = reinterpret_cast<sh_audio_t*>(d_audio->sh); sh_audio_t *sh_a=NULL; int i; @@ -844,7 +844,7 @@ if (i < mpg_d->num_a_streams && d_audio->id != mpg_d->a_stream_ids[i]) { d_audio->id = mpg_d->a_stream_ids[i]; d_audio->sh = sh_a; - ds_free_packs(d_audio); + d_audio->free_packs(); } } *((int*)arg) = demuxer->audio->id; Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -528,7 +528,7 @@ static int mpxpav64_read_packet(demuxer_t *demux,unsigned id,uint64_t len,float pts,int keyframe) { - demux_stream_t *ds=NULL; + Demuxer_Stream *ds=NULL; stream_t* s=demux->stream; if(demux->video->id==-1) @@ -565,7 +565,7 @@ dp->flags=keyframe?DP_KEYFRAME:DP_NONKEYFRAME; dp->pos=demux->filepos; MSG_DBG2("MPXPAV64: reading %llu of %s PTS %f %skeyframe at %016llX\n",len,ds==demux->audio?"audio":"video",dp->pts,keyframe?"":"non",pos); - ds_add_packet(ds,dp); + ds->add_packet(dp); return 1; } else @@ -577,7 +577,7 @@ } /* DATx|stn|size|pts|stream data of size32 */ -static int mpxpav64_demux(demuxer_t *demux,demux_stream_t *__ds){ +static int mpxpav64_demux(demuxer_t *demux,Demuxer_Stream *__ds){ stream_t* s=demux->stream; mpxpav64_priv_t *priv=static_cast<mpxpav64_priv_t*>(demux->priv); uint8_t flg; Modified: mplayerxp/libmpdemux/demux_nsv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nsv.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_nsv.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -48,7 +48,7 @@ } -static int nsv_demux ( demuxer_t *demuxer,demux_stream_t* __ds ) +static int nsv_demux ( demuxer_t *demuxer,Demuxer_Stream* __ds ) { unsigned char hdr[17]; // for the extra data @@ -119,9 +119,9 @@ // video frame is empty otherwise the stream will fasten up if(sh_video) { if( (hdr[2]&0x0f) != 0x0 ) - ds_read_packet(demuxer->video,demuxer->stream,videolen,priv->v_pts,demuxer->filepos-i_aux,DP_NONKEYFRAME); + demuxer->video->read_packet(demuxer->stream,videolen,priv->v_pts,demuxer->filepos-i_aux,DP_NONKEYFRAME); else - ds_read_packet(demuxer->video,demuxer->stream,videolen,priv->v_pts,demuxer->filepos,DP_NONKEYFRAME); + demuxer->video->read_packet(demuxer->stream,videolen,priv->v_pts,demuxer->filepos,DP_NONKEYFRAME); } else stream_skip(demuxer->stream,videolen); @@ -131,7 +131,7 @@ // we need to return an empty packet when the // audio frame is empty otherwise the stream will fasten up if(sh_audio) { - ds_read_packet(demuxer->audio,demuxer->stream,audiolen,priv->v_pts,demuxer->filepos+videolen,DP_NONKEYFRAME); + demuxer->audio->read_packet(demuxer->stream,audiolen,priv->v_pts,demuxer->filepos+videolen,DP_NONKEYFRAME); } else stream_skip(demuxer->stream,audiolen); Modified: mplayerxp/libmpdemux/demux_null.cpp =================================================================== --- mplayerxp/libmpdemux/demux_null.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_null.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -28,7 +28,7 @@ return NULL; } -static int null_demux(demuxer_t* demuxer, demux_stream_t *ds) { +static int null_demux(demuxer_t* demuxer, Demuxer_Stream *ds) { return 0; } Modified: mplayerxp/libmpdemux/demux_nuv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nuv.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_nuv.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -153,7 +153,7 @@ } -static int nuv_demux( demuxer_t *demuxer, demux_stream_t *__ds ) +static int nuv_demux( demuxer_t *demuxer, Demuxer_Stream *__ds ) { struct rtframeheader rtjpeg_frameheader; off_t orig_pos; @@ -187,7 +187,7 @@ } /* put RTjpeg tables, Video info to video buffer */ stream_seek ( demuxer->stream, orig_pos ); - ds_read_packet ( demuxer->video, demuxer->stream, rtjpeg_frameheader.packetlength + 12, + demuxer->video->read_packet ( demuxer->stream, rtjpeg_frameheader.packetlength + 12, rtjpeg_frameheader.timecode*0.001, orig_pos, DP_NONKEYFRAME); @@ -199,7 +199,7 @@ priv->current_audio_frame++; if (want_audio) { /* put Audio to audio buffer */ - ds_read_packet ( demuxer->audio, demuxer->stream, rtjpeg_frameheader.packetlength, + demuxer->audio->read_packet ( demuxer->stream, rtjpeg_frameheader.packetlength, rtjpeg_frameheader.timecode*0.001, orig_pos + 12, DP_NONKEYFRAME); } else { /* skip audio block */ Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -527,7 +527,7 @@ /// Calculate the timestamp and add the packet to the demux stream // return 1 if the packet was added, 0 otherwise -static int demux_ogg_add_packet(demux_stream_t* ds,ogg_stream_t* os,int id,ogg_packet* pack) { +static int demux_ogg_add_packet(Demuxer_Stream* ds,ogg_stream_t* os,int id,ogg_packet* pack) { demuxer_t* d = ds->demuxer; Demuxer_Packet* dp; unsigned char* data; @@ -589,7 +589,7 @@ memcpy(dp->buffer(),data,pack->bytes-(data-pack->packet)); dp->pts = pts; dp->flags = flags?DP_KEYFRAME:DP_NONKEYFRAME; - ds_add_packet(ds,dp); + ds->add_packet(dp); MSG_DBG2("New dp: %p ds=%p pts=%5.3f len=%d flag=%d \n", dp, ds, pts, dp->length(), flags); return 1; @@ -1014,7 +1014,7 @@ MSG_ERR("Ogg stream %d is of an unknown type\n",ogg_d->num_sub); if(sh_a || sh_v) { - demux_stream_t* ds = NULL; + Demuxer_Stream* ds = NULL; if(sh_a) { // If the audio stream is not defined we took the first one if(demuxer->audio->id == -1) { @@ -1095,11 +1095,11 @@ } -static int ogg_demux(demuxer_t *d,demux_stream_t *__ds) { +static int ogg_demux(demuxer_t *d,Demuxer_Stream *__ds) { UNUSED(__ds); ogg_demuxer_t* ogg_d; stream_t *s; - demux_stream_t *ds; + Demuxer_Stream *ds; ogg_sync_state* sync; ogg_stream_state* os; ogg_page* page; @@ -1226,7 +1226,7 @@ goto fallback; } // Add some data - plen = ds_get_packet(demuxer->audio,&p); + plen = demuxer->audio->get_packet(&p); buf = (unsigned char *)ogg_sync_buffer(&ogg_d->sync,plen); memcpy(buf,p,plen); ogg_sync_wrote(&ogg_d->sync,plen); @@ -1246,15 +1246,15 @@ // Initial header dp = new(zeromem) Demuxer_Packet(hdrsizes[0]); memcpy(dp->buffer(),((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t),hdrsizes[0]); - ds_add_packet(od->audio,dp); + od->audio->add_packet(dp); /// Comments dp = new(zeromem) Demuxer_Packet(hdrsizes[1]); memcpy(dp->buffer(),((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0],hdrsizes[1]); - ds_add_packet(od->audio,dp); + od->audio->add_packet(dp); /// Code book dp = new(zeromem) Demuxer_Packet(hdrsizes[2]); memcpy(dp->buffer(),((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0]+hdrsizes[1],hdrsizes[2]); - ds_add_packet(od->audio,dp); + od->audio->add_packet(dp); // Finish setting up the ogg demuxer od->priv = ogg_d; @@ -1280,7 +1280,7 @@ ogg_page* page= &ogg_d->page; ogg_stream_state* oss; ogg_stream_t* os; - demux_stream_t* ds; + Demuxer_Stream* ds; sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); ogg_packet op; float rate; Modified: mplayerxp/libmpdemux/demux_pva.cpp =================================================================== --- mplayerxp/libmpdemux/demux_pva.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_pva.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -186,7 +186,7 @@ // 0 = EOF or no stream found // 1 = successfully read a packet -static int pva_demux(demuxer_t * demux,demux_stream_t *__ds) +static int pva_demux(demuxer_t * demux,Demuxer_Stream *__ds) { uint8_t done=0; Demuxer_Packet * dp; @@ -230,7 +230,7 @@ dp->flags=DP_NONKEYFRAME; l=stream_read(demux->stream,dp->buffer(),current_payload.size); dp->resize(l); - ds_add_packet(demux->video,dp); + demux->video->add_packet(dp); } else { //printf("Skipping %u video bytes\n",current_payload.size); stream_skip(demux->stream,current_payload.size); @@ -260,7 +260,7 @@ stream_seek(demux->stream,current_payload.offset); l=stream_read(demux->stream,dp->buffer(),current_payload.size); dp->resize(l); - ds_add_packet(demux->audio,dp); + demux->audio->add_packet(dp); } else { stream_skip(demux->stream,current_payload.size); } Modified: mplayerxp/libmpdemux/demux_rawaudio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -76,7 +76,7 @@ return demuxer; } -static int rawaudio_demux(demuxer_t* demuxer, demux_stream_t *ds) { +static int rawaudio_demux(demuxer_t* demuxer, Demuxer_Stream *ds) { sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); int l = sh_audio->wf->nAvgBytesPerSec; off_t spos = stream_tell(demuxer->stream); @@ -90,7 +90,7 @@ l=stream_read(demuxer->stream,dp->buffer(),l); dp->resize(l); - ds_add_packet(ds,dp); + ds->add_packet(dp); return 1; } Modified: mplayerxp/libmpdemux/demux_rawvideo.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -120,12 +120,12 @@ return demuxer; } -static int rawvideo_demux(demuxer_t* demuxer, demux_stream_t *ds) { +static int rawvideo_demux(demuxer_t* demuxer, Demuxer_Stream *ds) { if(stream_eof(demuxer->stream)) return 0; if(ds!=demuxer->video) return 0; - ds_read_packet(ds,demuxer->stream,priv.imgsize,0,stream_tell(demuxer->stream),DP_KEYFRAME); + ds->read_packet(demuxer->stream,priv.imgsize,0,stream_tell(demuxer->stream),DP_KEYFRAME); return 1; } Modified: mplayerxp/libmpdemux/demux_real.cpp =================================================================== --- mplayerxp/libmpdemux/demux_real.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_real.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -405,10 +405,10 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int real_demux(demuxer_t *demuxer,demux_stream_t *__ds) +static int real_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) { real_priv_t *priv = static_cast<real_priv_t*>(demuxer->priv); - demux_stream_t *ds = NULL; + Demuxer_Stream *ds = NULL; float pts; int len; int timestamp; @@ -522,7 +522,7 @@ priv->a_pts = pts; dp->pos = demuxer->filepos; dp->flags=DP_NONKEYFRAME; - ds_add_packet(ds, dp); + ds->add_packet(dp); } delete sub_packet_lengths; return 1; @@ -538,7 +538,7 @@ priv->a_pts=pts; dp->pos = demuxer->filepos; dp->flags = (flags & 0x2) ? DP_KEYFRAME : DP_NONKEYFRAME; - ds_add_packet(ds, dp); + ds->add_packet(dp); } // we will not use audio index if we use -idx and have a video if(!demuxer->video->sh && index_mode == 2 && (unsigned)demuxer->audio->id < MAX_STREAMS) @@ -656,7 +656,7 @@ } else dp->pts=(dp_hdr->len<3)?0: real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->fourcc); - ds_add_packet(ds,dp); + ds->add_packet(dp); ds->asf_packet=NULL; } else { // append data to it! @@ -691,7 +691,7 @@ } else dp->pts=(dp_hdr->len<3)?0: real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->fourcc); - ds_add_packet(ds,dp); + ds->add_packet(dp); ds->asf_packet=NULL; // continue parsing continue; @@ -748,7 +748,7 @@ } else dp->pts=(dp_hdr->len<3)?0: real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->fourcc); - ds_add_packet(ds,dp); + ds->add_packet(dp); } // while(len>0) @@ -1470,13 +1470,13 @@ // detect streams: if(demuxer->video->id==-1 && v_streams>0){ // find the valid video stream: - if(!ds_fill_buffer(demuxer->video)){ + if(!demuxer->video->fill_buffer()){ MSG_INFO("RM: " MSGTR_MissingVideoStream); } } if(demuxer->audio->id==-1 && a_streams>0){ // find the valid audio stream: - if(!ds_fill_buffer(demuxer->audio)){ + if(!demuxer->audio->fill_buffer()){ MSG_INFO("RM: " MSGTR_MissingAudioStream); } } @@ -1503,8 +1503,8 @@ static void real_seek(demuxer_t *demuxer,const seek_args_t* seeka) { real_priv_t *priv = static_cast<real_priv_t*>(demuxer->priv); - demux_stream_t *d_audio = demuxer->audio; - demux_stream_t *d_video = demuxer->video; + Demuxer_Stream *d_audio = demuxer->audio; + Demuxer_Stream *d_video = demuxer->video; sh_audio_t *sh_audio = reinterpret_cast<sh_audio_t*>(d_audio->sh); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(d_video->sh); int vid = d_video->id, aid = d_audio->id; Modified: mplayerxp/libmpdemux/demux_realaud.cpp =================================================================== --- mplayerxp/libmpdemux/demux_realaud.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_realaud.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -62,11 +62,11 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int realaud_demux(demuxer_t *demuxer,demux_stream_t *__ds) +static int realaud_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) { realaud_priv_t *realaud_priv = static_cast<realaud_priv_t*>(demuxer->priv); int len; - demux_stream_t *ds = demuxer->audio; + Demuxer_Stream *ds = demuxer->audio; sh_audio_t *sh = reinterpret_cast<sh_audio_t*>(ds->sh); WAVEFORMATEX *wf = sh->wf; @@ -85,12 +85,12 @@ if(sh->i_bps) { realaud_priv->last_pts = realaud_priv->last_pts < 0 ? 0 : realaud_priv->last_pts + len/(float)sh->i_bps; - ds->pts = realaud_priv->last_pts - (ds_tell_pts(demuxer->audio)-sh->a_in_buffer_len)/(float)sh->i_bps; + ds->pts = realaud_priv->last_pts - (demuxer->audio->tell_pts()-sh->a_in_buffer_len)/(float)sh->i_bps; } else dp->pts = demuxer->filepos / realaud_priv->data_size; dp->pos = demuxer->filepos; dp->flags = DP_NONKEYFRAME; - ds_add_packet(ds, dp); + ds->add_packet(dp); return 1; } @@ -268,7 +268,7 @@ /* disable seeking */ demuxer->flags &= ~DEMUXF_SEEKABLE; - if(!ds_fill_buffer(demuxer->audio)) + if(!demuxer->audio->fill_buffer()) MSG_WARN("[RealAudio] No data.\n"); check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; @@ -290,7 +290,7 @@ int demux_seek_ra(demuxer_t *demuxer,const seek_args_t* seeka) { real_priv_t *priv = demuxer->priv; - demux_stream_t *d_audio = demuxer->audio; + Demuxer_Stream *d_audio = demuxer->audio; sh_audio_t *sh_audio = d_audio->sh; int aid = d_audio->id; int next_offset = 0; Modified: mplayerxp/libmpdemux/demux_roq.cpp =================================================================== --- mplayerxp/libmpdemux/demux_roq.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_roq.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -72,7 +72,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int roq_demux(demuxer_t *demuxer,demux_stream_t *__ds) +static int roq_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) { sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); roq_data_t *roq_data = static_cast<roq_data_t*>(demuxer->priv); @@ -87,11 +87,11 @@ stream_seek(demuxer->stream, roq_chunk.chunk_offset); if (roq_chunk.chunk_type == CHUNK_TYPE_AUDIO) - ds_read_packet(demuxer->audio, demuxer->stream, roq_chunk.chunk_size, + demuxer->audio->read_packet(demuxer->stream, roq_chunk.chunk_size, 0, roq_chunk.chunk_offset, DP_NONKEYFRAME); else - ds_read_packet(demuxer->video, demuxer->stream, roq_chunk.chunk_size, + demuxer->video->read_packet(demuxer->stream, roq_chunk.chunk_size, roq_chunk.video_chunk_number / sh_video->fps, roq_chunk.chunk_offset, DP_NONKEYFRAME); Modified: mplayerxp/libmpdemux/demux_smjpeg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_smjpeg.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -63,7 +63,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int smjpeg_demux(demuxer_t *demux,demux_stream_t *__ds) +static int smjpeg_demux(demuxer_t *demux,Demuxer_Stream *__ds) { int dtype, dsize, dpts; @@ -77,11 +77,11 @@ { case mmioFOURCC('s','n','d','D'): /* fixme, but no decoder implemented yet */ - ds_read_packet(demux->audio, demux->stream, dsize, + demux->audio->read_packet(demux->stream, dsize, (float)dpts/1000.0, demux->filepos, DP_NONKEYFRAME); break; case mmioFOURCC('v','i','d','D'): - ds_read_packet(demux->video, demux->stream, dsize, + demux->video->read_packet(demux->stream, dsize, (float)dpts/1000.0, demux->filepos, DP_NONKEYFRAME); break; case mmioFOURCC('D','O','N','E'): Modified: mplayerxp/libmpdemux/demux_ts.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ts.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_ts.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -122,7 +122,7 @@ typedef struct { - demux_stream_t *ds; + Demuxer_Stream *ds; Demuxer_Packet *pack; int offset, buffer_size; } av_fifo_t; @@ -1508,7 +1508,7 @@ if((priv->fifo[i].pack != NULL) && (priv->fifo[i].offset != 0)) { priv->fifo[i].pack->resize(priv->fifo[i].offset); - ds_add_packet(priv->fifo[i].ds, priv->fifo[i].pack); + priv->fifo[i].ds->add_packet(priv->fifo[i].pack); priv->fifo[i].offset = 0; priv->fifo[i].pack = NULL; } @@ -2516,7 +2516,7 @@ } -static int fill_packet(demuxer_t *demuxer, demux_stream_t *ds, Demuxer_Packet **dp, int *dp_offset, TS_stream_info *si) +static int fill_packet(demuxer_t *demuxer, Demuxer_Stream *ds, Demuxer_Packet **dp, int *dp_offset, TS_stream_info *si) { int ret = 0; @@ -2524,7 +2524,7 @@ { ret = *dp_offset; (*dp)->resize(ret); //shrinked to the right size - ds_add_packet(ds, *dp); + ds->add_packet(*dp); MSG_DBG2( "ADDED %d bytes to %s fifo, PTS=%f\n", ret, (ds == demuxer->audio ? "audio" : (ds == demuxer->video ? "video" : "sub")), (*dp)->pts); if(si) { @@ -2590,7 +2590,7 @@ ts_priv_t * priv = static_cast<ts_priv_t*>(demuxer->priv); stream_t *stream = demuxer->stream; unsigned char *p; - demux_stream_t *ds = NULL; + Demuxer_Stream *ds = NULL; Demuxer_Packet **dp = NULL; int *dp_offset = 0, *buffer_size = 0; int32_t progid=0, pid_type, bad, ts_error; @@ -2603,7 +2603,7 @@ while(! done) { bad = ts_error = 0; - ds = (demux_stream_t*) NULL; + ds = (Demuxer_Stream*) NULL; dp = (Demuxer_Packet **) NULL; dp_offset = buffer_size = NULL; rap_flag = 0; @@ -3046,14 +3046,14 @@ } } extern int videobuf_code_len; -extern int sync_video_packet(demux_stream_t *); -extern int skip_video_packet(demux_stream_t *); +extern int sync_video_packet(Demuxer_Stream *); +extern int skip_video_packet(Demuxer_Stream *); static void ts_seek(demuxer_t *demuxer,const seek_args_t* seeka) { - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; - demux_stream_t *d_sub=demuxer->sub; + Demuxer_Stream *d_audio=demuxer->audio; + Demuxer_Stream *d_video=demuxer->video; + Demuxer_Stream *d_sub=demuxer->sub; sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); sh_video_t *sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); ts_priv_t * priv = static_cast<ts_priv_t*>(demuxer->priv); @@ -3067,11 +3067,11 @@ if(sh_audio != NULL) - ds_free_packs(d_audio); + d_audio->free_packs(); if(sh_video != NULL) - ds_free_packs(d_video); + d_video->free_packs(); if(demuxer->sub->id > 0) - ds_free_packs(d_sub); + d_sub->free_packs(); video_stats = (sh_video != NULL); @@ -3109,17 +3109,17 @@ videobuf_code_len = 0; if(sh_video != NULL) - ds_fill_buffer(d_video); + d_video->fill_buffer(); if(sh_audio != NULL) { - ds_fill_buffer(d_audio); + d_audio->fill_buffer(); } while(sh_video != NULL) { if(sh_audio && !d_audio->eof && d_video->pts && d_audio->pts) { float a_pts=d_audio->pts; - a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + a_pts+=(d_audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; if(d_video->pts > a_pts) { // mpca_skip_frame( sh_audio->decoder); // sync audio continue; @@ -3144,7 +3144,7 @@ } } -static int ts_demux(demuxer_t * demuxer,demux_stream_t *__ds) +static int ts_demux(demuxer_t * demuxer,Demuxer_Stream *__ds) { ES_stream_t es; ts_priv_t *priv = static_cast<ts_priv_t*>(demuxer->priv); @@ -3186,7 +3186,7 @@ any_t*sh = NULL; int i, n; int reftype, areset = 0, vreset = 0; - demux_stream_t *ds; + Demuxer_Stream *ds; if(cmd == DEMUX_CMD_SWITCH_VIDEO) { reftype = TYPE_VIDEO; ds = demuxer->video; @@ -3201,7 +3201,7 @@ reset_fifos(priv, areset, vreset, 0); ds->id = -2; ds->sh = NULL; - ds_free_packs(ds); + ds->free_packs(); *((int*)args) = ds->id; return MPXP_Ok; } @@ -3231,7 +3231,7 @@ reset_fifos(priv, areset, vreset, 0); ds->id = priv->ts.streams[i].id; ds->sh = sh; - ds_free_packs(ds); + ds->free_packs(); MSG_V("\r\ndemux_ts, switched to audio pid %d, id: %d, sh: %p\r\n", i, ds->id, sh); } *((int*)args) = ds->id; Modified: mplayerxp/libmpdemux/demux_ty.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ty.cpp 2012-11-30 13:31:41 UTC (rev 492) +++ mplayerxp/libmpdemux/demux_ty.cpp 2012-11-30 15:24:08 UTC (rev 493) @@ -289,7 +289,7 @@ MSG_ERR("ty:WARNING - Would have blown my audio buffer\n" ); } -static void demux_ty_CopyToDemuxPacket( demux_stream_t *ds, +static void demux_ty_CopyToDemuxPacket( Demuxer_Stream *ds, unsigned char *buffer, int size, off_t pos, int64_t pts ) { Demuxer_Packet *dp = new(zeromem) Demuxer_Packet( size ); @@ -298,7 +298,7 @@ dp->pts = pts / 90000.0; dp->pos = pos; dp->flags = DP_NONKEYFRAME; - ds_add_packet( ds, dp ); + ds->add_packet(dp); } static int demux_ty_FindESHeader( uint8_t nal, @@ -336,7 +336,7 @@ #define AUDIO_NAL 0xc0 #define AC3_NAL 0xbd -static int ty_demux( demuxer_t *demux, demux_stream_t *dsds ) +static int ty_demux( demuxer_t *demux, Demuxer_Stream *dsds ) { int invalidType = 0; int errorHeader = 0; @@ -509,7 +509,7 @@ if( demux->video->id == -1 ) demux->video->id = aid; if( demux->video->id == aid ) { - demux_stream_t *ds = demux->video; + Demuxer_Stream *ds = demux->video; if( !ds->sh ) ds->sh = demux->v_streams[ aid ]; } @@ -579,7 +579,7 @@ if( !demux->a_streams[ aid ] ) new_sh_audio( demux, aid ); if( demux->audio->id == aid ) { - demux_stream_t *ds = demux->audio; + Demuxer_Stream *ds = demux->audio; if( !ds->sh ) { sh_audio_t* sh_a; ds->sh = demux->a_streams[ aid ]; @@ -747,8 +747,8 @@ static void ty_seek( demuxer_t *demuxer, const seek_args_t* seeka ) { - demux_stream_t *d_audio = demuxer->audio; - demux_stream_t *d_video = demuxer->video; + Demuxer_Stream *d_audio = demuxer->audio; + Demuxer_Stream *d_video = demuxer->video; sh_audio_t *sh_audio = reinterpret_cast<sh_audio_t*>(d_audio->sh); off_t newpos; off_t res; @@ -791,9 +791,9 @@ // re-sync video: videobuf_code_len = 0; // reset ES stream buffer - ds_fill_buffer( d_video ); + d_video->fill_buffer(); if( sh_audio ) - ds_fill_buffer( d_audio ); + d_audio->fill_buffer(); while( 1 ) { @@ -801,7 +801,7 @@ if( sh_audio && !d_audio->eof && d_video->pts && d_audio->pts ) { float a_pts = d_audio->pts; - a_pts += ( ds_tell_pts( d_audio ) - sh_audio->a_in_buffer_len ) / + a_pts += ( d_audio->tell_pts() - sh_audio->a_in_buffer_len ) / (float)sh_audio->i_bps; if( d_video->pts > a_pts ) { @@ -823,7 +823,7 @@ UNUSED(cmd); UNUSED(arg); #if 0 - demux_stream_t *d_video = demuxer->video; + Demuxer_Stream *d_video = demuxer->video; sh_video_t *sh_video = d_video->sh; switch(cmd) { case DEMUX_CMD_GET_TIME_LENGTH: return MPXP_NA; @@ -847,7 +847,7 @@ { TiVoInfo *tivo... [truncated message content] |
From: <nic...@us...> - 2012-12-01 17:06:25
|
Revision: 496 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=496&view=rev Author: nickols_k Date: 2012-12-01 17:06:18 +0000 (Sat, 01 Dec 2012) Log Message: ----------- memory leaks--: new class LocalPtr ananlogue of auto deleter like auto_ptr Modified Paths: -------------- mplayerxp/libvo/video_out.cpp mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/mplib.h mplayerxp/postproc/libmenu/menu.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-12-01 15:51:26 UTC (rev 495) +++ mplayerxp/libvo/video_out.cpp 2012-12-01 17:06:18 UTC (rev 496) @@ -120,7 +120,7 @@ dri_priv_t dri; const vo_info_t* video_out; class VO_Interface* vo_iface; - const OSD_Render* draw_alpha; + const OSD_Render* draw_alpha; }; vo_priv_t::vo_priv_t() { Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-01 15:51:26 UTC (rev 495) +++ mplayerxp/mplayerxp.cpp 2012-12-01 17:06:18 UTC (rev 496) @@ -237,8 +237,8 @@ MPXPContext::MPXPContext() :MPXPSys(*new(zeromem)MPXPSystem), - audio(*new(zeromem) audio_processing_t), - video(*new(zeromem) video_processing_t) + _audio(new(zeromem) audio_processing_t), + _video(new(zeromem) video_processing_t) { seek_time=-1; bench=new(zeromem) time_usage_t; @@ -246,10 +246,14 @@ rtc_fd=-1; } -MPXPContext::~MPXPContext() { delete bench; } +MPXPContext::~MPXPContext() +{ + delete &MPXPSys; + delete bench; +} static volatile char antiviral_hole2[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -static MPXPContext* MPXPCtx(new(zeromem) MPXPContext); +static LocalPtr<MPXPContext> MPXPCtx(new(zeromem) MPXPContext); xp_core_t* xp_core=NULL; static volatile char antiviral_hole3[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; volatile MPXPSecureKeys* secure_keys; @@ -370,7 +374,7 @@ if(mask&INITED_VCODEC){ inited_flags&=~INITED_VCODEC; MP_UNIT("uninit_vcodec"); - mpcv_uninit(mpxp_context().video.decoder); + mpcv_uninit(mpxp_context().video().decoder); sh_video=NULL; } @@ -384,7 +388,7 @@ if(mask&INITED_ACODEC){ inited_flags&=~INITED_ACODEC; MP_UNIT("uninit_acodec"); - mpca_uninit(mpxp_context().audio.decoder); + mpca_uninit(mpxp_context().audio().decoder); sh_audio=NULL; } @@ -732,14 +736,14 @@ if(sh_video){ MP_UNIT("seek_video_reset"); - mpcv_resync_stream(mpxp_context().video.decoder); + mpcv_resync_stream(mpxp_context().video().decoder); vo_data->reset(); sh_video->chapter_change=-1; } if(sh_audio){ MP_UNIT("seek_audio_reset"); - mpca_resync_stream(mpxp_context().audio.decoder); + mpca_resync_stream(mpxp_context().audio().decoder); ao_reset(ao_data); // stop audio, throwing away buffered data } @@ -786,7 +790,7 @@ void mpxp_resync_audio_stream(void) { - mpca_resync_stream(mpxp_context().audio.decoder); + mpca_resync_stream(mpxp_context().audio().decoder); } static void __FASTCALL__ mpxp_stream_event_handler(stream_t *s,const stream_packet_t *sp) @@ -1129,7 +1133,7 @@ Demuxer_Stream *d_audio=_demuxer->audio; sh_audio->codec=NULL; mpca=mpca_init(sh_audio); // try auto-probe first - if(mpca) { mpxp_context().audio.decoder=mpca; found=1; } + if(mpca) { mpxp_context().audio().decoder=mpca; found=1; } #ifdef ENABLE_WIN32LOADER if(!found) { // Go through the codec.conf and find the best codec... @@ -1197,7 +1201,7 @@ if(vo_conf.softzoom) vo_data->ZOOM_SET(); if(vo_conf.flip>0) vo_data->FLIP_SET(); if(vo_conf.vidmode) vo_data->VM_SET(); - if((mpxp_context().video.decoder=mpcv_init(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,_libinput))) sh_video->inited=1; + if((mpxp_context().video().decoder=mpcv_init(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,_libinput))) sh_video->inited=1; #ifdef ENABLE_WIN32LOADER if(!sh_video->inited) { /* Go through the codec.conf and find the best codec...*/ @@ -1524,7 +1528,7 @@ else v_cont+=v; if(v_cont > 100) v_cont=100; if(v_cont < -100) v_cont = -100; - if(mpcv_set_colors(mpxp_context().video.decoder,VO_EC_CONTRAST,v_cont)==MPXP_Ok) { + if(mpcv_set_colors(mpxp_context().video().decoder,VO_EC_CONTRAST,v_cont)==MPXP_Ok) { #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -1542,7 +1546,7 @@ else v_bright+=v; if(v_bright > 100) v_bright = 100; if(v_bright < -100) v_bright = -100; - if(mpcv_set_colors(mpxp_context().video.decoder,VO_EC_BRIGHTNESS,v_bright)==MPXP_Ok) { + if(mpcv_set_colors(mpxp_context().video().decoder,VO_EC_BRIGHTNESS,v_bright)==MPXP_Ok) { #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -1560,7 +1564,7 @@ else v_hue+=v; if(v_hue > 100) v_hue = 100; if(v_hue < -100) v_hue = -100; - if(mpcv_set_colors(mpxp_context().video.decoder,VO_EC_HUE,v_hue)==MPXP_Ok) { + if(mpcv_set_colors(mpxp_context().video().decoder,VO_EC_HUE,v_hue)==MPXP_Ok) { #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -1578,7 +1582,7 @@ else v_saturation+=v; if(v_saturation > 100) v_saturation = 100; if(v_saturation < -100) v_saturation = -100; - if(mpcv_set_colors(mpxp_context().video.decoder,VO_EC_SATURATION,v_saturation)==MPXP_Ok) { + if(mpcv_set_colors(mpxp_context().video().decoder,VO_EC_SATURATION,v_saturation)==MPXP_Ok) { #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -1889,8 +1893,8 @@ /* is it non duplicate block fro find_acodec() ??? */ if(sh_audio){ MSG_V("Initializing audio codec...\n"); - if(!mpxp_context().audio.decoder) { - if((mpxp_context().audio.decoder=mpca_init(sh_audio))==NULL){ + if(!mpxp_context().audio().decoder) { + if((mpxp_context().audio().decoder=mpca_init(sh_audio))==NULL){ MSG_ERR(MSGTR_CouldntInitAudioCodec); d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); @@ -1930,12 +1934,12 @@ /* Auto quality option enabled*/ MPXP_Rc rc; unsigned quality; - rc=mpcv_get_quality_max(mpxp_context().video.decoder,&quality); + rc=mpcv_get_quality_max(mpxp_context().video().decoder,&quality); if(rc==MPXP_Ok) mpxp_context().output_quality=quality; if(mp_conf.autoq>mpxp_context().output_quality) mp_conf.autoq=mpxp_context().output_quality; else mpxp_context().output_quality=mp_conf.autoq; MSG_V("AutoQ: setting quality to %d\n",mpxp_context().output_quality); - mpcv_set_quality(mpxp_context().video.decoder,mpxp_context().output_quality); + mpcv_set_quality(mpxp_context().video().decoder,mpxp_context().output_quality); } vf_showlist(reinterpret_cast<vf_instance_t*>(sh_video->vfilter)); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-01 15:51:26 UTC (rev 495) +++ mplayerxp/mplayerxp.h 2012-12-01 17:06:18 UTC (rev 496) @@ -132,22 +132,27 @@ struct MPXPSystem; /* non-configurable through command line stuff */ struct MPXPContext :public Opaque { - MPXPContext(); - virtual ~MPXPContext(); + public: + MPXPContext(); + virtual ~MPXPContext(); - int rtc_fd; - int seek_time; - int output_quality; - unsigned mpxp_after_seek; - int use_pts_fix2; - unsigned mplayer_accel; - subtitle* subtitles; - m_config_t* mconfig; - time_usage_t* bench; - MPXPSystem& MPXPSys; - any_t* msg_priv; - audio_processing_t& audio; - video_processing_t& video; + audio_processing_t& audio() const { return *_audio; } + video_processing_t& video() const { return *_video; } + + int rtc_fd; + int seek_time; + int output_quality; + unsigned mpxp_after_seek; + int use_pts_fix2; + unsigned mplayer_accel; + subtitle* subtitles; + m_config_t* mconfig; + time_usage_t* bench; + MPXPSystem& MPXPSys; + any_t* msg_priv; + private: + LocalPtr<audio_processing_t> _audio; + LocalPtr<video_processing_t> _video; }; MPXPContext& mpxp_context(); Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-12-01 15:51:26 UTC (rev 495) +++ mplayerxp/osdep/mplib.h 2012-12-01 17:06:18 UTC (rev 496) @@ -73,6 +73,20 @@ any_t* __FASTCALL__ rnd_fill(any_t* buffer,size_t size); any_t* get_caller_address(unsigned num_caller=0); + template <typename T> class LocalPtr { + public: + LocalPtr(T* value):ptr(value) {} + virtual ~LocalPtr() { delete ptr; } + + T& operator*() const { return *ptr; } + T* operator->() const { return ptr; } + private: + LocalPtr<T>& operator=(LocalPtr<T> a) { return this; } + LocalPtr<T>& operator=(LocalPtr<T>& a) { return this; } + LocalPtr<T>& operator=(LocalPtr<T>* a) { return this; } + T* ptr; + }; + class Opaque { public: Opaque() {} Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-01 15:51:26 UTC (rev 495) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-01 17:06:18 UTC (rev 496) @@ -333,7 +333,7 @@ #endif void menu_draw_text(mp_image_t* mpi,const char* txt, int x, int y) { - const OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); + const LocalPtr<OSD_Render> draw_alpha(new(zeromem) OSD_Render(mpi->imgfmt)); int font; int finalize=vo_data->is_final(); @@ -345,7 +345,7 @@ while (*txt) { int c=utf8_get_char((const char**)&txt); if ((font=vo_data->font->font[c])>=0 && (x + vo_data->font->width[c] <= mpi->w) && (y + vo_data->font->pic_a[font]->h <= mpi->h)) - draw_alpha.render(vo_data->font->width[c], vo_data->font->pic_a[font]->h, + draw_alpha->render(vo_data->font->width[c], vo_data->font->pic_a[font]->h, vo_data->font->pic_b[font]->bmp+vo_data->font->start[c], vo_data->font->pic_a[font]->bmp+vo_data->font->start[c], vo_data->font->pic_a[font]->w, @@ -365,7 +365,7 @@ int ll = 0; int font; int finalize=vo_data->is_final(); - const OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); + const LocalPtr<OSD_Render> draw_alpha(new(zeromem) OSD_Render(mpi->imgfmt)); #ifdef USE_FRIBIDI txt = menu_fribidi(txt); @@ -511,7 +511,7 @@ if(font >= 0) { int cs = (vo_data->font->pic_a[font]->h - vo_data->font->height) / 2; if ((sx + vo_data->font->width[c] < xmax) && (sy + vo_data->font->height < ymax) ) - draw_alpha.render(vo_data->font->width[c], vo_data->font->height, + draw_alpha->render(vo_data->font->width[c], vo_data->font->height, vo_data->font->pic_b[font]->bmp+vo_data->font->start[c] + cs * vo_data->font->pic_a[font]->w, vo_data->font->pic_a[font]->bmp+vo_data->font->start[c] + @@ -596,7 +596,7 @@ void menu_draw_box(const mp_image_t* mpi,unsigned char grey,unsigned char alpha, int x, int y, int w, int h) { - const OSD_Render& draw_alpha = *new(zeromem) OSD_Render(mpi->imgfmt); + const LocalPtr<OSD_Render> draw_alpha(new(zeromem) OSD_Render(mpi->imgfmt)); int g; if(x > mpi->w || y > mpi->h) return; @@ -615,7 +615,7 @@ unsigned char pic[stride*h],pic_alpha[stride*h]; memset(pic,g,stride*h); memset(pic_alpha,alpha,stride*h); - draw_alpha.render(w,h,pic,pic_alpha,stride, + draw_alpha->render(w,h,pic,pic_alpha,stride, mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3), mpi->stride[0],finalize); } Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-12-01 15:51:26 UTC (rev 495) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-12-01 17:06:18 UTC (rev 496) @@ -276,7 +276,7 @@ for( l = 0, l2 = len, ret = 0; l < len && l2 >= audio_buffer.sh_audio->audio_out_minsize; ) { float pts; - ret = mpca_decode(mpxp_context().audio.decoder, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); + ret = mpca_decode(mpxp_context().audio().decoder, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); if( ret <= 0 ) break; Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-01 15:51:26 UTC (rev 495) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-01 17:06:18 UTC (rev 496) @@ -65,7 +65,7 @@ ret=read_audio_buffer(sh_audio,(unsigned char *)&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); } else { - ret=mpca_decode(mpxp_context().audio.decoder,(unsigned char *)&sh_audio->a_buffer[sh_audio->a_buffer_len], + ret=mpca_decode(mpxp_context().audio().decoder,(unsigned char *)&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); } if(ret>0) sh_audio->a_buffer_len+=ret; Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-12-01 15:51:26 UTC (rev 495) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-12-01 17:06:18 UTC (rev 496) @@ -214,15 +214,15 @@ unsigned distance = dae_get_decoder_outrun(xp_core->video); int our_quality; our_quality = mpxp_context().output_quality*distance/total; - if(drop_param) mpcv_set_quality(mpxp_context().video.decoder,0); + if(drop_param) mpcv_set_quality(mpxp_context().video().decoder,0); else - if(mp_conf.autoq) mpcv_set_quality(mpxp_context().video.decoder,our_quality>0?our_quality:0); + if(mp_conf.autoq) mpcv_set_quality(mpxp_context().video().decoder,our_quality>0?our_quality:0); } frame->flags=drop_param; - blit_frame=mpcv_decode(mpxp_context().video.decoder,frame); + blit_frame=mpcv_decode(mpxp_context().video().decoder,frame); MSG_DBG2("DECODER: %i[%i] %f\n",dae_curr_vdecoded(xp_core),frame->len,frame->pts); if(mpxp_context().output_quality) { - if(drop_param) mpcv_set_quality(mpxp_context().video.decoder,mpxp_context().output_quality); + if(drop_param) mpcv_set_quality(mpxp_context().video().decoder,mpxp_context().output_quality); } if(!blit_frame && drop_param) priv->dae->num_dropped_frames++; if(blit_frame) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-02 12:19:12
|
Revision: 499 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=499&view=rev Author: nickols_k Date: 2012-12-02 12:19:04 +0000 (Sun, 02 Dec 2012) Log Message: ----------- new method of antiviral protection Modified Paths: -------------- mplayerxp/input2/input.cpp mplayerxp/libao2/audio_out.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libvo/video_out.cpp mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/mplib.cpp mplayerxp/osdep/mplib.h mplayerxp/postproc/af.cpp mplayerxp/postproc/vf.cpp Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/input2/input.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -749,7 +749,7 @@ filter->ctx = ctx; filter->next = priv->cmd_filters; priv->cmd_filters = filter; - rnd_fill(priv->antiviral_hole,offsetof(priv_t,cmd_binds)-offsetof(priv_t,antiviral_hole)); + fill_false_pointers(priv->antiviral_hole,offsetof(priv_t,cmd_binds)-offsetof(priv_t,antiviral_hole)); } static const char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { Modified: mplayerxp/libao2/audio_out.cpp =================================================================== --- mplayerxp/libao2/audio_out.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libao2/audio_out.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -218,8 +218,7 @@ ao->buffersize=-1; ao->opaque=mp_malloc(sizeof(priv_t)); priv_t* priv=reinterpret_cast<priv_t*>(ao->opaque); - rnd_fill(priv->antiviral_hole,sizeof(priv_t)); - rnd_fill(ao->antiviral_hole,offsetof(ao_data_t,samplerate)-offsetof(ao_data_t,antiviral_hole)); + fill_false_pointers(ao->antiviral_hole,offsetof(ao_data_t,samplerate)-offsetof(ao_data_t,antiviral_hole)); priv->audio_out=NULL; return ao; } Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -108,7 +108,7 @@ demuxer_t* new_demuxer(stream_t *stream,int a_id,int v_id,int s_id){ demuxer_t *d=new(zeromem) demuxer_t; - rnd_fill(d->antiviral_hole,reinterpret_cast<long>(&d->pin)-reinterpret_cast<long>(&d->antiviral_hole)); + fill_false_pointers(d->antiviral_hole,reinterpret_cast<long>(&d->pin)-reinterpret_cast<long>(&d->antiviral_hole)); d->pin=DEMUX_PIN; d->stream=stream; d->movi_start=stream->start_pos; Modified: mplayerxp/libmpdemux/demuxer_stream.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -15,7 +15,7 @@ Demuxer_Stream::Demuxer_Stream(demuxer_t *_demuxer,int _id) { - rnd_fill(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); pin=DS_PIN; _buffer_pos=_buffer_size=0; _buffer=NULL; Modified: mplayerxp/libmpstream/stream.cpp =================================================================== --- mplayerxp/libmpstream/stream.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libmpstream/stream.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -240,7 +240,7 @@ stream_t *s=new(zeromem) stream_t; if(s==NULL) return NULL; - rnd_fill(s->antiviral_hole,reinterpret_cast<long>(&s->pin)-reinterpret_cast<long>(&s->antiviral_hole)); + fill_false_pointers(s->antiviral_hole,reinterpret_cast<long>(&s->pin)-reinterpret_cast<long>(&s->antiviral_hole)); s->pin=STREAM_PIN; s->fd=-1; s->type=type; Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/libvo/video_out.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -125,7 +125,7 @@ }; vo_priv_t::vo_priv_t() { - rnd_fill(antiviral_hole,reinterpret_cast<long>(&srcFourcc)-reinterpret_cast<long>(antiviral_hole)); + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&srcFourcc)-reinterpret_cast<long>(antiviral_hole)); dri.num_xp_frames=1; } @@ -142,7 +142,7 @@ vo_priv_t* priv; priv=new(zeromem) vo_priv_t; vo_priv=priv; - rnd_fill(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole)); + fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole)); } Video_Output::~Video_Output() { Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/mplayerxp.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -149,7 +149,7 @@ struct MPXPSystem { public: - MPXPSystem():inited_flags(0),osd_function(OSD_PLAY) { rnd_fill(antiviral_hole,reinterpret_cast<long>(&_demuxer)-reinterpret_cast<long>(&antiviral_hole)); } + MPXPSystem():inited_flags(0),osd_function(OSD_PLAY) { fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&_demuxer)-reinterpret_cast<long>(&antiviral_hole)); } virtual ~MPXPSystem() {} void uninit_player(unsigned int mask); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/mplayerxp.h 2012-12-02 12:19:04 UTC (rev 499) @@ -136,8 +136,8 @@ MPXPContext(); virtual ~MPXPContext(); - audio_processing_t& audio() const { return *_audio; } - video_processing_t& video() const { return *_video; } + virtual audio_processing_t& audio() const { return *_audio; } + virtual video_processing_t& video() const { return *_video; } int rtc_fd; int seek_time; Modified: mplayerxp/osdep/mplib.cpp =================================================================== --- mplayerxp/osdep/mplib.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/osdep/mplib.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -26,6 +26,25 @@ return buffer; } +any_t* fill_false_pointers(any_t* buffer,size_t size) +{ + unsigned i,psize=(size/sizeof(any_t*))*sizeof(any_t*); + long lo_mask=(sizeof(any_t*)*8/2)-1; + long hi_mask=~lo_mask; + long filler; + for(i=0;i<psize/sizeof(long);i++) { + filler=rand()&lo_mask; + filler=(reinterpret_cast<long>(buffer)&hi_mask)|lo_mask; + ((long *)buffer)[i]=filler; + } + char ch; + for(i=psize;i<size;i++) { + ch=rand()%255; + ((char *)buffer)[i]=ch; + } + return buffer; +} + any_t* get_caller_address(unsigned num_caller) { any_t* stack[3+num_caller]; backtrace(stack,3+num_caller); Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/osdep/mplib.h 2012-12-02 12:19:04 UTC (rev 499) @@ -71,6 +71,7 @@ print_backtrace(why,stack,ncalls); } any_t* __FASTCALL__ rnd_fill(any_t* buffer,size_t size); + any_t* __FASTCALL__ fill_false_pointers(any_t* buffer,size_t size); any_t* get_caller_address(unsigned num_caller=0); template <typename T> class LocalPtr { Modified: mplayerxp/postproc/af.cpp =================================================================== --- mplayerxp/postproc/af.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/postproc/af.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -112,7 +112,7 @@ MSG_ERR(MSGTR_OutOfMemory); return NULL; } - rnd_fill(_new->antiviral_hole,offsetof(af_instance_t,pin)-offsetof(af_instance_t,antiviral_hole)); + fill_false_pointers(_new->antiviral_hole,offsetof(af_instance_t,pin)-offsetof(af_instance_t,antiviral_hole)); _new->pin=AF_PIN; _new->parent=s; // Check for commandline parameters @@ -617,7 +617,7 @@ af_stream_t *rval; rval = new(zeromem) af_stream_t; rval->parent = _parent; - rnd_fill(rval->antiviral_hole,offsetof(af_stream_t,first)-offsetof(af_stream_t,antiviral_hole)); + fill_false_pointers(rval->antiviral_hole,offsetof(af_stream_t,first)-offsetof(af_stream_t,antiviral_hole)); return rval; } Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-02 11:56:31 UTC (rev 498) +++ mplayerxp/postproc/vf.cpp 2012-12-02 12:19:04 UTC (rev 499) @@ -301,7 +301,7 @@ if(!strcmp(filter_list[i]->name,name)) break; } vf=new(zeromem) vf_instance_t; - rnd_fill(vf->antiviral_hole,offsetof(vf_instance_t,pin)-offsetof(vf_instance_t,antiviral_hole)); + fill_false_pointers(vf->antiviral_hole,offsetof(vf_instance_t,pin)-offsetof(vf_instance_t,antiviral_hole)); vf->pin=VF_PIN; vf->info=filter_list[i]; vf->next=next; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-03 15:31:02
|
Revision: 501 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=501&view=rev Author: nickols_k Date: 2012-12-03 15:30:49 +0000 (Mon, 03 Dec 2012) Log Message: ----------- Next step towards object-oriented progarming: hide decoder private from demuxer. Note: disabled demux_ogg - requires to be fully redesigned. Project lost stability and some decoders (like ad_lavc) became unstable (mainly due: 'any_t* opaque' which avoids type controls from side of g++). Modified Paths: -------------- mplayerxp/configure mplayerxp/libmpcodecs/ad.cpp mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/ad_a52.cpp mplayerxp/libmpcodecs/ad_acm.cpp mplayerxp/libmpcodecs/ad_dca.cpp mplayerxp/libmpcodecs/ad_dmo.cpp mplayerxp/libmpcodecs/ad_dshow.cpp mplayerxp/libmpcodecs/ad_dvdpcm.cpp mplayerxp/libmpcodecs/ad_faad.cpp mplayerxp/libmpcodecs/ad_hwac3.cpp mplayerxp/libmpcodecs/ad_internal.h mplayerxp/libmpcodecs/ad_lavc.cpp mplayerxp/libmpcodecs/ad_libdv.cpp mplayerxp/libmpcodecs/ad_mp3.cpp mplayerxp/libmpcodecs/ad_null.cpp mplayerxp/libmpcodecs/ad_pcm.cpp mplayerxp/libmpcodecs/ad_qtaudio.cpp mplayerxp/libmpcodecs/ad_real.cpp mplayerxp/libmpcodecs/ad_twin.cpp mplayerxp/libmpcodecs/ad_vorbis.cpp mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd.cpp mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_divx4.cpp mplayerxp/libmpcodecs/vd_dmo.cpp mplayerxp/libmpcodecs/vd_dshow.cpp mplayerxp/libmpcodecs/vd_huffyuv.cpp mplayerxp/libmpcodecs/vd_internal.h mplayerxp/libmpcodecs/vd_lavc.cpp mplayerxp/libmpcodecs/vd_libdv.cpp mplayerxp/libmpcodecs/vd_libmpeg2.cpp mplayerxp/libmpcodecs/vd_mpegpes.cpp mplayerxp/libmpcodecs/vd_null.cpp mplayerxp/libmpcodecs/vd_nuv.cpp mplayerxp/libmpcodecs/vd_qtvideo.cpp mplayerxp/libmpcodecs/vd_raw.cpp mplayerxp/libmpcodecs/vd_real.cpp mplayerxp/libmpcodecs/vd_theora.cpp mplayerxp/libmpcodecs/vd_vfw.cpp mplayerxp/libmpcodecs/vd_xanim.cpp mplayerxp/libmpcodecs/vd_xvid.cpp mplayerxp/libmpdemux/stheader.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/configure 2012-12-03 15:30:49 UTC (rev 501) @@ -79,7 +79,6 @@ "libdvdnav|build with libdvdnav support|http://dvd.sourceforge.net", "libdv|build with libdv support|http://libdv.sourceforge.net/", "libvcd|build with libvcd support|http://www.gnu.org/software/vcdimager", - "libvorbis|build with libvorbis support|http://www.vorbis.com", "libtheora|build with libtheora support|http://www.theora.org", "libbz2|build with libbz2 support|http://www.bzip.org" ) @@ -93,6 +92,7 @@ "sdl|build with SDL video and audio output|http://www.libsdl.org", "sdl_image|build with SDL_image for screenshots|http://www.libsdl.org/projects/SDL_image", "im_sure_that_must_have_streaming| the key to unlock streaming" + "libvorbis|build with libvorbis support|http://www.vorbis.com", ) AUTOCONF_LIST=( Modified: mplayerxp/libmpcodecs/ad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -87,12 +87,12 @@ return NULL; } -const audio_probe_t* afm_probe_driver(sh_audio_t *sh) { +const audio_probe_t* afm_probe_driver(ad_private_t*ctx,sh_audio_t *sh) { unsigned i; const audio_probe_t* probe; for (i=0; mpcodecs_ad_drivers[i] != &mpcodecs_ad_null; i++) { MSG_V("Probing: %s\n",mpcodecs_ad_drivers[i]->info->driver_name); - if((probe=mpcodecs_ad_drivers[i]->probe(sh,sh->wtag))!=NULL) { + if((probe=mpcodecs_ad_drivers[i]->probe(ctx,sh->wtag))!=NULL) { MSG_V("Driver: %s supports these outfmt for 0x%X wtag:\n" ,mpcodecs_ad_drivers[i]->info->driver_name,sh->wtag); for(i=0;i<Audio_MaxOutSample;i++) { Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad.h 2012-12-03 15:30:49 UTC (rev 501) @@ -41,20 +41,21 @@ }audio_probe_t; /* interface of video decoder drivers */ +struct ad_private_t; typedef struct ad_functions_s { const ad_info_t* info; const config_t* options;/**< Optional: MPlayerXP's option related */ - const audio_probe_t*(* __FASTCALL__ probe)(sh_audio_t *,uint32_t wtag); - MPXP_Rc (* __FASTCALL__ preinit)(sh_audio_t *); - MPXP_Rc (* __FASTCALL__ init)(sh_audio_t *sh); - void (* __FASTCALL__ uninit)(sh_audio_t *sh); - MPXP_Rc (*control_ad)(sh_audio_t *sh,int cmd,any_t* arg, ...); - unsigned (* __FASTCALL__ decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); + const audio_probe_t*(* __FASTCALL__ probe)(ad_private_t *,uint32_t wtag); + ad_private_t* (* __FASTCALL__ preinit)(sh_audio_t *); + MPXP_Rc (* __FASTCALL__ init)(ad_private_t *ctx); + void (* __FASTCALL__ uninit)(ad_private_t *ctx); + MPXP_Rc (*control_ad)(ad_private_t *ctx,int cmd,any_t* arg, ...); + unsigned (* __FASTCALL__ decode)(ad_private_t *ctx,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); } ad_functions_t; extern const ad_functions_t* afm_find_driver(const char *name); -extern const audio_probe_t* afm_probe_driver(sh_audio_t* sh); +extern const audio_probe_t* afm_probe_driver(ad_private_t*ctx,sh_audio_t* sh); #define FIX_APTS(sh_audio,pts,in_size) (sh_audio->i_bps?((float)(pts)+(float)(in_size)/(float)sh_audio->i_bps):((float)(pts))) #endif Modified: mplayerxp/libmpcodecs/ad_a52.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -22,9 +22,10 @@ #include "libao2/audio_out.h" #include "postproc/af.h" -typedef struct priv_s { +struct ad_private_t { + sh_audio_t* sh; float last_pts; -}priv_t; +}; #define MAX_AC3_FRAME 3840 @@ -55,21 +56,22 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag) { unsigned i; + UNUSED(ctx); for(i=0;probes[i].driver;i++) if(wtag==probes[i].wtag) return &probes[i]; return NULL; } -int a52_fillbuff(sh_audio_t *sh_audio,float *pts){ +int a52_fillbuff(ad_private_t *priv,float *pts){ int length=0; int flags=0; int sample_rate=0; int bit_rate=0; float apts=0.,null_pts; - priv_t *priv=reinterpret_cast<priv_t*>(sh_audio->context); + sh_audio_t* sh_audio = priv->sh; sh_audio->a_in_buffer_len=0; /* sync frame:*/ @@ -126,8 +128,9 @@ return (flags&A52_LFE) ? (channels+1) : channels; } -MPXP_Rc preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh) { + ad_private_t* ctx=new(zeromem) ad_private_t; /* Dolby AC3 audio: */ /* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ #ifdef WORDS_BIGENDIAN @@ -145,12 +148,13 @@ } sh->audio_out_minsize=mp_conf.ao_channels*afmt2bps(sh->afmt)*256*6; sh->audio_in_minsize=MAX_AC3_FRAME; - sh->context=mp_malloc(sizeof(priv_t)); - return MPXP_Ok; + ctx->sh=sh; + return ctx; } -MPXP_Rc init(sh_audio_t *sh_audio) +MPXP_Rc init(ad_private_t *ctx) { + sh_audio_t* sh_audio = ctx->sh; sample_t level=1, bias=384; float pts; int flags=0; @@ -161,12 +165,12 @@ MSG_ERR("A52 init failed\n"); return MPXP_False; } - if(a52_fillbuff(sh_audio,&pts)<0){ + if(a52_fillbuff(ctx,&pts)<0){ MSG_ERR("A52 sync failed\n"); return MPXP_False; } /* 'a52 cannot upmix' hotfix:*/ - a52_printinfo(sh_audio); + a52_printinfo(ctx->sh); sh_audio->nch=mp_conf.ao_channels; while(sh_audio->nch>0){ switch(sh_audio->nch){ @@ -202,13 +206,14 @@ return MPXP_Ok; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *ctx) { - delete sh->context; + delete ctx; } -MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *ctx,int cmd,any_t* arg, ...) { + sh_audio_t* sh = ctx->sh; UNUSED(arg); switch(cmd) { case ADCTRL_RESYNC_STREAM: @@ -216,7 +221,7 @@ return MPXP_True; case ADCTRL_SKIP_FRAME: { float pts; - a52_fillbuff(sh,&pts); // skip AC3 frame + a52_fillbuff(ctx,&pts); // skip AC3 frame return MPXP_True; } default: @@ -225,18 +230,18 @@ return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *ctx,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { + sh_audio_t* sh_audio = ctx->sh; sample_t level=1, bias=384; int flags=mpxp_a52_flags|A52_ADJUST_LEVEL; unsigned i; unsigned len=0; UNUSED(minlen); UNUSED(maxlen); - priv_t *priv=reinterpret_cast<priv_t*>(sh_audio->context); if(!sh_audio->a_in_buffer_len) { - if(a52_fillbuff(sh_audio,pts)<0) return len; /* EOF */ - } else *pts=priv->last_pts; + if(a52_fillbuff(ctx,pts)<0) return len; /* EOF */ + } else *pts=ctx->last_pts; sh_audio->a_in_buffer_len=0; if (a52_frame (mpxp_a52_state, (uint8_t*)sh_audio->a_in_buffer, &flags, &level, bias)){ MSG_WARN("a52: error decoding frame\n"); Modified: mplayerxp/libmpcodecs/ad_acm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_acm.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_acm.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -26,19 +26,20 @@ LIBAD_EXTERN(msacm) -typedef struct priv_s { +struct ad_private_t { float pts; WAVEFORMATEX o_wf; // out format HACMSTREAM srcstream; // handle -}priv_t; + sh_audio_t* sh; +}; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { return NULL; } +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* p,uint32_t wtag) { return NULL; } -static int init_acm_audio_codec(sh_audio_t *sh_audio){ +static int init_acm_audio_codec(ad_private_t *priv){ + sh_audio_t* sh_audio = priv->sh; HRESULT ret; WAVEFORMATEX *in_fmt=sh_audio->wf; unsigned int srcsize=0; - priv_t*priv=reinterpret_cast<priv_t*>(sh_audio->context); MSG_V("======= Win32 (ACM) AUDIO Codec init =======\n"); @@ -101,10 +102,10 @@ return 1; } -static int close_acm_audio_codec(sh_audio_t *sh_audio) +static int close_acm_audio_codec(ad_private_t *priv) { + sh_audio_t* sh_audio = priv->sh; HRESULT ret; - priv_t *priv=reinterpret_cast<priv_t*>(sh_audio->context); ret = acmStreamClose(priv->srcstream, 0); @@ -115,7 +116,7 @@ case ACMERR_CANCELED: MSG_DBG2( "ACM_Decoder: stream busy, waiting..\n"); sleep(100); - return(close_acm_audio_codec(sh_audio)); + return(close_acm_audio_codec(priv)); case ACMERR_UNPREPARED: case ACMERR_NOTPOSSIBLE: return(0); @@ -127,10 +128,11 @@ return(1); } -MPXP_Rc init(sh_audio_t *sh_audio) +MPXP_Rc init(ad_private_t *priv) { + sh_audio_t* sh_audio = priv->sh; float pts; - int ret=decode(sh_audio,reinterpret_cast<unsigned char*>(sh_audio->a_buffer),4096,sh_audio->a_buffer_size,&pts); + int ret=decode(priv,reinterpret_cast<unsigned char*>(sh_audio->a_buffer),4096,sh_audio->a_buffer_size,&pts); if(ret<0){ MSG_INFO("ACM decoding error: %d\n",ret); return MPXP_False; @@ -139,29 +141,31 @@ return MPXP_Ok; } -MPXP_Rc preinit(sh_audio_t *sh_audio) +ad_private_t* preinit(sh_audio_t *sh_audio) { /* Win32 ACM audio codec: */ - priv_t *priv; - if(!(priv=new(zeromem) priv_t)) return MPXP_False; - sh_audio->context=priv; - if(!init_acm_audio_codec(sh_audio)){ + ad_private_t *priv; + if(!(priv=new(zeromem) ad_private_t)) return NULL; + priv->sh = sh_audio; + if(!init_acm_audio_codec(priv)){ MSG_ERR(MSGTR_ACMiniterror); - return MPXP_False; + delete priv; + return NULL; } MSG_V("INFO: Win32/ACM init OK!\n"); - return MPXP_Ok; + return priv; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *p) { - close_acm_audio_codec(sh); - delete sh->context; + close_acm_audio_codec(p); + delete p; } -MPXP_Rc control_ad(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { - int skip; + sh_audio_t* sh_audio = priv->sh; + int skip; switch(cmd) { // case ADCTRL_RESYNC_STREAM: // sh_audio->a_in_buffer_len=0;/* reset ACM/DShow audio buffer */ @@ -182,13 +186,13 @@ return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { + sh_audio_t* sh_audio = priv->sh; ACMSTREAMHEADER ash; HRESULT hr; DWORD srcsize=0; DWORD len=minlen; - priv_t *priv=reinterpret_cast<priv_t*>(sh_audio->context); acmStreamSize(priv->srcstream,len , &srcsize, ACM_STREAMSIZEF_DESTINATION); MSG_V("acm says: srcsize=%ld (bufflen=%d size=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,len); Modified: mplayerxp/libmpcodecs/ad_dca.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -28,11 +28,11 @@ uint32_t mpxp_dca_accel=0; uint32_t mpxp_dca_flags=0; -typedef struct priv_s { +struct ad_private_t { float last_pts; -}priv_t; + sh_audio_t* sh; +}; - static const ad_info_t info = { "DTS Coherent Acoustics", "libdca", @@ -58,7 +58,8 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag) { + UNUSED(ctx); unsigned i; for(i=0;probes[i].driver;i++) if(wtag==probes[i].wtag) @@ -66,13 +67,13 @@ return NULL; } -int dca_fillbuff(sh_audio_t *sh_audio,float *pts){ +int dca_fillbuff(ad_private_t *priv,float *pts){ int length=0,flen=0; int flags=0; int sample_rate=0; int bit_rate=0; float apts=0.,null_pts; - priv_t *priv=reinterpret_cast<priv_t*>(sh_audio->context); + sh_audio_t* sh_audio = priv->sh; sh_audio->a_in_buffer_len=0; /* sync frame:*/ @@ -125,8 +126,7 @@ return (flags&DCA_LFE) ? (channels+1) : channels; } - -MPXP_Rc preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh) { /* DTS audio: however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ @@ -146,12 +146,14 @@ } sh->audio_out_minsize=mp_conf.ao_channels*afmt2bps(sh->afmt)*256*8; sh->audio_in_minsize=MAX_AC5_FRAME; - sh->context=mp_malloc(sizeof(priv_t)); - return MPXP_Ok; + ad_private_t* priv = new(zeromem) ad_private_t; + priv->sh = sh; + return priv; } -MPXP_Rc init(sh_audio_t *sh_audio) +MPXP_Rc init(ad_private_t *priv) { + sh_audio_t* sh_audio = priv->sh; sample_t level=1, bias=384; float pts; int flags=0; @@ -162,7 +164,7 @@ MSG_ERR("dca init failed\n"); return MPXP_False; } - if(dca_fillbuff(sh_audio,&pts)<0){ + if(dca_fillbuff(priv,&pts)<0){ MSG_ERR("dca sync failed\n"); return MPXP_False; } @@ -202,13 +204,14 @@ return MPXP_Ok; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *ctx) { - delete sh->context; + delete ctx; } -MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { + sh_audio_t* sh = priv->sh; UNUSED(arg); switch(cmd) { case ADCTRL_RESYNC_STREAM: @@ -216,7 +219,7 @@ return MPXP_True; case ADCTRL_SKIP_FRAME: { float pts; - dca_fillbuff(sh,&pts); // skip AC3 frame + dca_fillbuff(priv,&pts); // skip AC3 frame return MPXP_True; } default: @@ -225,16 +228,16 @@ return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { sample_t level=1, bias=384; unsigned i,nblocks,flags=mpxp_dca_flags|DCA_ADJUST_LEVEL; unsigned len=0; - priv_t *priv=reinterpret_cast<priv_t *>(sh_audio->context); + sh_audio_t* sh_audio = priv->sh; UNUSED(minlen); UNUSED(maxlen); if(!sh_audio->a_in_buffer_len) { - if(dca_fillbuff(sh_audio,pts)<0) return len; /* EOF */ + if(dca_fillbuff(priv,pts)<0) return len; /* EOF */ } else *pts=priv->last_pts; sh_audio->a_in_buffer_len=0; Modified: mplayerxp/libmpcodecs/ad_dmo.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_dmo.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -28,30 +28,31 @@ #include "loader/dmo/DMO_AudioDecoder.h" -typedef struct dmo_priv_s { +struct ad_private_t { float pts; DMO_AudioDecoder* ds_adec; -}priv_t; + sh_audio_t* sh; +}; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { return NULL; } +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* p,uint32_t wtag) { return NULL; } -static MPXP_Rc init(sh_audio_t *sh) +static MPXP_Rc init(ad_private_t *p) { - UNUSED(sh); + UNUSED(p); return MPXP_Ok; } -static MPXP_Rc preinit(sh_audio_t *sh_audio) +static ad_private_t* preinit(sh_audio_t *sh_audio) { - priv_t*priv; + ad_private_t*priv; int chans=(mp_conf.ao_channels==sh_audio->wf->nChannels) ? mp_conf.ao_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1); - if(!(priv=new(zeromem) priv_t)) return MPXP_False; - sh_audio->context=priv; + if(!(priv=new(zeromem) ad_private_t)) return NULL; + priv->sh=sh_audio; if(!(priv->ds_adec=DMO_AudioDecoder_Open(sh_audio->codec->dll_name,&sh_audio->codec->guid,sh_audio->wf,chans))) { MSG_ERR(MSGTR_MissingDLLcodec,sh_audio->codec->dll_name); - delete sh_audio->context; - return MPXP_False; + delete priv; + return NULL; } sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; sh_audio->nch=chans; @@ -60,18 +61,18 @@ if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192; sh_audio->audio_out_minsize=4*16384; MSG_V("INFO: Win32/DMO audio codec init OK!\n"); - return MPXP_Ok; + return priv; } -static void uninit(sh_audio_t *sh) +static void uninit(ad_private_t *priv) { - priv_t*priv = reinterpret_cast<priv_t*>(sh->context); DMO_AudioDecoder_Destroy(priv->ds_adec); delete priv; } -static MPXP_Rc control_ad(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) +static MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { + sh_audio_t* sh_audio = priv->sh; int skip; UNUSED(arg); switch(cmd) { @@ -89,9 +90,9 @@ return MPXP_Unknown; } -static unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +static unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - priv_t* priv = reinterpret_cast<priv_t*>(sh_audio->context); + sh_audio_t* sh_audio = priv->sh; unsigned len=0; UNUSED(minlen); { Modified: mplayerxp/libmpcodecs/ad_dshow.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_dshow.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -23,28 +23,29 @@ LIBAD_EXTERN(dshow) -typedef struct dshow_priv_s { +struct ad_private_t { float pts; DS_AudioDecoder* ds_adec; -}priv_t; + sh_audio_t* sh; +}; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { return NULL; } +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* p,uint32_t wtag) { return NULL; } -MPXP_Rc init(sh_audio_t *sh) +MPXP_Rc init(ad_private_t *p) { - UNUSED(sh); + UNUSED(p); return MPXP_Ok; } -MPXP_Rc preinit(sh_audio_t *sh_audio) +ad_private_t* preinit(sh_audio_t *sh_audio) { - priv_t *priv; - if(!(priv=new(zeromem) priv_t)) return MPXP_False; - sh_audio->context=priv; + ad_private_t *priv; + if(!(priv=new(zeromem) ad_private_t)) return NULL; + priv->sh = sh_audio; if(!(priv->ds_adec=DS_AudioDecoder_Open(sh_audio->codec->dll_name,&sh_audio->codec->guid,sh_audio->wf))) { MSG_ERR(MSGTR_MissingDLLcodec,sh_audio->codec->dll_name); - delete sh_audio->context; - return MPXP_False; + delete priv; + return NULL; } sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; sh_audio->nch=sh_audio->wf->nChannels; @@ -53,18 +54,18 @@ if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192; sh_audio->audio_out_minsize=16384; MSG_V("INFO: Win32/DShow init OK!\n"); - return MPXP_Ok; + return priv; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *priv) { - priv_t* priv = reinterpret_cast<priv_t*>(sh->context); DS_AudioDecoder_Destroy(priv->ds_adec); delete priv; } -MPXP_Rc control_ad(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *p,int cmd,any_t* arg, ...) { + sh_audio_t* sh_audio = p->sh; int skip; UNUSED(arg); switch(cmd) { @@ -87,9 +88,9 @@ return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - priv_t* priv = reinterpret_cast<priv_t*>(sh_audio->context); + sh_audio_t* sh_audio = priv->sh; unsigned len=0; UNUSED(minlen); { unsigned size_in=0; Modified: mplayerxp/libmpcodecs/ad_dvdpcm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_dvdpcm.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -8,6 +8,10 @@ #include "osdep/bswap.h" #include "libao2/afmt.h" +struct ad_private_t { + sh_audio_t* sh; +}; + static const ad_info_t info = { "Uncompressed DVD/VOB LPCM audio decoder", "dvdpcm", @@ -26,7 +30,8 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag) { + UNUSED(ctx); unsigned i; for(i=0;probes[i].driver;i++) if(wtag==probes[i].wtag) @@ -34,9 +39,10 @@ return NULL; } -MPXP_Rc init(sh_audio_t *sh) +MPXP_Rc init(ad_private_t *priv) { /* DVD PCM Audio:*/ + sh_audio_t* sh = priv->sh; sh->i_bps = 0; if(sh->codecdata_len==3){ // we have LPCM header: @@ -72,19 +78,22 @@ return MPXP_Ok; } -MPXP_Rc preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh) { sh->audio_out_minsize=2048; - return MPXP_Ok; + ad_private_t* priv = new(zeromem) ad_private_t; + priv->sh = sh; + return priv; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *priv) { - UNUSED(sh); + delete priv; } -MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { + sh_audio_t* sh = priv->sh; int skip; UNUSED(arg); switch(cmd) { @@ -101,8 +110,9 @@ return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { + sh_audio_t* sh_audio = priv->sh; unsigned j; unsigned len; float null_pts; Modified: mplayerxp/libmpcodecs/ad_faad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -35,9 +35,10 @@ LIBAD_EXTERN(faad) -typedef struct faad_priv_s { - float pts; -}priv_t; +struct ad_private_t { + float pts; + sh_audio_t* sh; +}; static const audio_probe_t probes[] = { { "faad", "libfaad", 0xFF, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE} }, @@ -56,8 +57,8 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { - UNUSED(sh); +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag) { + UNUSED(ctx); unsigned i; for(i=0;probes[i].driver;i++) if(wtag==probes[i].wtag) @@ -178,16 +179,22 @@ } -static MPXP_Rc preinit(sh_audio_t *sh) +static ad_private_t* preinit(sh_audio_t *sh) { sh->audio_out_minsize=8192*FAAD_MAX_CHANNELS; sh->audio_in_minsize=FAAD_BUFFLEN; - if(!(sh->context=mp_malloc(sizeof(priv_t)))) return MPXP_False; - return load_dll("libfaad"SLIBSUFFIX); + ad_private_t* priv = new(zeromem) ad_private_t; + priv->sh = sh; + if(load_dll("libfaad"SLIBSUFFIX)!=MPXP_Ok) { + delete priv; + return NULL; + } + return priv; } -static MPXP_Rc init(sh_audio_t *sh) +static MPXP_Rc init(ad_private_t *priv) { + sh_audio_t* sh = priv->sh; unsigned long NeAAC_samplerate; unsigned char NeAAC_channels; float pts; @@ -268,24 +275,24 @@ return MPXP_Ok; } -static void uninit(sh_audio_t *sh) +static void uninit(ad_private_t *priv) { MSG_V("FAAD: Closing decoder!\n"); NeAACDecClose(NeAAC_hdec); - delete sh->context; + delete priv; } -static MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +static MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { - UNUSED(sh); + UNUSED(priv); UNUSED(cmd); UNUSED(arg); return MPXP_Unknown; } -static unsigned decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +static unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - priv_t *priv=reinterpret_cast<priv_t*>(sh->context); + sh_audio_t* sh = priv->sh; int j = 0; unsigned len = 0; any_t*NeAAC_sample_buffer; Modified: mplayerxp/libmpcodecs/ad_hwac3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_hwac3.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -18,9 +18,10 @@ #define IEC61937_DATA_TYPE_AC3 1 -typedef struct priv_s { +struct ad_private_t { + sh_audio_t* sh; float last_pts; -}priv_t; +}; struct hwac3info { unsigned bitrate, framesize, samplerate, bsmod; @@ -142,7 +143,7 @@ extern a52_state_t *mpxp_a52_state; extern uint32_t mpxp_a52_accel; extern uint32_t mpxp_a52_flags; -int a52_fillbuff(sh_audio_t *sh_audio,float *pts); +int a52_fillbuff(ad_private_t *sh_audio,float *pts); static const ad_info_t info = { "AC3/DTS pass-through S/PDIF", @@ -170,8 +171,9 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag) { unsigned i; + UNUSED(ctx); for(i=0;probes[i].driver;i++) if(wtag==probes[i].wtag) return &probes[i]; @@ -179,19 +181,20 @@ } -MPXP_Rc preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh) { /* Dolby AC3 audio: */ - mpcodecs_ad_a52.preinit(sh); + ad_private_t* ctx=mpcodecs_ad_a52.preinit(sh); sh->audio_out_minsize=4*256*6; sh->audio_in_minsize=3840; sh->nch=2; sh->afmt=AFMT_AC3; - return MPXP_Ok; + return ctx; } -MPXP_Rc init(sh_audio_t *sh_audio) +MPXP_Rc init(ad_private_t *ctx) { + sh_audio_t* sh_audio = ctx->sh; /* Dolby AC3 passthrough:*/ float pts; mpxp_a52_state=a52_init (mpxp_a52_accel); /* doesn't require mmx optimzation */ @@ -199,7 +202,7 @@ MSG_ERR("A52 init failed\n"); return MPXP_False; } - if(a52_fillbuff(sh_audio,&pts)<0) { + if(a52_fillbuff(ctx,&pts)<0) { MSG_ERR("A52 sync failed\n"); return MPXP_False; } @@ -217,13 +220,14 @@ return MPXP_Ok; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *ctx) { - mpcodecs_ad_a52.uninit(sh); + mpcodecs_ad_a52.uninit(ctx); } -MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *ctx,int cmd,any_t* arg, ...) { + sh_audio_t* sh = ctx->sh; UNUSED(arg); switch(cmd) { case ADCTRL_RESYNC_STREAM: @@ -231,7 +235,7 @@ return MPXP_True; case ADCTRL_SKIP_FRAME: { float pts; - a52_fillbuff(sh,&pts); // skip AC3 frame + a52_fillbuff(ctx,&pts); // skip AC3 frame return MPXP_True; } default: @@ -240,13 +244,14 @@ return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *ctx,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { + sh_audio_t* sh_audio = ctx->sh; unsigned len=0; UNUSED(minlen); UNUSED(maxlen); if(!sh_audio->a_in_buffer_len) - if((int)(len=a52_fillbuff(sh_audio,pts))<0) return 0; /*EOF*/ + if((int)(len=a52_fillbuff(ctx,pts))<0) return 0; /*EOF*/ sh_audio->a_in_buffer_len=0; len = ac3_iec958_build_burst(len, 0x01, 1, (unsigned char *)sh_audio->a_in_buffer, buf); return len; Modified: mplayerxp/libmpcodecs/ad_internal.h =================================================================== --- mplayerxp/libmpcodecs/ad_internal.h 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_internal.h 2012-12-03 15:30:49 UTC (rev 501) @@ -11,12 +11,12 @@ #include "ad_msg.h" -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag); -static MPXP_Rc __FASTCALL__ init(sh_audio_t *sh); -static MPXP_Rc __FASTCALL__ preinit(sh_audio_t *sh); -static void __FASTCALL__ uninit(sh_audio_t *sh); -static MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...); -static unsigned __FASTCALL__ decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag); +static MPXP_Rc __FASTCALL__ init(ad_private_t *ctx); +static ad_private_t* __FASTCALL__ preinit(sh_audio_t *ctx); +static void __FASTCALL__ uninit(ad_private_t *ctx); +static MPXP_Rc control_ad(ad_private_t *ctx,int cmd,any_t* arg, ...); +static unsigned __FASTCALL__ decode(ad_private_t *ctx,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); #define LIBAD_EXTERN(x) extern const ad_functions_t mpcodecs_ad_##x = {\ &info,\ Modified: mplayerxp/libmpcodecs/ad_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_lavc.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_lavc.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -18,27 +18,24 @@ #include "mp_conf_lavc.h" #include "codecs_ld.h" -typedef struct priv_s { - AVCodecContext *lavc_ctx; - audio_probe_t* probe; -}priv_t; +struct ad_private_t { + AVCodecContext* lavc_ctx; + sh_audio_t* sh; +}; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* priv,uint32_t wtag) { unsigned i; audio_probe_t* acodec = NULL; const char *what="AVCodecID"; - priv_t* priv=reinterpret_cast<priv_t*>(sh->context); enum AVCodecID id = ff_codec_get_id(ff_codec_wav_tags,wtag); if (id <= 0) { prn_err: MSG_ERR("Cannot find %s for '0x%X' tag! Try force -ac option\n" ,what - ,sh->wtag); + ,wtag); return NULL; } if(!priv){ - priv=new(zeromem) priv_t; - sh->context=priv; // avcodec_init(); avcodec_register_all(); } @@ -54,12 +51,12 @@ if(codec->sample_fmts[i]==-1) break; acodec->sample_fmt[i]=ff_codec_get_tag(ff_codec_wav_tags,id); } - priv->probe=acodec; return acodec; } -struct codecs_st* __FASTCALL__ find_lavc_audio(sh_audio_t* sh) { - const audio_probe_t* aprobe=probe(sh,sh->wtag); +struct codecs_st* __FASTCALL__ find_lavc_audio(ad_private_t* priv) { + sh_audio_t* sh = priv->sh; + const audio_probe_t* aprobe=probe(priv,sh->wtag); struct codecs_st* acodec = NULL; if(aprobe) { acodec=new(zeromem) struct codecs_st; @@ -88,22 +85,22 @@ LIBAD_EXTERN(lavc) -MPXP_Rc preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh) { + ad_private_t* priv = new(zeromem) ad_private_t; sh->audio_out_minsize=AVCODEC_MAX_AUDIO_FRAME_SIZE; - return MPXP_Ok; + priv->sh = sh; + return priv; } -MPXP_Rc init(sh_audio_t *sh_audio) +MPXP_Rc init(ad_private_t *priv) { int x; float pts; AVCodec *lavc_codec=NULL; - priv_t* priv=reinterpret_cast<priv_t*>(sh_audio->context); + sh_audio_t* sh_audio = priv->sh; MSG_V("LAVC audio codec\n"); if(!priv){ - priv=new(zeromem) priv_t; - sh_audio->context=priv; // avcodec_init(); avcodec_register_all(); } @@ -145,7 +142,7 @@ MSG_V("INFO: libavcodec init OK!\n"); // Decode at least 1 byte: (to get header filled) - x=decode(sh_audio,reinterpret_cast<unsigned char*>(sh_audio->a_buffer),1,sh_audio->a_buffer_size,&pts); + x=decode(priv,reinterpret_cast<unsigned char*>(sh_audio->a_buffer),1,sh_audio->a_buffer_size,&pts); if(x>0) sh_audio->a_buffer_len=x; sh_audio->nch=priv->lavc_ctx->channels; @@ -169,21 +166,17 @@ return MPXP_Ok; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *priv) { - priv_t* priv=reinterpret_cast<priv_t*>(sh->context); avcodec_close(priv->lavc_ctx); if (priv->lavc_ctx->extradata) delete priv->lavc_ctx->extradata; delete priv->lavc_ctx; - if(priv->probe) { delete priv->probe->codec_dll; delete priv->probe; } delete priv; - sh->context=NULL; } -MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { UNUSED(arg); - priv_t* priv = reinterpret_cast<priv_t*>(sh->context); switch(cmd){ case ADCTRL_RESYNC_STREAM: avcodec_flush_buffers(priv->lavc_ctx); @@ -193,9 +186,9 @@ return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - priv_t* priv = reinterpret_cast<priv_t*>(sh_audio->context); + sh_audio_t* sh_audio = priv->sh; unsigned char *start=NULL; int y; unsigned len=0; Modified: mplayerxp/libmpcodecs/ad_libdv.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -20,6 +20,12 @@ #include "osdep/bswap.h" #include "ad_internal.h" +struct ad_private_t { + dv_decoder_t* decoder; + int16_t* audioBuffers[4]; + sh_audio_t* sh; +}; + static const ad_info_t info = { "Raw DV Audio Decoder", "libdv", @@ -38,7 +44,8 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* priv,uint32_t wtag) { + UNUSED(priv); unsigned i; for(i=0;probes[i].driver;i++) if(wtag==probes[i].wtag) @@ -49,21 +56,18 @@ // defined in vd_libdv.c: dv_decoder_t* init_global_rawdv_decoder(void); -static MPXP_Rc preinit(sh_audio_t *sh_audio) +static ad_private_t* preinit(sh_audio_t *sh_audio) { sh_audio->audio_out_minsize=4*DV_AUDIO_MAX_SAMPLES*2; - return MPXP_Ok; + ad_private_t* priv = new(zeromem) ad_private_t; + priv->sh = sh_audio; + return priv; } -typedef struct libdv_priv_s { - dv_decoder_t* decoder; - int16_t *audioBuffers[4]; -}priv_t; - -static MPXP_Rc init(sh_audio_t *sh) +static MPXP_Rc init(ad_private_t *priv) { unsigned i; - priv_t *priv; + sh_audio_t* sh = priv->sh; WAVEFORMATEX *h=sh->wf; if(!h) return MPXP_False; @@ -72,42 +76,38 @@ sh->nch=h->nChannels; sh->rate=h->nSamplesPerSec; sh->afmt=bps2afmt((h->wBitsPerSample+7)/8); - priv = new(zeromem) priv_t; priv->decoder=init_global_rawdv_decoder(); - sh->context = priv; for (i=0; i < 4; i++) priv->audioBuffers[i] = new int16_t[DV_AUDIO_MAX_SAMPLES]; return MPXP_Ok; } -static void uninit(sh_audio_t *sh_audio) +static void uninit(ad_private_t *priv) { - priv_t *priv = reinterpret_cast<priv_t*>(sh_audio->context); unsigned i; - UNUSED(sh_audio); - for (i=0; i < 4; i++) - delete priv->audioBuffers[i]; + for (i=0; i < 4; i++) delete priv->audioBuffers[i]; + delete priv; } -static MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +static MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { // TODO!!! - UNUSED(sh); + UNUSED(priv); UNUSED(cmd); UNUSED(arg); return MPXP_Unknown; } -static unsigned decode(sh_audio_t *sh, unsigned char *buf, unsigned minlen, unsigned maxlen,float *pts) +static unsigned decode(ad_private_t *priv, unsigned char *buf, unsigned minlen, unsigned maxlen,float *pts) { - priv_t *priv = reinterpret_cast<priv_t*>(sh->context); - dv_decoder_t* decoder=priv->decoder; //global_rawdv_decoder; - unsigned char* dv_audio_frame=NULL; - unsigned xx; - size_t len=0; - float apts; - UNUSED(maxlen); + sh_audio_t* sh = priv->sh; + dv_decoder_t* decoder=priv->decoder; //global_rawdv_decoder; + unsigned char* dv_audio_frame=NULL; + unsigned xx; + size_t len=0; + float apts; + UNUSED(maxlen); while(len<minlen) { xx=ds_get_packet_r(sh->ds,&dv_audio_frame,len>0?&apts:pts); if((int)xx<=0 || !dv_audio_frame) return 0; // EOF? Modified: mplayerxp/libmpcodecs/ad_mp3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -29,26 +29,6 @@ LIBAD_EXTERN(mp3) -static const audio_probe_t probes[] = { - { "mp3lib", "libmpg123", 0x50, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, - { "mp3lib", "libmpg123", 0x55, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, - { "mp3lib", "libmpg123", 0x55005354, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, - { "mp3lib", "libmpg123", 0x5000736D, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, - { "mp3lib", "libmpg123", 0x5500736D, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, - { "mp3lib", "libmpg123", FOURCC_TAG('.','M','P','3'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, - { "mp3lib", "libmpg123", FOURCC_TAG('L','A','M','E'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, - { "mp3lib", "libmpg123", FOURCC_TAG('M','P','3',' '), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, - { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} -}; - -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { - unsigned i; - for(i=0;probes[i].driver;i++) - if(wtag==probes[i].wtag) - return &probes[i]; - return NULL; -} - /** Opaque structure for the libmpg123 decoder handle. */ struct mpg123_handle_struct; typedef struct mpg123_handle_struct mpg123_handle; @@ -258,22 +238,45 @@ MPXP_Ok:MPXP_False; } -MPXP_Rc preinit(sh_audio_t *sh) -{ - int rval; - sh->audio_out_minsize=9216; - rval = load_dll("libmpg123"SLIBSUFFIX); /* try standard libmpg123 first */ - return rval?MPXP_Ok:MPXP_False; -} - -typedef struct priv_s { +struct ad_private_t { mpg123_handle *mh; off_t pos; float pts; -}priv_t; + sh_audio_t* sh; +}; -MPXP_Rc init(sh_audio_t *sh) +static const audio_probe_t probes[] = { + { "mp3lib", "libmpg123", 0x50, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, + { "mp3lib", "libmpg123", 0x55, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, + { "mp3lib", "libmpg123", 0x55005354, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, + { "mp3lib", "libmpg123", 0x5000736D, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, + { "mp3lib", "libmpg123", 0x5500736D, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, + { "mp3lib", "libmpg123", FOURCC_TAG('.','M','P','3'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, + { "mp3lib", "libmpg123", FOURCC_TAG('L','A','M','E'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, + { "mp3lib", "libmpg123", FOURCC_TAG('M','P','3',' '), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, + { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} +}; + +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* priv,uint32_t wtag) { + UNUSED(priv); + unsigned i; + for(i=0;probes[i].driver;i++) + if(wtag==probes[i].wtag) + return &probes[i]; + return NULL; +} + +ad_private_t* preinit(sh_audio_t *sh) { + sh->audio_out_minsize=9216; + if(load_dll("libmpg123"SLIBSUFFIX)!=MPXP_Ok) return NULL; + ad_private_t* priv = new(zeromem) ad_private_t; + priv->sh = sh; + return priv; +} + +MPXP_Rc init(ad_private_t *priv) +{ // MPEG Audio: float pts; long param,rate; @@ -281,11 +284,9 @@ int err=0,nch,enc; unsigned char *indata; struct mpg123_frameinfo fi; - priv_t *priv; + sh_audio_t* sh = priv->sh; sh->afmt=AFMT_FLOAT32; mpg123_init(); - priv = new(zeromem) priv_t; - sh->context = priv; priv->mh = mpg123_new(NULL,&err); if(err) { err_exit: @@ -313,7 +314,6 @@ mpg123_close(priv->mh); mpg123_delete(priv->mh); mpg123_exit(); - delete priv; return MPXP_False; } mpg123_getformat(priv->mh, &rate, &nch, &enc); @@ -344,9 +344,8 @@ return MPXP_Ok; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *priv) { - priv_t *priv=reinterpret_cast<priv_t*>(sh->context); mpg123_close(priv->mh); mpg123_delete(priv->mh); mpg123_exit(); @@ -354,17 +353,17 @@ dlclose(dll_handle); } -MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { - UNUSED(sh); + UNUSED(priv); UNUSED(cmd); UNUSED(arg); return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - priv_t *priv=reinterpret_cast<priv_t*>(sh->context); + sh_audio_t* sh = priv->sh; unsigned char *indata=NULL,*outdata=NULL; int err=MPG123_OK,indata_size=0; off_t offset,cpos; Modified: mplayerxp/libmpcodecs/ad_null.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_null.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_null.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -6,6 +6,10 @@ #include <unistd.h> #include "ad_internal.h" +struct ad_private_t { + sh_audio_t* sh; +}; + static const ad_info_t info = { "Null audio decoder", "null", @@ -19,36 +23,37 @@ LIBAD_EXTERN(null) -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { return NULL; } +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag) { return NULL; } -MPXP_Rc init(sh_audio_t *sh) +MPXP_Rc init(ad_private_t *priv) { - UNUSED(sh); + UNUSED(priv); return MPXP_Ok; } -MPXP_Rc preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh) { - UNUSED(sh); - return MPXP_Ok; + ad_private_t* priv = new(zeromem) ad_private_t; + priv->sh = sh; + return priv; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *priv) { - UNUSED(sh); + delete priv; } -MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { - UNUSED(sh); + UNUSED(priv); UNUSED(cmd); UNUSED(arg); return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - UNUSED(sh_audio); + UNUSED(priv); UNUSED(buf); UNUSED(minlen); UNUSED(maxlen); Modified: mplayerxp/libmpcodecs/ad_pcm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_pcm.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -8,6 +8,10 @@ #include "libao2/afmt.h" #include "osdep/bswap.h" +struct ad_private_t { + sh_audio_t* sh; +}; + static const ad_info_t info = { "Uncompressed PCM audio decoder", "pcm", @@ -40,7 +44,8 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag) { + UNUSED(ctx); unsigned i; for(i=0;probes[i].driver;i++) if(wtag==probes[i].wtag) @@ -49,8 +54,9 @@ } -MPXP_Rc init(sh_audio_t *sh_audio) +MPXP_Rc init(ad_private_t *priv) { + sh_audio_t* sh_audio = priv->sh; WAVEFORMATEX *h=sh_audio->wf; sh_audio->i_bps=h->nAvgBytesPerSec; sh_audio->nch=h->nChannels; @@ -81,19 +87,22 @@ return MPXP_Ok; } -MPXP_Rc preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh) { sh->audio_out_minsize=16384; - return MPXP_Ok; + ad_private_t* priv = new(zeromem) ad_private_t; + priv->sh = sh; + return priv; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *priv) { - UNUSED(sh); + delete priv; } -MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { + sh_audio_t* sh = priv->sh; int skip; UNUSED(arg); switch(cmd) { @@ -110,8 +119,9 @@ return MPXP_Unknown; } -unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { + sh_audio_t* sh_audio = priv->sh; unsigned len = sh_audio->nch*afmt2bps(sh_audio->afmt); len = (minlen + len - 1) / len * len; if (len > maxlen) Modified: mplayerxp/libmpcodecs/ad_qtaudio.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_qtaudio.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -33,7 +33,6 @@ LIBAD_EXTERN(qtaudio) -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { return NULL; } typedef struct OpaqueSoundConverter* SoundConverter; typedef unsigned long OSType; @@ -157,7 +156,13 @@ static int InFrameSize; static int OutFrameSize; -static MPXP_Rc preinit(sh_audio_t *sh){ +struct ad_private_t { + sh_audio_t* sh; +}; + +static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { return NULL; } + +static ad_private_t* preinit(sh_audio_t *sh){ int error; unsigned long FramesToGet=0; //how many frames the demuxer has to get unsigned long InputBufferSize=0; //size of the input buffer @@ -166,20 +171,20 @@ if(mp_conf.s_cache_size) { MSG_FATAL("Disabling sound:\nwin32 quicktime DLLs must be initialized in single-threaded mode! Try -nocache\n"); - return MPXP_False; + return NULL; } MSG_INFO("win32 libquicktime loader (c) Sascha Sommer\n"); #ifdef MACOSX EnterMovies(); #else - if(loader_init()) return MPXP_False; // failed to load DLL + if(loader_init()) return NULL; // failed to load DLL MSG_V("loader_init DONE!\n"); error = InitializeQTML(6+16); MSG_ERR("InitializeQTML:%i\n",error); - if(error) return MPXP_False; + if(error) return NULL; #endif #if 1 @@ -196,7 +201,7 @@ error = SoundConverterOpen(&InputFormatInfo, &OutputFormatInfo, &myConverter); MSG_V("SoundConverterOpen:%i\n",error); - if(error) return MPXP_False; + if(error) return NULL; if(sh->codecdata){ error = SoundConverterSetInfo(myConverter,siDecompressionParams,sh->codecdata); @@ -220,7 +225,7 @@ error = SoundConverterBeginConversion(myConverter); MSG_V("SoundConverterBeginConversion:%i\n",error); - if(error) return MPXP_False; + if(error) return NULL; sh->audio_out_minsize=OutputBufferSize; sh->audio_in_minsize=InputBufferSize; @@ -233,17 +238,19 @@ //InputBufferSize*WantedBufferSize/OutputBufferSize; #endif - - return MPXP_Ok; // return values: 1=OK 0=ERROR + ad_private_t* priv = new(zeromem) ad_private_t; + priv->sh = sh; + return priv; // return values: 1=OK 0=ERROR } -static MPXP_Rc init(sh_audio_t *sh_audio) +static MPXP_Rc init(ad_private_t *p) { - UNUSED(sh_audio); + UNUSED(p); return MPXP_Ok; // return values: 1=OK 0=ERROR } -static void uninit(sh_audio_t *sh){ +static void uninit(ad_private_t *p){ + sh_audio_t* sh = p->sh; int error; unsigned long ConvertedFrames=0; unsigned long ConvertedBytes=0; @@ -260,9 +267,11 @@ #ifdef MACOSX ExitMovies(); #endif + delete p; } -static unsigned decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts){ +static unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts){ + sh_audio_t* sh = priv->sh; int error; unsigned long FramesToGet=0; //how many frames the demuxer has to get unsigned long InputBufferSize=0; //size of the input buffer @@ -307,9 +316,9 @@ return ConvertedBytes; } -static MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...){ +static MPXP_Rc control_ad(ad_private_t *p,int cmd,any_t* arg, ...){ // various optional functions you MAY implement: - UNUSED(sh); + UNUSED(p); UNUSED(cmd); UNUSED(arg); return MPXP_Unknown; Modified: mplayerxp/libmpcodecs/ad_real.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_real.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_real.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -28,23 +28,7 @@ LIBAD_EXTERN(real) -static const audio_probe_t probes[] = { - { "realaudio", "14_4.so.6.0", FOURCC_TAG('1','4','_','4'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, - { "realaudio", "28_8.so.6.0", FOURCC_TAG('2','8','_','8'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, - { "realaudio", "cook.so.6.0", FOURCC_TAG('C','O','O','K'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, - { "realaudio", "sipr.so.6.0", FOURCC_TAG('S','I','P','R'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, - { "realaudio", "atrc.so.6.0", FOURCC_TAG('A','T','R','C'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, - { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} -}; -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { - unsigned i; - for(i=0;probes[i].driver;i++) - if(wtag==probes[i].wtag) - return &probes[i]; - return NULL; -} - static any_t*handle=NULL; any_t*__builtin_new(unsigned long size) { @@ -84,12 +68,31 @@ any_t* extradata; } ra_init_t; -typedef struct priv_s { +struct ad_private_t { any_t*internal; float pts; -} priv_t; + sh_audio_t* sh; +}; -static MPXP_Rc preinit(sh_audio_t *sh){ +static const audio_probe_t probes[] = { + { "realaudio", "14_4.so.6.0", FOURCC_TAG('1','4','_','4'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, + { "realaudio", "28_8.so.6.0", FOURCC_TAG('2','8','_','8'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, + { "realaudio", "cook.so.6.0", FOURCC_TAG('C','O','O','K'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, + { "realaudio", "sipr.so.6.0", FOURCC_TAG('S','I','P','R'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, + { "realaudio", "atrc.so.6.0", FOURCC_TAG('A','T','R','C'), ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE, AFMT_S8} }, + { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} +}; + +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* p,uint32_t wtag) { + UNUSED(p); + unsigned i; + for(i=0;probes[i].driver;i++) + if(wtag==probes[i].wtag) + return &probes[i]; + return NULL; +} + +static ad_private_t* preinit(sh_audio_t *sh){ // let's check if the driver is available, return 0 if not. // (you should do that if you use external lib(s) which is optional) unsigned int result; @@ -97,11 +100,12 @@ any_t* prop; char path[4096]; char cpath[4096]; - priv_t *priv; - sh->context=priv=new(zeromem) priv_t; + ad_private_t *priv; + priv=new(zeromem) ad_private_t; + priv->sh = sh; if(!(handle = dlopen (sh->codec->dll_name, RTLD_LAZY))) { - delete sh->context; - return MPXP_False; + delete priv; + return NULL; } raCloseCodec = (uint32_t (*)(uint32_t))ld_sym(handle, "RACloseCodec"); @@ -118,8 +122,8 @@ if(!raCloseCodec || !raDecode || !raFreeDecoder || !raGetFlavorProperty || !(raOpenCodec2||raOpenCodec) || !raSetFlavor || !raInitDecoder){ - delete sh->context; - return MPXP_False; + delete priv; + return NULL; } char *end; @@ -144,8 +148,8 @@ else result=raOpenCodec(&priv->internal); if(result){ MSG_WARN("Decoder open failed, error code: 0x%X\n",result); - delete sh->context; - return MPXP_False; + delete priv; + return NULL; } sh->rate=sh->wf->nSamplesPerSec; @@ -165,8 +169,8 @@ result=raInitDecoder(priv->internal,&init_data); if(result){ MSG_WARN("Decoder init failed, error code: 0x%X\n",result); - delete sh->context; - return MPXP_False; + delete priv; + return NULL; } if(raSetPwd){ @@ -177,8 +181,8 @@ result=raSetFlavor(priv->internal,((short*)(sh->wf+1))[2]); if(result){ MSG_WARN("Decoder flavor setup failed, error code: 0x%X\n",result); - delete sh->context; - return MPXP_False; + delete priv; + return NULL; } prop=raGetFlavorProperty(priv->internal,((short*)(sh->wf+1))[2],0,&len); @@ -196,22 +200,21 @@ sh->audio_out_minsize=128000; // no idea how to get... :( sh->audio_in_minsize=((short*)(sh->wf+1))[1]*sh->wf->nBlockAlign; - return MPXP_True; // return values: 1=OK 0=ERROR + return priv; // return values: 1=OK 0=ERROR } -static MPXP_Rc init(sh_audio_t *sh_audio){ +static MPXP_Rc init(ad_private_t *p){ // initialize the decoder, set tables etc... // set sample format/rate parameters if you didn't do it in preinit() yet. - UNUSED(sh_audio); + UNUSED(p); return MPXP_Ok; // return values: 1=OK 0=ERROR } -static void uninit(sh_audio_t *sh){ +static void uninit(ad_private_t *priv){ // uninit the decoder etc... - priv_t *priv = reinterpret_cast<priv_t*>(sh->context); if (raFreeDecoder) raFreeDecoder(long(priv->internal)); if (raCloseCodec) raCloseCodec(long(priv->internal)); - delete sh->context; + delete priv; } static const unsigned char sipr_swaps[38][2]={ @@ -221,8 +224,8 @@ {42,87},{43,65},{45,59},{48,79},{49,93},{51,89},{55,95},{61,76},{67,83}, {77,80} }; -static unsigned decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts){ - priv_t *priv = reinterpret_cast<priv_t*>(sh->context); +static unsigned decode(ad_private_t *priv,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts){ + sh_audio_t* sh = priv->sh; float null_pts; int result; unsigned len=0; @@ -296,8 +299,8 @@ // or -1 for EOF (or uncorrectable error) } -static MPXP_Rc control_ad(sh_audio_t *sh,int cmd,any_t* arg, ...){ - UNUSED(sh); +static MPXP_Rc control_ad(ad_private_t *p,int cmd,any_t* arg, ...){ + UNUSED(p); UNUSED(arg); // various optional functions you MAY implement: switch(cmd){ Modified: mplayerxp/libmpcodecs/ad_twin.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_twin.cpp 2012-12-02 12:21:15 UTC (rev 500) +++ mplayerxp/libmpcodecs/ad_twin.cpp 2012-12-03 15:30:49 UTC (rev 501) @@ -26,7 +26,6 @@ LIBAD_EXTERN(twin) -static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { return NULL; } /************************/ /*** General settings ***/ @@ -202,7 +201,7 @@ #define BYTE_BIT 8 #define BBUFSIZ 1024 /* Bit buffer size (bytes) */ #define BBUFLEN (BBUFSIZ*BYTE_BIT) /* Bit buffer length (bits) */ -typedef struct priv_s +struct ad_private_t { float pts; WAVEFORMATEX o_wf; // out format @@ -216,8 +215,11 @@ int ptr; /* current point in the bit buffer */ int nbuf; /* bit buffer size */ char buf[BBUFSIZ]; /* the bit buffer */ -}priv_t; + sh_audio_t* sh; +}; +static const audio_probe_t* __FASTCALL__ probe(ad_private_t* p,uint32_t wtag) { return NULL; } + static HINSTANCE vqf_dll; static int load_dll( const char *libname ) @@ -246,9 +248,9 @@ TvqGetNumFixedBitsPerFrame_ptr; } -static int init_vqf_audio_codec(sh_audio_t *sh_audio){ +static int init_vqf_audio_codec(ad_private_t *priv){ + sh_audio_t* sh_audio = priv->sh; WAVEFORMATEX *in_fmt=sh_audio->wf; - priv_t*priv=reinterpret_cast<priv_t*>(sh_audio->context); int ver; MSG_V("======= Win32 (TWinVQ) AUDIO Codec init =======\n"); @@ -298,46 +300,48 @@ return 1; } -static int close_vqf_audio_codec(sh_audio_t *sh_audio) +static int close_vqf_audio_codec(ad_private_t *priv) { - priv_t*priv=reinterpret_cast<priv_t*>(sh_audio->context); TvqTerminate(&priv->index); return 1; } -MPXP_Rc init(sh_audio_t *sh_audio) +MPXP_Rc init(ad_private_t*p) { - UNUSED(sh_audio); + UNUSED(p); return MPXP_Ok; } -MPXP_Rc preinit(sh_audio_t *sh_audio) +ad_private_t* preinit(sh_audio_t *sh_audio) { /* Win32 VQF audio codec: */ - priv_t *priv; - if(!(priv=new(zeromem) priv_t)) return MPXP_False; - sh_audio->context=priv; + ad_private_t *priv; + if(!(priv=new(zeromem) ad_private_t)) return NULL; + priv->sh = sh_audio; if(!load_dll((const char *)sh_audio->codec->dll_name)) { MSG_ERR("win32.dll looks broken :(\n"); - return MPXP_False; + delete priv; + return NULL; } - if(!init_vqf_audio_codec(sh_audio)){ + if(!init_vqf_audio_codec(priv)){ MSG_ERR("TWinVQ initialization fail\n"); - return MPXP_False; + delete priv; + return NULL; } MSG_V("INFO: TWinVQ audio codec init OK!\n"); - return MPXP_Ok; + return priv; } -void uninit(sh_audio_t *sh) +void uninit(ad_private_t *p) { - close_vqf_audio_codec(sh); - delete sh->context; + close_vqf_audio_codec(p); + delete p; FreeLibrary(vqf_dll); } -MPXP_Rc control_ad(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) +MPXP_Rc control_ad(ad_private_t *priv,int cmd,any_t* arg, ...) { + sh_audio_t* sh_audio = priv->sh; int skip; UNUSED(arg); switch(cmd) { @@ -360,14 +364,14 @@ static int bread(char *data, /* Output: Output data array */ int size, /* Input: Length of each data */ int nbits, /* Input: Number of bits to write */ - sh_audio_t *sh, /* Input: File pointer */ + ad_private_t *priv, /* Input: File pointer */ float *pts) { /*--- Variables ---*/ int ibits, iptr, idata, ibufadr, ibufbit, icl; unsigned char mask, tmpdat; int retval; - priv_t *priv=reinterpret_cast<priv_t*>(sh->context... [truncated message content] |
From: <nic...@us...> - 2012-12-04 08:03:00
|
Revision: 502 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=502&view=rev Author: nickols_k Date: 2012-12-04 08:02:46 +0000 (Tue, 04 Dec 2012) Log Message: ----------- move afilter and vfilter into private of corresponded decoders Modified Paths: -------------- mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/ad_a52.cpp mplayerxp/libmpcodecs/ad_acm.cpp mplayerxp/libmpcodecs/ad_dca.cpp mplayerxp/libmpcodecs/ad_dmo.cpp mplayerxp/libmpcodecs/ad_dshow.cpp mplayerxp/libmpcodecs/ad_dvdpcm.cpp mplayerxp/libmpcodecs/ad_faad.cpp mplayerxp/libmpcodecs/ad_hwac3.cpp mplayerxp/libmpcodecs/ad_internal.h mplayerxp/libmpcodecs/ad_lavc.cpp mplayerxp/libmpcodecs/ad_libdv.cpp mplayerxp/libmpcodecs/ad_mp3.cpp mplayerxp/libmpcodecs/ad_null.cpp mplayerxp/libmpcodecs/ad_pcm.cpp mplayerxp/libmpcodecs/ad_qtaudio.cpp mplayerxp/libmpcodecs/ad_real.cpp mplayerxp/libmpcodecs/ad_twin.cpp mplayerxp/libmpcodecs/ad_vorbis.cpp mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_divx4.cpp mplayerxp/libmpcodecs/vd_dmo.cpp mplayerxp/libmpcodecs/vd_dshow.cpp mplayerxp/libmpcodecs/vd_huffyuv.cpp mplayerxp/libmpcodecs/vd_internal.h mplayerxp/libmpcodecs/vd_lavc.cpp mplayerxp/libmpcodecs/vd_libdv.cpp mplayerxp/libmpcodecs/vd_libmpeg2.cpp mplayerxp/libmpcodecs/vd_mpegpes.cpp mplayerxp/libmpcodecs/vd_null.cpp mplayerxp/libmpcodecs/vd_nuv.cpp mplayerxp/libmpcodecs/vd_qtvideo.cpp mplayerxp/libmpcodecs/vd_raw.cpp mplayerxp/libmpcodecs/vd_real.cpp mplayerxp/libmpcodecs/vd_theora.cpp mplayerxp/libmpcodecs/vd_vfw.cpp mplayerxp/libmpcodecs/vd_xanim.cpp mplayerxp/libmpcodecs/vd_xvid.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/stheader.h mplayerxp/xmpcore/xmp_core.cpp Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad.h 2012-12-04 08:02:46 UTC (rev 502) @@ -40,6 +40,11 @@ unsigned sample_fmt[Audio_MaxOutSample]; }audio_probe_t; +struct audio_filter_info_t { + af_stream_t* afilter; + int afilter_inited; +}; + /* interface of video decoder drivers */ struct ad_private_t; typedef struct ad_functions_s @@ -47,7 +52,7 @@ const ad_info_t* info; const config_t* options;/**< Optional: MPlayerXP's option related */ const audio_probe_t*(* __FASTCALL__ probe)(ad_private_t *,uint32_t wtag); - ad_private_t* (* __FASTCALL__ preinit)(sh_audio_t *); + ad_private_t* (* __FASTCALL__ preinit)(sh_audio_t *,audio_filter_info_t*); MPXP_Rc (* __FASTCALL__ init)(ad_private_t *ctx); void (* __FASTCALL__ uninit)(ad_private_t *ctx); MPXP_Rc (*control_ad)(ad_private_t *ctx,int cmd,any_t* arg, ...); Modified: mplayerxp/libmpcodecs/ad_a52.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_a52.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -128,7 +128,7 @@ return (flags&A52_LFE) ? (channels+1) : channels; } -ad_private_t* preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { ad_private_t* ctx=new(zeromem) ad_private_t; /* Dolby AC3 audio: */ @@ -141,9 +141,9 @@ #define A52_FMT24 AFMT_S24_LE #endif sh->afmt=bps2afmt(2); - if(af_query_fmt(sh->afilter,mpaf_format_e(AFMT_FLOAT32)) == MPXP_Ok|| - af_query_fmt(sh->afilter,mpaf_format_e(A52_FMT32)) == MPXP_Ok || - af_query_fmt(sh->afilter,mpaf_format_e(A52_FMT24)) == MPXP_Ok) { + if(af_query_fmt(afi->afilter,mpaf_format_e(AFMT_FLOAT32)) == MPXP_Ok|| + af_query_fmt(afi->afilter,mpaf_format_e(A52_FMT32)) == MPXP_Ok || + af_query_fmt(afi->afilter,mpaf_format_e(A52_FMT24)) == MPXP_Ok) { sh->afmt=AFMT_FLOAT32; } sh->audio_out_minsize=mp_conf.ao_channels*afmt2bps(sh->afmt)*256*6; Modified: mplayerxp/libmpcodecs/ad_acm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_acm.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_acm.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -141,8 +141,9 @@ return MPXP_Ok; } -ad_private_t* preinit(sh_audio_t *sh_audio) +ad_private_t* preinit(sh_audio_t *sh_audio,audio_filter_info_t* afi) { + UNUSED(afi); /* Win32 ACM audio codec: */ ad_private_t *priv; if(!(priv=new(zeromem) ad_private_t)) return NULL; Modified: mplayerxp/libmpcodecs/ad_dca.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_dca.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -126,7 +126,7 @@ return (flags&DCA_LFE) ? (channels+1) : channels; } -ad_private_t* preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { /* DTS audio: however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ @@ -138,9 +138,9 @@ #define DCA_FMT24 AFMT_S24_LE #endif sh->afmt=bps2afmt(2); - if( af_query_fmt(sh->afilter,afmt2mpaf(AFMT_FLOAT32)) == MPXP_Ok|| - af_query_fmt(sh->afilter,afmt2mpaf(DCA_FMT32)) == MPXP_Ok || - af_query_fmt(sh->afilter,afmt2mpaf(DCA_FMT24)) == MPXP_Ok) + if( af_query_fmt(afi->afilter,afmt2mpaf(AFMT_FLOAT32)) == MPXP_Ok|| + af_query_fmt(afi->afilter,afmt2mpaf(DCA_FMT32)) == MPXP_Ok || + af_query_fmt(afi->afilter,afmt2mpaf(DCA_FMT24)) == MPXP_Ok) { sh->afmt=AFMT_FLOAT32; } Modified: mplayerxp/libmpcodecs/ad_dmo.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_dmo.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -42,8 +42,9 @@ return MPXP_Ok; } -static ad_private_t* preinit(sh_audio_t *sh_audio) +static ad_private_t* preinit(sh_audio_t *sh_audio,audio_filter_info_t* afi) { + UNUSED(afi); ad_private_t*priv; int chans=(mp_conf.ao_channels==sh_audio->wf->nChannels) ? mp_conf.ao_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1); Modified: mplayerxp/libmpcodecs/ad_dshow.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_dshow.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -37,8 +37,9 @@ return MPXP_Ok; } -ad_private_t* preinit(sh_audio_t *sh_audio) +ad_private_t* preinit(sh_audio_t *sh_audio,audio_filter_info_t* afi) { + UNUSED(afi); ad_private_t *priv; if(!(priv=new(zeromem) ad_private_t)) return NULL; priv->sh = sh_audio; Modified: mplayerxp/libmpcodecs/ad_dvdpcm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_dvdpcm.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -78,8 +78,9 @@ return MPXP_Ok; } -ad_private_t* preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { + UNUSED(afi); sh->audio_out_minsize=2048; ad_private_t* priv = new(zeromem) ad_private_t; priv->sh = sh; Modified: mplayerxp/libmpcodecs/ad_faad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_faad.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -38,6 +38,7 @@ struct ad_private_t { float pts; sh_audio_t* sh; + audio_filter_info_t* afi; }; static const audio_probe_t probes[] = { @@ -179,12 +180,13 @@ } -static ad_private_t* preinit(sh_audio_t *sh) +static ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { sh->audio_out_minsize=8192*FAAD_MAX_CHANNELS; sh->audio_in_minsize=FAAD_BUFFLEN; ad_private_t* priv = new(zeromem) ad_private_t; priv->sh = sh; + priv->afi = afi; if(load_dll("libfaad"SLIBSUFFIX)!=MPXP_Ok) { delete priv; return NULL; @@ -223,9 +225,9 @@ #endif /* Set the maximal quality */ /* This is useful for expesive audio cards */ - if(af_query_fmt(sh->afilter,afmt2mpaf(AFMT_FLOAT32)) == MPXP_Ok || - af_query_fmt(sh->afilter,afmt2mpaf(NeAAC_FMT32)) == MPXP_Ok || - af_query_fmt(sh->afilter,afmt2mpaf(NeAAC_FMT24)) == MPXP_Ok) { + if(af_query_fmt(priv->afi->afilter,afmt2mpaf(AFMT_FLOAT32)) == MPXP_Ok || + af_query_fmt(priv->afi->afilter,afmt2mpaf(NeAAC_FMT32)) == MPXP_Ok || + af_query_fmt(priv->afi->afilter,afmt2mpaf(NeAAC_FMT24)) == MPXP_Ok) { sh->afmt=AFMT_FLOAT32; NeAAC_conf->outputFormat=FAAD_FMT_FLOAT; } else { Modified: mplayerxp/libmpcodecs/ad_hwac3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_hwac3.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -181,10 +181,10 @@ } -ad_private_t* preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { /* Dolby AC3 audio: */ - ad_private_t* ctx=mpcodecs_ad_a52.preinit(sh); + ad_private_t* ctx=mpcodecs_ad_a52.preinit(sh,afi); sh->audio_out_minsize=4*256*6; sh->audio_in_minsize=3840; sh->nch=2; Modified: mplayerxp/libmpcodecs/ad_internal.h =================================================================== --- mplayerxp/libmpcodecs/ad_internal.h 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_internal.h 2012-12-04 08:02:46 UTC (rev 502) @@ -13,7 +13,7 @@ static const audio_probe_t* __FASTCALL__ probe(ad_private_t* ctx,uint32_t wtag); static MPXP_Rc __FASTCALL__ init(ad_private_t *ctx); -static ad_private_t* __FASTCALL__ preinit(sh_audio_t *ctx); +static ad_private_t* __FASTCALL__ preinit(sh_audio_t *ctx,audio_filter_info_t* afi); static void __FASTCALL__ uninit(ad_private_t *ctx); static MPXP_Rc control_ad(ad_private_t *ctx,int cmd,any_t* arg, ...); static unsigned __FASTCALL__ decode(ad_private_t *ctx,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); Modified: mplayerxp/libmpcodecs/ad_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_lavc.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_lavc.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -21,6 +21,7 @@ struct ad_private_t { AVCodecContext* lavc_ctx; sh_audio_t* sh; + audio_filter_info_t* afi; }; static const audio_probe_t* __FASTCALL__ probe(ad_private_t* priv,uint32_t wtag) { @@ -85,11 +86,12 @@ LIBAD_EXTERN(lavc) -ad_private_t* preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { ad_private_t* priv = new(zeromem) ad_private_t; sh->audio_out_minsize=AVCODEC_MAX_AUDIO_FRAME_SIZE; priv->sh = sh; + priv->afi = afi; return priv; } Modified: mplayerxp/libmpcodecs/ad_libdv.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -56,8 +56,9 @@ // defined in vd_libdv.c: dv_decoder_t* init_global_rawdv_decoder(void); -static ad_private_t* preinit(sh_audio_t *sh_audio) +static ad_private_t* preinit(sh_audio_t *sh_audio,audio_filter_info_t* afi) { + UNUSED(afi); sh_audio->audio_out_minsize=4*DV_AUDIO_MAX_SAMPLES*2; ad_private_t* priv = new(zeromem) ad_private_t; priv->sh = sh_audio; Modified: mplayerxp/libmpcodecs/ad_mp3.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_mp3.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -266,8 +266,9 @@ return NULL; } -ad_private_t* preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { + UNUSED(afi); sh->audio_out_minsize=9216; if(load_dll("libmpg123"SLIBSUFFIX)!=MPXP_Ok) return NULL; ad_private_t* priv = new(zeromem) ad_private_t; Modified: mplayerxp/libmpcodecs/ad_null.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_null.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_null.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -31,8 +31,9 @@ return MPXP_Ok; } -ad_private_t* preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { + UNUSED(afi); ad_private_t* priv = new(zeromem) ad_private_t; priv->sh = sh; return priv; Modified: mplayerxp/libmpcodecs/ad_pcm.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_pcm.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -10,6 +10,7 @@ struct ad_private_t { sh_audio_t* sh; + audio_filter_info_t* afi; }; static const ad_info_t info = { @@ -87,11 +88,12 @@ return MPXP_Ok; } -ad_private_t* preinit(sh_audio_t *sh) +ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { sh->audio_out_minsize=16384; ad_private_t* priv = new(zeromem) ad_private_t; priv->sh = sh; + priv->afi = afi; return priv; } Modified: mplayerxp/libmpcodecs/ad_qtaudio.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_qtaudio.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -162,7 +162,8 @@ static const audio_probe_t* __FASTCALL__ probe(sh_audio_t* sh,uint32_t wtag) { return NULL; } -static ad_private_t* preinit(sh_audio_t *sh){ +static ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi){ + UNUSED(afi); int error; unsigned long FramesToGet=0; //how many frames the demuxer has to get unsigned long InputBufferSize=0; //size of the input buffer Modified: mplayerxp/libmpcodecs/ad_real.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_real.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_real.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -92,7 +92,8 @@ return NULL; } -static ad_private_t* preinit(sh_audio_t *sh){ +static ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi){ + UNUSED(afi); // let's check if the driver is available, return 0 if not. // (you should do that if you use external lib(s) which is optional) unsigned int result; Modified: mplayerxp/libmpcodecs/ad_twin.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_twin.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_twin.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -312,8 +312,9 @@ return MPXP_Ok; } -ad_private_t* preinit(sh_audio_t *sh_audio) +ad_private_t* preinit(sh_audio_t *sh_audio,audio_filter_info_t* afi) { + UNUSED(afi); /* Win32 VQF audio codec: */ ad_private_t *priv; if(!(priv=new(zeromem) ad_private_t)) return NULL; Modified: mplayerxp/libmpcodecs/ad_vorbis.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/ad_vorbis.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -37,6 +37,7 @@ vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ vorbis_block vb; /* local working space for packet->PCM decode */ sh_audio_t* sh; + audio_filter_info_t* afi; }; static const audio_probe_t probes[] = { @@ -54,11 +55,12 @@ return NULL; } -static ad_private_t* preinit(sh_audio_t *sh) +static ad_private_t* preinit(sh_audio_t *sh,audio_filter_info_t* afi) { sh->audio_out_minsize=1024*4; // 1024 samples/frame ad_private_t* priv = new(zeromem) ad_private_t; priv->sh = sh; + priv->afi = afi; return priv; } @@ -114,9 +116,9 @@ #define OGG_FMT16 AFMT_S16_LE #endif sh->afmt=OGG_FMT16; - if(af_query_fmt(sh->afilter,mpaf_format_e(AFMT_FLOAT32)) == MPXP_Ok|| - af_query_fmt(sh->afilter,mpaf_format_e(OGG_FMT32)) == MPXP_Ok || - af_query_fmt(sh->afilter,mpaf_format_e(OGG_FMT24)) == MPXP_Ok) { + if(af_query_fmt(priv->afi->afilter,mpaf_format_e(AFMT_FLOAT32)) == MPXP_Ok|| + af_query_fmt(priv->afi->afilter,mpaf_format_e(OGG_FMT32)) == MPXP_Ok || + af_query_fmt(priv->afi->afilter,mpaf_format_e(OGG_FMT24)) == MPXP_Ok) { sh->afmt=OGG_FMT32; } // assume 128kbit if bitrate not specified in the header Modified: mplayerxp/libmpcodecs/dec_audio.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -29,18 +29,30 @@ /* used for ac3surround decoder - set using -channels option */ af_cfg_t af_cfg; // Configuration for audio filters -typedef struct priv_s { - sh_audio_t* parent; - const ad_functions_t* mpadec; - ad_private_t* ctx; -}priv_t; +struct decaudio_priv_t : public Opaque { + public: + decaudio_priv_t(); + virtual ~decaudio_priv_t(); + sh_audio_t* parent; + const ad_functions_t* mpadec; + ad_private_t* ctx; + audio_filter_info_t* afi; +}; + +decaudio_priv_t::decaudio_priv_t() + :afi(new(zeromem) audio_filter_info_t) +{ +} + +decaudio_priv_t::~decaudio_priv_t() { delete afi; } + audio_decoder_t* mpca_init(sh_audio_t *sh_audio) { const char *afm=NULL,*ac=NULL; const audio_probe_t* aprobe=NULL; audio_decoder_t* handle=new(zeromem) audio_decoder_t; - priv_t* priv = new(zeromem) priv_t; + decaudio_priv_t* priv = new(zeromem) decaudio_priv_t; priv->parent=sh_audio; handle->ad_private=priv; @@ -70,7 +82,7 @@ delete priv; return NULL; // no such driver } - if((priv->ctx=priv->mpadec->preinit(sh_audio))==NULL) { + if((priv->ctx=priv->mpadec->preinit(sh_audio,priv->afi))==NULL) { MSG_ERR(MSGTR_CODEC_CANT_PREINITA); delete priv; return NULL; @@ -157,14 +169,14 @@ void mpca_uninit(audio_decoder_t *opaque) { - priv_t* priv = reinterpret_cast<priv_t*>(opaque->ad_private); + decaudio_priv_t* priv = reinterpret_cast<decaudio_priv_t*>(opaque->ad_private); sh_audio_t* parent = priv->parent; if(!parent) { delete opaque; delete priv; return; } - if(priv->parent->afilter){ + if(priv->afi->afilter){ MSG_V("Uninit audio filters...\n"); - af_uninit(parent->afilter); - delete parent->afilter; - parent->afilter=NULL; + af_uninit(priv->afi->afilter); + delete priv->afi->afilter; + priv->afi->afilter=NULL; } if(parent->a_buffer) delete parent->a_buffer; parent->a_buffer=NULL; @@ -184,7 +196,7 @@ MPXP_Rc mpca_preinit_filters(audio_decoder_t *opaque, unsigned in_samplerate, unsigned in_channels, unsigned in_format, unsigned* out_samplerate, unsigned* out_channels, unsigned* out_format){ - priv_t* priv = reinterpret_cast<priv_t*>(opaque->ad_private); + decaudio_priv_t* priv = reinterpret_cast<decaudio_priv_t*>(opaque->ad_private); sh_audio_t* sh_audio = priv->parent; char strbuf[200]; af_stream_t* afs=af_new(sh_audio); @@ -223,7 +235,7 @@ mpaf_fmt2str(afs->output.format,strbuf,200), sh_audio->af_bps); - sh_audio->afilter=afs; + priv->afi->afilter=afs; return MPXP_Ok; } @@ -232,10 +244,10 @@ unsigned in_samplerate, unsigned in_channels, mpaf_format_e in_format, unsigned out_samplerate, unsigned out_channels, mpaf_format_e out_format, unsigned out_minsize, unsigned out_maxsize){ - priv_t* priv = reinterpret_cast<priv_t*>(opaque->ad_private); + decaudio_priv_t* priv = reinterpret_cast<decaudio_priv_t*>(opaque->ad_private); sh_audio_t* sh_audio = priv->parent; char strbuf[200]; - af_stream_t* afs=sh_audio->afilter; + af_stream_t* afs=priv->afi->afilter; if(!afs) afs = af_new(sh_audio); // input format: same as codec's output format: @@ -257,7 +269,7 @@ // let's autoprobe it! if(MPXP_Ok != af_init(afs,1)){ - sh_audio->afilter=NULL; + priv->afi->afilter=NULL; delete afs; return MPXP_False; // failed :( } @@ -278,8 +290,8 @@ sh_audio->a_buffer_len=0; af_showconf(afs->first); - sh_audio->afilter=afs; - sh_audio->afilter_inited=1; + priv->afi->afilter=afs; + priv->afi->afilter_inited=1; return MPXP_Ok; } @@ -289,13 +301,12 @@ unsigned out_samplerate, unsigned out_channels, mpaf_format_e out_format, unsigned out_minsize, unsigned out_maxsize) { - priv_t* priv = reinterpret_cast<priv_t*>(opaque->ad_private); - sh_audio_t* sh_audio = priv->parent; - if(sh_audio->afilter){ + decaudio_priv_t* priv = reinterpret_cast<decaudio_priv_t*>(opaque->ad_private); + if(priv->afi->afilter){ MSG_V("Uninit audio filters...\n"); - af_uninit(sh_audio->afilter); - delete sh_audio->afilter; - sh_audio->afilter=NULL; + af_uninit(priv->afi->afilter); + delete priv->afi->afilter; + priv->afi->afilter=NULL; } return mpca_init_filters(opaque,in_samplerate,in_channels, in_format,out_samplerate, @@ -305,7 +316,7 @@ unsigned mpca_decode(audio_decoder_t *opaque,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts) { - priv_t* priv = reinterpret_cast<priv_t*>(opaque->ad_private); + decaudio_priv_t* priv = reinterpret_cast<decaudio_priv_t*>(opaque->ad_private); sh_audio_t* sh_audio = priv->parent; unsigned len; unsigned cp_size,cp_tile; @@ -333,7 +344,7 @@ len=priv->mpadec->decode(priv->ctx,buf, minlen, maxlen,pts); if(len>buflen) MSG_WARN(MSGTR_CODEC_BUF_OVERFLOW,sh_audio->codec->driver_name,len,buflen); MSG_DBG2("decaudio: %i bytes %f pts min %i max %i buflen %i o_bps=%i f_bps=%i\n",len,*pts,minlen,maxlen,buflen,sh_audio->o_bps,sh_audio->af_bps); - if(len==0 || !sh_audio->afilter) return 0; // EOF? + if(len==0 || !priv->afi->afilter) return 0; // EOF? // run the filters: mp_aframe_t* afd; // filter input mp_aframe_t* pafd; // filter output @@ -343,7 +354,7 @@ ,0); // xp_idx afd->audio=buf; afd->len=len; - pafd=af_play(sh_audio->afilter,afd); + pafd=af_play(priv->afi->afilter,afd); afd->audio=NULL; // fake no buffer if(!pafd) { @@ -372,7 +383,7 @@ /* Note: it is called once after seeking, to resync. */ void mpca_resync_stream(audio_decoder_t *opaque) { - priv_t* priv = reinterpret_cast<priv_t*>(opaque->ad_private); + decaudio_priv_t* priv = reinterpret_cast<decaudio_priv_t*>(opaque->ad_private); sh_audio_t* sh_audio = priv->parent; if(sh_audio) { sh_audio->a_in_buffer_len=0; /* workaround */ @@ -384,7 +395,7 @@ of audio data - used to sync audio to video after seeking */ void mpca_skip_frame(audio_decoder_t *opaque) { - priv_t* priv = reinterpret_cast<priv_t*>(opaque->ad_private); + decaudio_priv_t* priv = reinterpret_cast<decaudio_priv_t*>(opaque->ad_private); sh_audio_t* sh_audio = priv->parent; MPXP_Rc rc=MPXP_True; if(sh_audio) Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -45,15 +45,29 @@ extern int v_hue; extern int v_saturation; -struct priv_t { - sh_video_t* parent; - const vd_functions_t* mpvdec; - any_t* libinput; - vd_private_t* ctx; +struct decvideo_priv_t : public Opaque { + public: + decvideo_priv_t(); + virtual ~decvideo_priv_t(); + + sh_video_t* parent; + const vd_functions_t* mpvdec; + any_t* libinput; + vd_private_t* ctx; + vf_stream_t* vfilter; + int vfilter_inited; + put_slice_info_t* psi; }; +decvideo_priv_t::decvideo_priv_t() + :psi(new(zeromem) put_slice_info_t) +{ +} + +decvideo_priv_t::~decvideo_priv_t() { delete psi; } + MPXP_Rc mpcv_get_quality_max(video_decoder_t *opaque,unsigned *quality){ - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); if(priv->mpvdec){ MPXP_Rc ret=priv->mpvdec->control_vd(priv->ctx,VDCTRL_QUERY_MAX_PP_LEVEL,quality); if(ret>=MPXP_Ok) return ret; @@ -62,7 +76,7 @@ } MPXP_Rc mpcv_set_quality(video_decoder_t *opaque,int quality){ - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); if(priv->mpvdec) return priv->mpvdec->control_vd(priv->ctx,VDCTRL_SET_PP_LEVEL, (any_t*)(&quality)); return MPXP_False; @@ -70,9 +84,8 @@ MPXP_Rc mpcv_set_colors(video_decoder_t *opaque,const char *item,int value) { - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); - sh_video_t* sh_video = priv->parent; - vf_stream_t* vs=sh_video->vfilter; + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); + vf_stream_t* vs=priv->vfilter; vf_equalizer_t eq; eq.item=item; eq.value=value*10; @@ -83,11 +96,11 @@ } void mpcv_uninit(video_decoder_t *opaque){ - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); sh_video_t* sh_video = priv->parent; if(!sh_video->inited) { delete priv; delete opaque; return; } MSG_V("uninit video ...\n"); - if(sh_video->vfilter && sh_video->vfilter_inited==1) vf_uninit(sh_video->vfilter); + if(priv->vfilter && priv->vfilter_inited==1) vf_uninit(priv->vfilter); priv->mpvdec->uninit(priv->ctx); sh_video->inited=0; delete priv; @@ -99,7 +112,7 @@ static unsigned smp_num_cpus=1; static unsigned use_vf_threads=0; -static void mpcv_print_codec_info(const priv_t *priv) { +static void mpcv_print_codec_info(decvideo_priv_t *priv) { sh_video_t* sh_video = priv->parent; MSG_OK("[VC] %s decoder: [%s] drv:%s.%s (%dx%d (aspect %g) %4.2ffps\n" ,mp_conf.video_codec?"Forcing":"Selected" @@ -112,12 +125,12 @@ ,sh_video->fps); // Yeah! We got it! sh_video->inited=1; - sh_video->vf_flags=vf_query_flags(sh_video->vfilter); + priv->psi->vf_flags=vf_query_flags(priv->vfilter); #ifdef _OPENMP if(mp_conf.gomp) { smp_num_cpus=omp_get_num_procs(); use_vf_threads=0; - if(((sh_video->vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; + if(((priv->psi->vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; if(use_vf_threads) MSG_STATUS("[mpdec] will perform parallel video-filter on %u CPUs\n",smp_num_cpus); } @@ -128,14 +141,14 @@ video_decoder_t * mpcv_lavc_init(sh_video_t* sh_video,any_t* libinput) { video_decoder_t* handle=new(zeromem) video_decoder_t; - priv_t* priv = new(zeromem) priv_t; + decvideo_priv_t* priv = new(zeromem) decvideo_priv_t; priv->parent=sh_video; priv->libinput=libinput; handle->vd_private=priv; /* Use lavc's drivers as last hope */ priv->mpvdec=vfm_find_driver("lavc"); if(priv->mpvdec) { - if((priv->ctx=priv->mpvdec->preinit(sh_video))==NULL){ + if((priv->ctx=priv->mpvdec->preinit(sh_video,priv->psi))==NULL){ MSG_ERR(MSGTR_CODEC_CANT_INITV); return NULL; } @@ -158,19 +171,19 @@ const video_probe_t* vprobe=NULL; sh_video->codec=NULL; video_decoder_t* handle=new(zeromem) video_decoder_t; - priv_t* priv = new(zeromem) priv_t; + decvideo_priv_t* priv = new(zeromem) decvideo_priv_t; priv->parent=sh_video; priv->libinput=libinput; handle->vd_private=priv; MP_UNIT("init_video_filters"); - if(sh_video->vfilter_inited<=0) { + if(priv->vfilter_inited<=0) { vf_conf_t conf; conf.w=sh_video->src_w; conf.h=sh_video->src_h; conf.fourcc=sh_video->fourcc; // may be NULL ??? - sh_video->vfilter=vf_init(libinput,&conf); - sh_video->vfilter_inited=1; + priv->vfilter=vf_init(libinput,&conf); + priv->vfilter_inited=1; } if(vfm) { @@ -189,7 +202,7 @@ priv->mpvdec=vfm_find_driver(vfm); } if(priv->mpvdec) { - if((priv->ctx=priv->mpvdec->preinit(sh_video))==NULL){ + if((priv->ctx=priv->mpvdec->preinit(sh_video,priv->psi))==NULL){ MSG_ERR(MSGTR_CODEC_CANT_INITV); delete sh_video->codec; sh_video->codec=NULL; @@ -199,7 +212,7 @@ sh_video->codec=NULL; } else done=1; } - if(done) vf_showlist(sh_video->vfilter); + if(done) vf_showlist(priv->vfilter); #ifdef ENABLE_WIN32LOADER if(sh_video->codec) { @@ -252,16 +265,15 @@ void mpcodecs_draw_image(video_decoder_t* opaque,mp_image_t *mpi) { - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); - sh_video_t* sh=priv->parent; + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); vf_stream_t* s; const unsigned h_step=16; unsigned num_slices = mpi->h/h_step; - s=sh->vfilter; + s=priv->vfilter; if(!(mpi->flags&(MP_IMGFLAG_DRAW_CALLBACK))){ if(mpi->h%h_step) num_slices++; - if(sh->vf_flags&VF_FLAGS_SLICES) + if(priv->psi->vf_flags&VF_FLAGS_SLICES) { unsigned j,i,y; mp_image_t *ampi[num_slices]; @@ -312,23 +324,22 @@ static void update_subtitle(video_decoder_t *opaque,float v_pts,unsigned idx); int mpcv_decode(video_decoder_t *opaque,const enc_frame_t* frame){ - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); - sh_video_t* sh_video = priv->parent; + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); vf_stream_t* s; mp_image_t *mpi=NULL; unsigned int t; unsigned int t2; double tt; - s=sh_video->vfilter; + s=priv->vfilter; t=GetTimer(); vf_control(s,VFCTRL_START_FRAME,NULL); - sh_video->active_slices=0; + priv->psi->active_slices=0; mpi=priv->mpvdec->decode(priv->ctx, frame); MSG_DBG2("decvideo: decoding video %u bytes\n",frame->len); - while(sh_video->active_slices!=0) yield_timeslice(); + while(priv->psi->active_slices!=0) yield_timeslice(); /* ------------------------ frame decoded. -------------------- */ if(!mpi) return 0; // error / skipped frame @@ -362,7 +373,7 @@ void mpcv_resync_stream(video_decoder_t *opaque) { - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); sh_video_t* sh_video = priv->parent; if(sh_video) if(sh_video->inited && priv->mpvdec) priv->mpvdec->control_vd(priv->ctx,VDCTRL_RESYNC_STREAM,NULL); @@ -373,7 +384,7 @@ #endif static void update_subtitle(video_decoder_t *opaque,float v_pts,unsigned xp_idx) { - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); sh_video_t* sh_video = priv->parent; Demuxer_Stream *d_dvdsub=sh_video->ds->demuxer->sub; #ifdef USE_SUB @@ -436,13 +447,13 @@ #include "libvo/video_out.h" MPXP_Rc mpcodecs_config_vf(video_decoder_t *opaque, int w, int h){ - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); sh_video_t* sh = priv->parent; int i,j; unsigned int out_fmt=0; int screen_size_x=0;//SCREEN_SIZE_X; int screen_size_y=0;//SCREEN_SIZE_Y; - vf_stream_t* s=sh->vfilter; + vf_stream_t* s=priv->vfilter; vf_conf_t conf; int palette=0; @@ -517,7 +528,7 @@ if(strcmp(vf_get_first_name(s),"fmtcvt")==0) vf_remove_first(s); } MSG_WARN(MSGTR_VOincompCodec); - sh->vfilter_inited=-1; + priv->vfilter_inited=-1; return MPXP_False; // failed } @@ -595,7 +606,7 @@ vo_data->flags, out_fmt)==0){ MSG_WARN(MSGTR_CannotInitVO); - sh->vfilter_inited=-1; + priv->vfilter_inited=-1; return MPXP_False; } MSG_DBG2("vf->config(%dx%d->%dx%d,flags=%d,'%s')\n", @@ -611,9 +622,9 @@ // returns NULL or allocated mp_image_t* // Note: buffer allocation may be moved to mpcodecs_config_vf() later... mp_image_t* mpcodecs_get_image(video_decoder_t *opaque, int mp_imgtype, int mp_imgflag,int w, int h){ - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); sh_video_t* sh = priv->parent; - vf_stream_t* s = sh->vfilter; + vf_stream_t* s = priv->vfilter; // MSG_DBG2("mpcodecs_get_image(vf_%s,%i,%i,%i,%i) was called\n",((vf_instance_t *)(sh->vfilter))->info->name,mp_imgtype,mp_imgflag,w,h); mp_image_t* mpi=vf_get_new_image(s,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h,dae_curr_vdecoded(xp_core)); mpi->x=mpi->y=0; @@ -623,8 +634,7 @@ } void mpcodecs_draw_slice(video_decoder_t *opaque, mp_image_t*mpi) { - priv_t* priv=reinterpret_cast<priv_t*>(opaque->vd_private); - sh_video_t* sh = priv->parent; - vf_stream_t* vf = sh->vfilter; + decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); + vf_stream_t* vf = priv->vfilter; vf_put_slice(vf,mpi); } Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd.h 2012-12-04 08:02:46 UTC (rev 502) @@ -47,6 +47,10 @@ const char *url; /* URL of homepage */ } vd_info_t; +struct put_slice_info_t { + int vf_flags; + unsigned active_slices; // used in dec_video+vd_ffmpeg only!!! +}; /* interface of video decoder drivers */ struct vd_private_t; typedef struct vd_functions_s @@ -54,7 +58,7 @@ const vd_info_t* info; const config_t* options;/**< Optional: MPlayerXP's option related */ const video_probe_t*(*__FASTCALL__ probe)(vd_private_t *ctx,uint32_t fourcc); - vd_private_t* (*__FASTCALL__ preinit)(sh_video_t *sh); + vd_private_t* (*__FASTCALL__ preinit)(sh_video_t *sh,put_slice_info_t* psi); MPXP_Rc (*__FASTCALL__ init)(vd_private_t *ctx,video_decoder_t*opaque); void (*__FASTCALL__ uninit)(vd_private_t *ctx); MPXP_Rc (*control_vd)(vd_private_t *ctx,int cmd,any_t* arg, ...); Modified: mplayerxp/libmpcodecs/vd_divx4.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_divx4.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -211,7 +211,8 @@ return getDecore_ptr != NULL; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_dmo.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_dmo.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_dmo.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -53,7 +53,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_dshow.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_dshow.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_dshow.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -70,7 +70,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_huffyuv.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_huffyuv.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_huffyuv.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -196,7 +196,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_internal.h =================================================================== --- mplayerxp/libmpcodecs/vd_internal.h 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_internal.h 2012-12-04 08:02:46 UTC (rev 502) @@ -14,7 +14,7 @@ static const video_probe_t* __FASTCALL__ probe(vd_private_t *ctx,uint32_t fourcc); static MPXP_Rc control_vd(vd_private_t *ctx,int cmd,any_t* arg,...); -static vd_private_t* __FASTCALL__ preinit(sh_video_t *sh); +static vd_private_t* __FASTCALL__ preinit(sh_video_t *sh,put_slice_info_t* psi); static MPXP_Rc __FASTCALL__ init(vd_private_t *ctx,video_decoder_t*opaque); static void __FASTCALL__ uninit(vd_private_t *ctx); static mp_image_t* __FASTCALL__ decode(vd_private_t *ctx,const enc_frame_t* frame); Modified: mplayerxp/libmpcodecs/vd_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_lavc.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_lavc.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -105,6 +105,7 @@ int vo_inited; int hello_printed; const video_probe_t* probe; + put_slice_info_t* psi; }; static pp_context* ppContext=NULL; static void draw_slice(struct AVCodecContext *s, const AVFrame *src, int offset[4], int y, int type, int height); @@ -244,9 +245,10 @@ return MPXP_False; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; + priv->psi=psi; return priv; } @@ -638,10 +640,10 @@ src->pict_type==AV_PICTURE_TYPE_P?"p": src->pict_type==AV_PICTURE_TYPE_I?"i":"??" ,mpi->width,mpi->height,mpi->x,mpi->y,mpi->w,mpi->h); - __MP_ATOMIC(sh->active_slices++); + __MP_ATOMIC(priv->psi->active_slices++); mpcodecs_draw_slice (priv->parent, mpi); mpi->xp_idx = orig_idx; - __MP_ATOMIC(sh->active_slices--); + __MP_ATOMIC(priv->psi->active_slices--); } /* copypaste from demux_real.c - it should match to get it working!*/ @@ -666,7 +668,7 @@ if(frame->len<=0) return NULL; // skipped frame priv->ctx->skip_frame=(frame->flags&3)?((frame->flags&2)?AVDISCARD_NONKEY:AVDISCARD_DEFAULT):AVDISCARD_NONE; - if(priv->cap_slices) priv->use_slices= !(sh->vf_flags&VF_FLAGS_SLICES)?0:(priv->ctx->skip_frame!=AVDISCARD_NONE)?0:1; + if(priv->cap_slices) priv->use_slices= !(priv->psi->vf_flags&VF_FLAGS_SLICES)?0:(priv->ctx->skip_frame!=AVDISCARD_NONE)?0:1; else priv->use_slices=0; /* if codec is capable DR1 Modified: mplayerxp/libmpcodecs/vd_libdv.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_libdv.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_libdv.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -87,7 +87,8 @@ return global_rawdv_decoder; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_libmpeg2.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -259,7 +259,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_mpegpes.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_mpegpes.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_mpegpes.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -109,7 +109,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_null.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_null.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_null.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -30,7 +30,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_nuv.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_nuv.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_nuv.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -55,7 +55,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_qtvideo.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_qtvideo.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_qtvideo.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -129,7 +129,8 @@ static int codec_inited=0; -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; @@ -261,7 +262,7 @@ fclose(f); } #else - if(!sh->ImageDesc) sh->ImageDesc=(sh->bih+1); // hack for SVQ3-in-AVI + if(!sh->ImageDesc) sh->ImageDesc=reinterpret_cast<ImageDescription*>(sh->bih+1); // hack for SVQ3-in-AVI MSG_V("ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize); framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize); memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize); Modified: mplayerxp/libmpcodecs/vd_raw.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_raw.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_raw.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -94,7 +94,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_real.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_real.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_real.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -172,7 +172,8 @@ int format; } rv_init_t; -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_theora.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_theora.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_theora.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -68,7 +68,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_vfw.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_vfw.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_vfw.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -246,7 +246,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_xanim.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_xanim.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_xanim.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -901,7 +901,8 @@ return MPXP_Unknown; } -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpcodecs/vd_xvid.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_xvid.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpcodecs/vd_xvid.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -318,7 +318,8 @@ } #endif -static vd_private_t* preinit(sh_video_t *sh){ +static vd_private_t* preinit(sh_video_t *sh,put_slice_info_t* psi){ + UNUSED(psi); vd_private_t* priv = new(zeromem) vd_private_t; priv->sh=sh; return priv; Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -2190,8 +2190,8 @@ static int demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid) { - BITMAPINFOHEADER *bih; - any_t*ImageDesc = NULL; + BITMAPINFOHEADER* bih; + ImageDescription* ImageDesc = NULL; sh_video_t *sh_v; if (track->ms_compat) /* MS compatibility mode */ Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -50,25 +50,25 @@ unsigned idx_size[MAX_AV_STREAMS]; }; -#define le2me_ImageDesc(h) { \ - (h)->idSize = le2me_32((h)->idSize); \ - (h)->cType = le2me_32((h)->cType); \ - (h)->resvd1 = le2me_32((h)->resvd1); \ - (h)->resvd2 = le2me_16((h)->resvd2); \ - (h)->dataRefIndex = le2me_16((h)->dataRefIndex); \ - (h)->version = le2me_16((h)->version); \ - (h)->revisionLevel = le2me_16((h)->revisionLevel); \ - (h)->vendor = le2me_32((h)->vendor); \ - (h)->temporalQuality = le2me_32((h)->temporalQuality); \ - (h)->spatialQuality = le2me_32((h)->spatialQuality); \ - (h)->width = le2me_16((h)->width); \ - (h)->height = le2me_16((h)->height); \ - (h)->vRes = le2me_32((h)->vRes); \ - (h)->hRes = le2me_32((h)->hRes); \ - (h)->dataSize = le2me_32((h)->dataSize); \ - (h)->frameCount = le2me_16((h)->frameCount); \ - (h)->depth = le2me_16((h)->depth); \ - (h)->clutID = le2me_16((h)->clutID); \ +static void le2me_ImageDesc(ImageDescription* h) { + h->idSize = le2me_32(h->idSize); + h->cType = le2me_32(h->cType); + h->resvd1 = le2me_32(h->resvd1); + h->resvd2 = le2me_16(h->resvd2); + h->dataRefIndex = le2me_16(h->dataRefIndex); + h->version = le2me_16(h->version); + h->revisionLevel = le2me_16(h->revisionLevel); + h->vendor = le2me_32(h->vendor); + h->temporalQuality = le2me_32(h->temporalQuality); + h->spatialQuality = le2me_32(h->spatialQuality); + h->width = le2me_16(h->width); + h->height = le2me_16(h->height); + h->vRes = le2me_32(h->vRes); + h->hRes = le2me_32(h->hRes); + h->dataSize = le2me_32(h->dataSize); + h->frameCount = le2me_16(h->frameCount); + h->depth = le2me_16(h->depth); + h->clutID = le2me_16(h->clutID); } #define MAX_PACKS 4096 @@ -239,7 +239,7 @@ } else { - sh->ImageDesc = mp_malloc(fsize); + sh->ImageDesc = (ImageDescription *)mp_malloc(fsize); stream_read(s,(char *)sh->ImageDesc,fsize); le2me_ImageDesc(((ImageDescription *)sh->ImageDesc)); } Modified: mplayerxp/libmpdemux/muxer.h =================================================================== --- mplayerxp/libmpdemux/muxer.h 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpdemux/muxer.h 2012-12-04 08:02:46 UTC (rev 502) @@ -47,7 +47,7 @@ // stream specific: WAVEFORMATEX *wf; BITMAPINFOHEADER *bih; // in format - any_t* ImageDesc; // for quicktime codecs + ImageDescription* ImageDesc; // for quicktime codecs float aspect; // muxer of that stream struct muxer_t *muxer; Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/libmpdemux/stheader.h 2012-12-04 08:02:46 UTC (rev 502) @@ -14,6 +14,8 @@ #include "xmpcore/mp_image.h" #include "demuxer_stream.h" +struct ImageDescription; + struct standard_header : public Opaque { public: standard_header() {} @@ -52,8 +54,6 @@ unsigned a_buffer_size; /* filter buffer */ - af_stream_t* afilter; - int afilter_inited; unsigned af_bps; // == samplerate*samplesize*channels (after filters bytes/sec) char* af_buffer; unsigned af_buffer_len; @@ -90,20 +90,13 @@ float fps; int chapter_change; unsigned src_w,src_h;// source picture size (filled by fileformat parser) -// int coded_w,coded_h; // coded size (filled by video codec) float aspect; unsigned int outfmtidx; // TODO: replace with out_fourcc -/* vfilter chan */ - vf_stream_t* vfilter; - int vfilter_inited; - int vf_flags; - unsigned active_slices; // used in dec_video+vd_ffmpeg only!!! -// unsigned int bitrate; - mp_image_t* image; + // win32 codec stuff: AVIStreamHeader video; - BITMAPINFOHEADER* bih; // in format - any_t* ImageDesc; // for quicktime codecs + BITMAPINFOHEADER* bih; // in format + ImageDescription* ImageDesc; // for quicktime codecs }; sh_audio_t* get_sh_audio(demuxer_t *demuxer,int id); Modified: mplayerxp/xmpcore/xmp_core.cpp =================================================================== --- mplayerxp/xmpcore/xmp_core.cpp 2012-12-03 15:30:49 UTC (rev 501) +++ mplayerxp/xmpcore/xmp_core.cpp 2012-12-04 08:02:46 UTC (rev 502) @@ -249,7 +249,7 @@ unsigned asize; unsigned o_bps; unsigned min_reserv; - o_bps=sha->afilter_inited?sha->af_bps:sha->o_bps; + o_bps=sha->af_bps; if(xp_core->video) asize = std::max(unsigned(3*sha->audio_out_minsize), unsigned(std::max( unsigned(3*MAX_OUTBURST), unsigned(o_bps*xp_core->num_v_buffs/shv->fps))))+MIN_BUFFER_RESERV; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-04 11:04:32
|
Revision: 504 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=504&view=rev Author: nickols_k Date: 2012-12-04 11:04:20 +0000 (Tue, 04 Dec 2012) Log Message: ----------- demux_ogg is being compiling but generates segfault in vorbis_packet_blocksize() Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/vd.cpp mplayerxp/libmpcodecs/vd_divx4.cpp mplayerxp/libmpcodecs/vd_libmpeg2.cpp mplayerxp/libmpcodecs/vd_mpegpes.cpp mplayerxp/libmpdemux/demux_ogg.cpp Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-04 08:18:06 UTC (rev 503) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-04 11:04:20 UTC (rev 504) @@ -191,6 +191,7 @@ if(priv->mpvdec) vprobe=priv->mpvdec->probe(priv->ctx,sh_video->fourcc); } else vprobe = vfm_driver_probe(priv->ctx,sh_video); + if(vprobe) { vfm=vprobe->driver; /* fake struct codecs_st*/ @@ -199,8 +200,9 @@ strcpy(sh_video->codec->driver_name,vprobe->driver); strcpy(sh_video->codec->codec_name,sh_video->codec->dll_name); memcpy(sh_video->codec->outfmt,vprobe->pix_fmt,sizeof(vprobe->pix_fmt)); - priv->mpvdec=vfm_find_driver(vfm); - } + } else return NULL; + + priv->mpvdec=vfm_find_driver(vfm); if(priv->mpvdec) { if((priv->ctx=priv->mpvdec->preinit(sh_video,priv->psi))==NULL){ MSG_ERR(MSGTR_CODEC_CANT_INITV); Modified: mplayerxp/libmpcodecs/vd.cpp =================================================================== --- mplayerxp/libmpcodecs/vd.cpp 2012-12-04 08:18:06 UTC (rev 503) +++ mplayerxp/libmpcodecs/vd.cpp 2012-12-04 11:04:20 UTC (rev 504) @@ -104,7 +104,7 @@ ,pfcc[0],pfcc[1],pfcc[2],pfcc[3],probe->flags[i]); for(i=0;i<Video_MaxOutFmt;i++) { pfcc = reinterpret_cast<const char*>(&probe->pix_fmt[i]); - MSG_V("%c%c%c%c(f=%X) ",pfcc[0],pfcc[1],pfcc[2],pfcc[3],probe->flags[i]); + MSG_V("%c%c%c%c (flg=%X) ",pfcc[0],pfcc[1],pfcc[2],pfcc[3],probe->flags[i]); if(probe->pix_fmt[i]==0||probe->pix_fmt[i]==-1) break; } MSG_V("\n"); Modified: mplayerxp/libmpcodecs/vd_divx4.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.cpp 2012-12-04 08:18:06 UTC (rev 503) +++ mplayerxp/libmpcodecs/vd_divx4.cpp 2012-12-04 11:04:20 UTC (rev 504) @@ -27,7 +27,7 @@ static const vd_info_t info = { "DivX4Linux lib (divx4/5 mode)", - "divx4", + "divx", "Nickols_K", "http://labs.divx.com/DivXLinuxCodec" }; Modified: mplayerxp/libmpcodecs/vd_libmpeg2.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2012-12-04 08:18:06 UTC (rev 503) +++ mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2012-12-04 11:04:20 UTC (rev 504) @@ -23,7 +23,7 @@ static const vd_info_t info = { "libmpeg2 MPEG 1/2 Video decoder", - "libmpeg2", + "mpeg2", "A'rpi", "http://libmpeg2.sourceforge.net" }; Modified: mplayerxp/libmpcodecs/vd_mpegpes.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_mpegpes.cpp 2012-12-04 08:18:06 UTC (rev 503) +++ mplayerxp/libmpcodecs/vd_mpegpes.cpp 2012-12-04 11:04:20 UTC (rev 504) @@ -26,69 +26,69 @@ LIBVD_EXTERN(mpegpes) static const video_probe_t probes[] = { - { "mpeg2", "libmpeg2", 0x10000001, VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", 0x10000002, VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('A','V','M','P'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('D','V','R',' '), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('L','M','P','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','1','V',' '), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','1','V','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','2','V','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','7','0','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','M','E','S'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','P','2','V'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','P','G','V'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','P','E','G'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','P','G','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','P','G','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','X','5','P'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('P','I','M','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('P','I','M','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','3'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','4'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','5'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','6'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','7'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','8'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','9'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('H','D','V','A'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','X','3','N'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','X','3','P'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','X','4','N'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','X','4','P'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('M','X','5','N'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','3'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','4'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','5'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','6'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','7'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','8'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','9'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','A'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','B'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','C'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','D'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','E'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','5','F'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','3'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','4'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','5'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','6'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','7'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','8'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','9'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','A'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','B'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','C'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','D'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','E'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, - { "mpeg2", "libmpeg2", FOURCC_TAG('X','D','V','F'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", 0x10000001, VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", 0x10000002, VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('A','V','M','P'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('D','V','R',' '), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('L','M','P','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','1','V',' '), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','1','V','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','2','V','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','7','0','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','M','E','S'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','P','2','V'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','P','G','V'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','P','E','G'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','P','G','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','P','G','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','X','5','P'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('P','I','M','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('P','I','M','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','3'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','4'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','5'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','6'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','7'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','8'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','9'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('H','D','V','A'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','X','3','N'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','X','3','P'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','X','4','N'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','X','4','P'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('M','X','5','N'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','3'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','4'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','5'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','6'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','7'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','8'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','9'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','A'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','B'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','C'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','D'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','E'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','5','F'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','1'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','2'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','3'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','4'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','5'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','6'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','7'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','8'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','9'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','A'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','B'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','C'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','D'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','E'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, + { "mpegpes", "libmpegpes", FOURCC_TAG('X','D','V','F'), VCodecStatus_Working, {IMGFMT_MPEGPES}, {VideoFlag_None} }, { NULL, NULL, 0x0, VCodecStatus_NotWorking, {0x0}, { VideoFlag_None }} }; Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-04 08:18:06 UTC (rev 503) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-04 11:04:20 UTC (rev 504) @@ -35,28 +35,23 @@ /// Vorbis decoder context : we need the vorbis_info for vorbis timestamping /// Shall we put this struct def in a common header ? -typedef struct ov_struct_st { +struct ogg_vorbis_struct { + int inited; vorbis_info vi; /* struct that stores all the static vorbis bitstream settings */ vorbis_comment vc; /* struct that stores all the bitstream user comments */ - vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ - vorbis_block vb; /* local working space for packet->PCM decode */ - float rg_scale; /* replaygain scale */ +#ifdef HAVE_LIBTHEORA + theora_info t_info; + theora_comment t_comment; +#endif +// vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ +// vorbis_block vb; /* local working space for packet->PCM decode */ +// float rg_scale; /* replaygain scale */ #ifdef TREMOR - int rg_scale_int; +// int rg_scale_int; #endif -} ov_struct_t; +}; -/* Theora decoder context : we won't be able to interpret granule positions - * without using theora_granule_time with the theora_state of the stream. - * This is duplicated in `vd_theora.c'; put this in a common header? - */ -typedef struct theora_struct_st { - theora_state st; - theora_comment cc; - theora_info inf; -} theora_struct_t; - //// OggDS headers // Header for the new header format typedef struct stream_header_video @@ -123,7 +118,7 @@ struct ogg_demuxer_t : public Opaque { public: - ogg_demuxer_t() {} + ogg_demuxer_t(); virtual ~ogg_demuxer_t(); /// Physical stream state @@ -137,6 +132,7 @@ int num_syncpoint; off_t pos, last_size; int64_t final_granulepos; + ogg_vorbis_struct* ov; /* Used for subtitle switching. */ int n_text; @@ -144,6 +140,11 @@ char **text_langs; }; +ogg_demuxer_t::ogg_demuxer_t() + :ov(new(zeromem) ogg_vorbis_struct) +{ +} + ogg_demuxer_t::~ogg_demuxer_t() { unsigned i; ogg_sync_clear(&sync); @@ -159,6 +160,7 @@ if (text_langs[i]) delete text_langs[i]; delete text_langs; } + delete ov; } #define NUM_VORBIS_HDR_PACKETS 3 @@ -354,7 +356,7 @@ } -static unsigned char* demux_ogg_read_packet(ogg_stream_t* os,ogg_packet* pack,any_t*context,float* pts,int* flags, int samplesize) { +static unsigned char* demux_ogg_read_packet(ogg_demuxer_t* ogg_d,ogg_stream_t* os,ogg_packet* pack,float* pts,int* flags, int samplesize) { unsigned char* data=NULL; *pts = 0; @@ -362,23 +364,25 @@ if(os->vorbis) { data = pack->packet; - if(*pack->packet & PACKET_TYPE_HEADER) - os->hdr_packets++; - else if (context ) - { - vorbis_info *vi = &((ov_struct_t*)context)->vi; + if(*pack->packet & PACKET_TYPE_HEADER) os->hdr_packets++; + else { + int32_t blocksize; + vorbis_info *vi = &ogg_d->ov->vi; + vorbis_comment *vc = &ogg_d->ov->vc; - // When we dump the audio, there is no vi, but we don't care of timestamp in this case - int32_t blocksize = vorbis_packet_blocksize(vi,pack) / samplesize; - // Calculate the timestamp if the packet don't have any - if(pack->granulepos == -1) { - pack->granulepos = os->lastpos; - if(os->lastsize > 0) - pack->granulepos += os->lastsize; - } - *pts = pack->granulepos / (float)vi->rate; - os->lastsize = blocksize; - os->lastpos = pack->granulepos; + if (ogg_d->ov->inited) { + // When we dump the audio, there is no vi, but we don't care of timestamp in this case + blocksize = vorbis_packet_blocksize(vi,pack) / samplesize; + // Calculate the timestamp if the packet don't have any + if(pack->granulepos == -1) { + pack->granulepos = os->lastpos; + if(os->lastsize > 0) + pack->granulepos += os->lastsize; + } + *pts = pack->granulepos / (float)vi->rate; + os->lastsize = blocksize; + os->lastpos = pack->granulepos; + } } } else if (os->theora) { /* we pass complete packets to theora, mustn't strip the header! */ @@ -388,10 +392,9 @@ /* header packets beginn on 1-bit: thus check (*data&0x80). We don't have theora_state st, until all header packets were passed to the decoder. */ - if (context != NULL && !(*data&0x80)) + if (ogg_d->ov->inited && !(*data&0x80)) { - theora_info *thi = ((theora_struct_t*)context)->st.i; - int keyframe_granule_shift=logf(thi->keyframe_frequency_force-1); + int keyframe_granule_shift=logf(ogg_d->ov->t_info.keyframe_frequency_force-1); int64_t iframemask = (1 << keyframe_granule_shift) - 1; if (pack->granulepos >= 0) @@ -529,26 +532,19 @@ // return 1 if the packet was added, 0 otherwise static int demux_ogg_add_packet(Demuxer_Stream* ds,ogg_stream_t* os,int id,ogg_packet* pack) { demuxer_t* d = ds->demuxer; + ogg_demuxer_t *ogg_d = static_cast<ogg_demuxer_t*>(d->priv); Demuxer_Packet* dp; unsigned char* data; float pts = 0; int flags = 0; - any_t*context = NULL; int samplesize = 1; // If packet is an comment header then we try to get comments at first if (pack->bytes >= 7 && !memcmp(pack->packet, "\003vorbis", 7)) { - vorbis_info vi; - vorbis_comment vc; - - vorbis_info_init(&vi); - vorbis_comment_init(&vc); - vi.rate = 1L; // it's checked by vorbis_synthesis_headerin() - if(vorbis_synthesis_headerin(&vi, &vc, pack) == 0) // if no errors - demux_ogg_check_comments(d, os, id, &vc); - vorbis_comment_clear(&vc); - vorbis_info_clear(&vi); + ogg_d->ov->vi.rate = 1L; // it's checked by vorbis_synthesis_headerin() + if(vorbis_synthesis_headerin(&ogg_d->ov->vi, &ogg_d->ov->vc, pack) == 0) // if no errors + demux_ogg_check_comments(d, os, id, &ogg_d->ov->vc); } if (os->text) { if (id == d->sub->id) // don't want to add subtitles to the demuxer for now @@ -567,12 +563,9 @@ // For vorbis packet the packet is the data, for other codec we must jump // the header if(ds == d->audio && ((sh_audio_t*)ds->sh)->wtag == FOURCC_VORBIS) { - context = ((sh_audio_t *)ds->sh)->context; samplesize = afmt2bps(((sh_audio_t *)ds->sh)->afmt); } - if (ds == d->video && ((sh_audio_t*)ds->sh)->wtag == FOURCC_THEORA) - context = ((sh_video_t *)ds->sh)->context; - data = demux_ogg_read_packet(os,pack,context,&pts,&flags,samplesize); + data = demux_ogg_read_packet(ogg_d,os,pack,&pts,&flags,samplesize); if(d->video->id < 0) ((sh_audio_t*)ds->sh)->a_pts = pts; @@ -606,7 +599,6 @@ ogg_stream_t* os; ogg_packet op; int np,sid,p,samplesize=1; - any_t*context = NULL; off_t pos, last_pos; pos = last_pos = demuxer->movi_start; @@ -622,15 +614,11 @@ // Get the serial number of the stream we use if(demuxer->video->id >= 0) { sid = demuxer->video->id; - /* demux_ogg_read_packet needs decoder context for Theora streams */ - if (((sh_video_t*)demuxer->video->sh)->fourcc == FOURCC_THEORA) - context = ((sh_video_t*)demuxer->video->sh)->context; } else { sid = demuxer->audio->id; /* demux_ogg_read_packet needs decoder context for Vorbis streams */ if(((sh_audio_t*)demuxer->audio->sh)->wtag == FOURCC_VORBIS) { - context = ((sh_audio_t*)demuxer->audio->sh)->context; samplesize = afmt2bps(((sh_audio_t*)demuxer->audio->sh)->afmt); } } @@ -667,7 +655,7 @@ while(ogg_stream_packetout(oss,&op) == 1) { float pts; int flags; - demux_ogg_read_packet(os,&op,context,&pts,&flags,samplesize); + demux_ogg_read_packet(ogg_d,os,&op,&pts,&flags,samplesize); if(op.granulepos >= 0) ogg_d->final_granulepos = op.granulepos; if(index_mode == 2 && (flags || (os->vorbis && op.granulepos >= 0))) { ogg_d->syncpoints = (ogg_syncpoint_t*)mp_realloc(ogg_d->syncpoints,(ogg_d->num_syncpoint+1)*sizeof(ogg_syncpoint_t)); @@ -779,6 +767,10 @@ ogg_sync_init(sync); stream_reset(s); + vorbis_info_init(&ogg_d->ov->vi); + vorbis_comment_init(&ogg_d->ov->vc); + ogg_d->ov->inited=1; + while(1) { /// Try to get a page ogg_d->pos += ogg_d->last_size; @@ -828,6 +820,10 @@ sh_a = NULL; sh_v = NULL; +#ifdef HAVE_LIBTHEORA + theora_info_init (&ogg_d->ov->t_info); + theora_comment_init (&ogg_d->ov->t_comment); +#endif // Check for Vorbis if(pack.bytes >= 7 && ! strncmp(reinterpret_cast<char*>(&pack.packet[1]),"vorbis", 6) ) { sh_a = new_sh_audio(demuxer,ogg_d->num_sub); @@ -842,27 +838,21 @@ #ifdef HAVE_LIBTHEORA if (pack.bytes >= 7 && !strncmp (reinterpret_cast<char*>(&pack.packet[1]), "theora", 6)) { int errorCode = 0; - theora_info inf; - theora_comment cc; - theora_info_init (&inf); - theora_comment_init (&cc); - - errorCode = theora_decode_header (&inf, &cc, &pack); + errorCode = theora_decode_header (&ogg_d->ov->t_info, &ogg_d->ov->t_comment, &pack); if (errorCode) MSG_ERR("Theora header parsing failed: %i \n", errorCode); else { sh_v = new_sh_video(demuxer,ogg_d->num_sub); - sh_v->context = NULL; sh_v->bih = new(zeromem) BITMAPINFOHEADER; sh_v->bih->biSize=sizeof(BITMAPINFOHEADER); sh_v->bih->biCompression= sh_v->fourcc = FOURCC_THEORA; - sh_v->fps = ((double)inf.fps_numerator)/ - (double)inf.fps_denominator; - sh_v->src_w = sh_v->bih->biWidth = inf.frame_width; - sh_v->src_h = sh_v->bih->biHeight = inf.frame_height; + sh_v->fps = ((double)ogg_d->ov->t_info.fps_numerator)/ + (double)ogg_d->ov->t_info.fps_denominator; + sh_v->src_w = sh_v->bih->biWidth = ogg_d->ov->t_info.frame_width; + sh_v->src_h = sh_v->bih->biHeight = ogg_d->ov->t_info.frame_height; sh_v->bih->biBitCount = 24; sh_v->bih->biPlanes = 3; sh_v->bih->biSizeImage = ((sh_v->bih->biBitCount/8) * @@ -874,12 +864,14 @@ MSG_V( "Ogg : stream %d is theora v%i.%i.%i %i:%i, %.3f FPS," " aspect %i:%i\n", ogg_d->num_sub, - (int)inf.version_major, - (int)inf.version_minor, - (int)inf.version_subminor, - inf.width, inf.height, + (int)ogg_d->ov->t_info.version_major, + (int)ogg_d->ov->t_info.version_minor, + (int)ogg_d->ov->t_info.version_subminor, + ogg_d->ov->t_info.width, + ogg_d->ov->t_info.height, sh_v->fps, - inf.aspect_numerator, inf.aspect_denominator); + ogg_d->ov->t_info.aspect_numerator, + ogg_d->ov->t_info.aspect_denominator); if(mp_conf.verbose>0) print_video_header(sh_v->bih,sizeof(BITMAPINFOHEADER)); } } @@ -1188,13 +1180,11 @@ ogg_stream_state* oss; ogg_stream_t* os; Demuxer_Stream* ds; - sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); ogg_packet op; float rate; int i,sp,first=0,precision=1,do_seek=1; vorbis_info* vi = NULL; int64_t gp = 0, old_gp; - any_t*context = NULL; off_t pos, old_pos; int np; int is_gp_valid; @@ -1204,16 +1194,10 @@ if(demuxer->video->id >= 0) { ds = demuxer->video; - /* demux_ogg_read_packet needs decoder context for Theora streams */ - if (((sh_video_t*)demuxer->video->sh)->fourcc == FOURCC_THEORA) - context = ((sh_video_t*)demuxer->video->sh)->context; rate = ogg_d->subs[ds->id].samplerate; } else { ds = demuxer->audio; - /* demux_ogg_read_packet needs decoder context for Vorbis streams */ - if(((sh_audio_t*)demuxer->audio->sh)->wtag == FOURCC_VORBIS) - context = ((sh_audio_t*)demuxer->audio->sh)->context; - vi = &((ov_struct_t*)((sh_audio_t*)ds->sh)->context)->vi; + vi = &ogg_d->ov->vi; rate = (float)vi->rate; samplesize = afmt2bps(((sh_audio_t*)ds->sh)->afmt); } @@ -1317,7 +1301,7 @@ break; } is_gp_valid = (op.granulepos >= 0); - demux_ogg_read_packet(os,&op,context,&pts,&is_keyframe,samplesize); + demux_ogg_read_packet(ogg_d,os,&op,&pts,&is_keyframe,samplesize); if (precision && is_gp_valid) { precision--; if (abs(gp - op.granulepos) > rate && (op.granulepos != old_gp)) { @@ -1364,8 +1348,14 @@ #ifdef USE_ICONV subcp_close(); #endif +#ifdef HAVE_LIBTHEORA + theora_comment_clear (&ogg_d->ov->t_comment); + theora_info_clear (&ogg_d->ov->t_info); +#endif + vorbis_comment_clear(&ogg_d->ov->vc); + vorbis_info_clear(&ogg_d->ov->vi); - delete ogg_d; + delete ogg_d; } static MPXP_Rc ogg_control(const demuxer_t *demuxer,int cmd,any_t*args) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-04 11:26:35
|
Revision: 505 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=505&view=rev Author: nickols_k Date: 2012-12-04 11:26:21 +0000 (Tue, 04 Dec 2012) Log Message: ----------- move ao_data and vo_data into MPXPContext Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/sub_cc.cpp mplayerxp/libmpdemux/sub_ty.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/postproc/af.cpp mplayerxp/postproc/af_ao2.cpp mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu_list.cpp mplayerxp/postproc/libmenu/menu_txt.cpp mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf_expand.cpp mplayerxp/postproc/vf_vo.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -358,7 +358,7 @@ if(frame->flags) return 0; update_subtitle(opaque,frame->pts,mpi->xp_idx); - vo_data->flush_page(dae_curr_vdecoded(xp_core)); + mpxp_context().video().output->flush_page(dae_curr_vdecoded(xp_core)); t2=GetTimer()-t2; tt=t2*0.000001f; @@ -396,7 +396,7 @@ if(mp_conf.sub_fps==0) mp_conf.sub_fps=sh_video->fps; MP_UNIT("find_sub"); if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) { - find_sub(mpxp_context().subtitles,sub_uses_time?(100*pts):(pts*mp_conf.sub_fps),vo_data); // FIXME! frame counter... + find_sub(mpxp_context().subtitles,sub_uses_time?(100*pts):(pts*mp_conf.sub_fps),mpxp_context().video().output); // FIXME! frame counter... sub_last_pts = pts; } MP_UNIT(NULL); @@ -416,31 +416,31 @@ } }else #endif - if(vo_data->spudec){ + if(mpxp_context().video().output->spudec){ unsigned char* packet=NULL; int len,timestamp; MP_UNIT("spudec"); - spudec_now_pts(vo_data->spudec,90000*v_pts); - if(spudec_visible(vo_data->spudec)) { - vo_data->draw_spudec_direct(xp_idx); + spudec_now_pts(mpxp_context().video().output->spudec,90000*v_pts); + if(spudec_visible(mpxp_context().video().output->spudec)) { + mpxp_context().video().output->draw_spudec_direct(xp_idx); } else { - spudec_heartbeat(vo_data->spudec,90000*v_pts); - if (vo_data->vobsub) { + spudec_heartbeat(mpxp_context().video().output->spudec,90000*v_pts); + if (mpxp_context().video().output->vobsub) { if (v_pts >= 0) { - while((len=vobsub_get_packet(vo_data->vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ + while((len=vobsub_get_packet(mpxp_context().video().output->vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ timestamp -= v_pts*90000; MSG_V("\rVOB sub: len=%d v_pts=%5.3f sub=%5.3f ts=%d \n",len,v_pts,timestamp / 90000.0,timestamp); - spudec_assemble(vo_data->spudec,packet,len,90000*d_dvdsub->pts); + spudec_assemble(mpxp_context().video().output->spudec,packet,len,90000*d_dvdsub->pts); } } } else { while((len=ds_get_packet_sub_r(d_dvdsub,&packet))>0){ MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",len,v_pts,d_dvdsub->pts); - spudec_assemble(vo_data->spudec,packet,len,90000*d_dvdsub->pts); + spudec_assemble(mpxp_context().video().output->spudec,packet,len,90000*d_dvdsub->pts); } } /* detect wether the sub has changed or not */ - if(spudec_changed(vo_data->spudec)) vo_data->draw_spudec_direct(xp_idx); + if(spudec_changed(mpxp_context().video().output->spudec)) mpxp_context().video().output->draw_spudec_direct(xp_idx); MP_UNIT(NULL); } } @@ -490,10 +490,10 @@ continue; } j=i; - /*vo_data->flags=flags;*/ + /*mpxp_context().video().output->flags=flags;*/ if(flags&VFCAP_CSP_SUPPORTED_BY_HW) break; } else - if(!palette && !(vo_data->flags&3) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){ + if(!palette && !(mpxp_context().video().output->flags&3) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){ sh->outfmtidx=j; // pass index to the control() function this way if(priv->mpvdec->control_vd(priv->ctx,VDCTRL_QUERY_FORMAT,&out_fmt)!=MPXP_False) palette=1; @@ -539,13 +539,13 @@ // autodetect flipping if(vo_conf.flip==0){ - vo_data->FLIP_UNSET(); + mpxp_context().video().output->FLIP_UNSET(); if(sh->codec->outflags[j]&CODECS_FLAG_FLIP) if(!(sh->codec->outflags[j]&CODECS_FLAG_NOFLIP)) - vo_data->FLIP_SET(); + mpxp_context().video().output->FLIP_SET(); } - if(vo_data->flags&VFCAP_FLIPPED) vo_data->FLIP_REVERT(); - if(vo_data->FLIP() && !(vo_data->flags&VFCAP_FLIP)){ + if(mpxp_context().video().output->flags&VFCAP_FLIPPED) mpxp_context().video().output->FLIP_REVERT(); + if(mpxp_context().video().output->FLIP() && !(mpxp_context().video().output->flags&VFCAP_FLIP)){ // we need to flip, but no flipping filter avail. conf.w=sh->src_w; conf.h=sh->src_h; @@ -599,13 +599,13 @@ MSG_V("vf->config(%dx%d->%dx%d,flags=0x%x,'%s',%s)\n", sh->src_w,sh->src_h, screen_size_x,screen_size_y, - vo_data->flags, + mpxp_context().video().output->flags, "MPlayerXP",vo_format_name(out_fmt)); // MSG_DBG2("vf configuring: %s\n",vf->info->name); if(vf_config(s,sh->src_w,sh->src_h, screen_size_x,screen_size_y, - vo_data->flags, + mpxp_context().video().output->flags, out_fmt)==0){ MSG_WARN(MSGTR_CannotInitVO); priv->vfilter_inited=-1; @@ -614,7 +614,7 @@ MSG_DBG2("vf->config(%dx%d->%dx%d,flags=%d,'%s')\n", sh->src_w,sh->src_h, screen_size_x,screen_size_y, - vo_data->flags, + mpxp_context().video().output->flags, vo_format_name(out_fmt)); return MPXP_True; } Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -318,7 +318,7 @@ #ifdef USE_ICONV subcp_recode1(&ogg_sub); #endif - vo_data->sub = &ogg_sub; + mpxp_context().video().output->sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); } @@ -573,7 +573,7 @@ /// Clear subtitles if necessary (for broken files) if ((clear_sub > 0) && (pts >= clear_sub)) { ogg_sub.lines = 0; - vo_data->sub = &ogg_sub; + mpxp_context().video().output->sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); clear_sub = -1; } @@ -1327,7 +1327,7 @@ } if(!precision && (is_keyframe || os->vorbis) ) { ogg_sub.lines = 0; - vo_data->sub = &ogg_sub; + mpxp_context().video().output->sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); clear_sub = -1; demux_ogg_add_packet(ds,os,ds->id,&op); Modified: mplayerxp/libmpdemux/sub_cc.cpp =================================================================== --- mplayerxp/libmpdemux/sub_cc.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/libmpdemux/sub_cc.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -150,7 +150,7 @@ static void display_buffer(const subtitle * buf) { - vo_data->sub=buf; + mpxp_context().video().output->sub=buf; vo_osd_changed(OSDTYPE_SUBTITLE); } Modified: mplayerxp/libmpdemux/sub_ty.cpp =================================================================== --- mplayerxp/libmpdemux/sub_ty.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/libmpdemux/sub_ty.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -894,9 +894,9 @@ // { // printf( "OSD:%d:%s\n", index, ty_OSD1.text[ index ] ); // } - vo_data->sub = &ty_OSD1; - vo_osd_changed( OSDTYPE_SUBTITLE ); - tyOSDUpdate = 0; + mpxp_context().video().output->sub = &ty_OSD1; + vo_osd_changed( OSDTYPE_SUBTITLE ); + tyOSDUpdate = 0; } } } Modified: mplayerxp/libmpstream/s_dvdnav.cpp =================================================================== --- mplayerxp/libmpstream/s_dvdnav.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/libmpstream/s_dvdnav.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -512,12 +512,12 @@ stream_change->physical_letterbox, stream_change->physical_pan_scan, stream_change->logical); - if (vo_data->spudec && mp_conf.dvdsub_id!=stream_change->physical_wide) { + if (mpxp_context().video().output->spudec && mp_conf.dvdsub_id!=stream_change->physical_wide) { MSG_DBG2("d_dvdsub->id change: was %d is now %d\n", d_dvdsub->id,stream_change->physical_wide); // FIXME: need a better way to change SPU id d_dvdsub->id=mp_conf.dvdsub_id=stream_change->physical_wide; - if (vo_data->spudec) spudec_reset(vo_data->spudec); + if (mpxp_context().video().output->spudec) spudec_reset(mpxp_context().video().output->spudec); } break; } @@ -563,7 +563,7 @@ MSG_DBG2("DVDNAV Event: Nav SPU CLUT Change\n"); if(sp->len!=64) MSG_WARN("DVDNAV Event: Nav SPU CLUT Change: %i bytes <> 64\n",sp->len); // send new palette to SPU decoder - if (vo_data->spudec) spudec_update_palette(vo_data->spudec,(const unsigned int *)(sp->buf)); + if (mpxp_context().video().output->spudec) spudec_update_palette(mpxp_context().video().output->spudec,(const unsigned int *)(sp->buf)); break; } } Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/mplayerxp.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -261,8 +261,6 @@ Decoding ahead **************************************************************************/ static volatile char antiviral_hole4[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -ao_data_t* ao_data=NULL; -Video_Output* vo_data=NULL; /**************************************************************************/ MPXPContext& mpxp_context() { return *MPXPCtx; } @@ -315,8 +313,8 @@ #ifdef ENABLE_WIN32LOADER free_codec_cfg(); #endif - if(vo_data) delete vo_data; - if(ao_data) delete ao_data; + if(mpxp_context().video().output) delete mpxp_context().video().output; + if(mpxp_context().audio().output) delete mpxp_context().audio().output; xmp_uninit(); mp_uninit_malloc(mp_conf.verbose); } @@ -360,15 +358,15 @@ if (mask&INITED_SPUDEC){ inited_flags&=~INITED_SPUDEC; MP_UNIT("uninit_spudec"); - spudec_free(vo_data->spudec); - vo_data->spudec=NULL; + spudec_free(mpxp_context().video().output->spudec); + mpxp_context().video().output->spudec=NULL; } if (mask&INITED_VOBSUB){ inited_flags&=~INITED_VOBSUB; MP_UNIT("uninit_vobsub"); - vobsub_close(vo_data->vobsub); - vo_data->vobsub=NULL; + vobsub_close(mpxp_context().video().output->vobsub); + mpxp_context().video().output->vobsub=NULL; } if(mask&INITED_VCODEC){ @@ -381,8 +379,8 @@ if(mask&INITED_VO){ inited_flags&=~INITED_VO; MP_UNIT("uninit_vo"); - delete vo_data; - vo_data=NULL; + delete mpxp_context().video().output; + mpxp_context().video().output=NULL; } if(mask&INITED_ACODEC){ @@ -395,8 +393,8 @@ if(mask&INITED_AO){ inited_flags&=~INITED_AO; MP_UNIT("uninit_ao"); - ao_uninit(ao_data); - ao_data=NULL; + ao_uninit(mpxp_context().audio().output); + mpxp_context().audio().output=NULL; } if(mask&INITED_DEMUXER) uninit_demuxer(); @@ -415,7 +413,7 @@ MP_UNIT("sub_free"); sub_free( mpxp_context().subtitles ); mp_conf.sub_name=NULL; - vo_data->sub=NULL; + mpxp_context().video().output->sub=NULL; mpxp_context().subtitles=NULL; } #endif @@ -577,7 +575,7 @@ static void init_player( void ) { if(mp_conf.video_driver && strcmp(mp_conf.video_driver,"help")==0) { - vo_data->print_help(); + mpxp_context().video().output->print_help(); mpxp_uninit_structs(); exit(0); } @@ -646,7 +644,7 @@ m_config_show_options(mpxp_context().mconfig); mp_input_print_binds(MPXPSys.libinput()); print_stream_drivers(); - vo_data->print_help(); + mpxp_context().video().output->print_help(); ao_print_help(); vf_help(); af_help(); @@ -685,7 +683,7 @@ else --pts; } else osd_last_pts=pts; - vo_data->osd_text=osd_text_buffer; + mpxp_context().video().output->osd_text=osd_text_buffer; if (MPXPSys.osd_show_framedrop) { sprintf(osd_text_tmp, "Framedrop: %s",mp_conf.frame_dropping>1?"hard":mp_conf.frame_dropping?"vo":"none"); MPXPSys.osd_show_framedrop--; @@ -696,13 +694,13 @@ #else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",MPXPSys.osd_function,pts/3600,(pts/60)%60,pts%60); #endif - if(strcmp(vo_data->osd_text, osd_text_tmp)) { - strcpy(vo_data->osd_text, osd_text_tmp); + if(strcmp(mpxp_context().video().output->osd_text, osd_text_tmp)) { + strcpy(mpxp_context().video().output->osd_text, osd_text_tmp); vo_osd_changed(OSDTYPE_OSD); } } else { - if(vo_data->osd_text) { - vo_data->osd_text=NULL; + if(mpxp_context().video().output->osd_text) { + mpxp_context().video().output->osd_text=NULL; vo_osd_changed(OSDTYPE_OSD); } } @@ -725,8 +723,8 @@ // success: /* FIXME there should be real seeking for vobsub */ - if (vo_data->vobsub) vobsub_reset(vo_data->vobsub); - if (vo_data->spudec) spudec_reset(vo_data->spudec); + if (mpxp_context().video().output->vobsub) vobsub_reset(mpxp_context().video().output->vobsub); + if (mpxp_context().video().output->spudec) spudec_reset(mpxp_context().video().output->spudec); if(sh_audio){ sh_audio->chapter_change=0; @@ -737,19 +735,19 @@ if(sh_video){ MP_UNIT("seek_video_reset"); mpcv_resync_stream(mpxp_context().video().decoder); - vo_data->reset(); + mpxp_context().video().output->reset(); sh_video->chapter_change=-1; } if(sh_audio){ MP_UNIT("seek_audio_reset"); mpca_resync_stream(mpxp_context().audio().decoder); - ao_reset(ao_data); // stop audio, throwing away buffered data + ao_reset(mpxp_context().audio().output); // stop audio, throwing away buffered data } - if (vo_data->vobsub) { + if (mpxp_context().video().output->vobsub) { MP_UNIT("seek_vobsub_reset"); - vobsub_seek_r(vo_data->vobsub, _seek); + vobsub_seek_r(mpxp_context().video().output->vobsub, _seek); } #ifdef USE_OSD @@ -758,8 +756,8 @@ int len=((_demuxer->movi_end-_demuxer->movi_start)>>8); if (len>0){ if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; - vo_data->osd_progbar_type=0; - vo_data->osd_progbar_value=(_demuxer->filepos-_demuxer->movi_start)/len; + mpxp_context().video().output->osd_progbar_type=0; + mpxp_context().video().output->osd_progbar_value=(_demuxer->filepos-_demuxer->movi_start)/len; vo_osd_changed(OSDTYPE_PROGBAR); } } @@ -768,10 +766,10 @@ max_pts_correction=0.1; if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; // to rewert to PLAY pointer after 1 sec mpxp_context().bench->audio=0; mpxp_context().bench->audio_decode=0; mpxp_context().bench->video=0; mpxp_context().bench->vout=0; - if(vo_data->spudec) { + if(mpxp_context().video().output->spudec) { unsigned char* packet=NULL; while(ds_get_packet_sub_r(d_dvdsub,&packet)>0) ; // Empty stream - spudec_reset(vo_data->spudec); + spudec_reset(mpxp_context().video().output->spudec); } } } @@ -845,12 +843,12 @@ sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys.demuxer()->audio->sh); if(xmp_test_model(XMP_Run_AudioPlayback)) MSG_STATUS("A:%6.1f %4.1f%%\r" - ,sh_audio->timer-ao_get_delay(ao_data) + ,sh_audio->timer-ao_get_delay(mpxp_context().audio().output) ,(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0 ); else MSG_STATUS("A:%6.1f %4.1f%% B:%4.1f\r" - ,sh_audio->timer-ao_get_delay(ao_data) + ,sh_audio->timer-ao_get_delay(mpxp_context().audio().output) ,(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0 ,get_delay_audio_buffer() ); @@ -881,13 +879,13 @@ // check font #ifdef USE_OSD if(mp_conf.font_name){ - vo_data->font=read_font_desc(mp_conf.font_name,mp_conf.font_factor,mp_conf.verbose>1); - if(!vo_data->font) MSG_ERR(MSGTR_CantLoadFont,mp_conf.font_name); + mpxp_context().video().output->font=read_font_desc(mp_conf.font_name,mp_conf.font_factor,mp_conf.verbose>1); + if(!mpxp_context().video().output->font) MSG_ERR(MSGTR_CantLoadFont,mp_conf.font_name); } else { // try default: - vo_data->font=read_font_desc(get_path("font/font.desc"),mp_conf.font_factor,mp_conf.verbose>1); - if(!vo_data->font) - vo_data->font=read_font_desc(DATADIR"/font/font.desc",mp_conf.font_factor,mp_conf.verbose>1); + mpxp_context().video().output->font=read_font_desc(get_path("font/font.desc"),mp_conf.font_factor,mp_conf.verbose>1); + if(!mpxp_context().video().output->font) + mpxp_context().video().output->font=read_font_desc(DATADIR"/font/font.desc",mp_conf.font_factor,mp_conf.verbose>1); } #endif /* Configure menu here */ @@ -913,7 +911,7 @@ unsigned i; // check video_out driver name: MP_UNIT("vo_init"); - vo_inited = (vo_data->init(mp_conf.video_driver)!=NULL)?1:0; + vo_inited = (mpxp_context().video().output->init(mp_conf.video_driver)!=NULL)?1:0; if(!vo_inited){ MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); @@ -941,23 +939,23 @@ int forced_subs_only=0; MP_UNIT("vobsub"); if (mp_conf.vobsub_name){ - vo_data->vobsub=vobsub_open(mp_conf.vobsub_name,mp_conf.spudec_ifo,1,&vo_data->spudec); - if(vo_data->vobsub==NULL) + mpxp_context().video().output->vobsub=vobsub_open(mp_conf.vobsub_name,mp_conf.spudec_ifo,1,&mpxp_context().video().output->spudec); + if(mpxp_context().video().output->vobsub==NULL) MSG_ERR(MSGTR_CantLoadSub,mp_conf.vobsub_name); else { inited_flags|=INITED_VOBSUB; - vobsub_set_from_lang(vo_data->vobsub, mp_conf.dvdsub_lang); + vobsub_set_from_lang(mpxp_context().video().output->vobsub, mp_conf.dvdsub_lang); // check if vobsub requested only to display forced subtitles - forced_subs_only=vobsub_get_forced_subs_flag(vo_data->vobsub); + forced_subs_only=vobsub_get_forced_subs_flag(mpxp_context().video().output->vobsub); } }else if(mp_conf.sub_auto && filename && (strlen(filename)>=5)){ /* try to autodetect vobsub from movie filename ::atmos */ char *buf = new(zeromem) char[strlen(filename)-3]; strncpy(buf, filename, strlen(filename)-4); - vo_data->vobsub=vobsub_open(buf,mp_conf.spudec_ifo,0,&vo_data->spudec); + mpxp_context().video().output->vobsub=vobsub_open(buf,mp_conf.spudec_ifo,0,&mpxp_context().video().output->spudec); delete buf; } - if(vo_data->vobsub) + if(mpxp_context().video().output->vobsub) { mp_conf.sub_auto=0; // don't do autosub for textsubs if vobsub found inited_flags|=INITED_VOBSUB; @@ -1085,26 +1083,26 @@ unsigned int palette[16], width, height; MP_UNIT("spudec_init_vobsub"); if (vobsub_parse_ifo(NULL,mp_conf.spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0) - vo_data->spudec=spudec_new_scaled(palette, sh_video->src_w, sh_video->src_h); + mpxp_context().video().output->spudec=spudec_new_scaled(palette, sh_video->src_w, sh_video->src_h); } - if (vo_data->spudec==NULL) { + if (mpxp_context().video().output->spudec==NULL) { unsigned *pal; MP_UNIT("spudec_init"); if(stream_control(stream,SCTRL_VID_GET_PALETTE,&pal)==MPXP_Ok) - vo_data->spudec=spudec_new_scaled(pal,sh_video->src_w, sh_video->src_h); + mpxp_context().video().output->spudec=spudec_new_scaled(pal,sh_video->src_w, sh_video->src_h); } - if (vo_data->spudec==NULL) { + if (mpxp_context().video().output->spudec==NULL) { MP_UNIT("spudec_init_normal"); - vo_data->spudec=spudec_new_scaled(NULL, sh_video->src_w, sh_video->src_h); - spudec_set_font_factor(vo_data->spudec,mp_conf.font_factor); + mpxp_context().video().output->spudec=spudec_new_scaled(NULL, sh_video->src_w, sh_video->src_h); + spudec_set_font_factor(mpxp_context().video().output->spudec,mp_conf.font_factor); } - if (vo_data->spudec!=NULL) { + if (mpxp_context().video().output->spudec!=NULL) { inited_flags|=INITED_SPUDEC; // Apply current settings for forced subs - spudec_set_forced_subs_only(vo_data->spudec,forced_subs_only); + spudec_set_forced_subs_only(mpxp_context().video().output->spudec,forced_subs_only); } #ifdef USE_SUB @@ -1175,13 +1173,13 @@ d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } else { - if(!(ao_data=ao_init(ao_subdevice))) { + if(!(mpxp_context().audio().output=ao_init(ao_subdevice))) { MSG_ERR(MSGTR_CannotInitAO); d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } if(ao_subdevice) delete ao_subdevice; - ao_inited=ao_register(ao_data,mp_conf.audio_driver,0); + ao_inited=ao_register(mpxp_context().audio().output,mp_conf.audio_driver,0); if (ao_inited!=MPXP_Ok){ MSG_FATAL(MSGTR_InvalidAOdriver,mp_conf.audio_driver); exit_player(MSGTR_Exit_error); @@ -1195,12 +1193,12 @@ MPXP_Rc rc=MPXP_Ok; MP_UNIT("init_video_codec"); sh_video->inited=0; - vo_data->flags=VOFLAG_NONE; + mpxp_context().video().output->flags=VOFLAG_NONE; /* configure flags */ - if(vo_conf.fullscreen) vo_data->FS_SET(); - if(vo_conf.softzoom) vo_data->ZOOM_SET(); - if(vo_conf.flip>0) vo_data->FLIP_SET(); - if(vo_conf.vidmode) vo_data->VM_SET(); + if(vo_conf.fullscreen) mpxp_context().video().output->FS_SET(); + if(vo_conf.softzoom) mpxp_context().video().output->ZOOM_SET(); + if(vo_conf.flip>0) mpxp_context().video().output->FLIP_SET(); + if(vo_conf.vidmode) mpxp_context().video().output->VM_SET(); if((mpxp_context().video().decoder=mpcv_init(sh_video,mp_conf.video_codec,mp_conf.video_family,-1,_libinput))) sh_video->inited=1; #ifdef ENABLE_WIN32LOADER if(!sh_video->inited) { @@ -1250,7 +1248,7 @@ sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); Demuxer_Stream *d_audio=_demuxer->audio; int rc=0; - const ao_info_t *info=ao_get_info(ao_data); + const ao_info_t *info=ao_get_info(mpxp_context().audio().output); MP_UNIT("setup_audio"); MSG_V("AO: [%s] %iHz %s %s\n", info->short_name, @@ -1270,26 +1268,26 @@ MSG_V("AO: Comment: %s\n", info->comment); MP_UNIT("af_preinit"); - ao_data->samplerate=mp_conf.force_srate?mp_conf.force_srate:sh_audio->rate; - ao_data->channels=mp_conf.ao_channels?mp_conf.ao_channels:sh_audio->nch; - ao_data->format=sh_audio->afmt; + mpxp_context().audio().output->samplerate=mp_conf.force_srate?mp_conf.force_srate:sh_audio->rate; + mpxp_context().audio().output->channels=mp_conf.ao_channels?mp_conf.ao_channels:sh_audio->nch; + mpxp_context().audio().output->format=sh_audio->afmt; if(mpca_preinit_filters(mpxp_context().audio().decoder, // input: (int)(sh_audio->rate), sh_audio->nch, sh_audio->afmt, // output: - &ao_data->samplerate, &ao_data->channels, &ao_data->format)!=MPXP_Ok){ + &mpxp_context().audio().output->samplerate, &mpxp_context().audio().output->channels, &mpxp_context().audio().output->format)!=MPXP_Ok){ MSG_ERR("Audio filter chain preinit failed\n"); } else { MSG_V("AF_pre: %dHz %dch (%s) afmt=%08X sh_audio_min=%i\n", - ao_data->samplerate, ao_data->channels, - ao_format_name(ao_data->format),ao_data->format + mpxp_context().audio().output->samplerate, mpxp_context().audio().output->channels, + ao_format_name(mpxp_context().audio().output->format),mpxp_context().audio().output->format ,sh_audio->audio_out_minsize); } - if(MPXP_Ok!=ao_configure(ao_data,mp_conf.force_srate?mp_conf.force_srate:ao_data->samplerate, - ao_data->channels,ao_data->format)) { + if(MPXP_Ok!=ao_configure(mpxp_context().audio().output,mp_conf.force_srate?mp_conf.force_srate:mpxp_context().audio().output->samplerate, + mpxp_context().audio().output->channels,mpxp_context().audio().output->format)) { MSG_ERR("Can't configure audio device\n"); d_audio->sh=NULL; sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); @@ -1300,8 +1298,8 @@ if(mpca_init_filters(mpxp_context().audio().decoder, sh_audio->rate, sh_audio->nch, mpaf_format_e(sh_audio->afmt), - ao_data->samplerate, ao_data->channels, mpaf_format_e(ao_data->format), - ao_data->outburst*4, ao_data->buffersize)!=MPXP_Ok) { + mpxp_context().audio().output->samplerate, mpxp_context().audio().output->channels, mpaf_format_e(mpxp_context().audio().output->format), + mpxp_context().audio().output->outburst*4, mpxp_context().audio().output->buffersize)!=MPXP_Ok) { MSG_ERR("No matching audio filter found!\n"); } } @@ -1333,7 +1331,7 @@ unsigned ipts,rpts; unsigned char h,m,s,rh,rm,rs; static char ph=0,pm=0,ps=0; - ipts=(unsigned)(sh_audio->timer-ao_get_delay(ao_data)); + ipts=(unsigned)(sh_audio->timer-ao_get_delay(mpxp_context().audio().output)); rpts=_demuxer->movi_length-ipts; h = ipts/3600; m = (ipts/60)%60; @@ -1359,7 +1357,7 @@ int rc=0; if(*osd_visible) { if (!--(*osd_visible)) { - vo_data->osd_progbar_type=-1; // disable + mpxp_context().video().output->osd_progbar_type=-1; // disable vo_osd_changed(OSDTYPE_PROGBAR); if (!((osd_function == OSD_PAUSE)||(osd_function==OSD_DVDMENU))) osd_function = OSD_PLAY; @@ -1380,7 +1378,7 @@ *in_pause = 1; return -1; } - vo_data->pause(); + mpxp_context().video().output->pause(); } if(mp_conf.verbose) { MSG_STATUS("\n------ PAUSED -------\r"); @@ -1392,11 +1390,11 @@ xp_core->in_pause=1; while( !dec_ahead_can_aseek ) yield_timeslice(); } - ao_pause(ao_data); // pause audio, keep data if possible + ao_pause(mpxp_context().audio().output); // pause audio, keep data if possible } while( (cmd = mp_input_get_cmd(_libinput,20,1,1)) == NULL) { - if(sh_video && vo_inited) vo_data->check_events(); + if(sh_video && vo_inited) mpxp_context().video().output->check_events(); yield_timeslice(); } @@ -1407,14 +1405,14 @@ if(osd_function==OSD_PAUSE) osd_function=OSD_PLAY; if (ao_inited==MPXP_Ok && sh_audio) { - ao_resume(ao_data); // resume audio + ao_resume(mpxp_context().audio().output); // resume audio if(xmp_test_model(XMP_Run_AudioPlayer)) { xp_core->in_pause=0; __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); } } if (vo_inited && sh_video) - vo_data->resume(); // resume video + mpxp_context().video().output->resume(); // resume video *in_pause=0; (void)GetRelativeTime(); // keep TF around FT in next cycle } @@ -1507,17 +1505,17 @@ } break; case MP_CMD_MUTE: - mixer_mute(ao_data); + mixer_mute(mpxp_context().audio().output); break; case MP_CMD_VOLUME : { int v = cmd->args[0].v.i; - if(v > 0) mixer_incvolume(ao_data); - else mixer_decvolume(ao_data); + if(v > 0) mixer_incvolume(mpxp_context().audio().output); + else mixer_decvolume(mpxp_context().audio().output); #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec - vo_data->osd_progbar_type=OSD_VOLUME; - vo_data->osd_progbar_value=(mixer_getbothvolume(ao_data)*256.0)/100.0; + mpxp_context().video().output->osd_progbar_type=OSD_VOLUME; + mpxp_context().video().output->osd_progbar_value=(mixer_getbothvolume(mpxp_context().audio().output)*256.0)/100.0; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -1532,9 +1530,9 @@ #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec - vo_data->osd_progbar_type=OSD_CONTRAST; - vo_data->osd_progbar_value=((v_cont)<<8)/100; - vo_data->osd_progbar_value = ((v_cont+100)<<8)/200; + mpxp_context().video().output->osd_progbar_type=OSD_CONTRAST; + mpxp_context().video().output->osd_progbar_value=((v_cont)<<8)/100; + mpxp_context().video().output->osd_progbar_value = ((v_cont+100)<<8)/200; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -1550,9 +1548,9 @@ #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec - vo_data->osd_progbar_type=OSD_BRIGHTNESS; - vo_data->osd_progbar_value=((v_bright)<<8)/100; - vo_data->osd_progbar_value = ((v_bright+100)<<8)/200; + mpxp_context().video().output->osd_progbar_type=OSD_BRIGHTNESS; + mpxp_context().video().output->osd_progbar_value=((v_bright)<<8)/100; + mpxp_context().video().output->osd_progbar_value = ((v_bright+100)<<8)/200; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -1568,9 +1566,9 @@ #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec - vo_data->osd_progbar_type=OSD_HUE; - vo_data->osd_progbar_value=((v_hue)<<8)/100; - vo_data->osd_progbar_value = ((v_hue+100)<<8)/200; + mpxp_context().video().output->osd_progbar_type=OSD_HUE; + mpxp_context().video().output->osd_progbar_value=((v_hue)<<8)/100; + mpxp_context().video().output->osd_progbar_value = ((v_hue+100)<<8)/200; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -1586,9 +1584,9 @@ #ifdef USE_OSD if(mp_conf.osd_level){ osd->visible=sh_video->fps; // 1 sec - vo_data->osd_progbar_type=OSD_SATURATION; - vo_data->osd_progbar_value=((v_saturation)<<8)/100; - vo_data->osd_progbar_value = ((v_saturation+100)<<8)/200; + mpxp_context().video().output->osd_progbar_type=OSD_SATURATION; + mpxp_context().video().output->osd_progbar_value=((v_saturation)<<8)/100; + mpxp_context().video().output->osd_progbar_value = ((v_saturation+100)<<8)/200; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -1624,10 +1622,10 @@ } break; case MP_CMD_VO_FULLSCREEN: - vo_data->fullscreen(); + mpxp_context().video().output->fullscreen(); break; case MP_CMD_VO_SCREENSHOT: - vo_data->screenshot(dae_curr_vplayed(xp_core)); + mpxp_context().video().output->screenshot(dae_curr_vplayed(xp_core)); break; case MP_CMD_SUB_POS: { int v; @@ -1697,7 +1695,7 @@ mpxp_init_structs(); MPXPSystem& MPXPSys=mpxp_context().MPXPSys; - vo_data=new(zeromem) Video_Output; + mpxp_context().video().output=new(zeromem) Video_Output; init_signal_handling(); xmp_init(); @@ -1923,7 +1921,7 @@ goto main; } - xp_core->num_v_buffs=vo_data->get_num_frames(); /* that really known after init_vcodecs */ + xp_core->num_v_buffs=mpxp_context().video().output->get_num_frames(); /* that really known after init_vcodecs */ if(mp_conf.autoq>0){ /* Auto quality option enabled*/ @@ -2050,7 +2048,7 @@ else MPXPSys.print_audio_status(); } usleep(250000); - if(sh_video) vo_data->check_events(); + if(sh_video) mpxp_context().video().output->check_events(); #ifdef USE_OSD while((MPXPSys.paint_osd(&osd.visible,&in_pause))!=0); #endif Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/mplayerxp.h 2012-12-04 11:26:21 UTC (rev 505) @@ -125,10 +125,12 @@ struct audio_processing_t { audio_decoder_t* decoder; + ao_data_t* output; }; struct video_processing_t { video_decoder_t* decoder; + Video_Output* output; }; struct MPXPSystem; @@ -196,7 +198,5 @@ void mp_register_options(m_config_t* cfg); extern play_tree_iter_t* playtree_iter; - extern ao_data_t* ao_data; - extern Video_Output* vo_data; } #endif Modified: mplayerxp/postproc/af.cpp =================================================================== --- mplayerxp/postproc/af.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/postproc/af.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -576,7 +576,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_control(ao_data,AOCONTROL_QUERY_FORMAT,fmt); + if(strcmp(filt_name,"ao2")==0) return ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_FORMAT,fmt); else if(afmt2mpaf(fmt)==filt->conf.format) return MPXP_True; return MPXP_False; } @@ -585,7 +585,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_control(ao_data,AOCONTROL_QUERY_RATE,rate); + if(strcmp(filt_name,"ao2")==0) return ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_RATE,rate); else if(rate==filt->conf.rate) return MPXP_True; return MPXP_False; } @@ -594,7 +594,7 @@ { af_instance_t* filt = s?s->first:NULL; const char *filt_name=filt?filt->info->name:"ao2"; - if(strcmp(filt_name,"ao2")==0) return ao_control(ao_data,AOCONTROL_QUERY_CHANNELS,nch); + if(strcmp(filt_name,"ao2")==0) return ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_CHANNELS,nch); else if(nch==filt->conf.nch) return MPXP_True; return MPXP_False; } Modified: mplayerxp/postproc/af_ao2.cpp =================================================================== --- mplayerxp/postproc/af_ao2.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/postproc/af_ao2.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -20,23 +20,23 @@ { unsigned i,ii; int rval; - rval=ao_control(ao_data,AOCONTROL_QUERY_RATE,irate); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_RATE,irate); if(rval == MPXP_True) return irate; for(i=0;i<sizeof(rates)/sizeof(unsigned)-1;i++) { if(irate >= rates[i] && irate < rates[i+1]) break; } ii=i; for(;i<sizeof(rates)/sizeof(unsigned);i++) { - rval=ao_control(ao_data,AOCONTROL_QUERY_RATE,rates[i]); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_RATE,rates[i]); if(rval == MPXP_True) return rates[i]; } i=ii; for(;i<sizeof(rates)/sizeof(unsigned);i--) { - rval=ao_control(ao_data,AOCONTROL_QUERY_RATE,rates[i]); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_RATE,rates[i]); if(rval == MPXP_True) return rates[i]; } for(i=0;i<sizeof(rates)/sizeof(unsigned);i++) { - rval=ao_control(ao_data,AOCONTROL_QUERY_RATE,rates[i]); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_RATE,rates[i]); if(rval == MPXP_True) return rates[i]; } return 44100; @@ -46,14 +46,14 @@ { unsigned i; int rval; - rval=ao_control(ao_data,AOCONTROL_QUERY_CHANNELS,ich); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_CHANNELS,ich); if(rval == MPXP_True) return ich; for(i=ich>1?ich:1;i<AF_NCH;i++) { - rval=ao_control(ao_data,AOCONTROL_QUERY_CHANNELS,i); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_CHANNELS,i); if(rval == MPXP_True) return i; } for(i=1;i<AF_NCH;i++) { - rval=ao_control(ao_data,AOCONTROL_QUERY_CHANNELS,i); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_CHANNELS,i); if(rval == MPXP_True) return i; } return 2; @@ -87,7 +87,7 @@ { unsigned i,j; int rval; - rval=ao_control(ao_data,AOCONTROL_QUERY_FORMAT,ifmt); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_FORMAT,ifmt); if(rval == MPXP_True) return ifmt; rval=-1; for(i=0;i<sizeof(cvt_list)/sizeof(fmt_cvt_t);i++) { @@ -97,7 +97,7 @@ i=rval; for(j=0;j<20;j++) { if(cvt_list[i].cvt_fourcc[j]==0) break; - rval=ao_control(ao_data,AOCONTROL_QUERY_FORMAT,cvt_list[i].cvt_fourcc[j]); + rval=ao_control(mpxp_context().audio().output,AOCONTROL_QUERY_FORMAT,cvt_list[i].cvt_fourcc[j]); if(rval == MPXP_True) return cvt_list[i].cvt_fourcc[j]; } return AFMT_S16_LE; @@ -128,7 +128,7 @@ switch(cmd){ case AF_CONTROL_SHOWCONF: { char sbuf[256]; - const ao_info_t*info=ao_get_info(ao_data); + const ao_info_t*info=ao_get_info(mpxp_context().audio().output); MSG_INFO("AO-CONF: [%s] %uHz nch=%u %s (%3.1f-kbit)\n" ,info->short_name,s->rate,s->nch,mpaf_fmt2str(s->format,sbuf,sizeof(sbuf)) ,(s->rate*s->nch*(s->format&MPAF_BPS_MASK)*8)*0.001f); Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -26,7 +26,7 @@ #include "menu.h" #include "pp_msg.h" -#include "mplayerxp.h" // vo_data +#include "mplayerxp.h" // mpxp_context().video().output extern menu_info_t menu_info_cmdlist; extern menu_info_t menu_info_pt; @@ -128,7 +128,7 @@ int bl = BUF_STEP, br = 0; int f, fd; #ifndef HAVE_FREETYPE - if(vo_data->font == NULL) + if(mpxp_context().video().output->font == NULL) return 0; #endif fd = open(cfg_file, O_RDONLY); @@ -269,8 +269,8 @@ // return the real height of a char: static inline int get_height(int c,int h){ int font; - if ((font=vo_data->font->font[c])>=0) - if(h<vo_data->font->pic_a[font]->h) h=vo_data->font->pic_a[font]->h; + if ((font=mpxp_context().video().output->font->font[c])>=0) + if(h<mpxp_context().video().output->font->pic_a[font]->h) h=mpxp_context().video().output->font->pic_a[font]->h; return h; } @@ -280,7 +280,7 @@ #if 0 while (*txt) { int c = utf8_get_char((const char**)&txt); - render_one_glyph(vo_data->font, c); + render_one_glyph(mpxp_context().video().output->font, c); } #endif } @@ -335,7 +335,7 @@ void menu_draw_text(mp_image_t* mpi,const char* txt, int x, int y) { const LocalPtr<OSD_Render> draw_alpha(new(zeromem) OSD_Render(mpi->imgfmt)); int font; - int finalize=vo_data->is_final(); + int finalize=mpxp_context().video().output->is_final(); #ifdef USE_FRIBIDI txt = menu_fribidi(txt); @@ -344,14 +344,14 @@ while (*txt) { int c=utf8_get_char((const char**)&txt); - if ((font=vo_data->font->font[c])>=0 && (x + vo_data->font->width[c] <= mpi->w) && (y + vo_data->font->pic_a[font]->h <= mpi->h)) - draw_alpha->render(vo_data->font->width[c], vo_data->font->pic_a[font]->h, - vo_data->font->pic_b[font]->bmp+vo_data->font->start[c], - vo_data->font->pic_a[font]->bmp+vo_data->font->start[c], - vo_data->font->pic_a[font]->w, + if ((font=mpxp_context().video().output->font->font[c])>=0 && (x + mpxp_context().video().output->font->width[c] <= mpi->w) && (y + mpxp_context().video().output->font->pic_a[font]->h <= mpi->h)) + draw_alpha->render(mpxp_context().video().output->font->width[c], mpxp_context().video().output->font->pic_a[font]->h, + mpxp_context().video().output->font->pic_b[font]->bmp+mpxp_context().video().output->font->start[c], + mpxp_context().video().output->font->pic_a[font]->bmp+mpxp_context().video().output->font->start[c], + mpxp_context().video().output->font->pic_a[font]->w, mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3), mpi->stride[0],finalize); - x+=vo_data->font->width[c]+vo_data->font->charspace; + x+=mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } } @@ -364,7 +364,7 @@ int sx, xmin, xmax, xmid, xrmin; int ll = 0; int font; - int finalize=vo_data->is_final(); + int finalize=mpxp_context().video().output->is_final(); const LocalPtr<OSD_Render> draw_alpha(new(zeromem) OSD_Render(mpi->imgfmt)); #ifdef USE_FRIBIDI @@ -433,12 +433,12 @@ // Jump some the beginnig text if needed while(sy < ymin && *txt) { int c=utf8_get_char((const char**)&txt); - if(c == '\n' || (warp && ll + vo_data->font->width[c] > w)) { + if(c == '\n' || (warp && ll + mpxp_context().video().output->font->width[c] > w)) { ll = 0; - sy += vo_data->font->height + vspace; + sy += mpxp_context().video().output->font->height + vspace; if(c == '\n') continue; } - ll += vo_data->font->width[c]+vo_data->font->charspace; + ll += mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } if(*txt == '\0') // Nothing left to draw return; @@ -448,7 +448,7 @@ int n; if(txt[0] == '\n') { // New line - sy += vo_data->font->height + vspace; + sy += mpxp_context().video().output->font->height + vspace; txt++; continue; } @@ -456,11 +456,11 @@ // Get the length and end of this line for(n = 0, ll = 0 ; txt[n] != '\0' && txt[n] != '\n' ; n++) { unsigned char c = txt[n]; - if(warp && ll + vo_data->font->width[c] > w) break; - ll += vo_data->font->width[c]+vo_data->font->charspace; + if(warp && ll + mpxp_context().video().output->font->width[c] > w) break; + ll += mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } line_end = &txt[n]; - ll -= vo_data->font->charspace; + ll -= mpxp_context().video().output->font->charspace; if(align & (MENU_TEXT_HCENTER|MENU_TEXT_RIGHT)) { @@ -470,25 +470,25 @@ int mid = ll/2; // Find the middle point for(n--, ll = 0 ; n <= 0 ; n--) { - ll += vo_data->font->width[(int)txt[n]]+vo_data->font->charspace; - if(ll - vo_data->font->charspace > mid) break; + ll += mpxp_context().video().output->font->width[(int)txt[n]]+mpxp_context().video().output->font->charspace; + if(ll - mpxp_context().video().output->font->charspace > mid) break; } - ll -= vo_data->font->charspace; + ll -= mpxp_context().video().output->font->charspace; sx = xmid + mid - ll; } else// MENU_TEXT_RIGHT) - sx = xmax + vo_data->font->charspace; + sx = xmax + mpxp_context().video().output->font->charspace; // We are after the start point -> go back if(sx > xmin) { for(n-- ; n <= 0 ; n--) { unsigned char c = txt[n]; - if(sx - vo_data->font->width[c] - vo_data->font->charspace < xmin) break; - sx -= vo_data->font->width[c]+vo_data->font->charspace; + if(sx - mpxp_context().video().output->font->width[c] - mpxp_context().video().output->font->charspace < xmin) break; + sx -= mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } } else { // We are before the start point -> go forward for( ; sx < xmin && (&txt[n]) != line_end ; n++) { unsigned char c = txt[n]; - sx += vo_data->font->width[c]+vo_data->font->charspace; + sx += mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } } txt = &txt[n]; // Jump to the new start char @@ -501,32 +501,32 @@ } else { for(sx = xrmin ; sx < xmin && txt != line_end ; txt++) { unsigned char c = txt[n]; - sx += vo_data->font->width[c]+vo_data->font->charspace; + sx += mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } } while(sx < xmax && txt != line_end) { int c=utf8_get_char((const char**)&txt); - font = vo_data->font->font[c]; + font = mpxp_context().video().output->font->font[c]; if(font >= 0) { - int cs = (vo_data->font->pic_a[font]->h - vo_data->font->height) / 2; - if ((sx + vo_data->font->width[c] < xmax) && (sy + vo_data->font->height < ymax) ) - draw_alpha->render(vo_data->font->width[c], vo_data->font->height, - vo_data->font->pic_b[font]->bmp+vo_data->font->start[c] + - cs * vo_data->font->pic_a[font]->w, - vo_data->font->pic_a[font]->bmp+vo_data->font->start[c] + - cs * vo_data->font->pic_a[font]->w, - vo_data->font->pic_a[font]->w, + int cs = (mpxp_context().video().output->font->pic_a[font]->h - mpxp_context().video().output->font->height) / 2; + if ((sx + mpxp_context().video().output->font->width[c] < xmax) && (sy + mpxp_context().video().output->font->height < ymax) ) + draw_alpha->render(mpxp_context().video().output->font->width[c], mpxp_context().video().output->font->height, + mpxp_context().video().output->font->pic_b[font]->bmp+mpxp_context().video().output->font->start[c] + + cs * mpxp_context().video().output->font->pic_a[font]->w, + mpxp_context().video().output->font->pic_a[font]->bmp+mpxp_context().video().output->font->start[c] + + cs * mpxp_context().video().output->font->pic_a[font]->w, + mpxp_context().video().output->font->pic_a[font]->w, mpi->planes[0] + sy * mpi->stride[0] + sx * (mpi->bpp>>3), mpi->stride[0],finalize); // else //printf("Can't draw '%c'\n",c); } - sx+=vo_data->font->width[c]+vo_data->font->charspace; + sx+=mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } txt = line_end; if(txt[0] == '\0') break; - sy += vo_data->font->height + vspace; + sy += mpxp_context().video().output->font->height + vspace; } } @@ -535,9 +535,9 @@ render_txt(txt); while (*txt) { int c=utf8_get_char((const char**)&txt); - l += vo_data->font->width[c]+vo_data->font->charspace; + l += mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } - return l - vo_data->font->charspace; + return l - mpxp_context().video().output->font->charspace; } void menu_text_size(const char* txt,int max_width, int vspace, int warp, int* _w, int* _h) { @@ -547,18 +547,18 @@ render_txt(txt); while (*txt) { int c=utf8_get_char((const char**)&txt); - if(c == '\n' || (warp && i + vo_data->font->width[c] >= max_width)) { + if(c == '\n' || (warp && i + mpxp_context().video().output->font->width[c] >= max_width)) { if(*txt) l++; i = 0; if(c == '\n') continue; } - i += vo_data->font->width[c]+vo_data->font->charspace; + i += mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; if(i > w) w = i; } *_w = w; - *_h = (l-1) * (vo_data->font->height + vspace) + vo_data->font->height; + *_h = (l-1) * (mpxp_context().video().output->font->height + vspace) + mpxp_context().video().output->font->height; } @@ -567,12 +567,12 @@ render_txt(txt); while (*txt) { int c=utf8_get_char((const char**)&txt); - if(c == '\n' || i + vo_data->font->width[c] > max_width) { + if(c == '\n' || i + mpxp_context().video().output->font->width[c] > max_width) { l++; i = 0; if(c == '\n') continue; } - i += vo_data->font->width[c]+vo_data->font->charspace; + i += mpxp_context().video().output->font->width[c]+mpxp_context().video().output->font->charspace; } return l; } @@ -586,10 +586,10 @@ txt++; break; } - i += vo_data->font->width[c]; + i += mpxp_context().video().output->font->width[c]; if(i >= max_width) break; - i += vo_data->font->charspace; + i += mpxp_context().video().output->font->charspace; } return txt; } @@ -610,7 +610,7 @@ if(g < 1) g = 1; { - int finalize = vo_data->is_final(); + int finalize = mpxp_context().video().output->is_final(); int stride = (w+7)&(~7); // round to 8 unsigned char pic[stride*h],pic_alpha[stride*h]; memset(pic,g,stride*h); Modified: mplayerxp/postproc/libmenu/menu_list.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_list.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/postproc/libmenu/menu_list.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -16,7 +16,7 @@ #include "libvo/video_out.h" #include "osdep/keycodes.h" -#include "mplayerxp.h" // vo_data +#include "mplayerxp.h" // mpxp_context().video().output #define IMPL 1 #include "menu_list.h" @@ -45,10 +45,10 @@ dw = w - 2*mpriv->minb; ptr_l = mpriv->ptr ? menu_text_length(mpriv->ptr) : 0; // mpi is too small - if(h - vo_data->font->height <= 0 || w - ptr_l <= 0 || dw <= 0 || dh <= 0) + if(h - mpxp_context().video().output->font->height <= 0 || w - ptr_l <= 0 || dw <= 0 || dh <= 0) return; - th = menu_text_num_lines(mpriv->title,dw) * (mpriv->vspace + vo_data->font->height) + mpriv->vspace; + th = menu_text_num_lines(mpriv->title,dw) * (mpriv->vspace + mpxp_context().video().output->font->height) + mpriv->vspace; // the selected item is hidden, find a visible one if(mpriv->current->hide) { @@ -78,17 +78,17 @@ else y = mpriv->minb; - need_h = count * (mpriv->vspace + vo_data->font->height) - mpriv->vspace; + need_h = count * (mpriv->vspace + mpxp_context().video().output->font->height) - mpriv->vspace; if( need_h + th > dh) { int start,end; - mpriv->disp_lines = (dh + mpriv->vspace - th) / (mpriv->vspace + vo_data->font->height); + mpriv->disp_lines = (dh + mpriv->vspace - th) / (mpriv->vspace + mpxp_context().video().output->font->height); if(mpriv->disp_lines < 4) { th = 0; - mpriv->disp_lines = (dh + mpriv->vspace) / ( vo_data->font->height + mpriv->vspace); + mpriv->disp_lines = (dh + mpriv->vspace) / ( mpxp_context().video().output->font->height + mpriv->vspace); } // Too smoll if(mpriv->disp_lines < 1) return; - need_h = mpriv->disp_lines*(mpriv->vspace + vo_data->font->height) - mpriv->vspace; + need_h = mpriv->disp_lines*(mpriv->vspace + mpxp_context().video().output->font->height) - mpriv->vspace; start = sidx - (mpriv->disp_lines/2); if(start < 0) start = 0; @@ -126,13 +126,13 @@ dy += th; } - for( ; m != NULL && dy + vo_data->font->height < dh ; m = m->next ) { + for( ; m != NULL && dy + mpxp_context().video().output->font->height < dh ; m = m->next ) { if(m->hide) continue; if(m == mpriv->current) { if(mpriv->ptr_bg >= 0) menu_draw_box(mpi,mpriv->ptr_bg,mpriv->ptr_bg_alpha, x < 0 ? (mpi->w-bg_w)/2 : x-mpriv->minb,dy+y-mpriv->vspace/2, - bg_w,vo_data->font->height + mpriv->vspace); + bg_w,mpxp_context().video().output->font->height + mpriv->vspace); if(ptr_l > 0) menu_draw_text_full(mpi,mpriv->ptr, x < 0 ? (mpi->w - need_w) / 2 + ptr_l : x, @@ -143,14 +143,14 @@ } else if(mpriv->item_bg >= 0) menu_draw_box(mpi,mpriv->item_bg,mpriv->item_bg_alpha, x < 0 ? (mpi->w-bg_w)/2 : x-mpriv->minb,dy+y-mpriv->vspace/2, - bg_w,vo_data->font->height + mpriv->vspace); + bg_w,mpxp_context().video().output->font->height + mpriv->vspace); menu_draw_text_full(mpi,m->txt, x < 0 ? (mpi->w - need_w) / 2 + ptr_l : x + ptr_l, dy+y,dw-ptr_l,dh - dy, mpriv->vspace,0, MENU_TEXT_TOP|MENU_TEXT_LEFT, MENU_TEXT_TOP|MENU_TEXT_LEFT); - dy += vo_data->font->height + mpriv->vspace; + dy += mpxp_context().video().output->font->height + mpriv->vspace; } } Modified: mplayerxp/postproc/libmenu/menu_txt.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_txt.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/postproc/libmenu/menu_txt.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -20,7 +20,7 @@ #include "libvo/video_out.h" #include "osdep/keycodes.h" #include "pp_msg.h" -#include "mplayerxp.h" // vo_data +#include "mplayerxp.h" // mpxp_context().video().output struct menu_priv_s { char** lines; @@ -98,13 +98,13 @@ static void draw(menu_t* menu,mp_image_t* mpi) { int x = mpriv->minb; int y = mpriv->minb; - //int th = 2*mpriv->hspace + vo_data->font->height; + //int th = 2*mpriv->hspace + mpxp_context().video().output->font->height; int i,end; if(x < 0) x = 8; if(y < 0) y = 8; - mpriv->disp_lines = (mpi->h + mpriv->hspace - 2*mpriv->minb) / ( vo_data->font->height + mpriv->hspace); + mpriv->disp_lines = (mpi->h + mpriv->hspace - 2*mpriv->minb) / ( mpxp_context().video().output->font->height + mpriv->hspace); if(mpriv->num_lines - mpriv->cur_line < mpriv->disp_lines) { i = mpriv->num_lines - 1 - mpriv->disp_lines; if(i < 0) i = 0; @@ -117,7 +117,7 @@ for( ; i < end ; i++) { menu_draw_text(mpi,mpriv->lines[i],x,y); - y += vo_data->font->height + mpriv->hspace; + y += mpxp_context().video().output->font->height + mpriv->hspace; } } Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/postproc/vf.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -18,7 +18,7 @@ #include "osdep/fastmemcpy.h" #include "libmpconf/codec-cfg.h" #include "pp_msg.h" -#include "mplayerxp.h" // vo_data +#include "mplayerxp.h" // mpxp_context().video().output extern const vf_info_t vf_info_1bpp; extern const vf_info_t vf_info_2xsai; @@ -645,7 +645,7 @@ _this->conf.h=h; _this->conf.fourcc=fmt; if(reset_cache) mpxp_reset_vcache(); - vo_data->reset(); + mpxp_context().video().output->reset(); } } _this=first; Modified: mplayerxp/postproc/vf_expand.cpp =================================================================== --- mplayerxp/postproc/vf_expand.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/postproc/vf_expand.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -19,7 +19,7 @@ #include "libvo/sub.h" #endif #include "pp_msg.h" -#include "mplayerxp.h" // vo_data +#include "mplayerxp.h" // mpxp_context().video().output struct vf_priv_t { int up_h,dn_h; @@ -36,7 +36,7 @@ vf->priv->w=width; vf->priv->h=height; if(vf->priv->dn_h==-1 || vf->priv->up_h==-1) - vf->priv->dn_h=vf->priv->up_h=(get_osd_height(vo_data,OSD_PB_START,0)*4)/3; + vf->priv->dn_h=vf->priv->up_h=(get_osd_height(mpxp_context().video().output,OSD_PB_START,0)*4)/3; h=height+vf->priv->up_h+vf->priv->dn_h; dh=d_height+vf->priv->up_h+vf->priv->dn_h; return vf_next_config(vf,width,h,d_width,dh,flags,outfmt); Modified: mplayerxp/postproc/vf_vo.cpp =================================================================== --- mplayerxp/postproc/vf_vo.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/postproc/vf_vo.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -12,7 +12,7 @@ #include "libvo/video_out.h" #include "libvo/dri_vo.h" #include "pp_msg.h" -#include "mplayerxp.h" // vo_data +#include "mplayerxp.h" // mpxp_context().video().output //===========================================================================// struct vf_priv_t { @@ -26,7 +26,7 @@ static void __FASTCALL__ print_conf(vf_instance_t* vf) { - const vo_info_t *info = vo_data->get_info(); + const vo_info_t *info = mpxp_context().video().output->get_info(); MSG_INFO("VO-CONF: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name, vf->priv->sw, vf->priv->sh, vf->priv->dw, vf->priv->dh, @@ -63,7 +63,7 @@ // save vo's stride capability for the wanted colorspace: vf->default_caps=query_format(vf,outfmt,d_width,d_height);// & VFCAP_ACCEPT_STRIDE; - if(MPXP_Ok!=vo_data->configure(vf->parent,width,height,d_width,d_height,flags,"MPlayerXP",outfmt)) + if(MPXP_Ok!=mpxp_context().video().output->configure(vf->parent,width,height,d_width,d_height,flags,"MPlayerXP",outfmt)) return 0; vf->priv->is_planar=vo_describe_fourcc(outfmt,&vf->priv->vd); vf->conf.w=d_width; @@ -81,12 +81,12 @@ case VFCTRL_SET_EQUALIZER: { vf_equalizer_t *eq=reinterpret_cast<vf_equalizer_t*>(data); if(!vo_config_count) return MPXP_False; // vo not configured? - return vo_data->ctrl(VOCTRL_SET_EQUALIZER, eq); + return mpxp_context().video().output->ctrl(VOCTRL_SET_EQUALIZER, eq); } case VFCTRL_GET_EQUALIZER: { vf_equalizer_t *eq=reinterpret_cast<vf_equalizer_t*>(data); if(!vo_config_count) return MPXP_False; // vo not configured? - return vo_data->ctrl(VOCTRL_GET_EQUALIZER, eq); + return mpxp_context().video().output->ctrl(VOCTRL_GET_EQUALIZER, eq); } } // return video_out->control_vf(request,data); @@ -96,12 +96,12 @@ static int __FASTCALL__ query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h){ dri_surface_cap_t dcaps; int rflags; - uint32_t flags=vo_data->query_format(&fmt,w,h); + uint32_t flags=mpxp_context().video().output->query_format(&fmt,w,h); MSG_DBG2("[vf_vo] %i=query_format(%s)\n",flags,vo_format_name(fmt)); rflags=0; UNUSED(vf); if(flags) { - vo_data->get_surface_caps(&dcaps); + mpxp_context().video().output->get_surface_caps(&dcaps); if(dcaps.caps&DRI_CAP_UPSCALER) rflags |=VFCAP_HWSCALE_UP; if(dcaps.caps&DRI_CAP_DOWNSCALER) rflags |=VFCAP_HWSCALE_DOWN; if(rflags&(VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN)) rflags |= VFCAP_SWSCALE; @@ -116,8 +116,8 @@ mp_image_t *mpi){ MPXP_Rc retval; UNUSED(vf); - int finalize = vo_data->is_final(); - retval=vo_data->get_surface(mpi); + int finalize = mpxp_context().video().output->is_final(); + retval=mpxp_context().video().output->get_surface(mpi); if(retval==MPXP_Ok) { mpi->flags |= MP_IMGFLAG_FINAL|MP_IMGFLAG_DIRECT; if(finalize) mpi->flags |= MP_IMGFLAG_FINALIZED; @@ -130,7 +130,7 @@ if(!vo_config_count) return 0; // vo not configured? if(!(mpi->flags & MP_IMGFLAG_FINAL) || (vf_first(vf)==vf && !(mpi->flags & MP_IMGFLAG_RENDERED))) { MSG_DBG2("vf_vo_put_slice was called(%u): %u %u %u %u\n",mpi->xp_idx,mpi->x,mpi->y,mpi->w,mpi->h); - vo_data->draw_slice(mpi); + mpxp_context().video().output->draw_slice(mpi); } return 1; } Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -44,8 +44,8 @@ float pts=HUGE; int ret=0; - ao_data->pts=sh_audio->timer*90000.0; - playsize=ao_get_space(ao_data); + mpxp_context().audio().output->pts=sh_audio->timer*90000.0; + playsize=ao_get_space(mpxp_context().audio().output); if(!playsize) { if(sh_video) @@ -87,9 +87,9 @@ } if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; - if(xmp_test_model(XMP_Run_AudioPlayer)) dec_ahead_audio_delay=ao_get_delay(ao_data); + if(xmp_test_model(XMP_Run_AudioPlayer)) dec_ahead_audio_delay=ao_get_delay(mpxp_context().audio().output); - playsize=ao_play(ao_data,sh_audio->a_buffer,playsize,0); + playsize=ao_play(mpxp_context().audio().output,sh_audio->a_buffer,playsize,0); if(playsize>0){ sh_audio->a_buffer_len-=playsize; @@ -99,7 +99,7 @@ if(mpxp_context().use_pts_fix2) { if(sh_audio->a_pts != HUGE) { sh_audio->a_pts_pos-=playsize; - if(sh_audio->a_pts_pos > -ao_get_delay(ao_data)*sh_audio->af_bps) { + if(sh_audio->a_pts_pos > -ao_get_delay(mpxp_context().audio().output)*sh_audio->af_bps) { sh_audio->timer+=playsize/(float)(sh_audio->af_bps); } else { sh_audio->timer=sh_audio->a_pts-(float)sh_audio->a_pts_pos/(float)sh_audio->af_bps; @@ -142,7 +142,7 @@ int eof = 0; struct timeval now; float d; - const float MAX_AUDIO_TIME = (float)ao_get_space(ao_data) / sh_audio->af_bps + ao_get_delay(ao_data); + const float MAX_AUDIO_TIME = (float)ao_get_space(mpxp_context().audio().output) / sh_audio->af_bps + ao_get_delay(mpxp_context().audio().output); float min_audio_time = MAX_AUDIO_TIME; float min_audio, max_audio; int samples, collect_samples; @@ -230,7 +230,7 @@ } LOCK_AUDIO_PLAY(); - d = ao_get_delay(ao_data) - min_audio_time; + d = ao_get_delay(mpxp_context().audio().output) - min_audio_time; if( d > 0 ) { gettimeofday(&now,NULL); audio_play_timeout.tv_nsec = now.tv_usec * 1000 + d*1000000000l; Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-04 11:04:20 UTC (rev 504) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-04 11:26:21 UTC (rev 505) @@ -41,8 +41,8 @@ } static void show_status_line_no_apts(sh_audio_t* sh_audio,float v_pts) { - if(mp_conf.av_sync_pts && sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data))) { - float a_pts = sh_audio->timer-ao_get_delay(ao_data); + if(mp_conf.av_sync_pts && sh_audio && (!xp_core->audio->eof || ao_get_delay(mpxp_context().audio().output))) { + float a_pts = sh_audio->timer-ao_get_delay(mpxp_context().audio().output); MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" ,a_pts ,v_pts @@ -70,7 +70,7 @@ { if(mpxp_context().use_pts_fix2 && sh_audio) { if(sh_video->chapter_change == -1) { /* First frame after seek */... [truncated message content] |
From: <nic...@us...> - 2012-12-04 16:36:58
|
Revision: 508 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=508&view=rev Author: nickols_k Date: 2012-12-04 16:36:42 +0000 (Tue, 04 Dec 2012) Log Message: ----------- convert struct demuxer_t into Demuxer Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/dump.h mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_audio.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_demuxers.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_fli.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_nsv.cpp mplayerxp/libmpdemux/demux_null.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_rawvideo.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_smjpeg.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_internal.h mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpdemux/demuxer_r.h mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpdemux/demuxer_stream.h mplayerxp/libmpdemux/mux_mpxp64.cpp mplayerxp/libmpdemux/mux_raw.cpp mplayerxp/libmpdemux/muxer.cpp mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/stheader.h mplayerxp/libmpdemux/video.cpp mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/s_tv.cpp mplayerxp/libmpstream/stream.h mplayerxp/mp-opt-reg.cpp mplayerxp/mplayerxp.cpp mplayerxp/xmpcore/mp_aframe.cpp mplayerxp/xmpcore/mp_aframe.h mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/dump.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -119,7 +119,7 @@ return retval; } -void dump_mux_init(demuxer_t *demuxer,any_t* libinput) +void dump_mux_init(Demuxer *demuxer,any_t* libinput) { sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); sh_video_t* shv=reinterpret_cast<sh_video_t*>(demuxer->video->sh); @@ -223,7 +223,7 @@ muxer_write_header(priv->muxer,demuxer); } -void dump_mux_close(demuxer_t *demuxer) +void dump_mux_close(Demuxer *demuxer) { dump_priv_t* priv=static_cast<dump_priv_t*>(demuxer->priv); Demuxer_Stream *d_audio=demuxer->audio; @@ -283,7 +283,7 @@ } -void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) +void dump_mux(Demuxer *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) { dump_priv_t* priv=static_cast<dump_priv_t*>(demuxer->priv); Demuxer_Stream *d_audio=demuxer->audio; Modified: mplayerxp/dump.h =================================================================== --- mplayerxp/dump.h 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/dump.h 2012-12-04 16:36:42 UTC (rev 508) @@ -7,9 +7,9 @@ namespace mpxp { int dump_parse(const char *param); void dump_stream(stream_t *stream); - void dump_mux_init(demuxer_t *demuxer,any_t*libinput); - void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames); - void dump_mux_close(demuxer_t *demuxer); + void dump_mux_init(Demuxer *demuxer,any_t*libinput); + void dump_mux(Demuxer *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames); + void dump_mux_close(Demuxer *demuxer); void __FASTCALL__ dump_stream_event_handler(stream_t *s,const stream_packet_t*sp); } //namespace #endif Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -40,7 +40,7 @@ int verc; }; -static MPXP_Rc aiff_probe(demuxer_t* demuxer) +static MPXP_Rc aiff_probe(Demuxer* demuxer) { char buf[12]; stream_t *s; @@ -51,7 +51,7 @@ return MPXP_False; } -static demuxer_t* aiff_open(demuxer_t* demuxer) { +static Demuxer* aiff_open(Demuxer* demuxer) { sh_audio_t* sh_audio; WAVEFORMATEX* w; stream_t *s; @@ -59,9 +59,9 @@ char preamble[8]; s = demuxer->stream; - sh_audio = new_sh_audio(demuxer,0); + sh_audio = demuxer->new_sh_audio(); demuxer->priv=priv=new(zeromem) priv_t; - sh_audio->wf = w = (WAVEFORMATEX*)mp_malloc(sizeof(WAVEFORMATEX)); + sh_audio->wf = w = new(zeromem) WAVEFORMATEX; w->wFormatTag = 0x1; sh_audio->wtag = mmioFOURCC('r','a','w',' '); /* S16BE */ w->nChannels = sh_audio->nch = w->nSamplesPerSec = sh_audio->rate = @@ -184,7 +184,7 @@ return demuxer; } -static int aiff_demux(demuxer_t* demuxer, Demuxer_Stream *ds) { +static int aiff_demux(Demuxer* demuxer, Demuxer_Stream *ds) { sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); int l = sh_audio->wf->nAvgBytesPerSec; off_t spos = stream_tell(demuxer->stream); @@ -204,7 +204,7 @@ return 1; } -static void aiff_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +static void aiff_seek(Demuxer *demuxer,const seek_args_t* seeka){ stream_t* s = demuxer->stream; sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); off_t base,pos; @@ -215,12 +215,12 @@ stream_seek(s,pos); } -static void aiff_close(demuxer_t* demuxer) +static void aiff_close(Demuxer* demuxer) { delete demuxer->priv; } -static MPXP_Rc aiff_control(const demuxer_t *demuxer,int cmd,any_t*args) +static MPXP_Rc aiff_control(const Demuxer *demuxer,int cmd,any_t*args) { UNUSED(demuxer); UNUSED(cmd); Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_asf.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -121,7 +121,7 @@ } } -static MPXP_Rc asf_probe(demuxer_t *demuxer){ +static MPXP_Rc asf_probe(Demuxer *demuxer){ const unsigned char asfhdrguid[16]= {0x30,0x26,0xB2,0x75,0x8E,0x66,0xCF,0x11,0xA6,0xD9,0x00,0xAA,0x00,0x62,0xCE,0x6C}; const unsigned char asf2hdrguid[16]={0xD1,0x29,0xE2,0xD6,0xDA,0x35,0xD1,0x11,0x90,0x34,0x00,0xA0,0xC9,0x03,0x49,0xBE}; asf_priv_t* apriv; @@ -150,11 +150,11 @@ delete demuxer->priv; return MPXP_False; // invalid header??? } - demuxer->file_format=DEMUXER_TYPE_ASF; + demuxer->file_format=Demuxer::Type_ASF; return MPXP_Ok; } -static demuxer_t* asf_open(demuxer_t *demuxer){ +static Demuxer* asf_open(Demuxer *demuxer){ static unsigned char buffer[2048]; uint32_t* streams = NULL; int audio_streams=0; @@ -189,7 +189,7 @@ stream_read(demuxer->stream,(char*) buffer,apriv->streamh.type_size); switch(ASF_LOAD_GUID_PREFIX(apriv->streamh.type)){ case ASF_GUID_PREFIX_audio_stream: { - sh_audio_t* sh_audio=new_sh_audio(demuxer,apriv->streamh.stream_no & 0x7F); + sh_audio_t* sh_audio=demuxer->new_sh_audio(apriv->streamh.stream_no & 0x7F); ++audio_streams; sh_audio->wf=(WAVEFORMATEX*)mp_calloc((apriv->streamh.type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):apriv->streamh.type_size,1); memcpy(sh_audio->wf,buffer,apriv->streamh.type_size); @@ -208,7 +208,7 @@ break; } case ASF_GUID_PREFIX_video_stream: { - sh_video_t* sh_video=new_sh_video(demuxer,apriv->streamh.stream_no & 0x7F); + sh_video_t* sh_video=demuxer->new_sh_video(apriv->streamh.stream_no & 0x7F); unsigned int len=apriv->streamh.type_size-(4+4+1+2); ++video_streams; sh_video->bih=(BITMAPINFOHEADER*)mp_mallocz(len<sizeof(BITMAPINFOHEADER)?sizeof(BITMAPINFOHEADER):len); @@ -422,7 +422,7 @@ } -static int demux_asf_read_packet(demuxer_t *demux,off_t dataoff,int len,int id,int seq,unsigned long time,unsigned short dur,int offs,int keyframe){ +static int demux_asf_read_packet(Demuxer *demux,off_t dataoff,int len,int id,int seq,unsigned long time,unsigned short dur,int offs,int keyframe){ Demuxer_Stream *ds=NULL; asf_priv_t *apriv=static_cast<asf_priv_t*>(demux->priv); @@ -501,7 +501,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int asf_demux(demuxer_t *demux,Demuxer_Stream *ds){ +static int asf_demux(Demuxer *demux,Demuxer_Stream *ds){ stream_t *stream=demux->stream; asf_priv_t *apriv=static_cast<asf_priv_t*>(demux->priv); int done=0; @@ -690,7 +690,7 @@ } -static void asf_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +static void asf_seek(Demuxer *demuxer,const seek_args_t* seeka){ Demuxer_Stream *d_audio=demuxer->audio; Demuxer_Stream *d_video=demuxer->video; asf_priv_t *apriv=static_cast<asf_priv_t*>(demuxer->priv); @@ -717,12 +717,12 @@ } } -static void asf_close(demuxer_t *demuxer) +static void asf_close(Demuxer *demuxer) { delete demuxer->priv; } -static MPXP_Rc asf_control(const demuxer_t *demuxer,int cmd,any_t*args) +static MPXP_Rc asf_control(const Demuxer *demuxer,int cmd,any_t*args) { UNUSED(demuxer); UNUSED(cmd); Modified: mplayerxp/libmpdemux/demux_audio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_audio.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_audio.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -411,7 +411,7 @@ } } -static void find_next_mp3_hdr(demuxer_t *demuxer,uint8_t *hdr) { +static void find_next_mp3_hdr(Demuxer *demuxer,uint8_t *hdr) { int len; off_t spos; while(!stream_eof(demuxer->stream)) { @@ -428,7 +428,7 @@ } -static int read_mp3v1_tags(demuxer_t *demuxer,uint8_t *hdr, off_t pos ) +static int read_mp3v1_tags(Demuxer *demuxer,uint8_t *hdr, off_t pos ) { unsigned n; stream_t *s=demuxer->stream; @@ -482,7 +482,7 @@ return 1; } -static int read_ac3_tags(demuxer_t *demuxer,uint8_t *hdr, off_t pos,unsigned *bitrate,unsigned *samplerate,unsigned *channels) +static int read_ac3_tags(Demuxer *demuxer,uint8_t *hdr, off_t pos,unsigned *bitrate,unsigned *samplerate,unsigned *channels) { uint8_t b[8]; unsigned n; @@ -506,7 +506,7 @@ return 1; } -static int read_ddca_tags(demuxer_t *demuxer,uint8_t *hdr, off_t pos,unsigned *bitrate,unsigned *samplerate,unsigned *channels) +static int read_ddca_tags(Demuxer *demuxer,uint8_t *hdr, off_t pos,unsigned *bitrate,unsigned *samplerate,unsigned *channels) { uint8_t b[12]; unsigned n; @@ -545,7 +545,7 @@ /* frame header */ #define ID3V22_FRAME_HEADER_SIZE 6 -static int read_id3v22_tags(demuxer_t *demuxer,unsigned flags,unsigned hsize) +static int read_id3v22_tags(Demuxer *demuxer,unsigned flags,unsigned hsize) { off_t pos,epos; stream_t *s=demuxer->stream; @@ -610,7 +610,7 @@ #define ID3V23_FRAME_GROUP_ID_FLAG 0x0020 #define ID3V23_FRAME_ZERO_FLAG 0x1F1F -static int read_id3v23_tags(demuxer_t *demuxer,unsigned flags,unsigned hsize) +static int read_id3v23_tags(Demuxer *demuxer,unsigned flags,unsigned hsize) { off_t pos,epos; stream_t *s=demuxer->stream; @@ -686,7 +686,7 @@ #define ID3V24_FRAME_DATA_LEN_FLAG 0x0001 #define ID3V24_FRAME_ZERO_FLAG 0x8FB0 -static int read_id3v24_tags(demuxer_t *demuxer,unsigned flags,unsigned hsize) +static int read_id3v24_tags(Demuxer *demuxer,unsigned flags,unsigned hsize) { off_t pos,epos; stream_t *s=demuxer->stream; @@ -741,7 +741,7 @@ return 1; } -static int read_id3v2_tags(demuxer_t *demuxer) +static int read_id3v2_tags(Demuxer *demuxer) { char buf[4]; stream_t* s=demuxer->stream; @@ -762,7 +762,7 @@ return 1; } -static int audio_get_raw_id(demuxer_t *demuxer,off_t fptr,unsigned *brate,unsigned *samplerate,unsigned *channels) +static int audio_get_raw_id(Demuxer *demuxer,off_t fptr,unsigned *brate,unsigned *samplerate,unsigned *channels) { int retval=0; uint32_t fcc,fcc1,fmt; @@ -800,7 +800,7 @@ return retval; } -static MPXP_Rc audio_probe(demuxer_t* demuxer) +static MPXP_Rc audio_probe(Demuxer* demuxer) { uint32_t fcc1,fcc2; stream_t *s; @@ -864,7 +864,7 @@ extern const demuxer_driver_t demux_audio; -static demuxer_t* audio_open(demuxer_t* demuxer) { +static Demuxer* audio_open(Demuxer* demuxer) { stream_t *s; sh_audio_t* sh_audio; uint8_t hdr[HDR_SIZE]; @@ -1011,7 +1011,7 @@ MSG_ERR("Can't detect audio format\n"); return NULL; } - sh_audio = new_sh_audio(demuxer,0); + sh_audio = demuxer->new_sh_audio(); MSG_DBG2("mp3_header off: st_pos=%lu n=%lu HDR_SIZE=%u\n",st_pos,n,HDR_SIZE); demuxer->movi_start = stream_tell(s); demuxer->movi_end = s->end_pos; @@ -1216,7 +1216,7 @@ MSG_DBG2("Found %u bytes WAVEFORMATEX\n",l); if(l < 16) { MSG_ERR("Bad wav header length : too short !!!\n"); - free_sh_audio(sh_audio); + delete sh_audio; return NULL; } w->wFormatTag = sh_audio->wtag = stream_read_word_le(s); @@ -1394,9 +1394,9 @@ return out & mask; } -static int audio_demux(demuxer_t *demuxer,Demuxer_Stream *ds) { +static int audio_demux(Demuxer *demuxer,Demuxer_Stream *ds) { sh_audio_t* sh_audio; - demuxer_t* demux; + Demuxer* demux; da_priv_t* priv; stream_t* s; int frmt,seof; @@ -1577,7 +1577,7 @@ return 0; } -static void high_res_mp3_seek(demuxer_t *demuxer,float _time) { +static void high_res_mp3_seek(Demuxer *demuxer,float _time) { uint8_t hdr[4]; int len,nf; da_priv_t* priv = static_cast<da_priv_t*>(demuxer->priv); @@ -1598,7 +1598,7 @@ } } -static void high_res_ac3_seek(demuxer_t *demuxer,float _time) { +static void high_res_ac3_seek(Demuxer *demuxer,float _time) { uint8_t hdr[8]; int len,nf; unsigned tmp; @@ -1620,7 +1620,7 @@ } } -static void high_res_ddca_seek(demuxer_t *demuxer,float _time) { +static void high_res_ddca_seek(Demuxer *demuxer,float _time) { uint8_t hdr[12]; int len,nf; unsigned tmp; @@ -1642,7 +1642,7 @@ } } -static void audio_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +static void audio_seek(Demuxer *demuxer,const seek_args_t* seeka){ sh_audio_t* sh_audio; stream_t* s; int base,pos,frmt; @@ -1764,14 +1764,14 @@ stream_seek(s,pos); } -static void audio_close(demuxer_t* demuxer) { +static void audio_close(Demuxer* demuxer) { da_priv_t* priv = static_cast<da_priv_t*>(demuxer->priv); if(!priv) return; delete priv; } -static MPXP_Rc audio_control(const demuxer_t *demuxer,int cmd,any_t*args) +static MPXP_Rc audio_control(const Demuxer *demuxer,int cmd,any_t*args) { UNUSED(demuxer); UNUSED(cmd); Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -23,7 +23,7 @@ #include "aviprint.h" #include "demux_msg.h" -typedef int (*alt_demuxer_t)(demuxer_t *demux,Demuxer_Stream *__ds); +typedef int (*alt_demuxer_t)(Demuxer *demux,Demuxer_Stream *__ds); struct avi_priv_t : public Opaque { public: avi_priv_t() {} @@ -119,7 +119,7 @@ extern const demuxer_driver_t demux_avi; -static void read_avi_header(demuxer_t *demuxer,int index_mode){ +static void read_avi_header(Demuxer *demuxer,int index_mode){ MainAVIHeader avih; sh_audio_t *sh_audio=NULL; sh_video_t *sh_video=NULL; @@ -266,13 +266,13 @@ MSG_FATAL("DVDS chunk found!!! Still is not suupported\n"); } if(h.fccType==streamtypeVIDEO){ - sh_video=new_sh_video(demuxer,stream_id); + sh_video=demuxer->new_sh_video(stream_id); memcpy(&sh_video->video,&h,sizeof(h)); // demuxer->video->sh=sh_video; } else if(h.fccType==streamtypeAUDIO){ MSG_V("avi: Found audio stream\n"); - sh_audio=new_sh_audio(demuxer,stream_id); + sh_audio=demuxer->new_sh_audio(stream_id); memcpy(&sh_audio->audio,&h,sizeof(h)); // demuxer->audio->sh=sh_audio; } @@ -763,7 +763,7 @@ #undef MIN // Select ds from ID -static Demuxer_Stream* demux_avi_select_stream(demuxer_t *demux,unsigned int id){ +static Demuxer_Stream* demux_avi_select_stream(Demuxer *demux,unsigned int id){ int stream_id=avi_stream_id(id); if(demux->video->id==-1) @@ -840,7 +840,7 @@ return (len1<len2)? len1 : len2; } -static int demux_avi_read_packet(demuxer_t *demux,Demuxer_Stream *ds,unsigned int id,unsigned int len,int idxpos,dp_flags_e flags){ +static int demux_avi_read_packet(Demuxer *demux,Demuxer_Stream *ds,unsigned int id,unsigned int len,int idxpos,dp_flags_e flags){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); int skip; float pts=0; @@ -903,10 +903,10 @@ return ds?1:0; } -static int avi_read_ni(demuxer_t *demux,Demuxer_Stream* ds); -static int avi_read_nini(demuxer_t *demux,Demuxer_Stream* ds); +static int avi_read_ni(Demuxer *demux,Demuxer_Stream* ds); +static int avi_read_nini(Demuxer *demux,Demuxer_Stream* ds); -static int avi_demux(demuxer_t *demux,Demuxer_Stream *__ds){ +static int avi_demux(Demuxer *demux,Demuxer_Stream *__ds){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); if(priv->alt_demuxer) return priv->alt_demuxer(demux,__ds); unsigned int id=0; @@ -934,7 +934,7 @@ } pos = (off_t)priv->idx_offset+avi_idx_offset(idx); - if((pos<demux->movi_start || pos>=demux->movi_end) && (demux->movi_end>demux->movi_start) && (demux->flags & DEMUXF_SEEKABLE)){ + if((pos<demux->movi_start || pos>=demux->movi_end) && (demux->movi_end>demux->movi_start) && (demux->flags & Demuxer::Seekable)){ MSG_V("ChunkOffset out of range! idx=0x%X \n",pos); continue; } @@ -966,7 +966,7 @@ if(!(idx->dwFlags&AVIIF_KEYFRAME)) flags=DP_NONKEYFRAME; } else { demux->filepos=stream_tell(demux->stream); - if(demux->filepos>=demux->movi_end && demux->movi_end>demux->movi_start && (demux->flags & DEMUXF_SEEKABLE)){ + if(demux->filepos>=demux->movi_end && demux->movi_end>demux->movi_start && (demux->flags & Demuxer::Seekable)){ stream_set_eof(demux->stream,1); return 0; } @@ -1008,7 +1008,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int avi_read_ni(demuxer_t *demux,Demuxer_Stream* ds){ +static int avi_read_ni(Demuxer *demux,Demuxer_Stream* ds){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); unsigned int id=0; unsigned int len; @@ -1078,7 +1078,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int avi_read_nini(demuxer_t *demux,Demuxer_Stream* ds){ +static int avi_read_nini(Demuxer *demux,Demuxer_Stream* ds){ avi_priv_t *priv=static_cast<avi_priv_t*>(demux->priv); unsigned int id=0; unsigned int len; @@ -1130,7 +1130,7 @@ int index_mode=-1; // -1=untouched 0=don't use index 1=use (geneate) index extern demuxer_driver_t demux_ogg; -static demuxer_t* avi_open(demuxer_t* demuxer){ +static Demuxer* avi_open(Demuxer* demuxer){ Demuxer_Stream *d_audio=demuxer->audio; Demuxer_Stream *d_video=demuxer->video; sh_audio_t *sh_audio=NULL; @@ -1204,7 +1204,7 @@ MSG_ERR("AVI_NI: " MSGTR_MissingAudioStream); sh_audio=NULL; } - } else demuxer->flags &= ~DEMUXF_SEEKABLE; + } else demuxer->flags &= ~Demuxer::Seekable; if(!d_video->fill_buffer()){ MSG_ERR("AVI: " MSGTR_MissingVideoStreamBug); return NULL; @@ -1284,7 +1284,7 @@ return demuxer; } -static void avi_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +static void avi_seek(Demuxer *demuxer,const seek_args_t* seeka){ avi_priv_t *priv=static_cast<avi_priv_t*>(demuxer->priv); Demuxer_Stream *d_audio=demuxer->audio; Demuxer_Stream *d_video=demuxer->video; @@ -1469,20 +1469,20 @@ } #define formtypeON2 mmioFOURCC('O', 'N', '2', 'f') -static MPXP_Rc avi_probe(demuxer_t *demuxer) +static MPXP_Rc avi_probe(Demuxer *demuxer) { uint32_t riff,id; riff = stream_read_dword_le(demuxer->stream); stream_read_dword_le(demuxer->stream); /*filesize */ id=stream_read_dword_le(demuxer->stream); /* "AVI " */ - demuxer->file_format=DEMUXER_TYPE_AVI; + demuxer->file_format=Demuxer::Type_AVI; if(riff == mmioFOURCC('R','I','F','F') && id == formtypeAVI) return MPXP_Ok; if(riff == mmioFOURCC('O','N','2',' ') && id == formtypeON2) return MPXP_Ok; return MPXP_False; } -static void avi_close(demuxer_t *demuxer) +static void avi_close(Demuxer *demuxer) { avi_priv_t* priv=static_cast<avi_priv_t*>(demuxer->priv); @@ -1491,7 +1491,7 @@ delete priv; } -static MPXP_Rc avi_control(const demuxer_t *demuxer,int cmd,any_t*args) +static MPXP_Rc avi_control(const Demuxer *demuxer,int cmd,any_t*args) { UNUSED(demuxer); UNUSED(cmd); Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -29,7 +29,7 @@ static int demux_rw_seek(struct SDL_RWops *context, int offset, int whence) { unsigned long newpos=-1; - demuxer_t *demux = reinterpret_cast<demuxer_t*>(context->hidden.unknown.data1); + Demuxer *demux = reinterpret_cast<Demuxer*>(context->hidden.unknown.data1); switch(whence) { case SEEK_SET: @@ -51,7 +51,7 @@ static int demux_rw_read(struct SDL_RWops *context, any_t*ptr, int size, int maxnum) { int retval; - demuxer_t *demux = reinterpret_cast<demuxer_t*>(context->hidden.unknown.data1); + Demuxer *demux = reinterpret_cast<Demuxer*>(context->hidden.unknown.data1); retval = stream_read(demux->stream,ptr,size*maxnum); return retval; } @@ -66,7 +66,7 @@ return 0; } -static void demux_dup_rw_stream(demuxer_t* demuxer, struct SDL_RWops*rwops) +static void demux_dup_rw_stream(Demuxer* demuxer, struct SDL_RWops*rwops) { /* it's not a danger to mp_malloc 8 bytes */ rwops->hidden.unknown.data1=demuxer; @@ -84,16 +84,16 @@ static SDL_RWops my_rw; static SDL_Surface *img; -static MPXP_Rc bmp_probe(demuxer_t *demuxer) +static MPXP_Rc bmp_probe(Demuxer *demuxer) { demux_dup_rw_stream(demuxer,&my_rw); stream_reset(demuxer->stream); img = IMG_Load_RW(&my_rw,0); - if(img) demuxer->file_format=DEMUXER_TYPE_BMP; + if(img) demuxer->file_format=Demuxer::Type_BMP; return img ? MPXP_Ok : MPXP_False; } -static int bmp_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) +static int bmp_demux(Demuxer *demuxer,Demuxer_Stream *__ds) { UNUSED(__ds); unsigned lsize=((img->format->BitsPerPixel+7)/8)*img->w; @@ -142,12 +142,12 @@ return 1; } -static demuxer_t* bmp_open(demuxer_t* demuxer) +static Demuxer* bmp_open(Demuxer* demuxer) { sh_video_t *sh_video = NULL; unsigned npal_colors; // create a new video stream header - sh_video = new_sh_video(demuxer, 0); + sh_video = demuxer->new_sh_video(); // make sure the demuxer knows about the new video stream header demuxer->video->sh = sh_video; // make sure that the video demuxer stream header knows about its @@ -191,7 +191,7 @@ return demuxer; } -static void bmp_close(demuxer_t* demuxer) +static void bmp_close(Demuxer* demuxer) { UNUSED(demuxer); if(img) SDL_FreeSurface(img); @@ -210,7 +210,7 @@ }; // Check if a file is a BMP file depending on whether starts with 'BM' -static MPXP_Rc bmp_probe(demuxer_t *demuxer) +static MPXP_Rc bmp_probe(Demuxer *demuxer) { if (stream_read_word(demuxer->stream) == (('B' << 8) | 'M')) return MPXP_Ok; @@ -221,7 +221,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int bmp_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) +static int bmp_demux(Demuxer *demuxer,Demuxer_Stream *__ds) { bmp_image_t *bmp_image = static_cast<bmp_image_t*>(demuxer->priv); @@ -232,7 +232,7 @@ return 1; } -static demuxer_t* bmp_open(demuxer_t* demuxer) +static Demuxer* bmp_open(Demuxer* demuxer) { sh_video_t *sh_video = NULL; unsigned int filesize; @@ -248,7 +248,7 @@ stream_skip(demuxer->stream, 2); // create a new video stream header - sh_video = new_sh_video(demuxer, 0); + sh_video = demuxer->new_sh_video(); // make sure the demuxer knows about the new video stream header demuxer->video->sh = sh_video; @@ -295,7 +295,7 @@ return demuxer; } -static void bmp_close(demuxer_t* demuxer) { +static void bmp_close(Demuxer* demuxer) { bmp_image_t *bmp_image = static_cast<bmp_image_t*>(demuxer->priv); if(!bmp_image) @@ -304,7 +304,7 @@ } #endif -static MPXP_Rc bmp_control(const demuxer_t *demuxer,int cmd,any_t*args) +static MPXP_Rc bmp_control(const Demuxer *demuxer,int cmd,any_t*args) { UNUSED(demuxer); UNUSED(cmd); Modified: mplayerxp/libmpdemux/demux_demuxers.cpp =================================================================== --- mplayerxp/libmpdemux/demux_demuxers.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_demuxers.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -9,27 +9,28 @@ #include "stheader.h" #include "demux_msg.h" +namespace mpxp { struct dd_priv_t : public Opaque { public: dd_priv_t() {} virtual ~dd_priv_t(); - demuxer_t* vd; - demuxer_t* ad; - demuxer_t* sd; + Demuxer* vd; + Demuxer* ad; + Demuxer* sd; }; dd_priv_t::~dd_priv_t() { - if(vd) { free_demuxer(vd); vd=NULL; } - if(ad && ad != vd) { free_demuxer(ad); ad=NULL; } - if(sd && sd != vd && sd != ad) { free_demuxer(sd); sd=NULL; } + if(vd) { delete vd; vd=NULL; } + if(ad && ad != vd) { delete ad; ad=NULL; } + if(sd && sd != vd && sd != ad) { delete sd; sd=NULL; } } -demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) { - demuxer_t* ret; +Demuxer* new_demuxers_demuxer(Demuxer* vd, Demuxer* ad, Demuxer* sd) { + Demuxer* ret; dd_priv_t* priv; - ret = new(zeromem) demuxer_t; + ret = new(zeromem) Demuxer; priv = new(zeromem) dd_priv_t; priv->vd = vd; @@ -37,10 +38,10 @@ priv->sd = sd; ret->priv = priv; - ret->file_format = DEMUXER_TYPE_DEMUXERS; + ret->file_format = Demuxer::Type_DEMUXERS; // Video is the most important :-) ret->stream = vd->stream; - ret->flags = (vd->flags&DEMUXF_SEEKABLE) && (ad->flags&DEMUXF_SEEKABLE) && (sd->flags&DEMUXF_SEEKABLE); + ret->flags = (vd->flags&Demuxer::Seekable) && (ad->flags&Demuxer::Seekable) && (sd->flags&Demuxer::Seekable)?Demuxer::Seekable:Demuxer::NonSeekable; ret->video = vd->video; ret->audio = ad->audio; @@ -52,21 +53,21 @@ return ret; } -static int demux_demuxers_fill_buffer(demuxer_t *demux,Demuxer_Stream *ds) { +static int demux_demuxers_fill_buffer(Demuxer *demux,Demuxer_Stream *ds) { dd_priv_t* priv=static_cast<dd_priv_t*>(demux->priv); if(ds->demuxer == priv->vd) - return demux_fill_buffer(priv->vd,ds); + return priv->vd->fill_buffer(ds); else if(ds->demuxer == priv->ad) - return demux_fill_buffer(priv->ad,ds); + return priv->ad->fill_buffer(ds); else if(ds->demuxer == priv->sd) - return demux_fill_buffer(priv->sd,ds); + return priv->sd->fill_buffer(ds); MSG_ERR("Demux demuxers fill_buffer error : bad demuxer : not vd, ad nor sd\n"); return 0; } -static void demux_demuxers_seek(demuxer_t *demuxer,const seek_args_t* seeka) { +static void demux_demuxers_seek(Demuxer *demuxer,const seek_args_t* seeka) { dd_priv_t* priv=static_cast<dd_priv_t*>(demuxer->priv); float pos; @@ -76,13 +77,13 @@ stream_set_eof(priv->sd->stream,0); // Seek video - demux_seek(priv->vd,seeka); + priv->vd->seek(seeka); // Get the new pos pos = demuxer->video->pts; if(priv->ad != priv->vd) { sh_audio_t* sh = (sh_audio_t*)demuxer->audio->sh; - demux_seek(priv->ad,&seek_p); + priv->ad->seek(&seek_p); // In case the demuxer don't set pts if(!demuxer->audio->pts) demuxer->audio->pts = pos-((demuxer->audio->tell_pts()-sh->a_in_buffer_len)/(float)sh->i_bps); @@ -91,12 +92,13 @@ } if(priv->sd != priv->vd) - demux_seek(priv->sd,&seek_p); + priv->sd->seek(&seek_p); } -static void demux_close_demuxers(demuxer_t* demuxer) { +static void demux_close_demuxers(Demuxer* demuxer) { dd_priv_t* priv = static_cast<dd_priv_t*>(demuxer->priv); delete priv; delete demuxer; } +} // namespace mpxp Modified: mplayerxp/libmpdemux/demux_dv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dv.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_dv.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -53,7 +53,7 @@ dv_decoder_t *decoder; }; -static void dv_seek(demuxer_t *demuxer,const seek_args_t* seeka) +static void dv_seek(Demuxer *demuxer,const seek_args_t* seeka) { rawdv_frames_t *frames = reinterpret_cast<rawdv_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); @@ -73,7 +73,7 @@ frames->current_filepos=newpos*frames->frame_size; } -static MPXP_Rc dv_probe(demuxer_t *demuxer) +static MPXP_Rc dv_probe(Demuxer *demuxer) { unsigned char tmp_buffer[DV_PAL_FRAME_SIZE]; int bytes_read=0; @@ -103,7 +103,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int dv_demux(demuxer_t *demuxer, Demuxer_Stream *ds) +static int dv_demux(Demuxer *demuxer, Demuxer_Stream *ds) { rawdv_frames_t *frames = static_cast<rawdv_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); @@ -135,7 +135,7 @@ return 1; } -static demuxer_t* dv_open(demuxer_t* demuxer) +static Demuxer* dv_open(Demuxer* demuxer) { unsigned char dv_frame[DV_PAL_FRAME_SIZE]; sh_video_t *sh_video = NULL; @@ -159,13 +159,13 @@ return NULL; // create a new video stream header - sh_video = new_sh_video(demuxer, 0); + sh_video = demuxer->new_sh_video(); if (!sh_video) return NULL; // make sure the demuxer knows about the new video stream header // (even though new_sh_video() ought to take care of it) - demuxer->flags |= DEMUXF_SEEKABLE; + demuxer->flags |= Demuxer::Seekable; demuxer->video->sh = sh_video; // make sure that the video demuxer stream header knows about its @@ -201,7 +201,7 @@ MSG_V("demux_open_rawdv() seek to %qu, size: %d, dv_dec->frame_size: %d\n",frames->current_filepos,frames->frame_size, dv_decoder->frame_size); if (dv_decoder->audio != NULL && demuxer->audio->id>=-1){ - sh_audio_t *sh_audio = new_sh_audio(demuxer, 0); + sh_audio_t *sh_audio = demuxer->new_sh_audio(); demuxer->audio->id = 0; demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; @@ -228,7 +228,7 @@ return demuxer; } -static void dv_close(demuxer_t* demuxer) +static void dv_close(Demuxer* demuxer) { rawdv_frames_t *frames = static_cast<rawdv_frames_t*>(demuxer->priv); @@ -236,7 +236,7 @@ delete frames; } -static MPXP_Rc dv_control(const demuxer_t *demuxer,int cmd, any_t*arg) { +static MPXP_Rc dv_control(const Demuxer *demuxer,int cmd, any_t*arg) { return MPXP_Unknown; } Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_film.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -58,7 +58,7 @@ if(chunks) delete chunks; } -static void film_seek(demuxer_t *demuxer, const seek_args_t* seeka) +static void film_seek(Demuxer *demuxer, const seek_args_t* seeka) { film_data_t *film_data = static_cast<film_data_t*>(demuxer->priv); int new_current_chunk=(seeka->flags&DEMUX_SEEK_SET)?0:film_data->current_chunk; @@ -91,7 +91,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int film_demux(demuxer_t *demuxer,Demuxer_Stream *__ds) +static int film_demux(Demuxer *demuxer,Demuxer_Stream *__ds) { UNUSED(__ds); int i; @@ -193,7 +193,7 @@ return 1; } -static MPXP_Rc film_probe(demuxer_t* demuxer) +static MPXP_Rc film_probe(Demuxer* demuxer) { uint32_t chunk_type; @@ -201,11 +201,11 @@ chunk_type = le2me_32(stream_read_fourcc(demuxer->stream)); // validate the chunk type if (chunk_type != CHUNK_FILM) return MPXP_False; - demuxer->file_format=DEMUXER_TYPE_FILM; + demuxer->file_format=Demuxer::Type_FILM; return MPXP_Ok; } -static demuxer_t* film_open(demuxer_t* demuxer) +static Demuxer* film_open(Demuxer* demuxer) { sh_video_t *sh_video = NULL; sh_audio_t *sh_audio = NULL; @@ -272,7 +272,7 @@ if (video_format) { // create and initialize the video stream header - sh_video = new_sh_video(demuxer, 0); + sh_video = demuxer->new_sh_video(); demuxer->video->sh = sh_video; sh_video->ds = demuxer->video; @@ -305,7 +305,7 @@ if (audio_channels > 0) { // create and initialize the audio stream header - sh_audio = new_sh_audio(demuxer, 0); + sh_audio = demuxer->new_sh_audio(); demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; @@ -336,7 +336,7 @@ // otherwise, make some assumptions about the audio // create and initialize the audio stream header - sh_audio = new_sh_audio(demuxer, 0); + sh_audio = demuxer->new_sh_audio(); demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; @@ -435,14 +435,14 @@ return demuxer; } -static void film_close(demuxer_t* demuxer) { +static void film_close(Demuxer* demuxer) { film_data_t *film_data = reinterpret_cast<film_data_t*>(demuxer->priv); if(!film_data) return; delete film_data; } -static MPXP_Rc film_control(const demuxer_t *demuxer,int cmd,any_t*args) +static MPXP_Rc film_control(const Demuxer *demuxer,int cmd,any_t*args) { UNUSED(demuxer); UNUSED(cmd); Modified: mplayerxp/libmpdemux/demux_fli.cpp =================================================================== --- mplayerxp/libmpdemux/demux_fli.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_fli.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -37,7 +37,7 @@ if(frame_size) delete frame_size; } -static void fli_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +static void fli_seek(Demuxer *demuxer,const seek_args_t* seeka){ fli_frames_t *frames = static_cast<fli_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); int newpos=(seeka->flags&DEMUX_SEEK_SET)?0:frames->current_frame; @@ -50,7 +50,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int fli_demux(demuxer_t *demuxer,Demuxer_Stream *__ds){ +static int fli_demux(Demuxer *demuxer,Demuxer_Stream *__ds){ fli_frames_t *frames = static_cast<fli_frames_t*>(demuxer->priv); sh_video_t *sh_video = reinterpret_cast<sh_video_t*>(demuxer->video->sh); @@ -75,16 +75,16 @@ return 1; } -static MPXP_Rc fli_probe(demuxer_t* demuxer){ +static MPXP_Rc fli_probe(Demuxer* demuxer){ unsigned magic_number; demuxer->movi_end = stream_skip(demuxer->stream,4); magic_number = stream_read_word_le(demuxer->stream); if ((magic_number != 0xAF11) && (magic_number != 0xAF12)) return MPXP_False; - demuxer->file_format=DEMUXER_TYPE_FLI; + demuxer->file_format=Demuxer::Type_FLI; return MPXP_Ok; } -static demuxer_t* fli_open(demuxer_t* demuxer){ +static Demuxer* fli_open(Demuxer* demuxer){ sh_video_t *sh_video = NULL; fli_frames_t *frames = new(zeromem) fli_frames_t; int frame_number; @@ -124,7 +124,7 @@ frames->frame_size = new unsigned int [frames->num_frames]; // create a new video stream header - sh_video = new_sh_video(demuxer, 0); + sh_video = demuxer->new_sh_video(); // make sure the demuxer knows about the new video stream header // (even though new_sh_video() ought to take care of it) @@ -187,7 +187,7 @@ return demuxer; } -static void fli_close(demuxer_t* demuxer) { +static void fli_close(Demuxer* demuxer) { fli_frames_t *frames = static_cast<fli_frames_t*>(demuxer->priv); if(!frames) return; @@ -195,7 +195,7 @@ delete frames; } -static MPXP_Rc fli_control(const demuxer_t *demuxer,int cmd,any_t*args) +static MPXP_Rc fli_control(const Demuxer *demuxer,int cmd,any_t*args) { UNUSED(demuxer); UNUSED(cmd); Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -182,7 +182,7 @@ *key++ = (char2int(str[0]) << 4) | char2int(str[1]); } -static MPXP_Rc lavf_probe(demuxer_t *demuxer){ +static MPXP_Rc lavf_probe(Demuxer *demuxer){ AVProbeData avpd; uint8_t buf[PROBE_BUF_SIZE]; lavf_priv_t *priv; @@ -222,12 +222,12 @@ return MPXP_False; }else MSG_V("LAVF_check: %s\n", priv->avif->long_name); - demuxer->file_format=DEMUXER_TYPE_ASF; + demuxer->file_format=Demuxer::Type_ASF; return MPXP_Ok; } -static demuxer_t* lavf_open(demuxer_t *demuxer){ +static Demuxer* lavf_open(Demuxer *demuxer){ AVFormatContext *avfc; lavf_priv_t *priv= static_cast<lavf_priv_t*>(demuxer->priv); unsigned j; @@ -279,7 +279,7 @@ switch(codec->codec_type){ case AVMEDIA_TYPE_AUDIO:{ WAVEFORMATEX *wf= (WAVEFORMATEX*)mp_calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1); - sh_audio_t* sh_audio=new_sh_audio(demuxer, i); + sh_audio_t* sh_audio=demuxer->new_sh_audio(i); priv->audio_streams++; if(!codec->codec_tag) codec->codec_tag= ff_codec_get_tag(ff_codec_wav_tags,codec->codec_id); @@ -346,7 +346,7 @@ break;} case AVMEDIA_TYPE_VIDEO:{ BITMAPINFOHEADER *bih=(BITMAPINFOHEADER*)mp_calloc(sizeof(BITMAPINFOHEADER) + codec->extradata_size,1); - sh_video_t* sh_video=new_sh_video(demuxer, i); + sh_video_t* sh_video=demuxer->new_sh_video(i); priv->video_streams++; if(!codec->codec_tag) @@ -413,7 +413,7 @@ return demuxer; } -static int lavf_demux(demuxer_t *demux, Demuxer_Stream *dsds){ +static int lavf_demux(Demuxer *demux, Demuxer_Stream *dsds){ UNUSED(dsds); lavf_priv_t *priv= static_cast<lavf_priv_t*>(demux->priv); AVPacket pkt; @@ -468,14 +468,14 @@ return 1; } -static void lavf_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +static void lavf_seek(Demuxer *demuxer,const seek_args_t* seeka){ lavf_priv_t *priv = static_cast<lavf_priv_t*>(demuxer->priv); MSG_DBG2("lavf_demux(%p, %f, %d)\n", demuxer, seeka->secs, seeka->flags); av_seek_frame(priv->avfc, -1, priv->last_pts + seeka->secs*AV_TIME_BASE, seeka->secs < 0 ? AVSEEK_FLAG_BACKWARD : 0); } -static MPXP_Rc lavf_control(const demuxer_t *demuxer, int cmd, any_t*arg) +static MPXP_Rc lavf_control(const Demuxer *demuxer, int cmd, any_t*arg) { UNUSED(demuxer); UNUSED(cmd); @@ -483,7 +483,7 @@ return MPXP_Unknown; } -static void lavf_close(demuxer_t *demuxer) +static void lavf_close(Demuxer *demuxer) { lavf_priv_t* priv = static_cast<lavf_priv_t*>(demuxer->priv); if (priv){ Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -1052,7 +1052,7 @@ } static int -demux_mkv_read_info (demuxer_t *demuxer) +demux_mkv_read_info (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; @@ -1112,7 +1112,7 @@ } static int -demux_mkv_read_trackencodings (demuxer_t *demuxer, mkv_track_t *track) +demux_mkv_read_trackencodings (Demuxer *demuxer, mkv_track_t *track) { stream_t *s = demuxer->stream; mkv_content_encoding_t *ce, e; @@ -1264,7 +1264,7 @@ } static int -demux_mkv_read_trackaudio (demuxer_t *demuxer, mkv_track_t *track) +demux_mkv_read_trackaudio (Demuxer *demuxer, mkv_track_t *track) { stream_t *s = demuxer->stream; uint64_t len, length, l; @@ -1322,7 +1322,7 @@ } static int -demux_mkv_read_trackvideo (demuxer_t *demuxer, mkv_track_t *track) +demux_mkv_read_trackvideo (Demuxer *demuxer, mkv_track_t *track) { stream_t *s = demuxer->stream; uint64_t len, length, l; @@ -1401,7 +1401,7 @@ } static int -demux_mkv_read_trackentry (demuxer_t *demuxer) +demux_mkv_read_trackentry (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; @@ -1582,7 +1582,7 @@ } static int -demux_mkv_read_tracks (demuxer_t *demuxer) +demux_mkv_read_tracks (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; @@ -1617,7 +1617,7 @@ } static int -demux_mkv_read_cues (demuxer_t *demuxer) +demux_mkv_read_cues (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; @@ -1733,7 +1733,7 @@ } static int -demux_mkv_read_chapters (demuxer_t *demuxer) +demux_mkv_read_chapters (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; @@ -1870,14 +1870,14 @@ } static int -demux_mkv_read_tags (demuxer_t *demuxer) +demux_mkv_read_tags (Demuxer *demuxer) { ebml_read_skip (demuxer->stream, NULL); return 0; } static int -demux_mkv_read_attachments (demuxer_t *demuxer) +demux_mkv_read_attachments (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; @@ -1992,7 +1992,7 @@ } static int -demux_mkv_read_seekhead (demuxer_t *demuxer) +demux_mkv_read_seekhead (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); stream_t *s = demuxer->stream; @@ -2118,14 +2118,14 @@ } static int -demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid); +demux_mkv_open_video (Demuxer *demuxer, mkv_track_t *track, int vid); static int -demux_mkv_open_audio (demuxer_t *demuxer, mkv_track_t *track, int aid); +demux_mkv_open_audio (Demuxer *demuxer, mkv_track_t *track, int aid); static int -demux_mkv_open_sub (demuxer_t *demuxer, mkv_track_t *track, int sid); +demux_mkv_open_sub (Demuxer *demuxer, mkv_track_t *track, int sid); static void -display_create_tracks (demuxer_t *demuxer) +display_create_tracks (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); int i, vid=0, aid=0, sid=0; @@ -2188,7 +2188,7 @@ }; static int -demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid) +demux_mkv_open_video (Demuxer *demuxer, mkv_track_t *track, int vid) { BITMAPINFOHEADER* bih; ImageDescription* ImageDesc = NULL; @@ -2314,7 +2314,7 @@ } } - sh_v = new_sh_video_vid (demuxer, track->tnum, vid); + sh_v = demuxer->new_sh_video_vid (track->tnum, vid); sh_v->bih = bih; sh_v->fourcc = sh_v->bih->biCompression; if (track->v_frate == 0.0) @@ -2346,10 +2346,10 @@ } static int -demux_mkv_open_audio (demuxer_t *demuxer, mkv_track_t *track, int aid) +demux_mkv_open_audio (Demuxer *demuxer, mkv_track_t *track, int aid) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); - sh_audio_t *sh_a = new_sh_audio_aid(demuxer, track->tnum, aid); + sh_audio_t *sh_a = demuxer->new_sh_audio_aid(track->tnum, aid); Demuxer_Packet *dp; if(!sh_a) return 1; mkv_d->audio_tracks[mkv_d->last_aid] = track->tnum; @@ -2438,7 +2438,7 @@ MSG_WARN("[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n[mkv] private codec data.\n", track->codec_id, track->tnum); - free_sh_audio(reinterpret_cast<sh_audio_t*>(demuxer->a_streams[track->tnum])); + delete demuxer->a_streams[track->tnum]; demuxer->a_streams[track->tnum]=0; return 1; } @@ -2655,7 +2655,7 @@ { /* do nothing, still works */ } else if (!track->ms_compat || (track->private_size < sizeof(WAVEFORMATEX))) { - free_sh_audio(reinterpret_cast<sh_audio_t*>(demuxer->a_streams[track->tnum])); + delete demuxer->a_streams[track->tnum]; demuxer->a_streams[track->tnum]=0; return 1; } @@ -2673,7 +2673,7 @@ \param demuxer The generic demuxer. */ static void -demux_mkv_parse_vobsub_data (demuxer_t *demuxer) +demux_mkv_parse_vobsub_data (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track; @@ -2715,7 +2715,7 @@ */ #ifdef USE_ASS static void -demux_mkv_parse_ass_data (demuxer_t *demuxer) +demux_mkv_parse_ass_data (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track; @@ -2747,7 +2747,7 @@ #endif static int -demux_mkv_open_sub (demuxer_t *demuxer, mkv_track_t *track, int sid) +demux_mkv_open_sub (Demuxer *demuxer, mkv_track_t *track, int sid) { UNUSED(demuxer); UNUSED(sid); @@ -2770,7 +2770,7 @@ return 0; } -static void mkv_seek (demuxer_t *demuxer,const seek_args_t* seeka); +static void mkv_seek (Demuxer *demuxer,const seek_args_t* seeka); /** \brief Given a matroska track number and type, find the id that mplayer would ask for. * \param d The demuxer for which the subtitle id should be returned. @@ -2791,7 +2791,7 @@ return -1; } -static MPXP_Rc mkv_probe(demuxer_t *demuxer) +static MPXP_Rc mkv_probe(Demuxer *demuxer) { stream_t *s = demuxer->stream; int version; @@ -2806,7 +2806,7 @@ return MPXP_Ok; } -static demuxer_t* mkv_open (demuxer_t *demuxer) +static Demuxer* mkv_open (Demuxer *demuxer) { stream_t *s = demuxer->stream; mkv_demuxer_t *mkv_d; @@ -3051,12 +3051,12 @@ } if (s->end_pos == 0 || (mkv_d->indexes == NULL && index_mode < 0)) - demuxer->flags &= ~(DEMUXF_SEEKABLE); + demuxer->flags &= ~(Demuxer::Seekable); else { demuxer->movi_start = s->start_pos; demuxer->movi_end = s->end_pos; - demuxer->flags |= DEMUXF_SEEKABLE; + demuxer->flags |= Demuxer::Seekable; if (mkv_d->chapters && dvd_chapter>1 && dvd_chapter<=mkv_d->num_chapters) { seek_args_t seeka; @@ -3074,7 +3074,7 @@ return demuxer; } -static void mkv_close (demuxer_t *demuxer) +static void mkv_close (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); @@ -3168,7 +3168,7 @@ } static void -handle_subtitles(demuxer_t *demuxer, mkv_track_t *track, char *block, +handle_subtitles(Demuxer *demuxer, mkv_track_t *track, char *block, int64_t size, uint64_t block_duration, uint64_t timecode) { Demuxer_Packet *dp; @@ -3267,7 +3267,7 @@ } static void -handle_realvideo (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer, +handle_realvideo (Demuxer *demuxer, mkv_track_t *track, uint8_t *buffer, uint32_t size, int block_bref) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); @@ -3319,7 +3319,7 @@ } static void -handle_realaudio (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer, +handle_realaudio (Demuxer *demuxer, mkv_track_t *track, uint8_t *buffer, uint32_t size, int block_bref) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); @@ -3433,7 +3433,7 @@ * \param track The track structure whose cache should be handled. */ static void -flush_cached_dps (demuxer_t *demuxer, mkv_track_t *track) +flush_cached_dps (Demuxer *demuxer, mkv_track_t *track) { int i, ok; @@ -3477,7 +3477,7 @@ * of \a block_bref. Otherwise it's a B frame. */ static void -handle_video_bframes (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer, +handle_video_bframes (Demuxer *demuxer, mkv_track_t *track, uint8_t *buffer, uint32_t size, int block_bref, int block_fref) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); @@ -3507,7 +3507,7 @@ } static int -handle_block (demuxer_t *demuxer, uint8_t *block, uint64_t length, +handle_block (Demuxer *demuxer, uint8_t *block, uint64_t length, uint64_t block_duration, int64_t block_bref, int64_t block_fref, uint8_t simpleblock) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); @@ -3672,7 +3672,7 @@ return 0; } -static int mkv_demux (demuxer_t *demuxer, Demuxer_Stream *ds) +static int mkv_demux (Demuxer *demuxer, Demuxer_Stream *ds) { UNUSED(ds); mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); @@ -3820,7 +3820,7 @@ return 0; } -static void mkv_seek (demuxer_t *demuxer,const seek_args_t* seeka) +static void mkv_seek (Demuxer *demuxer,const seek_args_t* seeka) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_d->free_cached_dps (); @@ -3982,7 +3982,7 @@ } } -static MPXP_Rc mkv_control (const demuxer_t *demuxer, int cmd, any_t*arg) +static MPXP_Rc mkv_control (const Demuxer *demuxer, int cmd, any_t*arg) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); switch (cmd) { @@ -3997,7 +3997,7 @@ *((int *) arg) = (int) (100 * mkv_d->last_pts / mkv_d->duration); return MPXP_Ok; #endif - case DEMUX_CMD_SWITCH_AUDIO: + case Demuxer::Switch_Audio: if (demuxer->audio && demuxer->audio->sh) { sh_audio_t *sh = reinterpret_cast<sh_audio_t*>(demuxer->a_streams[demuxer->audio->id]); int aid = *(int*)arg; @@ -4028,7 +4028,7 @@ \param maxlen The maximum number of characters to copy into lang */ void -demux_mkv_get_sub_lang(demuxer_t *demuxer, int track_num, char *lang, +demux_mkv_get_sub_lang(Demuxer *demuxer, int track_num, char *lang, int maxlen) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); @@ -4048,7 +4048,7 @@ \param maxlen The maximum number of characters to copy into lang */ void -demux_mkv_get_audio_lang(demuxer_t *demuxer, int track_num, char *lang, +demux_mkv_get_audio_lang(Demuxer *demuxer, int track_num, char *lang, int maxlen) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_mov.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -326,7 +326,7 @@ #define MOV_FOURCC(a,b,c,d) ((a<<24)|(b<<16)|(c<<8)|(d)) -static MPXP_Rc mov_probe(demuxer_t* demuxer){ +static MPXP_Rc mov_probe(Demuxer* demuxer){ int flags=0; int no=0; unsigned ver; @@ -495,7 +495,7 @@ if(flags==3){ // if we're over the headers, then we can stop parsing here! demuxer->priv=priv; - demuxer->file_format=DEMUXER_TYPE_MOV; + demuxer->file_format=Demuxer::Type_MOV; return MPXP_Ok; } break; @@ -521,14 +521,14 @@ if(flags==3){ demuxer->priv=priv; - demuxer->file_format=DEMUXER_TYPE_MOV; + demuxer->file_format=Demuxer::Type_MOV; return MPXP_Ok; } delete priv; if ((flags==5) || (flags==7)) // reference & header sent { - demuxer->file_format=DEMUXER_TYPE_MOV; + demuxer->file_format=Demuxer::Type_MOV; return MPXP_Ok; } if(flags==1) @@ -594,10 +594,10 @@ return n; } -static int lschunks_intrak(demuxer_t* demuxer, int level, unsigned int id, +static int lschunks_intrak(Demuxer* demuxer, int level, unsigned int id, off_t pos, off_t len, mov_track_t* trak); -static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak){ +static void lschunks(Demuxer* demuxer,int level,off_t endpos,mov_track_t* trak){ mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); while(1){ off_t pos; @@ -671,7 +671,7 @@ #endif int version=0, adjust; int is_vorbis = 0; - sh_audio_t* sh=new_sh_audio(demuxer,priv->track_db); + sh_audio_t* sh=demuxer->new_sh_audio(priv->track_db); sh->wtag=trak->fourcc; /* crude audio delay from editlist0 hack ::atm */ @@ -976,7 +976,7 @@ int entry,flag, start, count_flag, end, palette_count, gray; int hdr_ptr = 76; // the byte just after depth unsigned char *palette_map; - sh_video_t* sh=new_sh_video(demuxer,priv->track_db); + sh_video_t* sh=demuxer->new_sh_video(priv->track_db); int depth; sh->fourcc=trak->fourcc; @@ -1491,7 +1491,7 @@ } } -static int lschunks_intrak(demuxer_t* demuxer, int level, unsigned int id, +static int lschunks_intrak(Demuxer* demuxer, int level, unsigned int id, off_t pos, off_t len, mov_track_t* trak) { switch(id) { @@ -1794,7 +1794,7 @@ return 0; } -static demuxer_t* mov_open(demuxer_t* demuxer){ +static Demuxer* mov_open(Demuxer* demuxer){ mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); int t_no; int best_a_id=-1, best_a_len=0; @@ -1930,7 +1930,7 @@ // return value: // 0 = EOF or no stream found // 1 = successfully read a packet -static int mov_demux(demuxer_t *demuxer,Demuxer_Stream* ds){ +static int mov_demux(Demuxer *demuxer,Demuxer_Stream* ds){ mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); mov_track_t* trak=NULL; float pts; @@ -2061,7 +2061,7 @@ return pts; } -static void mov_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +static void mov_seek(Demuxer *demuxer,const seek_args_t* seeka){ mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); Demuxer_Stream* ds; mov_track_t* trak; @@ -2087,14 +2087,14 @@ } } -static void mov_close(demuxer_t *demuxer) +static void mov_close(Demuxer *demuxer) { mov_priv_t* priv = static_cast<mov_priv_t*>(demuxer->priv); if (!priv) return; delete priv; } -static MPXP_Rc mov_control(const demuxer_t *demuxer,int cmd,any_t*args) +static MPXP_Rc mov_control(const Demuxer *demuxer,int cmd,any_t*args) { UNUSED(demuxer); UNUSED(cmd); Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-04 13:56:44 UTC (rev 507) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-04 16:36:42 UTC (rev 508) @@ -44,7 +44,7 @@ #define MPGPES_BAD_PTS -1 -typedef int (*alt_demuxer_t)(demuxer_t *demux,Demuxer_Stream *__ds); +typedef int (*alt_demuxer_t)(Demuxer *demux,Demuxer_Stream *__ds); struct mpg_demuxer_t : public Opaque { public: mpg_demuxer_t() {} @@ -95,7 +95,7 @@ return pts; } -static int parse_psm(demuxer_t *demux, int len) { +static int parse_psm(Demuxer *demux, int len) { unsigned char c, id, type; unsigned int plen, prog_len, es_map_len; mpg_demuxer_t *priv = static_cast<mpg_demuxer_t*>(demux->priv); @@ -155,11 +155,11 @@ return 1; } -static void new_audio_stream(demuxer_t *demux, int aid){ +static void new_audio_stream(Demuxer *demux, int aid){ if(!demux->a_streams[aid]){ mpg_demuxer_t *mpg_d=static_cast<mpg_demuxer_t*>(demux->priv); sh_audio_t* sh_a; - new_sh_audio(demux,aid); + demux->new_sh_audio(aid); sh_a = (sh_audio_t*)demux->a_streams[aid]; switch(aid & 0xE0){ // 1110 0000 b (high 3 bit: type low 5: id) case 0x00: sh_a->wtag=AUDIO_MP2;break; @@ -191,7 +191,7 @@ return rval; } -static int demux_mpg_read_packet(demuxer_t *demux,int id){ +static int demux_mpg_read_packet(Demuxer *demux,int id){ int d; int len; unsigned char c=0; @@ -374,7 +374,7 @@ if(id>=0x1E0 && id<=0x1EF){ // mpeg video int aid=id-0x1E0; - if(!demux->v_streams[aid]) new_sh_video(demux,aid); + if(!demux->v_streams[aid]) demux->new_sh_video(aid); if(demux->video->id==-1) demux->video->id=aid; if(demux->video->id==aid){ ds=demux->video; @@ -432,7 +432,7 @@ return 0; } -static int mpges_demux(demuxer_t *demux,Demuxer_Stream *__ds){ +static int mpges_demux(Demuxer *demux,Demuxer_Stream *__ds){ /* Elementary video stream */ if(stream_eof(demux->stream)) return 0; demux->filepos=stream_tell(demux->stream); @@ -440,7 +440,7 @@ return 1; } -static int mpgps_demux(demuxer_t *demux,Demuxer_Stream *__ds){ +static int mpgps_demux(Demuxer *demux,Demuxer_Stream *__ds){ mpg_demuxer_t* mpg_d = static_cast<mpg_demuxer_t*>(demux->priv); if(mpg_d->alt_demuxer) return mpg_d->alt_demuxer(demux,__ds); unsigned int head=0; @@ -543,7 +543,7 @@ return 1; } -static void mpgps_seek(demuxer_t *demuxer,const seek_args_t* seeka){ +static void mpgps_seek(Demuxer *demuxer,const seek_args_t* seeka){ Demuxer_Stream *d_audio=demuxer->audio; Demuxer_Stream *d_video=demuxer->video; sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); @@ -636,7 +636,7 @@ 0x000001FF - prog_stream_dir */ extern const demuxer_driver_t demux_mpgps; -static MPXP_Rc mpgps_probe(demuxer_t*demuxer) +static MPXP_Rc mpgps_probe(Demuxer*demuxer) { uint32_t code,id; int pes=2,rval; @@ -716,7 +716,7 @@ mpg_stat.num_elementary_v_packets); if(rval){ - demuxer->file_format=DEMUXER_TYPE_MPEG_PS; + demuxer->file_format=Demuxer::Type_MPEG_PS; } else { /*MPEG packet stats: p100: 458 p101: 458 PES: 0 MP3: 1103 (.m2v)*/ @@ -733,18 +733,18 @@ --pes; continue; /* tricky... */ } - demuxer->file_format=DEMUXER_TYPE_MPEG_ES; /* <-- hack is here :) */ + demuxer->file_format=Demuxer::Type_MPEG_ES; /* <-- hack is here :) */ } else if(mpg_stat.num_elementary_packets1B6>3 && mpg_stat.num_elementary_packets12x>=1 && mpg_stat.num_elementary_packetsPES==0 && mpg_stat.num_elementary_packets100<=mpg_stat.num_elementary_packets12x && demuxer->synced<2) { /* fuzzy mpeg4-es detection. do NOT enable without heavy testing of mpeg formats detection! */ - demuxer->file_format=DEMUXER_TYPE_MPEG4_ES; + demuxer->file_format=Demuxer::Type_MPEG4_ES; } else if((mpg_stat.num_h264_slice>3 || (mpg_stat.num_h264_dpa>3 && mpg_stat.num_h264_dpb>3 && mpg_stat.num_h264_dpc>3)) && /* FIXME mpg_stat.num_h264_sps>=1 && */ mpg_stat.num_h264_pps>=1 && mpg_stat.num_h264_idr>=1 && mpg_stat.num_elementary_packets1B6==0 && mpg_stat.num_elementary_packetsPES==0 && demuxer->synced<2) { /* fuzzy h264-es detection. do NOT enable without heavy testing of mpeg formats detection!*/ - demuxer->file_format=DEMUXER_TYPE_H264_ES; + demuxer->file_format=Demuxer::Type_H264_ES; } else { if(demuxer->synced==2) MSG_ERR("MPEG: " MSGTR_MissingVideoStreamBug); @@ -756,11 +756,11 @@ } break; } - if( demuxer->file_format==DEMUXER_TYPE_MPEG_ES || - demuxer->file_format==DEMUXER_TYPE_MPEG4_ES || - demuxer->file_format==DEMUXER_TYPE_H264_ES){ /* little hack, see above! */ + if( demuxer->file_format==Demuxer::Type_MPEG_ES || + demuxer->file_format==Demuxer::Type_MPEG4_ES || + demuxer->file_format==Demuxer::Type_H264_ES){ /* little hack, see above! */ mpg_d->alt_demuxer=mpges_demux; - if(!demuxer->v_streams[0]) new_sh_video(demuxer,0); + if(!demuxer->v_streams[0]) demuxer->new_sh_video(); if(demuxer->video->id==-1) demuxer->video->id=0; demuxer->video->sh=demuxer->v_streams[0]; stream_seek(demuxer->stream,demuxer->stream->start_pos); @@ -785,7 +785,7 @@ return MPXP_False; } -static demuxer_t* mpgps_open(demuxer_t*demuxer) +static Demuxer* mpgps_open(Demuxer*demuxer) { sh_video_t *sh_video=reinterpret_cast<sh_video_t*>(demuxer->video->sh); mpg_demuxer_t* mpg_d=static_cast<mpg_demuxer_t*>(demuxer->priv); @@ -809,17 +809,17 @@ return demuxer; } -static void mpgps_close(demuxer_t*demuxer) +static void mpgps_close(Demuxer*demuxer) { mpg_demuxer_t* mpg_d = static_cast<mpg_demuxer_t*>(demuxer->priv); if (mpg_d) delete mpg_d; } -static MPXP_Rc mpgps... [truncated message content] |
From: <nic...@us...> - 2012-12-04 17:04:47
|
Revision: 509 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=509&view=rev Author: nickols_k Date: 2012-12-04 17:04:36 +0000 (Tue, 04 Dec 2012) Log Message: ----------- more methods for classes Note about illegal patch: before previous commit i had stable segfault on 'delete sh_video;' after converting new_sh_audio() and new_sh_video() into methods of Demuxer i have working exit_player(). This means that most probably exactly these functions where substituted. But after migrating on C++ they were converted into long names. Therefore, malefactor(s) continue(d) work parallel with me. Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpdemux/parse_es.cpp mplayerxp/libmpdemux/parse_es.h mplayerxp/libmpdemux/stheader.h mplayerxp/mplayerxp.cpp Added Paths: ----------- mplayerxp/libmpdemux/stheader.cpp Removed Paths: ------------- mplayerxp/libmpdemux/video.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/dump.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -395,7 +395,7 @@ if(shv && !veof) { float v_pts; - in_size=video_read_frame(shv,&frame_time,&v_pts,&start,0); + in_size=shv->read_frame(&frame_time,&v_pts,&start,0); cmd = check_cmd(priv); if(cmd == -1) goto done; else Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/Makefile 2012-12-04 17:04:36 UTC (rev 509) @@ -12,7 +12,7 @@ CXXSRCS += demux_dv.cpp endif -CXXSRCS += mp3_hdr.cpp video.cpp mpeg_hdr.cpp aviprint.cpp parse_mp4.cpp parse_es.cpp +CXXSRCS += mp3_hdr.cpp stheader.cpp mpeg_hdr.cpp aviprint.cpp parse_mp4.cpp parse_es.cpp CXXSRCS += yuv4mpeg.cpp yuv4mpeg_ratio.cpp sub_cc.cpp sub_ty.cpp CXXSRCS += demux_aiff.cpp \ demux_asf.cpp \ Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -227,7 +227,7 @@ stream_reset(demuxer->stream); stream_seek(demuxer->stream, bmp_image->image_offset); - ds_read_packet(demuxer->video, demuxer->stream, bmp_image->image_size, + demuxer->video->read_packet(demuxer->stream, bmp_image->image_size, 0, bmp_image->image_offset, DP_KEYFRAME); return 1; } Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -591,11 +591,11 @@ continue; } } - i=sync_video_packet(d_video); + i=sync_video_packet(*d_video); if(sh_video->fourcc == VIDEO_MPEG4) { if(i==0x1B6) { //vop (frame) startcode int pos = videobuf_len; - if(!read_video_packet(d_video)) break; // EOF + if(!read_video_packet(*d_video)) break; // EOF if((videobuffer[pos+4] & 0x3F) == 0) break;//I-frame } } else if(sh_video->fourcc == VIDEO_H264){ @@ -603,7 +603,7 @@ } else { //default VIDEO_MPEG1/VIDEO_MPEG2 if(i==0x1B3 || i==0x1B8) break; // found it! } - if(!i || !skip_video_packet(d_video)) break; // EOF? + if(!i || !skip_video_packet(*d_video)) break; // EOF? } } Modified: mplayerxp/libmpdemux/demux_ts.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ts.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/demux_ts.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -3045,9 +3045,6 @@ priv->fifo[2].offset = 0; } } -extern int videobuf_code_len; -extern int sync_video_packet(Demuxer_Stream *); -extern int skip_video_packet(Demuxer_Stream *); static void ts_seek(Demuxer *demuxer,const seek_args_t* seeka) { @@ -3126,7 +3123,7 @@ } } - i = sync_video_packet(d_video); + i = sync_video_packet(*d_video); if((sh_video->fourcc == VIDEO_MPEG1) || (sh_video->fourcc == VIDEO_MPEG2)) { if(i==0x1B3 || i==0x1B8) break; // found it! @@ -3140,7 +3137,7 @@ if((i & ~0x60) == 0x105) break; } - if(!i || !skip_video_packet(d_video)) break; // EOF? + if(!i || !skip_video_packet(*d_video)) break; // EOF? } } Modified: mplayerxp/libmpdemux/demux_ty.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ty.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/demux_ty.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -809,9 +809,9 @@ continue; } } - i = sync_video_packet( d_video ); + i = sync_video_packet(*d_video); if( i == 0x1B3 || i == 0x1B8 ) break; // found it! - if( !i || !skip_video_packet( d_video ) ) break; // EOF? + if( !i || !skip_video_packet(*d_video) ) break; // EOF? } if ( mp_conf.subcc_enabled ) ty_ClearOSD( 0 ); Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -445,14 +445,4 @@ return id; } -sh_audio_t::~sh_audio_t(){ - MSG_V("DEMUXER: freeing sh_audio at %p \n",this); - if(wf) delete wf; -} - -sh_video_t::~sh_video_t(){ - MSG_V("DEMUXER: freeing sh_video at %p \n",this); - if(bih) delete bih; -} - } // namespace mpxp Modified: mplayerxp/libmpdemux/demuxer_r.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_r.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/demuxer_r.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -108,7 +108,7 @@ double tt; LOCK_DEMUXER(); if(mp_conf.benchmark) t=GetTimer(); - retval = video_read_frame(sh_video,&frame_time,&v_pts,&start,force_fps); + retval = sh_video->read_frame(&frame_time,&v_pts,&start,force_fps); if(retval<=0) return NULL; frame=new_enc_frame(VideoFrame,retval,v_pts,frame_time); frame->data=start; Modified: mplayerxp/libmpdemux/parse_es.cpp =================================================================== --- mplayerxp/libmpdemux/parse_es.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/parse_es.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -20,7 +20,7 @@ int videobuf_code_len=0; // sync video stream, and returns next packet code -int sync_video_packet(Demuxer_Stream *ds){ +int sync_video_packet(Demuxer_Stream& ds){ int skipped=0; // we need enough bytes in the buffer: while(videobuf_code_len<4){ @@ -29,7 +29,7 @@ c=demux_getc(ds);if(c<0){ return 0;} // EOF videobuf_code[videobuf_code_len++]=c; #else - videobuf_code[videobuf_code_len++]=ds->getch(); + videobuf_code[videobuf_code_len++]=ds.getch(); #endif } // sync packet: @@ -43,7 +43,7 @@ videobuf_code[0]=videobuf_code[1]; videobuf_code[1]=videobuf_code[2]; videobuf_code[2]=videobuf_code[3]; - c=ds->getch();if(c<0){ return 0;} // EOF + c=ds.getch();if(c<0){ return 0;} // EOF videobuf_code[3]=c; } if(skipped) MSG_DBG2("videobuf: %d bytes skipped (next: 0x1%02X)\n",skipped,videobuf_code[3]); @@ -51,7 +51,7 @@ } // return: packet length -int read_video_packet(Demuxer_Stream *ds){ +int read_video_packet(Demuxer_Stream& ds){ int packet_start; // SYNC STREAM @@ -68,7 +68,7 @@ // READ PACKET: { unsigned int head=-1; while(videobuf_len<VIDEOBUFFER_SIZE){ - int c=ds->getch(); + int c=ds.getch(); if(c<0) break; // EOF videobuffer[videobuf_len++]=c; #if 1 @@ -83,7 +83,7 @@ } } - if(ds->eof){ + if(ds.eof){ videobuf_code_len=0; // EOF, no next code return videobuf_len-packet_start; } @@ -103,7 +103,7 @@ } // return: next packet code -int skip_video_packet(Demuxer_Stream *ds){ +int skip_video_packet(Demuxer_Stream& ds){ // SYNC STREAM // if(!sync_video_packet(ds)) return 0; // cannot sync (EOF) Modified: mplayerxp/libmpdemux/parse_es.h =================================================================== --- mplayerxp/libmpdemux/parse_es.h 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/parse_es.h 2012-12-04 17:04:36 UTC (rev 509) @@ -11,11 +11,11 @@ extern int videobuf_code_len; // sync video stream, and returns next packet code -int sync_video_packet(Demuxer_Stream *ds); +int sync_video_packet(Demuxer_Stream& ds); // return: packet length -int read_video_packet(Demuxer_Stream *ds); +int read_video_packet(Demuxer_Stream& ds); // return: next packet code -int skip_video_packet(Demuxer_Stream *ds); +int skip_video_packet(Demuxer_Stream& ds); #endif Copied: mplayerxp/libmpdemux/stheader.cpp (from rev 508, mplayerxp/libmpdemux/video.cpp) =================================================================== --- mplayerxp/libmpdemux/stheader.cpp (rev 0) +++ mplayerxp/libmpdemux/stheader.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -0,0 +1,597 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +// read vmpideo frame + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "help_mp.h" +#include "sub_cc.h" + +#include "libmpstream/stream.h" +#include "demuxer.h" +#include "stheader.h" +#include "parse_es.h" +#include "mpeg_hdr.h" +#include "mplayerxp.h" +#include "demux_msg.h" + +extern void ty_processuserdata(const unsigned char* buf, int len ); +namespace mpxp { + +sh_audio_t::~sh_audio_t(){ + MSG_V("DEMUXER: freeing sh_audio at %p \n",this); + if(wf) delete wf; +} + +sh_video_t::~sh_video_t(){ + MSG_V("DEMUXER: freeing sh_video at %p \n",this); + if(bih) delete bih; +} + +/* biCompression constant */ +#define BI_RGB 0L + +static mp_mpeg_header_t picture; +static int telecine=0; +static float telecine_cnt=-2.5; + +#if 0 +/* aspect 0 means don't prescale */ +static float mpeg1_aspects[]= +{ + 0.0000, 0.0000, 1.4848, 1.4222, 1.3131, 1.2415, 1.1853, 1.1912, + 1.0666, 1.0188, 1.0255, 1.0695, 1.1250, 1.1575, 1.2015, 0.0000 +}; + +static float mpeg2_aspects[]= +{ + 0.0000, 0.0000, 1.3333, 1.7777, 2.2100, 0.8055, 0.8437, 0.8935, + 0.9375, 0.9815, 1.0255, 1.0695, 1.1250, 1.1575, 1.2015, 0.0000 +}; + +static float mpeg_framerates[]= +{ + 0.000, 23.976, 24.000, 25.000, 29.970, 30.000, 50.000, 59.940, 60.000, + 15.000, /* Xing's 15fps: (9)*/ + /* libmpeg3's "Unofficial economy rates": (10-13) */ + 5.00,10.00,12.00,15.00, + /* some invalid ones: (14-15) */ + 0.0, 0.0 +}; +#endif +int sh_video_t::read_properties(){ +Demuxer_Stream& d_video=*ds; + +enum { + VIDEO_MPEG12, + VIDEO_MPEG4, + VIDEO_H264, + VIDEO_OTHER +} video_codec; + +if((d_video.demuxer->file_format == Demuxer::Type_PVA) || + (d_video.demuxer->file_format == Demuxer::Type_MPEG_ES) || + (d_video.demuxer->file_format == Demuxer::Type_MPEG_PS && ((! fourcc) || (fourcc==0x10000001) || (fourcc==0x10000002))) || + (d_video.demuxer->file_format == Demuxer::Type_MPEG_TS && ((fourcc==0x10000001) || (fourcc==0x10000002))) +#ifdef STREAMING_LIVE_DOT_COM + || ((d_video.demuxer->file_format == Demuxer::Type_RTP) && demux_is_mpeg_rtp_stream(d_video.demuxer)) +#endif + ) + video_codec = VIDEO_MPEG12; + else if((d_video.demuxer->file_format == Demuxer::Type_MPEG4_ES) || + ((d_video.demuxer->file_format == Demuxer::Type_MPEG_TS) && (fourcc==0x10000004)) || + ((d_video.demuxer->file_format == Demuxer::Type_MPEG_PS) && (fourcc==0x10000004)) + ) + video_codec = VIDEO_MPEG4; + else if((d_video.demuxer->file_format == Demuxer::Type_H264_ES) || + ((d_video.demuxer->file_format == Demuxer::Type_MPEG_TS) && (fourcc==0x10000005)) || + ((d_video.demuxer->file_format == Demuxer::Type_MPEG_PS) && (fourcc==0x10000005)) + ) + video_codec = VIDEO_H264; + else + video_codec = VIDEO_OTHER; + +// Determine image properties: +switch(video_codec){ + case VIDEO_OTHER: { + if((d_video.demuxer->file_format == Demuxer::Type_ASF) || (d_video.demuxer->file_format == Demuxer::Type_AVI)) { + // display info: +#if 0 + if(bih->biCompression == BI_RGB && + (video.fccHandler == mmioFOURCC('D', 'I', 'B', ' ') || + video.fccHandler == mmioFOURCC('R', 'G', 'B', ' ') || + video.fccHandler == mmioFOURCC('R', 'A', 'W', ' ') || + video.fccHandler == 0)) { + fourcc = mmioFOURCC(0, 'R', 'G', 'B') | bih->biBitCount; + } + else +#endif + fourcc=bih->biCompression; + + src_w=bih->biWidth; + src_h=abs(bih->biHeight); + +#if 1 + /* hack to support decoding of mpeg1 chunks in AVI's with libmpeg2 -- 2002 alex */ + if ((fourcc == 0x10000001) || + (fourcc == 0x10000002) || + (fourcc == mmioFOURCC('m','p','g','1')) || + (fourcc == mmioFOURCC('M','P','G','1')) || + (fourcc == mmioFOURCC('m','p','g','2')) || + (fourcc == mmioFOURCC('M','P','G','2')) || + (fourcc == mmioFOURCC('m','p','e','g')) || + (fourcc == mmioFOURCC('M','P','E','G'))) + { + int saved_pos; + Demuxer::demuxer_type_e saved_type; + + /* demuxer pos saving is required for libavcodec mpeg decoder as it's + reading the mpeg header self! */ + +// saved_pos = d_video.buffer_pos; + saved_type = d_video.demuxer->file_format; + + d_video.demuxer->file_format = Demuxer::Type_MPEG_ES; + read_properties(); + d_video.demuxer->file_format = saved_type; +// d_video.buffer_pos = saved_pos; +// goto mpeg_header_parser; + } +#endif + } + break; + } + case VIDEO_MPEG4: { + int pos = 0, vop_cnt=0, units[3]; + videobuf_len=0; videobuf_code_len=0; + MSG_V("Searching for Video Object Start code... ");fflush(stdout); + while(1){ + int i=sync_video_packet(d_video); + if(i<=0x11F) break; // found it! + if(!i || !skip_video_packet(d_video)){ + MSG_V("NONE :(\n"); + return 0; + } + } + MSG_V("OK!\n"); + if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; + if(!videobuffer){ + MSG_ERR(MSGTR_ShMemAllocFail); + return 0; + } + MSG_V("Searching for Video Object Layer Start code... ");fflush(stdout); + while(1){ + int i=sync_video_packet(d_video); + MSG_V("M4V: 0x%X\n",i); + if(i>=0x120 && i<=0x12F) break; // found it! + if(!i || !read_video_packet(d_video)){ + MSG_V("NONE :(\n"); + return 0; + } + } + pos = videobuf_len+4; + if(!read_video_packet(d_video)){ + MSG_ERR("Can't read Video Object Layer Header\n"); + return 0; + } + mp4_header_process_vol(&picture, &(videobuffer[pos])); + MSG_V("OK! FPS SEEMS TO BE %.3f\nSearching for Video Object Plane Start code... ", fps);fflush(stdout); + mp4_init: + while(1){ + int i=sync_video_packet(d_video); + if(i==0x1B6) break; // found it! + if(!i || !read_video_packet(d_video)){ + MSG_V("NONE :(\n"); + return 0; + } + } + pos = videobuf_len+4; + if(!read_video_packet(d_video)){ + MSG_ERR("Can't read Video Object Plane Header\n"); + return 0; + } + mp4_header_process_vop(&picture, &(videobuffer[pos])); + units[vop_cnt] = picture.timeinc_unit; + vop_cnt++; + //mp_msg(MSGT_DECVIDEO,MSGL_V, "TYPE: %d, unit: %d\n", picture.picture_type, picture.timeinc_unit); + if(!picture.fps) { + int i, mn, md, mx, diff; + if(vop_cnt < 3) + goto mp4_init; + + i=0; + mn = mx = units[0]; + for(i=0; i<3; i++) { + if(units[i] < mn) + mn = units[i]; + if(units[i] > mx) + mx = units[i]; + } + md = mn; + for(i=0; i<3; i++) { + if((units[i] > mn) && (units[i] < mx)) + md = units[i]; + } + MSG_V("MIN: %d, mid: %d, max: %d\n", mn, md, mx); + if(mx - md > md - mn) + diff = md - mn; + else + diff = mx - md; + if(diff > 0){ + picture.fps = (picture.timeinc_resolution * 10000) / diff; + MSG_V("FPS seems to be: %d/10000, resolution: %d, delta_units: %d\n", picture.fps, picture.timeinc_resolution, diff); + } + } + if(picture.fps) { + fps=picture.fps*0.0001f; + MSG_INFO("FPS seems to be: %d/10000\n", picture.fps); + } + MSG_V("OK!\n"); + fourcc=0x10000004; + break; + } + case VIDEO_H264: { + int pos = 0; + videobuf_len=0; videobuf_code_len=0; + MSG_V("Searching for sequence parameter set... ");fflush(stdout); + while(1){ + int i=sync_video_packet(d_video); + if((i&~0x60) == 0x107 && i != 0x107) break; // found it! + if(!i || !skip_video_packet(d_video)){ + MSG_V("NONE :(\n"); + return 0; + } + } + MSG_V("OK!\n"); + if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; + if(!videobuffer){ + MSG_ERR(MSGTR_ShMemAllocFail); + return 0; + } + pos = videobuf_len+4; + if(!read_video_packet(d_video)){ + MSG_ERR("Can't read sequence parameter set\n"); + return 0; + } + h264_parse_sps(&picture, &(videobuffer[pos]), videobuf_len - pos); + MSG_V("Searching for picture parameter set... ");fflush(stdout); + while(1){ + int i=sync_video_packet(d_video); + MSG_V("H264: 0x%X\n",i); + if((i&~0x60) == 0x108 && i != 0x108) break; // found it! + if(!i || !read_video_packet(d_video)){ + MSG_V("NONE :(\n"); + return 0; + } + } + MSG_V("OK!\nSearching for Slice... ");fflush(stdout); + while(1){ + int i=sync_video_packet(d_video); + if((i&~0x60) == 0x101 || (i&~0x60) == 0x102 || (i&~0x60) == 0x105) break; // found it! + if(!i || !read_video_packet(d_video)){ + MSG_V("NONE :(\n"); + return 0; + } + } + MSG_V("OK!\n"); + fourcc=0x10000005; + if(picture.fps) { + fps=picture.fps*0.0001f; + MSG_INFO("FPS seems to be: %d/10000\n", picture.fps); + } + break; + } + case VIDEO_MPEG12: { +//mpeg_header_parser: + // Find sequence_header first: + videobuf_len=0; videobuf_code_len=0; + telecine=0; telecine_cnt=-2.5; + MSG_V("Searching for sequence header... ");fflush(stdout); + while(1){ + int i=sync_video_packet(d_video); + if(i==0x1B3) break; // found it! + if(!i || !skip_video_packet(d_video)){ + MSG_V("NONE :(\n"); + MSG_ERR(MSGTR_MpegNoSequHdr); + return 0; + } + } + MSG_V("OK!\n"); +// sh_video=d_video.sh;ds=d_video; +// mpeg2_init(); + // ========= Read & process sequence header & extension ============ + if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; + if(!videobuffer){ + MSG_ERR(MSGTR_ShMemAllocFail); + return 0; + } + + if(!read_video_packet(d_video)){ + MSG_ERR(MSGTR_CannotReadMpegSequHdr); + return 0; + } + if(mp_header_process_sequence_header (&picture, &videobuffer[4])) { + MSG_ERR(MSGTR_BadMpegSequHdr); + return 0; + } + if(sync_video_packet(d_video)==0x1B5){ // next packet is seq. ext. +// videobuf_len=0; + int pos=videobuf_len; + if(!read_video_packet(d_video)){ + MSG_ERR(MSGTR_CannotReadMpegSequHdrEx); + return 0; + } + if(mp_header_process_extension (&picture, &videobuffer[pos+4])) { + MSG_ERR(MSGTR_BadMpegSequHdrEx); + return 0; + } + } + // fill aspect info: + switch(picture.aspect_ratio_information){ + case 2: // PAL/NTSC SVCD/DVD 4:3 + case 8: // PAL VCD 4:3 + case 12: // NTSC VCD 4:3 + aspect=4.0/3.0; + break; + case 3: // PAL/NTSC Widescreen SVCD/DVD 16:9 + case 6: // (PAL?)/NTSC Widescreen SVCD 16:9 + aspect=16.0/9.0; + break; + case 4: // according to ISO-138182-2 Table 6.3 + aspect=2.21; + break; + case 9: // Movie Type ??? / 640x480 + aspect=0.0; + break; + default: + MSG_ERR("Detected unknown aspect_ratio_information in mpeg sequence header.\n" + "Please report the aspect value (%i) along with the movie type (VGA,PAL,NTSC," + "SECAM) and the movie resolution (720x576,352x240,480x480,...) to the MPlayer" + " developers, so that we can add support for it!\nAssuming 1:1 aspect for now.\n", + picture.aspect_ratio_information); + case 1: // VGA 1:1 - do not prescale + aspect=0.0; + break; + } + // fill aspect info: + fourcc=picture.mpeg1?0x10000001:0x10000002; // mpeg video +#if 0 + if(picture.mpeg1) + aspect=mpeg1_aspects[picture.aspect_ratio_information & 0x0F]; + else + aspect=mpeg2_aspects[picture.aspect_ratio_information & 0x0F]; +#endif + // display info: + fps=picture.fps*0.0001f; +#if 0 + fps=mpeg_framerates[picture.frame_rate_code & 0x0F]; +#endif + src_w=picture.display_picture_width; + src_h=picture.display_picture_height; + // info: + MSG_DBG2("mpeg bitrate: %d (%X)\n",picture.bitrate,picture.bitrate); + MSG_V("VIDEO: %s %dx%d (aspect %d) %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n", + picture.mpeg1?"MPEG1":"MPEG2", + src_w,src_h, + picture.aspect_ratio_information, + fps, + picture.bitrate*0.5f, + picture.bitrate/16.0f ); + break; + } +} // switch(file_format) + +return 1; +} + +static void process_userdata(const unsigned char* buf,int len){ + int i; + /* if the user data starts with "CC", assume it is a Closed Captions info packet */ + if(len>2 && buf[0]=='C' && buf[1]=='C'){ + subcc_process_data(buf+2,len-2); + } + if( len > 2 && buf[ 0 ] == 'T' && buf[ 1 ] == 'Y' ) + { + ty_processuserdata( buf + 2, len - 2 ); + return; + } + MSG_V( "user_data: len=%3d %02X %02X %02X %02X '", + len, buf[0], buf[1], buf[2], buf[3]); + for(i=0;i<len;i++) + if(buf[i]>=32 && buf[i]<127) MSG_V("%c",buf[i]); + MSG_V("'\n"); +} + +int sh_video_t::read_frame(float* frame_time_ptr,float *v_pts,unsigned char** start,int force_fps){ + Demuxer_Stream& d_video=*ds; + Demuxer *demuxer=d_video.demuxer; + float frame_time=1; + float pts1=d_video.pts; + int picture_coding_type=0; +// unsigned char* start=NULL; + int in_size=0; + + *start=NULL; + + if(demuxer->file_format==Demuxer::Type_MPEG_ES || + (demuxer->file_format==Demuxer::Type_MPEG_PS && ((! fourcc) || (fourcc==0x10000001) || (fourcc==0x10000002))) + || demuxer->file_format==Demuxer::Type_PVA || + ((demuxer->file_format==Demuxer::Type_MPEG_TS) && ((fourcc==0x10000001) || (fourcc==0x10000002)))) + { + int in_frame=0; + //float newfps; + //videobuf_len=0; + while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){ + int i=sync_video_packet(d_video); + //any_t* buffer=&videobuffer[videobuf_len+4]; + int __start=videobuf_len+4; + if(in_frame){ + if(i<0x101 || i>=0x1B0){ // not slice code -> end of frame +#if 1 + // send END OF FRAME code: + videobuffer[videobuf_len+0]=0; + videobuffer[videobuf_len+1]=0; + videobuffer[videobuf_len+2]=1; + videobuffer[videobuf_len+3]=0xFF; + videobuf_len+=4; +#endif + if(!i) return -1; // EOF + break; + } + } else { + //if(i==0x100) in_frame=1; // picture startcode + if(i>=0x101 && i<0x1B0) in_frame=1; // picture startcode + else if(!i) return -1; // EOF + } + if(!read_video_packet(d_video)) return -1; // EOF + // process headers: + switch(i){ + case 0x1B3: mp_header_process_sequence_header (&picture, &videobuffer[__start]);break; + case 0x1B5: mp_header_process_extension (&picture, &videobuffer[__start]);break; + case 0x1B2: process_userdata (&videobuffer[__start], videobuf_len-__start);break; + case 0x100: picture_coding_type=(videobuffer[__start+1] >> 3) & 7;break; + } + } + // if(videobuf_len>max_framesize) max_framesize=videobuf_len; // debug + *start=videobuffer; in_size=videobuf_len; + +#if 1 + // get mpeg fps: + //newfps=frameratecode2framerate[picture->frame_rate_code]*0.0001f; + if((int)(fps*10000+0.5)!=picture.fps) if(!force_fps && !telecine){ + MSG_WARN("Warning! FPS changed %5.3f -> %5.3f (%f) [%d] \n",fps,picture.fps*0.0001,fps-picture.fps*0.0001,picture.frame_rate_code); + fps=picture.fps*0.0001; + } +#endif + + // fix mpeg2 frametime: + frame_time=(picture.display_time)*0.01f; + picture.display_time=100; + videobuf_len=0; + + telecine_cnt*=0.9; // drift out error + telecine_cnt+=frame_time-5.0/4.0; + MSG_DBG2("\r telecine = %3.1f %5.3f \n",frame_time,telecine_cnt); + + if(telecine){ + frame_time=1; + if(telecine_cnt<-1.5 || telecine_cnt>1.5){ + MSG_INFO("Leave telecine mode\n"); + telecine=0; + } + } else + if(telecine_cnt>-0.5 && telecine_cnt<0.5 && !force_fps){ + fps=fps*4/5; + MSG_INFO("Enter telecine mode\n"); + telecine=1; + } + + } else if((demuxer->file_format==Demuxer::Type_MPEG4_ES) || ((demuxer->file_format==Demuxer::Type_MPEG_TS) && (fourcc==0x10000004)) || + ((demuxer->file_format==Demuxer::Type_MPEG_PS) && (fourcc==0x10000004)) + ){ + // + while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){ + int i=sync_video_packet(d_video); + if(!i) return -1; + if(!read_video_packet(d_video)) return -1; // EOF + if(i==0x1B6) break; + } + *start=videobuffer; in_size=videobuf_len; + videobuf_len=0; + + } else if(demuxer->file_format==Demuxer::Type_H264_ES || ((demuxer->file_format==Demuxer::Type_MPEG_TS) && (fourcc==0x10000005)) || + ((demuxer->file_format==Demuxer::Type_MPEG_PS) && (fourcc==0x10000005)) + ){ + // + while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){ + int i=sync_video_packet(d_video); + int pos = videobuf_len+4; + if(!i) return -1; + if(!read_video_packet(d_video)) return -1; // EOF + if((i&~0x60) == 0x107 && i != 0x107) { + h264_parse_sps(&picture, &(videobuffer[pos]), videobuf_len - pos); + if(picture.fps > 0) { + fps=picture.fps*0.0001f; + } + i=sync_video_packet(d_video); + if(!i) return -1; + if(!read_video_packet(d_video)) return -1; // EOF + } + if((i&~0x60) == 0x101 || (i&~0x60) == 0x102 || (i&~0x60) == 0x105) break; + } + *start=videobuffer; in_size=videobuf_len; + videobuf_len=0; + } else { + /* frame-based file formats: (AVI,ASF,MOV) */ + in_size=d_video.get_packet(start); + if(in_size<0) return -1; // EOF + } + + // Increase video timers: + frame_time*=1.0f/fps; + + /* override frame_time for variable/unknown FPS formats: */ + if(!force_fps) + switch(demuxer->file_format) + { + case Demuxer::Type_REAL: + case Demuxer::Type_MATROSKA: + if(d_video.pts>0 && pts1>0 && d_video.pts>pts1) + frame_time=d_video.pts-pts1; + break; + default: +#ifdef USE_TV + case Demuxer::Type_TV: +#endif + case Demuxer::Type_MOV: + case Demuxer::Type_FILM: + case Demuxer::Type_VIVO: + case Demuxer::Type_ASF: { + /* .ASF files has no fixed FPS - just frame durations! */ + float next_pts = d_video.get_next_pts(); + float d= next_pts > 0 ? next_pts - d_video.pts : d_video.pts-pts1; + if(d>=0){ + if(d>0) + if((int)fps==1000) + MSG_STATUS("\rASF framerate: %d fps \n",(int)(1.0f/d)); + fps=1.0f/d; + frame_time = d; + } else { + MSG_WARN("\nInvalid frame duration value (%2.5f/%2.5f => %5.3f). Defaulting to 1/25 sec.\n",d_video.pts,next_pts,frame_time); + frame_time = 1/25.0; + } + } + } + if(demuxer->file_format==Demuxer::Type_MPEG_PS || + demuxer->file_format==Demuxer::Type_MPEG_ES || + demuxer->file_format==Demuxer::Type_MPEG_TS) d_video.pts+=frame_time; + /* FIXUP VIDEO PTS*/ + if((demuxer->file_format == Demuxer::Type_MPEG_ES || + demuxer->file_format == Demuxer::Type_MPEG4_ES || + demuxer->file_format == Demuxer::Type_H264_ES || + demuxer->file_format == Demuxer::Type_MPEG_PS || + ((demuxer->file_format==Demuxer::Type_MPEG_TS) && ((fourcc==0x10000001) || (fourcc==0x10000002))) || + mp_conf.av_force_pts_fix) && mp_conf.av_sync_pts && mp_conf.av_force_pts_fix2!=1) + { + if(d_video.pts_flags && d_video.pts < 1.0 && d_video.prev_pts > 2.0) + { + float spts; + spts=d_video.demuxer->stream->stream_pts; + d_video.pts_corr=spts>0?spts:d_video.prev_pts; + d_video.pts_flags=0; + MSG_V("***PTS discontinuity happens*** correcting video %f pts as %f\n",d_video.pts,d_video.pts_corr); + } + if(d_video.pts>1.0) d_video.pts_flags=1; + if(!d_video.eof) d_video.prev_pts=d_video.pts+d_video.pts_corr; + *v_pts=d_video.prev_pts; + } + else *v_pts=d_video.pts; + + if(frame_time_ptr) *frame_time_ptr=frame_time; + return in_size; +} +} // namespace mpxp Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/stheader.h 2012-12-04 17:04:36 UTC (rev 509) @@ -79,6 +79,8 @@ sh_video_t() {} virtual ~sh_video_t(); + virtual int read_properties(); + virtual int read_frame(float* frame_time_ptr,float *v_pts,unsigned char** start,int force_fps); // input format uint32_t fourcc; int is_static; /* default: 0 - means movie; 1 - means picture (.jpg ...)*/ @@ -95,8 +97,6 @@ BITMAPINFOHEADER*bih; // in format ImageDescription*ImageDesc; // for quicktime codecs }; - int video_read_properties(sh_video_t *sh_video); - int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,float *v_pts,unsigned char** start,int force_fps); } //namespace mpxp #endif Deleted: mplayerxp/libmpdemux/video.cpp =================================================================== --- mplayerxp/libmpdemux/video.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/libmpdemux/video.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -1,586 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -// read vmpideo frame - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "help_mp.h" -#include "sub_cc.h" - -#include "libmpstream/stream.h" -#include "demuxer.h" -#include "stheader.h" -#include "parse_es.h" -#include "mpeg_hdr.h" -#include "mplayerxp.h" -#include "demux_msg.h" - -extern void ty_processuserdata(const unsigned char* buf, int len ); -namespace mpxp { -/* biCompression constant */ -#define BI_RGB 0L - -static mp_mpeg_header_t picture; -static int telecine=0; -static float telecine_cnt=-2.5; - -#if 0 -/* aspect 0 means don't prescale */ -static float mpeg1_aspects[]= -{ - 0.0000, 0.0000, 1.4848, 1.4222, 1.3131, 1.2415, 1.1853, 1.1912, - 1.0666, 1.0188, 1.0255, 1.0695, 1.1250, 1.1575, 1.2015, 0.0000 -}; - -static float mpeg2_aspects[]= -{ - 0.0000, 0.0000, 1.3333, 1.7777, 2.2100, 0.8055, 0.8437, 0.8935, - 0.9375, 0.9815, 1.0255, 1.0695, 1.1250, 1.1575, 1.2015, 0.0000 -}; - -static float mpeg_framerates[]= -{ - 0.000, 23.976, 24.000, 25.000, 29.970, 30.000, 50.000, 59.940, 60.000, - 15.000, /* Xing's 15fps: (9)*/ - /* libmpeg3's "Unofficial economy rates": (10-13) */ - 5.00,10.00,12.00,15.00, - /* some invalid ones: (14-15) */ - 0.0, 0.0 -}; -#endif -int video_read_properties(sh_video_t *sh_video){ -Demuxer_Stream *d_video=sh_video->ds; - -enum { - VIDEO_MPEG12, - VIDEO_MPEG4, - VIDEO_H264, - VIDEO_OTHER -} video_codec; - -if((d_video->demuxer->file_format == Demuxer::Type_PVA) || - (d_video->demuxer->file_format == Demuxer::Type_MPEG_ES) || - (d_video->demuxer->file_format == Demuxer::Type_MPEG_PS && ((! sh_video->fourcc) || (sh_video->fourcc==0x10000001) || (sh_video->fourcc==0x10000002))) || - (d_video->demuxer->file_format == Demuxer::Type_MPEG_TS && ((sh_video->fourcc==0x10000001) || (sh_video->fourcc==0x10000002))) -#ifdef STREAMING_LIVE_DOT_COM - || ((d_video->demuxer->file_format == Demuxer::Type_RTP) && demux_is_mpeg_rtp_stream(d_video->demuxer)) -#endif - ) - video_codec = VIDEO_MPEG12; - else if((d_video->demuxer->file_format == Demuxer::Type_MPEG4_ES) || - ((d_video->demuxer->file_format == Demuxer::Type_MPEG_TS) && (sh_video->fourcc==0x10000004)) || - ((d_video->demuxer->file_format == Demuxer::Type_MPEG_PS) && (sh_video->fourcc==0x10000004)) - ) - video_codec = VIDEO_MPEG4; - else if((d_video->demuxer->file_format == Demuxer::Type_H264_ES) || - ((d_video->demuxer->file_format == Demuxer::Type_MPEG_TS) && (sh_video->fourcc==0x10000005)) || - ((d_video->demuxer->file_format == Demuxer::Type_MPEG_PS) && (sh_video->fourcc==0x10000005)) - ) - video_codec = VIDEO_H264; - else - video_codec = VIDEO_OTHER; - -// Determine image properties: -switch(video_codec){ - case VIDEO_OTHER: { - if((d_video->demuxer->file_format == Demuxer::Type_ASF) || (d_video->demuxer->file_format == Demuxer::Type_AVI)) { - // display info: -#if 0 - if(sh_video->bih->biCompression == BI_RGB && - (sh_video->video.fccHandler == mmioFOURCC('D', 'I', 'B', ' ') || - sh_video->video.fccHandler == mmioFOURCC('R', 'G', 'B', ' ') || - sh_video->video.fccHandler == mmioFOURCC('R', 'A', 'W', ' ') || - sh_video->video.fccHandler == 0)) { - sh_video->fourcc = mmioFOURCC(0, 'R', 'G', 'B') | sh_video->bih->biBitCount; - } - else -#endif - sh_video->fourcc=sh_video->bih->biCompression; - - sh_video->src_w=sh_video->bih->biWidth; - sh_video->src_h=abs(sh_video->bih->biHeight); - -#if 1 - /* hack to support decoding of mpeg1 chunks in AVI's with libmpeg2 -- 2002 alex */ - if ((sh_video->fourcc == 0x10000001) || - (sh_video->fourcc == 0x10000002) || - (sh_video->fourcc == mmioFOURCC('m','p','g','1')) || - (sh_video->fourcc == mmioFOURCC('M','P','G','1')) || - (sh_video->fourcc == mmioFOURCC('m','p','g','2')) || - (sh_video->fourcc == mmioFOURCC('M','P','G','2')) || - (sh_video->fourcc == mmioFOURCC('m','p','e','g')) || - (sh_video->fourcc == mmioFOURCC('M','P','E','G'))) - { - int saved_pos; - Demuxer::demuxer_type_e saved_type; - - /* demuxer pos saving is required for libavcodec mpeg decoder as it's - reading the mpeg header self! */ - -// saved_pos = d_video->buffer_pos; - saved_type = d_video->demuxer->file_format; - - d_video->demuxer->file_format = Demuxer::Type_MPEG_ES; - video_read_properties(sh_video); - d_video->demuxer->file_format = saved_type; -// d_video->buffer_pos = saved_pos; -// goto mpeg_header_parser; - } -#endif - } - break; - } - case VIDEO_MPEG4: { - int pos = 0, vop_cnt=0, units[3]; - videobuf_len=0; videobuf_code_len=0; - MSG_V("Searching for Video Object Start code... ");fflush(stdout); - while(1){ - int i=sync_video_packet(d_video); - if(i<=0x11F) break; // found it! - if(!i || !skip_video_packet(d_video)){ - MSG_V("NONE :(\n"); - return 0; - } - } - MSG_V("OK!\n"); - if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; - if(!videobuffer){ - MSG_ERR(MSGTR_ShMemAllocFail); - return 0; - } - MSG_V("Searching for Video Object Layer Start code... ");fflush(stdout); - while(1){ - int i=sync_video_packet(d_video); - MSG_V("M4V: 0x%X\n",i); - if(i>=0x120 && i<=0x12F) break; // found it! - if(!i || !read_video_packet(d_video)){ - MSG_V("NONE :(\n"); - return 0; - } - } - pos = videobuf_len+4; - if(!read_video_packet(d_video)){ - MSG_ERR("Can't read Video Object Layer Header\n"); - return 0; - } - mp4_header_process_vol(&picture, &(videobuffer[pos])); - MSG_V("OK! FPS SEEMS TO BE %.3f\nSearching for Video Object Plane Start code... ", sh_video->fps);fflush(stdout); - mp4_init: - while(1){ - int i=sync_video_packet(d_video); - if(i==0x1B6) break; // found it! - if(!i || !read_video_packet(d_video)){ - MSG_V("NONE :(\n"); - return 0; - } - } - pos = videobuf_len+4; - if(!read_video_packet(d_video)){ - MSG_ERR("Can't read Video Object Plane Header\n"); - return 0; - } - mp4_header_process_vop(&picture, &(videobuffer[pos])); - units[vop_cnt] = picture.timeinc_unit; - vop_cnt++; - //mp_msg(MSGT_DECVIDEO,MSGL_V, "TYPE: %d, unit: %d\n", picture.picture_type, picture.timeinc_unit); - if(!picture.fps) { - int i, mn, md, mx, diff; - if(vop_cnt < 3) - goto mp4_init; - - i=0; - mn = mx = units[0]; - for(i=0; i<3; i++) { - if(units[i] < mn) - mn = units[i]; - if(units[i] > mx) - mx = units[i]; - } - md = mn; - for(i=0; i<3; i++) { - if((units[i] > mn) && (units[i] < mx)) - md = units[i]; - } - MSG_V("MIN: %d, mid: %d, max: %d\n", mn, md, mx); - if(mx - md > md - mn) - diff = md - mn; - else - diff = mx - md; - if(diff > 0){ - picture.fps = (picture.timeinc_resolution * 10000) / diff; - MSG_V("FPS seems to be: %d/10000, resolution: %d, delta_units: %d\n", picture.fps, picture.timeinc_resolution, diff); - } - } - if(picture.fps) { - sh_video->fps=picture.fps*0.0001f; - MSG_INFO("FPS seems to be: %d/10000\n", picture.fps); - } - MSG_V("OK!\n"); - sh_video->fourcc=0x10000004; - break; - } - case VIDEO_H264: { - int pos = 0; - videobuf_len=0; videobuf_code_len=0; - MSG_V("Searching for sequence parameter set... ");fflush(stdout); - while(1){ - int i=sync_video_packet(d_video); - if((i&~0x60) == 0x107 && i != 0x107) break; // found it! - if(!i || !skip_video_packet(d_video)){ - MSG_V("NONE :(\n"); - return 0; - } - } - MSG_V("OK!\n"); - if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; - if(!videobuffer){ - MSG_ERR(MSGTR_ShMemAllocFail); - return 0; - } - pos = videobuf_len+4; - if(!read_video_packet(d_video)){ - MSG_ERR("Can't read sequence parameter set\n"); - return 0; - } - h264_parse_sps(&picture, &(videobuffer[pos]), videobuf_len - pos); - MSG_V("Searching for picture parameter set... ");fflush(stdout); - while(1){ - int i=sync_video_packet(d_video); - MSG_V("H264: 0x%X\n",i); - if((i&~0x60) == 0x108 && i != 0x108) break; // found it! - if(!i || !read_video_packet(d_video)){ - MSG_V("NONE :(\n"); - return 0; - } - } - MSG_V("OK!\nSearching for Slice... ");fflush(stdout); - while(1){ - int i=sync_video_packet(d_video); - if((i&~0x60) == 0x101 || (i&~0x60) == 0x102 || (i&~0x60) == 0x105) break; // found it! - if(!i || !read_video_packet(d_video)){ - MSG_V("NONE :(\n"); - return 0; - } - } - MSG_V("OK!\n"); - sh_video->fourcc=0x10000005; - if(picture.fps) { - sh_video->fps=picture.fps*0.0001f; - MSG_INFO("FPS seems to be: %d/10000\n", picture.fps); - } - break; - } - case VIDEO_MPEG12: { -//mpeg_header_parser: - // Find sequence_header first: - videobuf_len=0; videobuf_code_len=0; - telecine=0; telecine_cnt=-2.5; - MSG_V("Searching for sequence header... ");fflush(stdout); - while(1){ - int i=sync_video_packet(d_video); - if(i==0x1B3) break; // found it! - if(!i || !skip_video_packet(d_video)){ - MSG_V("NONE :(\n"); - MSG_ERR(MSGTR_MpegNoSequHdr); - return 0; - } - } - MSG_V("OK!\n"); -// sh_video=d_video->sh;sh_video->ds=d_video; -// mpeg2_init(); - // ========= Read & process sequence header & extension ============ - if(!videobuffer) videobuffer=new(alignmem,8) unsigned char[VIDEOBUFFER_SIZE]; - if(!videobuffer){ - MSG_ERR(MSGTR_ShMemAllocFail); - return 0; - } - - if(!read_video_packet(d_video)){ - MSG_ERR(MSGTR_CannotReadMpegSequHdr); - return 0; - } - if(mp_header_process_sequence_header (&picture, &videobuffer[4])) { - MSG_ERR(MSGTR_BadMpegSequHdr); - return 0; - } - if(sync_video_packet(d_video)==0x1B5){ // next packet is seq. ext. -// videobuf_len=0; - int pos=videobuf_len; - if(!read_video_packet(d_video)){ - MSG_ERR(MSGTR_CannotReadMpegSequHdrEx); - return 0; - } - if(mp_header_process_extension (&picture, &videobuffer[pos+4])) { - MSG_ERR(MSGTR_BadMpegSequHdrEx); - return 0; - } - } - // fill aspect info: - switch(picture.aspect_ratio_information){ - case 2: // PAL/NTSC SVCD/DVD 4:3 - case 8: // PAL VCD 4:3 - case 12: // NTSC VCD 4:3 - sh_video->aspect=4.0/3.0; - break; - case 3: // PAL/NTSC Widescreen SVCD/DVD 16:9 - case 6: // (PAL?)/NTSC Widescreen SVCD 16:9 - sh_video->aspect=16.0/9.0; - break; - case 4: // according to ISO-138182-2 Table 6.3 - sh_video->aspect=2.21; - break; - case 9: // Movie Type ??? / 640x480 - sh_video->aspect=0.0; - break; - default: - MSG_ERR("Detected unknown aspect_ratio_information in mpeg sequence header.\n" - "Please report the aspect value (%i) along with the movie type (VGA,PAL,NTSC," - "SECAM) and the movie resolution (720x576,352x240,480x480,...) to the MPlayer" - " developers, so that we can add support for it!\nAssuming 1:1 aspect for now.\n", - picture.aspect_ratio_information); - case 1: // VGA 1:1 - do not prescale - sh_video->aspect=0.0; - break; - } - // fill aspect info: - sh_video->fourcc=picture.mpeg1?0x10000001:0x10000002; // mpeg video -#if 0 - if(picture.mpeg1) - sh_video->aspect=mpeg1_aspects[picture.aspect_ratio_information & 0x0F]; - else - sh_video->aspect=mpeg2_aspects[picture.aspect_ratio_information & 0x0F]; -#endif - // display info: - sh_video->fps=picture.fps*0.0001f; -#if 0 - sh_video->fps=mpeg_framerates[picture.frame_rate_code & 0x0F]; -#endif - sh_video->src_w=picture.display_picture_width; - sh_video->src_h=picture.display_picture_height; - // info: - MSG_DBG2("mpeg bitrate: %d (%X)\n",picture.bitrate,picture.bitrate); - MSG_V("VIDEO: %s %dx%d (aspect %d) %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n", - picture.mpeg1?"MPEG1":"MPEG2", - sh_video->src_w,sh_video->src_h, - picture.aspect_ratio_information, - sh_video->fps, - picture.bitrate*0.5f, - picture.bitrate/16.0f ); - break; - } -} // switch(file_format) - -return 1; -} - -static void process_userdata(const unsigned char* buf,int len){ - int i; - /* if the user data starts with "CC", assume it is a Closed Captions info packet */ - if(len>2 && buf[0]=='C' && buf[1]=='C'){ - subcc_process_data(buf+2,len-2); - } - if( len > 2 && buf[ 0 ] == 'T' && buf[ 1 ] == 'Y' ) - { - ty_processuserdata( buf + 2, len - 2 ); - return; - } - MSG_V( "user_data: len=%3d %02X %02X %02X %02X '", - len, buf[0], buf[1], buf[2], buf[3]); - for(i=0;i<len;i++) - if(buf[i]>=32 && buf[i]<127) MSG_V("%c",buf[i]); - MSG_V("'\n"); -} - -int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,float *v_pts,unsigned char** start,int force_fps){ - Demuxer_Stream *d_video=sh_video->ds; - Demuxer *demuxer=d_video->demuxer; - float frame_time=1; - float pts1=d_video->pts; - int picture_coding_type=0; -// unsigned char* start=NULL; - int in_size=0; - - *start=NULL; - - if(demuxer->file_format==Demuxer::Type_MPEG_ES || - (demuxer->file_format==Demuxer::Type_MPEG_PS && ((! sh_video->fourcc) || (sh_video->fourcc==0x10000001) || (sh_video->fourcc==0x10000002))) - || demuxer->file_format==Demuxer::Type_PVA || - ((demuxer->file_format==Demuxer::Type_MPEG_TS) && ((sh_video->fourcc==0x10000001) || (sh_video->fourcc==0x10000002)))) - { - int in_frame=0; - //float newfps; - //videobuf_len=0; - while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){ - int i=sync_video_packet(d_video); - //any_t* buffer=&videobuffer[videobuf_len+4]; - int __start=videobuf_len+4; - if(in_frame){ - if(i<0x101 || i>=0x1B0){ // not slice code -> end of frame -#if 1 - // send END OF FRAME code: - videobuffer[videobuf_len+0]=0; - videobuffer[videobuf_len+1]=0; - videobuffer[videobuf_len+2]=1; - videobuffer[videobuf_len+3]=0xFF; - videobuf_len+=4; -#endif - if(!i) return -1; // EOF - break; - } - } else { - //if(i==0x100) in_frame=1; // picture startcode - if(i>=0x101 && i<0x1B0) in_frame=1; // picture startcode - else if(!i) return -1; // EOF - } - if(!read_video_packet(d_video)) return -1; // EOF - // process headers: - switch(i){ - case 0x1B3: mp_header_process_sequence_header (&picture, &videobuffer[__start]);break; - case 0x1B5: mp_header_process_extension (&picture, &videobuffer[__start]);break; - case 0x1B2: process_userdata (&videobuffer[__start], videobuf_len-__start);break; - case 0x100: picture_coding_type=(videobuffer[__start+1] >> 3) & 7;break; - } - } - // if(videobuf_len>max_framesize) max_framesize=videobuf_len; // debug - *start=videobuffer; in_size=videobuf_len; - -#if 1 - // get mpeg fps: - //newfps=frameratecode2framerate[picture->frame_rate_code]*0.0001f; - if((int)(sh_video->fps*10000+0.5)!=picture.fps) if(!force_fps && !telecine){ - MSG_WARN("Warning! FPS changed %5.3f -> %5.3f (%f) [%d] \n",sh_video->fps,picture.fps*0.0001,sh_video->fps-picture.fps*0.0001,picture.frame_rate_code); - sh_video->fps=picture.fps*0.0001; - } -#endif - - // fix mpeg2 frametime: - frame_time=(picture.display_time)*0.01f; - picture.display_time=100; - videobuf_len=0; - - telecine_cnt*=0.9; // drift out error - telecine_cnt+=frame_time-5.0/4.0; - MSG_DBG2("\r telecine = %3.1f %5.3f \n",frame_time,telecine_cnt); - - if(telecine){ - frame_time=1; - if(telecine_cnt<-1.5 || telecine_cnt>1.5){ - MSG_INFO("Leave telecine mode\n"); - telecine=0; - } - } else - if(telecine_cnt>-0.5 && telecine_cnt<0.5 && !force_fps){ - sh_video->fps=sh_video->fps*4/5; - MSG_INFO("Enter telecine mode\n"); - telecine=1; - } - - } else if((demuxer->file_format==Demuxer::Type_MPEG4_ES) || ((demuxer->file_format==Demuxer::Type_MPEG_TS) && (sh_video->fourcc==0x10000004)) || - ((demuxer->file_format==Demuxer::Type_MPEG_PS) && (sh_video->fourcc==0x10000004)) - ){ - // - while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){ - int i=sync_video_packet(d_video); - if(!i) return -1; - if(!read_video_packet(d_video)) return -1; // EOF - if(i==0x1B6) break; - } - *start=videobuffer; in_size=videobuf_len; - videobuf_len=0; - - } else if(demuxer->file_format==Demuxer::Type_H264_ES || ((demuxer->file_format==Demuxer::Type_MPEG_TS) && (sh_video->fourcc==0x10000005)) || - ((demuxer->file_format==Demuxer::Type_MPEG_PS) && (sh_video->fourcc==0x10000005)) - ){ - // - while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){ - int i=sync_video_packet(d_video); - int pos = videobuf_len+4; - if(!i) return -1; - if(!read_video_packet(d_video)) return -1; // EOF - if((i&~0x60) == 0x107 && i != 0x107) { - h264_parse_sps(&picture, &(videobuffer[pos]), videobuf_len - pos); - if(picture.fps > 0) { - sh_video->fps=picture.fps*0.0001f; - } - i=sync_video_packet(d_video); - if(!i) return -1; - if(!read_video_packet(d_video)) return -1; // EOF - } - if((i&~0x60) == 0x101 || (i&~0x60) == 0x102 || (i&~0x60) == 0x105) break; - } - *start=videobuffer; in_size=videobuf_len; - videobuf_len=0; - } else { - /* frame-based file formats: (AVI,ASF,MOV) */ - in_size=d_video->get_packet(start); - if(in_size<0) return -1; // EOF - } - - // Increase video timers: - frame_time*=1.0f/sh_video->fps; - - /* override frame_time for variable/unknown FPS formats: */ - if(!force_fps) - switch(demuxer->file_format) - { - case Demuxer::Type_REAL: - case Demuxer::Type_MATROSKA: - if(d_video->pts>0 && pts1>0 && d_video->pts>pts1) - frame_time=d_video->pts-pts1; - break; - default: -#ifdef USE_TV - case Demuxer::Type_TV: -#endif - case Demuxer::Type_MOV: - case Demuxer::Type_FILM: - case Demuxer::Type_VIVO: - case Demuxer::Type_ASF: { - /* .ASF files has no fixed FPS - just frame durations! */ - float next_pts = d_video->get_next_pts(); - float d= next_pts > 0 ? next_pts - d_video->pts : d_video->pts-pts1; - if(d>=0){ - if(d>0) - if((int)sh_video->fps==1000) - MSG_STATUS("\rASF framerate: %d fps \n",(int)(1.0f/d)); - sh_video->fps=1.0f/d; - frame_time = d; - } else { - MSG_WARN("\nInvalid frame duration value (%2.5f/%2.5f => %5.3f). Defaulting to 1/25 sec.\n",d_video->pts,next_pts,frame_time); - frame_time = 1/25.0; - } - } - } - if(demuxer->file_format==Demuxer::Type_MPEG_PS || - demuxer->file_format==Demuxer::Type_MPEG_ES || - demuxer->file_format==Demuxer::Type_MPEG_TS) d_video->pts+=frame_time; - /* FIXUP VIDEO PTS*/ - if((demuxer->file_format == Demuxer::Type_MPEG_ES || - demuxer->file_format == Demuxer::Type_MPEG4_ES || - demuxer->file_format == Demuxer::Type_H264_ES || - demuxer->file_format == Demuxer::Type_MPEG_PS || - ((demuxer->file_format==Demuxer::Type_MPEG_TS) && ((sh_video->fourcc==0x10000001) || (sh_video->fourcc==0x10000002))) || - mp_conf.av_force_pts_fix) && mp_conf.av_sync_pts && mp_conf.av_force_pts_fix2!=1) - { - if(d_video->pts_flags && d_video->pts < 1.0 && d_video->prev_pts > 2.0) - { - float spts; - spts=d_video->demuxer->stream->stream_pts; - d_video->pts_corr=spts>0?spts:d_video->prev_pts; - d_video->pts_flags=0; - MSG_V("***PTS discontinuity happens*** correcting video %f pts as %f\n",d_video->pts,d_video->pts_corr); - } - if(d_video->pts>1.0) d_video->pts_flags=1; - if(!d_video->eof) d_video->prev_pts=d_video->pts+d_video->pts_corr; - *v_pts=d_video->prev_pts; - } - else *v_pts=d_video->pts; - - if(frame_time_ptr) *frame_time_ptr=frame_time; - return in_size; -} -} // namespace mpxp Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-04 16:36:42 UTC (rev 508) +++ mplayerxp/mplayerxp.cpp 2012-12-04 17:04:36 UTC (rev 509) @@ -1054,7 +1054,7 @@ sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); Demuxer_Stream *d_video=_demuxer->video; MP_UNIT("video_read_properties"); - if(!video_read_properties(sh_video)) { + if(!sh_video->read_properties()) { MSG_ERR("Video: can't read properties\n"); d_video->sh=NULL; sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-05 11:42:45
|
Revision: 511 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=511&view=rev Author: nickols_k Date: 2012-12-05 11:42:31 +0000 (Wed, 05 Dec 2012) Log Message: ----------- include input2 into namespace mpxp Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/dump.h mplayerxp/input2/input.cpp mplayerxp/input2/input.h mplayerxp/input2/joystick.cpp mplayerxp/input2/joystick.h mplayerxp/input2/lirc.cpp mplayerxp/input2/lirc.h mplayerxp/input2/mouse.h mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/mpdemux.cpp mplayerxp/libmpdemux/mpdemux.h mplayerxp/libmpstream/asf_mmst_streaming.cpp mplayerxp/libmpstream/asf_streaming.cpp mplayerxp/libmpstream/asf_streaming.h mplayerxp/libmpstream/cache2.cpp mplayerxp/libmpstream/cdd.h mplayerxp/libmpstream/cddb.cpp mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/network.h mplayerxp/libmpstream/s_cdd.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/libmpstream/s_dvdread.cpp mplayerxp/libmpstream/s_file.cpp mplayerxp/libmpstream/s_ftp.cpp mplayerxp/libmpstream/s_lavc.cpp mplayerxp/libmpstream/s_network.cpp mplayerxp/libmpstream/s_null.cpp mplayerxp/libmpstream/s_oss.cpp mplayerxp/libmpstream/s_rtsp.cpp mplayerxp/libmpstream/s_tv.cpp mplayerxp/libmpstream/s_udp.cpp mplayerxp/libmpstream/s_vcdnav.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libmpstream/stream.h mplayerxp/libmpstream/stream_internal.h mplayerxp/libmpstream/tcp.cpp mplayerxp/libmpstream/tcp.h mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/libplaytree/playtreeparser.h mplayerxp/mp-opt-reg.cpp mplayerxp/mplayerxp.cpp mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu.h mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_internal.h mplayerxp/postproc/vf_menu.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/dump.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -89,7 +89,7 @@ uint64_t vsize,asize,ssize; float timer_corr; /* use common time-base */ float vtimer; - any_t* libinput; + libinput_t* libinput; }; void __FASTCALL__ dump_stream_event_handler(stream_t *s,const stream_packet_t*sp) @@ -119,7 +119,7 @@ return retval; } -void dump_mux_init(Demuxer *demuxer,any_t* libinput) +void dump_mux_init(Demuxer *demuxer,libinput_t* libinput) { sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); sh_video_t* shv=reinterpret_cast<sh_video_t*>(demuxer->video->sh); Modified: mplayerxp/dump.h =================================================================== --- mplayerxp/dump.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/dump.h 2012-12-05 11:42:31 UTC (rev 511) @@ -7,7 +7,7 @@ namespace mpxp { int dump_parse(const char *param); void dump_stream(stream_t *stream); - void dump_mux_init(Demuxer *demuxer,any_t*libinput); + void dump_mux_init(Demuxer *demuxer,libinput_t*libinput); void dump_mux(Demuxer *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames); void dump_mux_close(Demuxer *demuxer); void __FASTCALL__ dump_stream_event_handler(stream_t *s,const stream_packet_t*sp); Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/input.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -35,6 +35,8 @@ #include "joystick.h" #include "osdep/getch2.h" +namespace mpxp { + #ifndef MP_MAX_KEY_FD #define MP_MAX_KEY_FD 10 #endif @@ -56,18 +58,17 @@ typedef void (*mp_close_func_t)(any_t* ctx); // These are used to close the driver -typedef struct mp_cmd_bind { +struct mp_cmd_bind_t { int input[MP_MAX_KEY_DOWN+1]; const char* cmd; -} mp_cmd_bind_t; +}; -typedef struct mp_key_name { +struct mp_key_name_t { int key; const char* name; -} mp_key_name_t; +}; - -typedef struct mp_input_fd { +struct mp_input_fd_t { any_t* opaque; union { mp_key_func_t key_func; @@ -78,17 +79,15 @@ // This fields are for the cmd fds char* buffer; int pos,size; -} mp_input_fd_t; +}; -typedef struct mp_cmd_filter_st mp_cmd_filter_t; - -struct mp_cmd_filter_st { +struct mp_cmd_filter_t { mp_input_cmd_filter filter; any_t* ctx; mp_cmd_filter_t* next; }; -typedef struct priv_s { +struct libinput_t { char antiviral_hole[RND_CHAR1]; // These are the user defined binds mp_cmd_bind_t* cmd_binds; @@ -111,15 +110,15 @@ int in_file_fd; int tim; //for getch2 char key_str[12]; -}priv_t; +}; -typedef struct input_conf_s { +struct input_conf_t { int use_joystick,use_lirc,use_lircc; unsigned ar_delay,ar_rate; const char* js_dev; const char* in_file; int print_key_list,print_cmd_list; -}input_conf_t; +}; static input_conf_t libinput_conf = { 1, 1, 1, 100, 8, "/dev/input/js0", NULL, 0, 0 }; /// This array defines all know commands. @@ -423,8 +422,8 @@ void (*mp_input_key_cb)(int code) = NULL; static mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd); // This create a copy of a command (used by the auto repeat stuff) -static int mp_input_print_key_list(any_t*); -static int mp_input_print_cmd_list(any_t*); +static int mp_input_print_key_list(libinput_t*); +static int mp_input_print_cmd_list(libinput_t*); static const config_t joystick_conf[] = { { "on", &libinput_conf.use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of joystick" }, @@ -460,65 +459,65 @@ static int mp_input_default_key_func(any_t* fd); static int mp_input_default_cmd_func(any_t* fd,char* buf, int l); -static const char* mp_input_get_key_name(any_t*,int key); +static const char* mp_input_get_key_name(libinput_t*,int key); -static MPXP_Rc mp_input_add_cmd_fd(any_t* handle,any_t* opaque, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { - priv_t* priv = (priv_t*)handle; - if(priv->num_cmd_fd == MP_MAX_CMD_FD) { +static MPXP_Rc mp_input_add_cmd_fd(libinput_t* handle,any_t* opaque, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { + libinput_t& priv = *handle; + if(priv.num_cmd_fd == MP_MAX_CMD_FD) { MSG_ERR("Too much command fd, unable to register fd\n"); return MPXP_False; } - memset(&priv->cmd_fds[priv->num_cmd_fd],0,sizeof(mp_input_fd_t)); - priv->cmd_fds[priv->num_cmd_fd].opaque = opaque; - priv->cmd_fds[priv->num_cmd_fd].read.cmd_func = read_func ? read_func : mp_input_default_cmd_func; - priv->cmd_fds[priv->num_cmd_fd].close_func = close_func; - if(!sel) priv->cmd_fds[priv->num_cmd_fd].flags = MP_FD_NO_SELECT; - priv->num_cmd_fd++; + memset(&priv.cmd_fds[priv.num_cmd_fd],0,sizeof(mp_input_fd_t)); + priv.cmd_fds[priv.num_cmd_fd].opaque = opaque; + priv.cmd_fds[priv.num_cmd_fd].read.cmd_func = read_func ? read_func : mp_input_default_cmd_func; + priv.cmd_fds[priv.num_cmd_fd].close_func = close_func; + if(!sel) priv.cmd_fds[priv.num_cmd_fd].flags = MP_FD_NO_SELECT; + priv.num_cmd_fd++; return MPXP_Ok; } -static void mp_input_rm_cmd_fd(any_t* handle,any_t* fd) { - priv_t* priv = (priv_t*)handle; +static void mp_input_rm_cmd_fd(libinput_t* handle,any_t* fd) { + libinput_t& priv = *handle; unsigned int i; - for(i = 0; i < priv->num_cmd_fd; i++) { - if(priv->cmd_fds[i].opaque == fd) break; + for(i = 0; i < priv.num_cmd_fd; i++) { + if(priv.cmd_fds[i].opaque == fd) break; } - if(i == priv->num_cmd_fd) return; - if(priv->cmd_fds[i].close_func) priv->cmd_fds[i].close_func(priv->cmd_fds[i].opaque); - if(priv->cmd_fds[i].buffer) delete priv->cmd_fds[i].buffer; - if(i + 1 < priv->num_cmd_fd) memmove(&priv->cmd_fds[i],&priv->cmd_fds[i+1],(priv->num_cmd_fd-i-1)*sizeof(mp_input_fd_t)); - priv->num_cmd_fd--; + if(i == priv.num_cmd_fd) return; + if(priv.cmd_fds[i].close_func) priv.cmd_fds[i].close_func(priv.cmd_fds[i].opaque); + if(priv.cmd_fds[i].buffer) delete priv.cmd_fds[i].buffer; + if(i + 1 < priv.num_cmd_fd) memmove(&priv.cmd_fds[i],&priv.cmd_fds[i+1],(priv.num_cmd_fd-i-1)*sizeof(mp_input_fd_t)); + priv.num_cmd_fd--; } -static void mp_input_rm_key_fd(any_t* handle,any_t* fd) { - priv_t* priv = (priv_t*)handle; +static void mp_input_rm_key_fd(libinput_t* handle,any_t* fd) { + libinput_t& priv = *handle; unsigned int i; - for(i = 0; i < priv->num_key_fd; i++) { - if(priv->key_fds[i].opaque == fd) break; + for(i = 0; i < priv.num_key_fd; i++) { + if(priv.key_fds[i].opaque == fd) break; } - if(i == priv->num_key_fd) return; - if(priv->key_fds[i].close_func) priv->key_fds[i].close_func(priv->key_fds[i].opaque); - if(i + 1 < priv->num_key_fd) memmove(&priv->key_fds[i],&priv->key_fds[i+1],(priv->num_key_fd-i-1)*sizeof(mp_input_fd_t)); - priv->num_key_fd--; + if(i == priv.num_key_fd) return; + if(priv.key_fds[i].close_func) priv.key_fds[i].close_func(priv.key_fds[i].opaque); + if(i + 1 < priv.num_key_fd) memmove(&priv.key_fds[i],&priv.key_fds[i+1],(priv.num_key_fd-i-1)*sizeof(mp_input_fd_t)); + priv.num_key_fd--; } -static MPXP_Rc mp_input_add_key_fd(any_t* handle,any_t* opaque, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { - priv_t* priv = (priv_t*)handle; - if(priv->num_key_fd == MP_MAX_KEY_FD) { +static MPXP_Rc mp_input_add_key_fd(libinput_t* handle,any_t* opaque, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { + libinput_t& priv = *handle; + if(priv.num_key_fd == MP_MAX_KEY_FD) { MSG_ERR("Too much key fd, unable to register fd\n"); return MPXP_False; } - memset(&priv->key_fds[priv->num_key_fd],0,sizeof(mp_input_fd_t)); - priv->key_fds[priv->num_key_fd].opaque = opaque; - priv->key_fds[priv->num_key_fd].read.key_func = read_func ? read_func : mp_input_default_key_func; - priv->key_fds[priv->num_key_fd].close_func = close_func; - if(!sel) priv->key_fds[priv->num_key_fd].flags |= MP_FD_NO_SELECT; - priv->num_key_fd++; + memset(&priv.key_fds[priv.num_key_fd],0,sizeof(mp_input_fd_t)); + priv.key_fds[priv.num_key_fd].opaque = opaque; + priv.key_fds[priv.num_key_fd].read.key_func = read_func ? read_func : mp_input_default_key_func; + priv.key_fds[priv.num_key_fd].close_func = close_func; + if(!sel) priv.key_fds[priv.num_key_fd].flags |= MP_FD_NO_SELECT; + priv.num_key_fd++; return MPXP_Ok; } @@ -638,17 +637,17 @@ } static int mp_input_default_key_func(any_t* fd) { - priv_t* priv = (priv_t*)fd; + libinput_t& priv = *reinterpret_cast<libinput_t*>(fd); int r,code=0; unsigned int l; l = 0; - if(priv->in_file_fd == 0) { // stdin is handled by getch2 - code = getch2(priv->tim); + if(priv.in_file_fd == 0) { // stdin is handled by getch2 + code = getch2(priv.tim); if(code < 0) code = MP_INPUT_NOTHING; } else { - fcntl(priv->in_file_fd,F_SETFL,fcntl(priv->in_file_fd,F_GETFL)|O_NONBLOCK); + fcntl(priv.in_file_fd,F_SETFL,fcntl(priv.in_file_fd,F_GETFL)|O_NONBLOCK); while(l < sizeof(int)) { - r = read(priv->in_file_fd,(&code)+l,sizeof(int)-l); + r = read(priv.in_file_fd,(&code)+l,sizeof(int)-l); if(r <= 0) break; l +=r; } @@ -726,10 +725,10 @@ } static int mp_input_default_cmd_func(any_t* fd,char* buf, int l) { - priv_t* priv=(priv_t*)fd; - fcntl(priv->in_file_fd,F_SETFL,fcntl(priv->in_file_fd,F_GETFL)|O_NONBLOCK); + libinput_t& priv=*reinterpret_cast<libinput_t*>(fd); + fcntl(priv.in_file_fd,F_SETFL,fcntl(priv.in_file_fd,F_GETFL)|O_NONBLOCK); while(1) { - int r = read(priv->in_file_fd,buf,l); + int r = read(priv.in_file_fd,buf,l); // Error ? if(r < 0) { if(errno == EINTR) continue; @@ -741,15 +740,15 @@ } } -void mp_input_add_cmd_filter(any_t* handle,mp_input_cmd_filter func, any_t* ctx) { - priv_t* priv = (priv_t*)handle; +void mp_input_add_cmd_filter(libinput_t* handle,mp_input_cmd_filter func,any_t* ctx) { + libinput_t& priv = *handle; mp_cmd_filter_t* filter = new(zeromem) mp_cmd_filter_t; filter->filter = func; filter->ctx = ctx; - filter->next = priv->cmd_filters; - priv->cmd_filters = filter; - fill_false_pointers(priv->antiviral_hole,offsetof(priv_t,cmd_binds)-offsetof(priv_t,antiviral_hole)); + filter->next = priv.cmd_filters; + priv.cmd_filters = filter; + fill_false_pointers(priv.antiviral_hole,offsetof(libinput_t,cmd_binds)-offsetof(libinput_t,antiviral_hole)); } static const char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { @@ -773,76 +772,76 @@ return binds[j].cmd; } -mp_cmd_t* mp_input_get_cmd_from_keys(any_t* handle,int n,int* keys) { - priv_t* priv = (priv_t*)handle; +mp_cmd_t* mp_input_get_cmd_from_keys(libinput_t* handle,int n,int* keys) { + libinput_t& priv = *handle; const char* cmd = NULL; mp_cmd_t* ret; - if(priv->cmd_binds) cmd = mp_input_find_bind_for_key(priv->cmd_binds,n,keys); + if(priv.cmd_binds) cmd = mp_input_find_bind_for_key(priv.cmd_binds,n,keys); if(cmd == NULL) cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys); if(cmd == NULL) { - MSG_WARN("No bind found for key %s",mp_input_get_key_name(priv,keys[0])); + MSG_WARN("No bind found for key %s",mp_input_get_key_name(&priv,keys[0])); if(n > 1) { int s; - for(s=1; s < n; s++) MSG_WARN("-%s",mp_input_get_key_name(priv,keys[s])); + for(s=1; s < n; s++) MSG_WARN("-%s",mp_input_get_key_name(&priv,keys[s])); } MSG_WARN(" \n"); return NULL; } ret = mp_input_parse_cmd(cmd); if(!ret) { - MSG_ERR("Invalid command for binded key %s",mp_input_get_key_name(priv,priv->key_down[0])); - if(priv->num_key_down > 1) { + MSG_ERR("Invalid command for binded key %s",mp_input_get_key_name(&priv,priv.key_down[0])); + if(priv.num_key_down > 1) { unsigned int s; - for(s=1; s < priv->num_key_down; s++) MSG_ERR("-%s",mp_input_get_key_name(priv,priv->key_down[s])); + for(s=1; s < priv.num_key_down; s++) MSG_ERR("-%s",mp_input_get_key_name(&priv,priv.key_down[s])); } MSG_ERR(" : %s \n",cmd); } return ret; } -static int mp_input_read_key_code(any_t* handle,int tim) { - priv_t* priv = (priv_t*)handle; +static int mp_input_read_key_code(libinput_t* handle,int tim) { + libinput_t& priv = *handle; int n=0; unsigned i; - if(priv->num_key_fd == 0) return MP_INPUT_NOTHING; + if(priv.num_key_fd == 0) return MP_INPUT_NOTHING; // Remove fd marked as dead and build the fd_set // n == number of fd's to be select() checked - for(i = 0; (unsigned int)i < priv->num_key_fd; i++) { - if( (priv->key_fds[i].flags & MP_FD_DEAD) ) { - mp_input_rm_key_fd(priv,priv->key_fds[i].opaque); + for(i = 0; (unsigned int)i < priv.num_key_fd; i++) { + if( (priv.key_fds[i].flags & MP_FD_DEAD) ) { + mp_input_rm_key_fd(&priv,priv.key_fds[i].opaque); i--; continue; - } else if(priv->key_fds[i].flags & MP_FD_NO_SELECT) continue; + } else if(priv.key_fds[i].flags & MP_FD_NO_SELECT) continue; n++; } - if(priv->num_key_fd == 0) return MP_INPUT_NOTHING; - for(i = 0; i < priv->num_key_fd; i++) { + if(priv.num_key_fd == 0) return MP_INPUT_NOTHING; + for(i = 0; i < priv.num_key_fd; i++) { int code = -1; - priv->tim = tim; - code = ((mp_key_func_t)priv->key_fds[i].read.key_func)(priv->key_fds[i].opaque); + priv.tim = tim; + code = ((mp_key_func_t)priv.key_fds[i].read.key_func)(priv.key_fds[i].opaque); if(code >= 0) return code; if(code == MP_INPUT_ERROR) MSG_ERR("Error on key input fd\n"); else if(code == MP_INPUT_DEAD) { MSG_ERR("Dead key input on fd\n"); - mp_input_rm_key_fd(priv,priv->key_fds[i].opaque); + mp_input_rm_key_fd(&priv,priv.key_fds[i].opaque); } } return MP_INPUT_NOTHING; } -static mp_cmd_t* mp_input_read_keys(any_t*handle,int tim) { - priv_t* priv = (priv_t*)handle; - int code = mp_input_read_key_code(priv,tim); +static mp_cmd_t* mp_input_read_keys(libinput_t*handle,int tim) { + libinput_t& priv = *handle; + int code = mp_input_read_key_code(&priv,tim); unsigned int j; mp_cmd_t* ret; if(mp_input_key_cb) { - for( ; code >= 0 ; code = mp_input_read_key_code(priv,0) ) { + for( ; code >= 0 ; code = mp_input_read_key_code(&priv,0) ) { if(code & MP_KEY_DOWN) continue; code &= ~(MP_KEY_DOWN|MP_NO_REPEAT_KEY); mp_input_key_cb(code); @@ -850,103 +849,103 @@ return NULL; } - for( ; code >= 0 ; code = mp_input_read_key_code(priv,0) ) { + for( ; code >= 0 ; code = mp_input_read_key_code(&priv,0) ) { // key pushed if(code & MP_KEY_DOWN) { - if(priv->num_key_down > MP_MAX_KEY_DOWN) { + if(priv.num_key_down > MP_MAX_KEY_DOWN) { MSG_ERR("Too much key down at the same time\n"); continue; } code &= ~MP_KEY_DOWN; // Check if we don't already have this key as pushed - for(j = 0; j < priv->num_key_down; j++) { - if(priv->key_down[j] == code) + for(j = 0; j < priv.num_key_down; j++) { + if(priv.key_down[j] == code) break; } - if(j != priv->num_key_down) continue; - priv->key_down[priv->num_key_down] = code; - priv->num_key_down++; - priv->last_key_down = GetTimer(); - priv->ar_state = 0; + if(j != priv.num_key_down) continue; + priv.key_down[priv.num_key_down] = code; + priv.num_key_down++; + priv.last_key_down = GetTimer(); + priv.ar_state = 0; continue; } // key released // Check if the key is in the down key, driver which can't send push event // send only release event - for(j = 0; j < priv->num_key_down; j++) { - if(priv->key_down[j] == code) break; + for(j = 0; j < priv.num_key_down; j++) { + if(priv.key_down[j] == code) break; } - if(j == priv->num_key_down) { // key was not in the down keys : add it - if(priv->num_key_down > MP_MAX_KEY_DOWN) { + if(j == priv.num_key_down) { // key was not in the down keys : add it + if(priv.num_key_down > MP_MAX_KEY_DOWN) { MSG_ERR("Too much key down at the same time\n"); continue; } - priv->key_down[priv->num_key_down] = code; - priv->num_key_down++; - priv->last_key_down = 1; + priv.key_down[priv.num_key_down] = code; + priv.num_key_down++; + priv.last_key_down = 1; } // We ignore key from last combination - ret = priv->last_key_down ? mp_input_get_cmd_from_keys(priv,priv->num_key_down,priv->key_down):NULL; + ret = priv.last_key_down ? mp_input_get_cmd_from_keys(&priv,priv.num_key_down,priv.key_down):NULL; // Remove the key - if(j+1 < priv->num_key_down) memmove(&priv->key_down[j],&priv->key_down[j+1],(priv->num_key_down-(j+1))*sizeof(int)); - priv->num_key_down--; - priv->last_key_down = 0; - priv->ar_state = -1; - if(priv->ar_cmd) { - mp_cmd_free(priv->ar_cmd); - priv->ar_cmd = NULL; + if(j+1 < priv.num_key_down) memmove(&priv.key_down[j],&priv.key_down[j+1],(priv.num_key_down-(j+1))*sizeof(int)); + priv.num_key_down--; + priv.last_key_down = 0; + priv.ar_state = -1; + if(priv.ar_cmd) { + mp_cmd_free(priv.ar_cmd); + priv.ar_cmd = NULL; } if(ret) return ret; } // No input : autorepeat ? - if(libinput_conf.ar_rate > 0 && priv->ar_state >=0 && priv->num_key_down > 0 && !(priv->key_down[priv->num_key_down-1]&MP_NO_REPEAT_KEY)) { + if(libinput_conf.ar_rate > 0 && priv.ar_state >=0 && priv.num_key_down > 0 && !(priv.key_down[priv.num_key_down-1]&MP_NO_REPEAT_KEY)) { unsigned int t = GetTimer(); // First time : wait delay - if(priv->ar_state == 0 && (t - priv->last_key_down) >= libinput_conf.ar_delay*1000) { - priv->ar_cmd = mp_input_get_cmd_from_keys(priv,priv->num_key_down,priv->key_down); - if(!priv->ar_cmd) { - priv->ar_state = -1; + if(priv.ar_state == 0 && (t - priv.last_key_down) >= libinput_conf.ar_delay*1000) { + priv.ar_cmd = mp_input_get_cmd_from_keys(&priv,priv.num_key_down,priv.key_down); + if(!priv.ar_cmd) { + priv.ar_state = -1; return NULL; } - priv->ar_state = 1; - priv->last_ar = t; - return mp_cmd_clone(priv->ar_cmd); + priv.ar_state = 1; + priv.last_ar = t; + return mp_cmd_clone(priv.ar_cmd); // Then send rate / sec event - } else if(priv->ar_state == 1 && (t -priv->last_ar) >= 1000000/libinput_conf.ar_rate) { - priv->last_ar = t; - return mp_cmd_clone(priv->ar_cmd); + } else if(priv.ar_state == 1 && (t -priv.last_ar) >= 1000000/libinput_conf.ar_rate) { + priv.last_ar = t; + return mp_cmd_clone(priv.ar_cmd); } } return NULL; } -static mp_cmd_t* mp_input_read_cmds(any_t* handle) { - priv_t* priv = (priv_t*)handle; +static mp_cmd_t* mp_input_read_cmds(libinput_t* handle) { + libinput_t& priv = *handle; int n = 0,got_cmd = 0; unsigned i; mp_cmd_t* ret; static int last_loop = 0; - if(priv->num_cmd_fd == 0) return NULL; + if(priv.num_cmd_fd == 0) return NULL; - for(i = 0; (unsigned int)i < priv->num_cmd_fd ; i++) { - if(priv->cmd_fds[i].flags&MP_FD_EOF) { - mp_input_rm_cmd_fd(priv,priv->cmd_fds[i].opaque); + for(i = 0; (unsigned int)i < priv.num_cmd_fd ; i++) { + if(priv.cmd_fds[i].flags&MP_FD_EOF) { + mp_input_rm_cmd_fd(&priv,priv.cmd_fds[i].opaque); i--; continue; - } else if(priv->cmd_fds[i].flags & MP_FD_NO_SELECT) continue; - if(priv->cmd_fds[i].flags & MP_FD_GOT_CMD) got_cmd = 1; + } else if(priv.cmd_fds[i].flags & MP_FD_NO_SELECT) continue; + if(priv.cmd_fds[i].flags & MP_FD_GOT_CMD) got_cmd = 1; n++; } - if(priv->num_cmd_fd == 0) return NULL; - for(i = 0; i < priv->num_cmd_fd; i++) { + if(priv.num_cmd_fd == 0) return NULL; + for(i = 0; i < priv.num_cmd_fd; i++) { int r = 0; char* cmd; - r = mp_input_read_cmd(&priv->cmd_fds[i],&cmd); + r = mp_input_read_cmd(&priv.cmd_fds[i],&cmd); if(r < 0) { if(r == MP_INPUT_ERROR) MSG_ERR("Error on cmd fd\n"); - else if(r == MP_INPUT_DEAD) priv->cmd_fds[i].flags |= MP_FD_DEAD; + else if(r == MP_INPUT_DEAD) priv.cmd_fds[i].flags |= MP_FD_DEAD; continue; } ret = mp_input_parse_cmd(cmd); @@ -959,26 +958,26 @@ return NULL; } -MPXP_Rc mp_input_queue_cmd(any_t* handle,mp_cmd_t* cmd) { - priv_t* priv = (priv_t*)handle; - if(priv->cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; - priv->cmd_queue[priv->cmd_queue_end] = cmd; - priv->cmd_queue_end = (priv->cmd_queue_end + 1) % CMD_QUEUE_SIZE; - priv->cmd_queue_length++; +MPXP_Rc mp_input_queue_cmd(libinput_t* handle,mp_cmd_t* cmd) { + libinput_t& priv = *handle; + if(priv.cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; + priv.cmd_queue[priv.cmd_queue_end] = cmd; + priv.cmd_queue_end = (priv.cmd_queue_end + 1) % CMD_QUEUE_SIZE; + priv.cmd_queue_length++; return MPXP_Ok; } -static mp_cmd_t* mp_input_get_queued_cmd(any_t* handle,int peek_only) { - priv_t* priv = (priv_t*)handle; +static mp_cmd_t* mp_input_get_queued_cmd(libinput_t* handle,int peek_only) { + libinput_t& priv = *handle; mp_cmd_t* ret; - if(priv->cmd_queue_length == 0) return NULL; + if(priv.cmd_queue_length == 0) return NULL; - ret = priv->cmd_queue[priv->cmd_queue_start]; + ret = priv.cmd_queue[priv.cmd_queue_start]; if (!peek_only) { - priv->cmd_queue_length--; - priv->cmd_queue_start = (priv->cmd_queue_start + 1) % CMD_QUEUE_SIZE; + priv.cmd_queue_length--; + priv.cmd_queue_start = (priv.cmd_queue_start + 1) % CMD_QUEUE_SIZE; } return ret; } @@ -987,26 +986,26 @@ * \param peek_only when set, the returned command stays in the queue. * Do not mp_free the returned cmd whe you set this! */ -mp_cmd_t* mp_input_get_cmd(any_t*handle,int tim, int paused, int peek_only) { - priv_t* priv = (priv_t*)handle; +mp_cmd_t* mp_input_get_cmd(libinput_t*handle,int tim, int paused, int peek_only) { + libinput_t& priv = *handle; mp_cmd_t* ret = NULL; mp_cmd_filter_t* cf; int from_queue; from_queue = 1; - ret = mp_input_get_queued_cmd(priv,peek_only); + ret = mp_input_get_queued_cmd(&priv,peek_only); if(!ret) { from_queue = 0; - ret = mp_input_read_keys(priv,tim); - if(!ret) ret = mp_input_read_cmds(priv); + ret = mp_input_read_keys(&priv,tim); + if(!ret) ret = mp_input_read_cmds(&priv); } if(!ret) return NULL; - for(cf = priv->cmd_filters ; cf ; cf = cf->next) { + for(cf = priv.cmd_filters ; cf ; cf = cf->next) { if(cf->filter(ret,paused,cf->ctx)) return NULL; } - if (!from_queue && peek_only) mp_input_queue_cmd(priv,ret); + if (!from_queue && peek_only) mp_input_queue_cmd(&priv,ret); return ret; } @@ -1044,8 +1043,8 @@ return ret; } -static const char* mp_input_get_key_name(any_t* handle,int key) { - priv_t* priv = (priv_t*)handle; +static const char* mp_input_get_key_name(libinput_t* handle,int key) { + libinput_t& priv = *handle; unsigned i; for(i = 0; key_names[i].name != NULL; i++) { @@ -1053,13 +1052,13 @@ } if(isascii(key)) { - snprintf(priv->key_str,12,"%c",(char)key); - return priv->key_str; + snprintf(priv.key_str,12,"%c",(char)key); + return priv.key_str; } // Print the hex key code - snprintf(priv->key_str,12,"%#-8x",key); - return priv->key_str; + snprintf(priv.key_str,12,"%#-8x",key); + return priv.key_str; } static int mp_input_get_key_from_name(char* name) { @@ -1097,8 +1096,8 @@ return 1; } -static void mp_input_bind_keys(any_t* handle,int keys[MP_MAX_KEY_DOWN+1], char* cmd) { - priv_t* priv = (priv_t*)handle; +static void mp_input_bind_keys(libinput_t* handle,int keys[MP_MAX_KEY_DOWN+1], char* cmd) { + libinput_t& priv = *handle; int i = 0,j; mp_cmd_bind_t* _bind = NULL; @@ -1107,20 +1106,20 @@ assert(cmd != NULL); #endif - if(priv->cmd_binds) { - for(i = 0; priv->cmd_binds[i].cmd != NULL ; i++) { - for(j = 0 ; priv->cmd_binds[i].input[j] == keys[j] && keys[j] != 0 ; j++) /* NOTHING */; - if(keys[j] == 0 && priv->cmd_binds[i].input[j] == 0 ) { - _bind = &priv->cmd_binds[i]; + if(priv.cmd_binds) { + for(i = 0; priv.cmd_binds[i].cmd != NULL ; i++) { + for(j = 0 ; priv.cmd_binds[i].input[j] == keys[j] && keys[j] != 0 ; j++) /* NOTHING */; + if(keys[j] == 0 && priv.cmd_binds[i].input[j] == 0 ) { + _bind = &priv.cmd_binds[i]; break; } } } if(!_bind) { - priv->cmd_binds = (mp_cmd_bind_t*)mp_realloc(priv->cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); - memset(&priv->cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); - _bind = &priv->cmd_binds[i]; + priv.cmd_binds = (mp_cmd_bind_t*)mp_realloc(priv.cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); + memset(&priv.cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); + _bind = &priv.cmd_binds[i]; } if(_bind->cmd) delete _bind->cmd; _bind->cmd = mp_strdup(cmd); @@ -1137,8 +1136,8 @@ #define BS_MAX 256 #define SPACE_CHAR " \n\r\t" -static int mp_input_parse_config(any_t* handle,const char *file) { - priv_t* priv = (priv_t*)handle; +static int mp_input_parse_config(libinput_t* handle,const char *file) { + libinput_t& priv = *handle; int fd; int bs = 0,r,eof = 0,comments = 0; char *iter,*end; @@ -1175,7 +1174,7 @@ // Empty buffer : return if(bs <= 1) { MSG_INFO("Input config file %s parsed : %d binds\n",file,n_binds); - if(binds) priv->cmd_binds = binds; + if(binds) priv.cmd_binds = binds; close(fd); return 1; } @@ -1235,8 +1234,8 @@ // Found new line if(iter[0] == '\n' || iter[0] == '\r') { int i; - MSG_ERR("No command found for key %s" ,mp_input_get_key_name(priv,keys[0])); - for(i = 1; keys[i] != 0 ; i++) MSG_ERR("-%s",mp_input_get_key_name(priv,keys[i])); + MSG_ERR("No command found for key %s" ,mp_input_get_key_name(&priv,keys[0])); + for(i = 1; keys[i] != 0 ; i++) MSG_ERR("-%s",mp_input_get_key_name(&priv,keys[i])); MSG_ERR("\n"); keys[0] = 0; if(iter > buffer) { @@ -1261,7 +1260,7 @@ strncpy(cmd,iter,end-iter); cmd[end-iter] = '\0'; //printf("Set bind %d => %s\n",keys[0],cmd); - mp_input_bind_keys(priv,keys,cmd); + mp_input_bind_keys(&priv,keys,cmd); n_binds++; keys[0] = 0; end++; @@ -1276,8 +1275,8 @@ return 0; } -static void mp_input_init(any_t* handle) { - priv_t* priv = (priv_t*)handle; +static void mp_input_init(libinput_t* handle) { + libinput_t& priv = *handle; const char* file; file = config_file[0] != '/' ? get_path(config_file) : config_file; @@ -1293,14 +1292,14 @@ any_t* joystick_fd; joystick_fd = mp_input_joystick_open(libinput_conf.js_dev); if(!joystick_fd) MSG_ERR("Can't init input joystick with using: %s\n",libinput_conf.js_dev); - else mp_input_add_key_fd(priv,joystick_fd,1,mp_input_joystick_read,(mp_close_func_t)mp_input_joystick_close); + else mp_input_add_key_fd(&priv,joystick_fd,1,mp_input_joystick_read,(mp_close_func_t)mp_input_joystick_close); } #endif #ifdef HAVE_LIRC if(libinput_conf.use_lirc) { any_t* lirc_fd = mp_input_lirc_open(); - if(lirc_fd) mp_input_add_cmd_fd(priv,lirc_fd,0,mp_input_lirc_read_cmd,mp_input_lirc_close); + if(lirc_fd) mp_input_add_cmd_fd(&priv,lirc_fd,0,mp_input_lirc_read_cmd,mp_input_lirc_close); } #endif @@ -1314,41 +1313,41 @@ struct stat st; if(stat(libinput_conf.in_file,&st)) MSG_ERR("Can't stat %s: %s\n",libinput_conf.in_file,strerror(errno)); else { - priv->in_file_fd = open(libinput_conf.in_file,(S_ISFIFO(st.st_mode)?O_RDWR:O_RDONLY)|O_NONBLOCK); - if(priv->in_file_fd >= 0) mp_input_add_cmd_fd(priv,priv,1,NULL,(mp_close_func_t)close); + priv.in_file_fd = open(libinput_conf.in_file,(S_ISFIFO(st.st_mode)?O_RDWR:O_RDONLY)|O_NONBLOCK); + if(priv.in_file_fd >= 0) mp_input_add_cmd_fd(&priv,&priv,1,NULL,(mp_close_func_t)close); else MSG_ERR("Can't open %s: %s\n",libinput_conf.in_file,strerror(errno)); } } - priv->in_file_fd = 0; + priv.in_file_fd = 0; getch2_enable(); // prepare stdin for hotkeys... - mp_input_add_key_fd(priv,priv,1,NULL,(mp_close_func_t)close); + mp_input_add_key_fd(&priv,&priv,1,NULL,(mp_close_func_t)close); } -static void mp_input_uninit(any_t* handle) { - priv_t* priv = (priv_t*)handle; +static void mp_input_uninit(libinput_t* handle) { + libinput_t& priv = *handle; unsigned int i; - for(i=0; i < priv->num_key_fd; i++) { - if(priv->key_fds[i].close_func) priv->key_fds[i].close_func(priv->key_fds[i].opaque); + for(i=0; i < priv.num_key_fd; i++) { + if(priv.key_fds[i].close_func) priv.key_fds[i].close_func(priv.key_fds[i].opaque); } - for(i=0; i < priv->num_cmd_fd; i++) { - if(priv->cmd_fds[i].close_func) priv->cmd_fds[i].close_func(priv->cmd_fds[i].opaque); + for(i=0; i < priv.num_cmd_fd; i++) { + if(priv.cmd_fds[i].close_func) priv.cmd_fds[i].close_func(priv.cmd_fds[i].opaque); } - if(priv->cmd_binds) { + if(priv.cmd_binds) { for(i=0;;i++) { - if(priv->cmd_binds[i].cmd != NULL) delete priv->cmd_binds[i].cmd; + if(priv.cmd_binds[i].cmd != NULL) delete priv.cmd_binds[i].cmd; else break; } - delete priv->cmd_binds; - priv->cmd_binds=NULL; + delete priv.cmd_binds; + priv.cmd_binds=NULL; } - if(priv->in_file_fd==0) getch2_disable(); + if(priv.in_file_fd==0) getch2_disable(); } -any_t* mp_input_open(void) { - priv_t* priv=new(zeromem) priv_t; +libinput_t* mp_input_open(void) { + libinput_t* priv=new(zeromem) libinput_t; priv->ar_state=-1; priv->in_file_fd=-1; mp_input_init(priv); @@ -1357,7 +1356,7 @@ return priv; } -void mp_input_close(any_t* handle) { +void mp_input_close(libinput_t* handle) { mp_input_uninit(handle); delete handle; } @@ -1366,19 +1365,19 @@ m_config_register_options(cfg,mp_input_opts); } -void mp_input_print_keys(any_t*handle) { +void mp_input_print_keys(libinput_t*handle) { unsigned i; UNUSED(handle); MSG_INFO("List of available KEYS:\n"); for(i= 0; key_names[i].name != NULL ; i++) MSG_INFO("%s\n",key_names[i].name); } -static int mp_input_print_key_list(any_t*handle) { +static int mp_input_print_key_list(libinput_t*handle) { mp_input_print_keys(handle); exit(0); } -void mp_input_print_binds(any_t*handle) { +void mp_input_print_binds(libinput_t*handle) { unsigned i,j; MSG_INFO("List of available key bindings:\n"); for(i=0; def_cmd_binds[i].cmd != NULL ; i++) { @@ -1389,7 +1388,7 @@ } } -void mp_input_print_cmds(any_t*handle) { +void mp_input_print_cmds(libinput_t*handle) { const mp_cmd_t *cmd; int i,j; const char* type; @@ -1419,13 +1418,13 @@ } } -static int mp_input_print_cmd_list(any_t*handle) { +static int mp_input_print_cmd_list(libinput_t*handle) { mp_input_print_cmds(handle); exit(0); } -MPXP_Rc mp_input_check_interrupt(any_t* handle,int tim) { - priv_t* priv = (priv_t*)handle; +MPXP_Rc mp_input_check_interrupt(libinput_t* handle,int tim) { + libinput_t* priv = (libinput_t*)handle; mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(handle,tim,0,1)) == NULL) return MPXP_False; switch(cmd->id) { @@ -1442,3 +1441,5 @@ mp_cmd_free(cmd); return MPXP_False; } + +} // namespace mpxp Modified: mplayerxp/input2/input.h =================================================================== --- mplayerxp/input2/input.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/input.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,161 +1,168 @@ #ifndef INPUT_H_INCLUDED #define INPUT_H_INCLUDED 1 #include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; + #include "xmpcore/xmp_enums.h" -// All commands id -enum { - MP_CMD_SEEK =0, - MP_CMD_RESERVED_0 =1, - MP_CMD_QUIT =2, - MP_CMD_PAUSE =3, - MP_CMD_SOFT_QUIT =4, - MP_CMD_PLAY_TREE_STEP =5, - MP_CMD_PLAY_TREE_UP_STEP =6, - MP_CMD_PLAY_ALT_SRC_STEP =7, - MP_CMD_RESERVED_1 =8, - MP_CMD_OSD =9, - MP_CMD_VOLUME =10, - MP_CMD_RESERVED_2 =11, - MP_CMD_CONTRAST =12, - MP_CMD_BRIGHTNESS =13, - MP_CMD_HUE =14, - MP_CMD_SATURATION =15, - MP_CMD_FRAMEDROPPING =16, - MP_CMD_TV_STEP_CHANNEL =17, - MP_CMD_TV_STEP_NORM =18, - MP_CMD_TV_STEP_CHANNEL_LIST =19, - MP_CMD_VO_FULLSCREEN =20, - MP_CMD_SUB_POS =21, - MP_CMD_DVDNAV =22, - MP_CMD_VO_SCREENSHOT =23, - MP_CMD_PANSCAN =24, - MP_CMD_MUTE =25, - MP_CMD_LOADFILE =26, - MP_CMD_LOADLIST =27, - MP_CMD_VF_CHANGE_RECTANGLE =28, - MP_CMD_GAMMA =29, - MP_CMD_SUB_VISIBILITY =30, - MP_CMD_VOBSUB_LANG =31, - MP_CMD_MENU =32, - MP_CMD_SET_MENU =33, - MP_CMD_GET_TIME_LENGTH =34, - MP_CMD_GET_PERCENT_POS =35, - MP_CMD_SUB_STEP =36, - MP_CMD_TV_SET_CHANNEL =37, +namespace mpxp { + // All commands id + enum { + MP_CMD_SEEK =0, + MP_CMD_RESERVED_0 =1, + MP_CMD_QUIT =2, + MP_CMD_PAUSE =3, + MP_CMD_SOFT_QUIT =4, + MP_CMD_PLAY_TREE_STEP =5, + MP_CMD_PLAY_TREE_UP_STEP=6, + MP_CMD_PLAY_ALT_SRC_STEP=7, + MP_CMD_RESERVED_1 =8, + MP_CMD_OSD =9, + MP_CMD_VOLUME =10, + MP_CMD_RESERVED_2 =11, + MP_CMD_CONTRAST =12, + MP_CMD_BRIGHTNESS =13, + MP_CMD_HUE =14, + MP_CMD_SATURATION =15, + MP_CMD_FRAMEDROPPING =16, + MP_CMD_TV_STEP_CHANNEL =17, + MP_CMD_TV_STEP_NORM =18, + MP_CMD_TV_STEP_CHANNEL_LIST=19, + MP_CMD_VO_FULLSCREEN =20, + MP_CMD_SUB_POS =21, + MP_CMD_DVDNAV =22, + MP_CMD_VO_SCREENSHOT =23, + MP_CMD_PANSCAN =24, + MP_CMD_MUTE =25, + MP_CMD_LOADFILE =26, + MP_CMD_LOADLIST =27, + MP_CMD_VF_CHANGE_RECTANGLE=28, + MP_CMD_GAMMA =29, + MP_CMD_SUB_VISIBILITY =30, + MP_CMD_VOBSUB_LANG =31, + MP_CMD_MENU =32, + MP_CMD_SET_MENU =33, + MP_CMD_GET_TIME_LENGTH =34, + MP_CMD_GET_PERCENT_POS =35, + MP_CMD_SUB_STEP =36, + MP_CMD_TV_SET_CHANNEL =37, #ifdef USE_EDL - MP_CMD_EDL_MARK =38, + MP_CMD_EDL_MARK =38, #endif - MP_CMD_SUB_ALIGNMENT =39, - MP_CMD_TV_LAST_CHANNEL =40, - MP_CMD_OSD_SHOW_TEXT =41, - MP_CMD_TV_STEP_CHANNEL_UP =42, - MP_CMD_TV_STEP_CHANNEL_DOWN =43, + MP_CMD_SUB_ALIGNMENT =39, + MP_CMD_TV_LAST_CHANNEL =40, + MP_CMD_OSD_SHOW_TEXT =41, + MP_CMD_TV_STEP_CHANNEL_UP=42, + MP_CMD_TV_STEP_CHANNEL_DOWN=43, - MP_CMD_SPEED_INCR =44, - MP_CMD_SPEED_MULT =45, - MP_CMD_SPEED_SET =46, + MP_CMD_SPEED_INCR =44, + MP_CMD_SPEED_MULT =45, + MP_CMD_SPEED_SET =46, - MP_CMD_SWITCH_AUDIO =47, - MP_CMD_SWITCH_VIDEO =48, - MP_CMD_SWITCH_SUB =49, + MP_CMD_SWITCH_AUDIO =47, + MP_CMD_SWITCH_VIDEO =48, + MP_CMD_SWITCH_SUB =49, - MP_CMD_FRAME_STEP =56, + MP_CMD_FRAME_STEP =56, - MP_CMD_DVDNAV_EVENT =6000, + MP_CMD_DVDNAV_EVENT =6000, /// Console command - MP_CMD_CHELP =7000, - MP_CMD_CEXIT =7001, - MP_CMD_CHIDE =7002, - MP_CMD_CRUN =7003 -}; + MP_CMD_CHELP =7000, + MP_CMD_CEXIT =7001, + MP_CMD_CHIDE =7002, + MP_CMD_CRUN =7003 + }; -enum { - MP_CMD_DVDNAV_UP =1, - MP_CMD_DVDNAV_DOWN =2, - MP_CMD_DVDNAV_LEFT =3, - MP_CMD_DVDNAV_RIGHT =4, - MP_CMD_DVDNAV_MENU =5, - MP_CMD_DVDNAV_SELECT=6, -}; -enum { + enum { + MP_CMD_DVDNAV_UP =1, + MP_CMD_DVDNAV_DOWN =2, + MP_CMD_DVDNAV_LEFT =3, + MP_CMD_DVDNAV_RIGHT =4, + MP_CMD_DVDNAV_MENU =5, + MP_CMD_DVDNAV_SELECT =6, + }; + enum { // The args types - MP_CMD_ARG_INT =0, - MP_CMD_ARG_FLOAT =1, - MP_CMD_ARG_STRING =2, - MP_CMD_ARG_VOID =3, + MP_CMD_ARG_INT =0, + MP_CMD_ARG_FLOAT=1, + MP_CMD_ARG_STRING=2, + MP_CMD_ARG_VOID =3, - MP_CMD_MAX_ARGS =10 -}; + MP_CMD_MAX_ARGS =10 + }; // Error codes for the drivers -enum { - MP_INPUT_ERROR =-1,// An error occured but we can continue - MP_INPUT_DEAD =-2,// A fatal error occured, this driver should be removed - MP_INPUT_NOTHING =-3 // No input were avaible -}; + enum { + MP_INPUT_ERROR =-1,// An error occured but we can continue + MP_INPUT_DEAD =-2,// A fatal error occured, this driver should be removed + MP_INPUT_NOTHING =-3 // No input were avaible + }; // For the keys drivers, if possible you can send key up and key down // events. Key up is the default, to send a key down you must or the key // code with MP_KEY_DOWN -enum { - MP_KEY_DOWN =(1<<29), - MP_NO_REPEAT_KEY =(1<<28), // Use this when the key shouldn't be auto-repeated (like mouse buttons) - MP_MAX_KEY_DOWN =32 -}; + enum { + MP_KEY_DOWN =(1<<29), + MP_NO_REPEAT_KEY =(1<<28), // Use this when the key shouldn't be auto-repeated (like mouse buttons) + MP_MAX_KEY_DOWN =32 + }; -typedef union mp_cmd_arg_value { - int i; - float f; - char* s; - any_t* v; -} mp_cmd_arg_value_t; + union mp_cmd_arg_value_t { + int i; + float f; + char* s; + any_t* v; + }; -typedef struct mp_cmd_arg { - int type; - mp_cmd_arg_value_t v; -} mp_cmd_arg_t; + struct mp_cmd_arg_t { + int type; + mp_cmd_arg_value_t v; + }; -typedef struct mp_cmd { - int id; - const char* name; - int nargs; - mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; -} mp_cmd_t; + struct mp_cmd_t { + int id; + const char* name; + int nargs; + mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; + }; -// These typedefs are for the drivers. They are the functions used to retrive -// the next key code or command. + struct libinput_t; -typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, any_t* ctx); // Should return 1 if the command was processed -extern void (*mp_input_key_cb)(int code); // Set this to grab all incoming key code + // These typedefs are for the drivers. They are the functions used to retrive + // the next key code or command. -extern mp_cmd_t* mp_input_get_cmd_from_keys(any_t* handle,int n,int* keys); -// This function can be used to reput a command in the system. It's used by libmpdemux -// when it perform a blocking operation to resend the command it received to the main -// loop. -extern MPXP_Rc mp_input_queue_cmd(any_t* handle,mp_cmd_t* cmd); + typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, any_t* ctx); // Should return 1 if the command was processed + extern void (*mp_input_key_cb)(int code); // Set this to grab all incoming key code -// This function retrive the next avaible command waiting no more than time msec. -// If pause is true, the next input will always return a pause command. -extern mp_cmd_t* mp_input_get_cmd(any_t*handle,int time, int paused, int peek_only); + extern mp_cmd_t* mp_input_get_cmd_from_keys(libinput_t* handle,int n,int* keys); + // This function can be used to reput a command in the system. It's used by libmpdemux + // when it perform a blocking operation to resend the command it received to the main + // loop. + extern MPXP_Rc mp_input_queue_cmd(libinput_t* handle,mp_cmd_t* cmd); -extern mp_cmd_t* mp_input_parse_cmd(const char* str); + // This function retrive the next avaible command waiting no more than time msec. + // If pause is true, the next input will always return a pause command. + extern mp_cmd_t* mp_input_get_cmd(libinput_t*handle,int time, int paused, int peek_only); -/// These filter allow you to process the command before mplayer -/// If a filter return a true value mp_input_get_cmd will return NULL -extern void mp_input_add_cmd_filter(any_t* handle,mp_input_cmd_filter, any_t* ctx); -// After getting a command from mp_input_get_cmd you need to mp_free it using this -// function -extern void mp_cmd_free(mp_cmd_t* cmd); + extern mp_cmd_t* mp_input_parse_cmd(const char* str); -// When you create a new driver you should add it in this 2 functions. -extern any_t* mp_input_open(void); -extern void mp_input_close(any_t* handle); + /// These filter allow you to process the command before mplayer + /// If a filter return a true value mp_input_get_cmd will return NULL + extern void mp_input_add_cmd_filter(libinput_t* handle,mp_input_cmd_filter, any_t* ctx); + // After getting a command from mp_input_get_cmd you need to mp_free it using this + // function + extern void mp_cmd_free(mp_cmd_t* cmd); -extern void mp_input_print_keys(any_t*handle); -extern void mp_input_print_cmds(any_t*handle); + // When you create a new driver you should add it in this 2 functions. + extern libinput_t* mp_input_open(void); + extern void mp_input_close(libinput_t* handle); -extern void mp_input_print_binds(any_t*handle); -// Interruptible usleep: (used by libmpdemux) -extern MPXP_Rc mp_input_check_interrupt(any_t* handle,int time); + extern void mp_input_print_keys(libinput_t*handle); + extern void mp_input_print_cmds(libinput_t*handle); + + extern void mp_input_print_binds(libinput_t*handle); + // Interruptible usleep: (used by libmpdemux) + extern MPXP_Rc mp_input_check_interrupt(libinput_t* handle,int time); +} // namespace mpxp #endif Modified: mplayerxp/input2/joystick.cpp =================================================================== --- mplayerxp/input2/joystick.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/joystick.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -25,13 +25,15 @@ #include <linux/joystick.h> +#include "in_msg.h" + +namespace mpxp { typedef struct priv_s { int axis[10]; int btns; int fd; }priv_t; -#include "in_msg.h" any_t* mp_input_joystick_open(const char* dev) { int l=0; @@ -76,18 +78,18 @@ } void mp_input_joystick_close(any_t* ctx) { - priv_t* priv = (priv_t*)ctx; + priv_t* priv = reinterpret_cast<priv_t*>(ctx); close(priv->fd); delete priv; } int mp_input_joystick_read(any_t* ctx) { - priv_t* priv = (priv_t*)ctx; + priv_t& priv = *reinterpret_cast<priv_t*>(ctx); struct js_event ev; int l=0; while((unsigned int)l < sizeof(struct js_event)) { - int r = read(priv->fd,&ev+l,sizeof(struct js_event)-l); + int r = read(priv.fd,&ev+l,sizeof(struct js_event)-l); if(r <= 0) { if(errno == EINTR) continue; else if(errno == EAGAIN) return MP_INPUT_NOTHING; @@ -107,34 +109,34 @@ MSG_WARN("Joystick : warning init event, we have lost sync with driver\n"); ev.type &= ~JS_EVENT_INIT; if(ev.type == JS_EVENT_BUTTON) { - int s = (priv->btns >> ev.number) & 1; + int s = (priv.btns >> ev.number) & 1; if(s == ev.value) // State is the same : ignore return MP_INPUT_NOTHING; } if(ev.type == JS_EVENT_AXIS) { - if( (priv->axis[ev.number] == 1 && ev.value > JOY_AXIS_DELTA) || - (priv->axis[ev.number] == -1 && ev.value < -JOY_AXIS_DELTA) || - (priv->axis[ev.number] == 0 && ev.value >= -JOY_AXIS_DELTA && ev.value <= JOY_AXIS_DELTA)) + if( (priv.axis[ev.number] == 1 && ev.value > JOY_AXIS_DELTA) || + (priv.axis[ev.number] == -1 && ev.value < -JOY_AXIS_DELTA) || + (priv.axis[ev.number] == 0 && ev.value >= -JOY_AXIS_DELTA && ev.value <= JOY_AXIS_DELTA)) // State is the same : ignore return MP_INPUT_NOTHING; } } if(ev.type & JS_EVENT_BUTTON) { - priv->btns &= ~(1 << ev.number); - priv->btns |= (ev.value << ev.number); + priv.btns &= ~(1 << ev.number); + priv.btns |= (ev.value << ev.number); if(ev.value == 1) return ((JOY_BTN0+ev.number) | MP_KEY_DOWN); else return (JOY_BTN0+ev.number); } else if(ev.type & JS_EVENT_AXIS) { - if(ev.value < -JOY_AXIS_DELTA && priv->axis[ev.number] != -1) { - priv->axis[ev.number] = -1; + if(ev.value < -JOY_AXIS_DELTA && priv.axis[ev.number] != -1) { + priv.axis[ev.number] = -1; return (JOY_AXIS0_MINUS+(2*ev.number)) | MP_KEY_DOWN; - } else if(ev.value > JOY_AXIS_DELTA && priv->axis[ev.number] != 1) { - priv->axis[ev.number] = 1; + } else if(ev.value > JOY_AXIS_DELTA && priv.axis[ev.number] != 1) { + priv.axis[ev.number] = 1; return (JOY_AXIS0_PLUS+(2*ev.number)) | MP_KEY_DOWN; - } else if(ev.value <= JOY_AXIS_DELTA && ev.value >= -JOY_AXIS_DELTA && priv->axis[ev.number] != 0) { - int r = priv->axis[ev.number] == 1 ? JOY_AXIS0_PLUS+(2*ev.number) : JOY_AXIS0_MINUS+(2*ev.number); - priv->axis[ev.number] = 0; + } else if(ev.value <= JOY_AXIS_DELTA && ev.value >= -JOY_AXIS_DELTA && priv.axis[ev.number] != 0) { + int r = priv.axis[ev.number] == 1 ? JOY_AXIS0_PLUS+(2*ev.number) : JOY_AXIS0_MINUS+(2*ev.number); + priv.axis[ev.number] = 0; return r; } else return MP_INPUT_NOTHING; @@ -144,8 +146,11 @@ } return MP_INPUT_NOTHING; } +} // namespace mpxp #else +namespace mpxp { any_t* mp_input_joystick_open(const char* dev) { UNUNSED(dev); return NULL; } void mp_input_joystick_close(any_t* ctx) { UNUSED(ctx); } int mp_input_joystick_read(any_t* ctx) { UNUSED(ctx); return MP_INPUT_NOTHING; } +} // namespace mpxp #endif Modified: mplayerxp/input2/joystick.h =================================================================== --- mplayerxp/input2/joystick.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/joystick.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,44 +1,46 @@ #ifndef JOYSTICK_H_INCLUDED #define JOYSTICK_H_INCLUDED 1 -enum { - JOY_BASE =(0x100+128), - JOY_AXIS0_PLUS =(JOY_BASE+0), - JOY_AXIS0_MINUS =(JOY_BASE+1), - JOY_AXIS1_PLUS =(JOY_BASE+2), - JOY_AXIS1_MINUS =(JOY_BASE+3), - JOY_AXIS2_PLUS =(JOY_BASE+4), - JOY_AXIS2_MINUS =(JOY_BASE+5), - JOY_AXIS3_PLUS =(JOY_BASE+6), - JOY_AXIS3_MINUS =(JOY_BASE+7), - JOY_AXIS4_PLUS =(JOY_BASE+8), - JOY_AXIS4_MINUS =(JOY_BASE+9), - JOY_AXIS5_PLUS =(JOY_BASE+10), - JOY_AXIS5_MINUS =(JOY_BASE+11), - JOY_AXIS6_PLUS =(JOY_BASE+12), - JOY_AXIS6_MINUS =(JOY_BASE+13), - JOY_AXIS7_PLUS =(JOY_BASE+14), - JOY_AXIS7_MINUS =(JOY_BASE+15), - JOY_AXIS8_PLUS =(JOY_BASE+16), - JOY_AXIS8_MINUS =(JOY_BASE+17), - JOY_AXIS9_PLUS =(JOY_BASE+18), - JOY_AXIS9_MINUS =(JOY_BASE+19) -}; -enum { - JOY_BTN_BASE=((0x100+148)|(1<<28)), - JOY_BTN0 =(JOY_BTN_BASE+0), - JOY_BTN1 =(JOY_BTN_BASE+1), - JOY_BTN2 =(JOY_BTN_BASE+2), - JOY_BTN3 =(JOY_BTN_BASE+3), - JOY_BTN4 =(JOY_BTN_BASE+4), - JOY_BTN5 =(JOY_BTN_BASE+5), - JOY_BTN6 =(JOY_BTN_BASE+6), - JOY_BTN7 =(JOY_BTN_BASE+7), - JOY_BTN8 =(JOY_BTN_BASE+8), - JOY_BTN9 =(JOY_BTN_BASE+9) -}; +namespace mpxp { + enum { + JOY_BASE =(0x100+128), + JOY_AXIS0_PLUS =(JOY_BASE+0), + JOY_AXIS0_MINUS =(JOY_BASE+1), + JOY_AXIS1_PLUS =(JOY_BASE+2), + JOY_AXIS1_MINUS =(JOY_BASE+3), + JOY_AXIS2_PLUS =(JOY_BASE+4), + JOY_AXIS2_MINUS =(JOY_BASE+5), + JOY_AXIS3_PLUS =(JOY_BASE+6), + JOY_AXIS3_MINUS =(JOY_BASE+7), + JOY_AXIS4_PLUS =(JOY_BASE+8), + JOY_AXIS4_MINUS =(JOY_BASE+9), + JOY_AXIS5_PLUS =(JOY_BASE+10), + JOY_AXIS5_MINUS =(JOY_BASE+11), + JOY_AXIS6_PLUS =(JOY_BASE+12), + JOY_AXIS6_MINUS =(JOY_BASE+13), + JOY_AXIS7_PLUS =(JOY_BASE+14), + JOY_AXIS7_MINUS =(JOY_BASE+15), + JOY_AXIS8_PLUS =(JOY_BASE+16), + JOY_AXIS8_MINUS =(JOY_BASE+17), + JOY_AXIS9_PLUS =(JOY_BASE+18), + JOY_AXIS9_MINUS =(JOY_BASE+19) + }; + enum { + JOY_BTN_BASE =((0x100+148)|(1<<28)), + JOY_BTN0 =(JOY_BTN_BASE+0), + JOY_BTN1 =(JOY_BTN_BASE+1), + JOY_BTN2 =(JOY_BTN_BASE+2), + JOY_BTN3 =(JOY_BTN_BASE+3), + JOY_BTN4 =(JOY_BTN_BASE+4), + JOY_BTN5 =(JOY_BTN_BASE+5), + JOY_BTN6 =(JOY_BTN_BASE+6), + JOY_BTN7 =(JOY_BTN_BASE+7), + JOY_BTN8 =(JOY_BTN_BASE+8), + JOY_BTN9 =(JOY_BTN_BASE+9) + }; -extern any_t* mp_input_joystick_open(const char* dev); -extern void mp_input_joystick_close(any_t* ctx); -extern int mp_input_joystick_read(any_t* ctx); + extern any_t* mp_input_joystick_open(const char* dev); + extern void mp_input_joystick_close(any_t* ctx); + extern int mp_input_joystick_read(any_t* ctx); +} // namespace mpxp #endif Modified: mplayerxp/input2/lirc.cpp =================================================================== --- mplayerxp/input2/lirc.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/lirc.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -17,6 +17,7 @@ #include "input.h" #include "in_msg.h" +namespace mpxp { static struct lirc_config *lirc_config; char *lirc_configfile; @@ -46,27 +47,27 @@ } int mp_input_lirc_read_cmd(any_t* ctx,char* dest, int s) { - priv_t* priv = (priv_t*)ctx; + priv_t& priv = *reinterpret_cast<priv_t*>(ctx); fd_set fds; struct timeval tv; int r,cl = 0; char *code = NULL,*c = NULL; // We have something in the buffer return it - if(priv->cmd_buf != NULL) { - int l = strlen(priv->cmd_buf), w = l > s ? s : l; - memcpy(dest,priv->cmd_buf,w); + if(priv.cmd_buf != NULL) { + int l = strlen(priv.cmd_buf), w = l > s ? s : l; + memcpy(dest,priv.cmd_buf,w); l -= w; - if(l > 0) memmove(priv->cmd_buf,&priv->cmd_buf[w],l+1); + if(l > 0) memmove(priv.cmd_buf,&priv.cmd_buf[w],l+1); else { - delete priv->cmd_buf; - priv->cmd_buf = NULL; + delete priv.cmd_buf; + priv.cmd_buf = NULL; } return w; } // Nothing in the buffer, pool the lirc fd FD_ZERO(&fds); - FD_SET(priv->lirc_sock,&fds); + FD_SET(priv.lirc_sock,&fds); memset(&tv,0,sizeof(tv)); while((r = select(1,&fds,NULL,NULL,&tv)) <= 0) { if(r < 0) { @@ -88,23 +89,23 @@ while((r = lirc_code2char(lirc_config,code,&c))==0 && c!=NULL) { int l = strlen(c); if(l <= 0) continue; - priv->cmd_buf = (char *)mp_realloc(priv->cmd_buf,cl+l+2); - memcpy(&priv->cmd_buf[cl],c,l); + priv.cmd_buf = (char *)mp_realloc(priv.cmd_buf,cl+l+2); + memcpy(&priv.cmd_buf[cl],c,l); cl += l+1; - priv->cmd_buf[cl-1] = '\n'; - priv->cmd_buf[cl] = '\0'; + priv.cmd_buf[cl-1] = '\n'; + priv.cmd_buf[cl] = '\0'; } delete code; if(r < 0) return MP_INPUT_DEAD; - else if(priv->cmd_buf) // return the first command in the buffer - return mp_input_lirc_read_cmd(priv,dest,s); + else if(priv.cmd_buf) // return the first command in the buffer + return mp_input_lirc_read_cmd(&priv,dest,s); else return MP_INPUT_NOTHING; } void mp_input_lirc_close(any_t* ctx) { - priv_t* priv = (priv_t*)ctx; + priv_t* priv = reinterpret_cast<priv_t*>(ctx); if(priv->cmd_buf) { delete priv->cmd_buf; priv->cmd_buf = NULL; @@ -113,5 +114,5 @@ lirc_deinit(); delete priv; } - +}// namespace mpxp #endif Modified: mplayerxp/input2/lirc.h =================================================================== --- mplayerxp/input2/lirc.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/lirc.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,7 +1,8 @@ #ifndef __LIRC_H_INCLUDED #define __LIRC_H_INCLUDED 1 - -extern any_t* mp_input_lirc_open(void); -extern int mp_input_lirc_read_cmd(any_t* ctx,char* dest, int s); -extern void mp_input_lirc_close(any_t* ctx); +namespace mpxp { + extern any_t* mp_input_lirc_open(void); + extern int mp_input_lirc_read_cmd(any_t* ctx,char* dest, int s); + extern void mp_input_lirc_close(any_t* ctx); +} // namespace mpxp #endif Modified: mplayerxp/input2/mouse.h =================================================================== --- mplayerxp/input2/mouse.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/mouse.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,30 +1,31 @@ #ifndef MOUSE_H_INCLUDED #define MOUSE_H_INCLUDED 1 - -enum { - MOUSE_BASE=((0x100+256)|MP_NO_REPEAT_KEY), - MOUSE_BTN0=(MOUSE_BASE+0), - MOUSE_BTN1=(MOUSE_BASE+1), - MOUSE_BTN2=(MOUSE_BASE+2), - MOUSE_BTN3=(MOUSE_BASE+3), - MOUSE_BTN4=(MOUSE_BASE+4), - MOUSE_BTN5=(MOUSE_BASE+5), - MOUSE_BTN6=(MOUSE_BASE+6), - MOUSE_BTN7=(MOUSE_BASE+7), - MOUSE_BTN8=(MOUSE_BASE+8), - MOUSE_BTN9=(MOUSE_BASE+9) -}; -enum { - MOUSE_BASE_DBL=(0x300|MP_NO_REPEAT_KEY), - MOUSE_BTN0_DBL=(MOUSE_BASE_DBL+0), - MOUSE_BTN1_DBL=(MOUSE_BASE_DBL+1), - MOUSE_BTN2_DBL=(MOUSE_BASE_DBL+2), - MOUSE_BTN3_DBL=(MOUSE_BASE_DBL+3), - MOUSE_BTN4_DBL=(MOUSE_BASE_DBL+4), - MOUSE_BTN5_DBL=(MOUSE_BASE_DBL+5), - MOUSE_BTN6_DBL=(MOUSE_BASE_DBL+6), - MOUSE_BTN7_DBL=(MOUSE_BASE_DBL+7), - MOUSE_BTN8_DBL=(MOUSE_BASE_DBL+8), - MOUSE_BTN9_DBL=(MOUSE_BASE_DBL+9) -}; +namespace mpxp { + enum { + MOUSE_BASE=((0x100+256)|MP_NO_REPEAT_KEY), + MOUSE_BTN0=(MOUSE_BASE+0), + MOUSE_BTN1=(MOUSE_BASE+1), + MOUSE_BTN2=(MOUSE_BASE+2), + MOUSE_BTN3=(MOUSE_BASE+3), + MOUSE_BTN4=(MOUSE_BASE+4), + MOUSE_BTN5=(MOUSE_BASE+5), + MOUSE_BTN6=(MOUSE_BASE+6), + MOUSE_BTN7=(MOUSE_BASE+7), + MOUSE_BTN8=(MOUSE_BASE+8), + MOUSE_BTN9=(MOUSE_BASE+9) + }; + enum { + MOUSE_BASE_DBL=(0x300|MP_NO_REPEAT_KEY), + MOUSE_BTN0_DBL=(MOUSE_BASE_DBL+0), + MOUSE_BTN1_DBL=(MOUSE_BASE_DBL+1), + MOUSE_BTN2_DBL=(MOUSE_BASE_DBL+2), + MOUSE_BTN3_DBL=(MOUSE_BASE_DBL+3), + MOUSE_BTN4_DBL=(MOUSE_BASE_DBL+4), + MOUSE_BTN5_DBL=(MOUSE_BASE_DBL+5), + MOUSE_BTN6_DBL=(MOUSE_BASE_DBL+6), + MOUSE_BTN7_DBL=(MOUSE_BASE_DBL+7), + MOUSE_BTN8_DBL=(MOUSE_BASE_DBL+8), + MOUSE_BTN9_DBL=(MOUSE_BASE_DBL+9) + }; +} // namespace mpxp #endif \ No newline at end of file Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -52,7 +52,7 @@ sh_video_t* parent; const vd_functions_t* mpvdec; - any_t* libinput; + libinput_t* libinput; vd_private_t* ctx; vf_stream_t* vfilter; int vfilter_inited; @@ -139,7 +139,7 @@ #endif } -video_decoder_t * mpcv_lavc_init(sh_video_t* sh_video,any_t* libinput) { +video_decoder_t * mpcv_lavc_init(sh_video_t* sh_video,libinput_t* libinput) { video_decoder_t* handle=new(zeromem) video_decoder_t; decvideo_priv_t* priv = new(zeromem) decvideo_priv_t; priv->parent=sh_video; @@ -164,7 +164,7 @@ return handle; } -video_decoder_t * mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,any_t*libinput){ +video_decoder_t * mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,libinput_t*libinput){ UNUSED(codecname); UNUSED(status); int done=0; Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpcodecs/dec_video.h 2012-12-05 11:42:31 UTC (rev 511) @@ -5,14 +5,18 @@ #include "libmpstream/stream.h" #include "libmpdemux/stheader.h" +namespace mpxp { + struct libinput_t; +} + struct video_decoder_t { any_t* vd_private; }; // dec_video.c: -extern video_decoder_t* __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status,any_t*libinput); +extern video_decoder_t* __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status,libinput_t*libinput); extern void __FASTCALL__ mpcv_uninit(video_decoder_t *handle); -extern video_decoder_t* __FASTCALL__ mpcv_lavc_init(sh_video_t*,any_t* libinput); +extern video_decoder_t* __FASTCALL__ mpcv_lavc_init(sh_video_t*,libinput_t* libinput); extern int __FASTCALL__ mpcv_decode(video_decoder_t *handle,const enc_frame_t* frame); extern MPXP_Rc __FASTCALL__ mpcv_get_quality_max(video_decoder_t *handle,unsigned *qual); Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpconf/cfgparser.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -220,7 +220,7 @@ return ret; } -m_config_t* m_config_new(play_tree_t* pt,any_t*libinput) { +m_config_t* m_config_new(play_tree_t* pt,libinput_t*libinput) { m_config_t* config; #ifdef MP_DEBUG Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpconf/cfgparser.h 2012-12-05 11:42:31 UTC (rev 511) @@ -5,6 +5,10 @@ #define __CFG_PARSER_H 1 #include "xmpcore/xmp_enums.h" +namespace mpxp { + struct libinput_t; +} + /* config types */ enum { CONF_TYPE_FLAG =0, @@ -63,7 +67,7 @@ play_tree_t* last_entry; // last added entry play_tree_t* last_parent; // if last_entry is NULL we must create child of this int recursion_depth; - any_t* libinput; + libinput_t* libinput; }; struct config_save { @@ -89,7 +93,7 @@ */ MPXP_Rc m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); -m_config_t* m_config_new(play_tree_t* pt,any_t*libinput); +m_config_t* m_config_new(play_tree_t* pt,libinput_t*libinput); void m_config_free(m_config_t* config); Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -15,6 +15,7 @@ #include "libmpsub/subreader.h" #include "libmpconf/cfgparser.h" +#include "input2/input.h" #include "osdep/fastmemcpy.h" #include "libvo/sub.h" #include "libao2/afmt.h" @@ -367,7 +368,7 @@ stream_t *as = NULL,*ss = NULL; Demuxer *vd,*ad = NULL,*sd = NULL; int afmt = 0,sfmt = 0; - any_t* libinput=NULL; + libinput_t* libinput=NULL; #ifdef HAVE_STREAMIN libinput=vs->streaming_strl->libinput; #endif Modified: mplayerxp/libmpdemux/mpdemux.cpp =================================================================== --- mplayerxp/libmpdemux/mpdemux.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpdemux/mpdemux.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -7,7 +7,7 @@ #include "mpdemux.h" #include "demux_msg.h" -int mpdemux_check_interrupt(any_t* libinput,int _time) { +int mpdemux_check_interrupt(libinput_t* libinput,int _time) { mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(libinput,_time,0,1)) == NULL) return 0; Modified: mplayerxp/libmpdemux/mpdemux.h =================================================================== --- mplayerxp/libmpdemux/mpdemux.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpdemux/mpdemux.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,5 +1,5 @@ #ifndef MPDEMUX_H #define MPDEMUX_H 1 -extern int mpdemux_check_interrupt(any_t* libinput,int time); +extern int mpdemux_check_interrupt(libinput_t* libinput,int time); #endif Modified: mplayerxp/libmpstream/asf_mmst_streaming.cpp =================================================================== --- mplayerxp/libmpstream... [truncated message content] |
From: <nic...@us...> - 2012-12-06 13:54:07
|
Revision: 513 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=513&view=rev Author: nickols_k Date: 2012-12-06 13:53:54 +0000 (Thu, 06 Dec 2012) Log Message: ----------- convert struct stream_driver_t into class Stream_Interface note: many stream drivers became untested. Many other sources were modified to not be depended from struct stream_t Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpdemux/asf.h mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_audio.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_nsv.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_rawvideo.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpdemux/demuxer_stream.h mplayerxp/libmpdemux/stheader.cpp mplayerxp/libmpstream/Makefile mplayerxp/libmpstream/asf_mmst_streaming.cpp mplayerxp/libmpstream/asf_streaming.cpp mplayerxp/libmpstream/asf_streaming.h mplayerxp/libmpstream/cache2.cpp mplayerxp/libmpstream/cdd.h mplayerxp/libmpstream/cdda.cpp mplayerxp/libmpstream/cddb.cpp mplayerxp/libmpstream/mrl.cpp mplayerxp/libmpstream/mrl.h mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/network.h mplayerxp/libmpstream/pnm.cpp mplayerxp/libmpstream/pnm.h mplayerxp/libmpstream/rtp.cpp mplayerxp/libmpstream/rtp.h mplayerxp/libmpstream/s_cdd.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/libmpstream/s_dvdread.cpp mplayerxp/libmpstream/s_file.cpp mplayerxp/libmpstream/s_ftp.cpp mplayerxp/libmpstream/s_lavc.cpp mplayerxp/libmpstream/s_network.cpp mplayerxp/libmpstream/s_null.cpp mplayerxp/libmpstream/s_oss.cpp mplayerxp/libmpstream/s_rtsp.cpp mplayerxp/libmpstream/s_tv.cpp mplayerxp/libmpstream/s_udp.cpp mplayerxp/libmpstream/s_vcdnav.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libmpstream/stream.h mplayerxp/libmpstream/stream_internal.h mplayerxp/libmpstream/tcp.cpp mplayerxp/libmpstream/tcp.h mplayerxp/libmpstream/tvi/frequencies.cpp mplayerxp/libmpstream/tvi/frequencies.h mplayerxp/libmpstream/tvi/tv.h mplayerxp/libmpstream/tvi/tvi_def.h mplayerxp/libmpstream/tvi/tvi_dummy.cpp mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/mp-opt-reg.cpp mplayerxp/mplayerxp.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/dump.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -44,7 +44,7 @@ const char *ext,*name; MP_UNIT("dumpstream"); stream_reset(stream); - stream_seek(stream,stream->start_pos); + stream_seek(stream,stream->start_pos()); ext=".ext"; if(!port) { Modified: mplayerxp/libmpdemux/asf.h =================================================================== --- mplayerxp/libmpdemux/asf.h 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/asf.h 2012-12-06 13:53:54 UTC (rev 513) @@ -134,12 +134,12 @@ } ASF_StreamType_e; typedef struct { - ASF_StreamType_e streaming_type; + ASF_StreamType_e networking_type; int request; int packet_size; int *audio_streams,n_audio,*video_streams,n_video; int audio_id, video_id; -} asf_http_streaming_ctrl_t; +} asf_http_networking_t; /* Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_asf.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -334,10 +334,10 @@ if(streams) { uint32_t vr = 0, ar = 0,i; #ifdef HAVE_STREAMING - if( demuxer->stream->streaming_ctrl!=NULL ) { - if( demuxer->stream->streaming_ctrl->bandwidth!=0 && demuxer->stream->streaming_ctrl->data!=NULL ) { - best_audio = ((asf_http_streaming_ctrl_t*)demuxer->stream->streaming_ctrl->data)->audio_id; - best_video = ((asf_http_streaming_ctrl_t*)demuxer->stream->streaming_ctrl->data)->video_id; + if( demuxer->stream->networking!=NULL ) { + if( demuxer->stream->networking->bandwidth!=0 && demuxer->stream->networking->data!=NULL ) { + best_audio = ((asf_http_networking_t*)demuxer->stream->networking->data)->audio_id; + best_video = ((asf_http_networking_t*)demuxer->stream->networking->data)->video_id; } } else #endif Modified: mplayerxp/libmpdemux/demux_audio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_audio.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_audio.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -444,13 +444,13 @@ if(stream_eof(s)) return 0; } - if(s->end_pos) { + if(s->end_pos()) { char tag[4]; - stream_seek(s,s->end_pos-128); + stream_seek(s,s->end_pos()-128); stream_read(s,tag,3); tag[3] = '\0'; if(strcmp(tag,"TAG")) - demuxer->movi_end = s->end_pos; + demuxer->movi_end = s->end_pos(); else { char buf[31]; uint8_t g; @@ -487,7 +487,7 @@ uint8_t b[8]; unsigned n; stream_t *s=demuxer->stream; - demuxer->movi_end = s->end_pos; + demuxer->movi_end = s->end_pos(); memcpy(b,hdr,4); stream_seek(s,pos+4); stream_read(s,&b[4],4); @@ -511,7 +511,7 @@ uint8_t b[12]; unsigned n; stream_t *s=demuxer->stream; - demuxer->movi_end = s->end_pos; + demuxer->movi_end = s->end_pos(); memcpy(b,hdr,4); stream_seek(s,pos+4); stream_read(s,&b[4],8); @@ -882,7 +882,7 @@ priv = new(zeromem) da_priv_t; s = demuxer->stream; stream_reset(s); - stream_seek(s,s->start_pos); + stream_seek(s,s->start_pos()); while(n < 5 && !stream_eof(s)) { st_pos = stream_tell(s); @@ -1014,7 +1014,7 @@ sh_audio = demuxer->new_sh_audio(); MSG_DBG2("mp3_header off: st_pos=%lu n=%lu HDR_SIZE=%u\n",st_pos,n,HDR_SIZE); demuxer->movi_start = stream_tell(s); - demuxer->movi_end = s->end_pos; + demuxer->movi_end = s->end_pos(); switch(frmt) { case RAW_FLAC: { @@ -1101,7 +1101,7 @@ w->nBlockAlign = sh_audio->nch*afmt2bps(sh_audio->afmt); w->wBitsPerSample = 8*afmt2bps(sh_audio->afmt); w->cbSize = 0; - demuxer->movi_start = demuxer->stream->start_pos+hsize; + demuxer->movi_start = demuxer->stream->start_pos()+hsize; demuxer->movi_end = demuxer->movi_start+hsize+dsize; demuxer->movi_length = (demuxer->movi_end-demuxer->movi_start)/w->nAvgBytesPerSec; } @@ -1158,7 +1158,7 @@ priv->pos = 32; // empty bit buffer priv->length = 1152 * frames / (float)sh_audio->wf->nSamplesPerSec; demuxer->movi_start = 24; /* skip header */ - demuxer->movi_end = s->end_pos; + demuxer->movi_end = s->end_pos(); if (demuxer->movi_end > demuxer->movi_start && priv->length > 1) sh_audio->wf->nAvgBytesPerSec = (demuxer->movi_end - demuxer->movi_start) / priv->length; else @@ -1340,10 +1340,10 @@ stream_seek(s,data_off); stream_read(s,hdr,4); MSG_DBG2("Trying id3v1 at %llX\n",data_off); - if(!read_mp3v1_tags(demuxer,hdr,data_off)) demuxer->movi_end = s->end_pos; + if(!read_mp3v1_tags(demuxer,hdr,data_off)) demuxer->movi_end = s->end_pos(); } else - demuxer->movi_end = s->end_pos; + demuxer->movi_end = s->end_pos(); stream_seek(s,data_off); } break; } Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -158,7 +158,7 @@ if(!demuxer->movi_start) demuxer->movi_start=stream_tell(demuxer->stream); demuxer->movi_end=stream_tell(demuxer->stream)+len; MSG_V("Found movie at 0x%X - 0x%X\n",(int)demuxer->movi_start,(int)demuxer->movi_end); - if(demuxer->stream->end_pos>demuxer->movi_end) demuxer->movi_end=demuxer->stream->end_pos; + if(demuxer->stream->end_pos()>demuxer->movi_end) demuxer->movi_end=demuxer->stream->end_pos(); if(index_mode==-2 || index_mode==2 || index_mode==0) break; // reading from non-seekable source (stdin) or forced index or no index forced if(list_end>0) stream_seek(demuxer->stream,list_end); // skip movi @@ -609,7 +609,7 @@ if (mp_conf.verbose>=2) print_index(priv->idx, priv->idx_size); - demuxer->movi_end=demuxer->stream->end_pos; + demuxer->movi_end=demuxer->stream->end_pos(); freeout: @@ -1141,7 +1141,7 @@ demuxer->priv=priv; //---- AVI header: - read_avi_header(demuxer,(demuxer->stream->type&STREAMTYPE_SEEKABLE)?index_mode:-2); + read_avi_header(demuxer,(demuxer->stream->type()&STREAMTYPE_SEEKABLE)?index_mode:-2); if(demuxer->audio->id>=0 && !demuxer->get_sh_audio(demuxer->audio->id)){ MSG_WARN("AVI: invalid audio stream ID: %d - ignoring (nosound)\n",demuxer->audio->id); Modified: mplayerxp/libmpdemux/demux_dv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dv.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_dv.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -142,7 +142,7 @@ rawdv_frames_t *frames = new rawdv_frames_t; dv_decoder_t *dv_decoder=NULL; - MSG_V("demux_open_rawdv() end_pos %" PRId64"\n",(int64_t)demuxer->stream->end_pos); + MSG_V("demux_open_rawdv() end_pos %" PRId64"\n",(int64_t)demuxer->stream->end_pos()); // go back to the beginning stream_reset(demuxer->stream); @@ -197,7 +197,7 @@ frames->current_filepos=0; frames->current_frame=0; frames->frame_size=dv_decoder->frame_size; - frames->frame_number=demuxer->stream->end_pos/frames->frame_size; + frames->frame_number=demuxer->stream->end_pos()/frames->frame_size; MSG_V("demux_open_rawdv() seek to %qu, size: %d, dv_dec->frame_size: %d\n",frames->current_filepos,frames->frame_size, dv_decoder->frame_size); if (dv_decoder->audio != NULL && demuxer->audio->id>=-1){ Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_film.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -228,7 +228,7 @@ // go back to the beginning stream_reset(demuxer->stream); - stream_seek(demuxer->stream, demuxer->stream->start_pos); + stream_seek(demuxer->stream, demuxer->stream->start_pos()); // read the master chunk type chunk_type = stream_read_fourcc(demuxer->stream); @@ -245,7 +245,7 @@ header_size = stream_read_dword(demuxer->stream); film_data->film_version = stream_read_fourcc(demuxer->stream); demuxer->movi_start = header_size; - demuxer->movi_end = demuxer->stream->end_pos; + demuxer->movi_end = demuxer->stream->end_pos(); header_size -= 16; MSG_HINT( "FILM version %.4s\n", Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -146,11 +146,11 @@ if(whence == SEEK_CUR) pos +=stream_tell(stream); else if(whence == SEEK_END) - pos += stream->end_pos; + pos += stream->end_pos(); else if(whence != SEEK_SET) return -1; - if(pos<stream->end_pos && stream->eof) + if(pos<stream->end_pos() && stream->eof) stream_reset(stream); if(stream_seek(stream, pos)==0) return -1; Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -2791,7 +2791,7 @@ stream_t *s = demuxer->stream; int version; char *str; - stream_seek(s, s->start_pos); + stream_seek(s, s->start_pos()); str = ebml_read_header (s, &version); if (str == NULL || strcmp (str, "matroska") || version > 1) { MSG_DBG2( "[mkv] no head found\n"); @@ -2809,7 +2809,7 @@ int i, version, cont = 0; char *str; - stream_seek(s, s->start_pos); + stream_seek(s, s->start_pos()); str = ebml_read_header (s, &version); if (str == NULL || strcmp (str, "matroska") || version > 2) { MSG_DBG2( "[mkv] no head found\n"); @@ -3045,12 +3045,12 @@ } } - if (s->end_pos == 0 || (mkv_d->indexes == NULL && index_mode < 0)) + if (s->end_pos() == 0 || (mkv_d->indexes == NULL && index_mode < 0)) demuxer->flags &= ~(Demuxer::Seekable); else { - demuxer->movi_start = s->start_pos; - demuxer->movi_end = s->end_pos; + demuxer->movi_start = s->start_pos(); + demuxer->movi_end = s->end_pos(); demuxer->flags |= Demuxer::Seekable; if (mkv_d->chapters && dvd_chapter>1 && dvd_chapter<=mkv_d->num_chapters) { Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -561,7 +561,7 @@ } if(newpos<demuxer->movi_start){ - if(!(demuxer->stream->type&STREAMTYPE_PROGRAM)) demuxer->movi_start=0; // for VCD + if(!(demuxer->stream->type()&STREAMTYPE_PROGRAM)) demuxer->movi_start=0; // for VCD if(newpos<demuxer->movi_start) newpos=demuxer->movi_start; } @@ -673,7 +673,7 @@ code = bswap_32(code); /* test stream only if stream is started from 0000001XX */ if ((code & 0xffffff00) == 0x100) { - stream_seek(demuxer->stream,demuxer->stream->start_pos); + stream_seek(demuxer->stream,demuxer->stream->start_pos()); memset(&mpg_stat,0,sizeof(struct mpg_stat_s)); while(pes>=0){ @@ -763,7 +763,7 @@ if(!demuxer->get_sh_video()) demuxer->new_sh_video(); if(demuxer->video->id==-1) demuxer->video->id=0; demuxer->video->sh=demuxer->get_sh_video(); - stream_seek(demuxer->stream,demuxer->stream->start_pos); + stream_seek(demuxer->stream,demuxer->stream->start_pos()); return mpges_demux(demuxer,demuxer->video)?MPXP_Ok:MPXP_False; } else { /* Modified: mplayerxp/libmpdemux/demux_nsv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nsv.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_nsv.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -334,7 +334,7 @@ return MPXP_False; // not an NSV file stream_reset(demuxer->stream); // clear EOF - stream_seek(demuxer->stream,demuxer->stream->start_pos); + stream_seek(demuxer->stream,demuxer->stream->start_pos()); return MPXP_Ok; } Modified: mplayerxp/libmpdemux/demux_nuv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nuv.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_nuv.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -225,7 +225,7 @@ /* Go to the start */ stream_reset(demuxer->stream); - stream_seek(demuxer->stream, demuxer->stream->start_pos); + stream_seek(demuxer->stream, demuxer->stream->start_pos()); stream_read ( demuxer->stream, (char*)& rtjpeg_fileheader, sizeof(rtjpeg_fileheader) ); le2me_rtfileheader(&rtjpeg_fileheader); Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -668,7 +668,7 @@ if(p > 1 || (p == 1 && ! ogg_page_continued(page))) last_pos = pos; pos += np; - if(index_mode == 2) MSG_V("Building syncpoint table %d%%\r",(int)(pos*100/s->end_pos)); + if(index_mode == 2) MSG_V("Building syncpoint table %d%%\r",(int)(pos*100/s->end_pos())); } if(index_mode == 2) MSG_V("\n"); @@ -1033,7 +1033,7 @@ } } /// Add the header packets if the stream isn't seekable - if(ds && !s->end_pos) { + if(ds && !s->end_pos()) { /// Finish the page, otherwise packets will be lost do { demux_ogg_add_packet(ds,&ogg_d->subs[ogg_d->num_sub],ogg_d->num_sub,&pack); @@ -1069,11 +1069,11 @@ } ogg_d->final_granulepos=0; - if(!s->end_pos) + if(!s->end_pos()) demuxer->flags &= ~(Demuxer::Seekable); else { - demuxer->movi_start = s->start_pos; // Needed for XCD (Ogg written in MODE2) - demuxer->movi_end = s->end_pos; + demuxer->movi_start = s->start_pos(); // Needed for XCD (Ogg written in MODE2) + demuxer->movi_end = s->end_pos(); demuxer->flags |= Demuxer::Seekable; demux_ogg_scan_stream(demuxer); } Modified: mplayerxp/libmpdemux/demux_pva.cpp =================================================================== --- mplayerxp/libmpdemux/demux_pva.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_pva.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -174,7 +174,7 @@ sh_audio->ds=demuxer->audio; demuxer->movi_start=0; - demuxer->movi_end=demuxer->stream->end_pos; + demuxer->movi_end=demuxer->stream->end_pos(); priv->last_video_pts=-1; priv->last_audio_pts=-1; Modified: mplayerxp/libmpdemux/demux_rawaudio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -36,7 +36,7 @@ static MPXP_Rc rawaudio_probe(Demuxer* demuxer) { - if(demuxer->stream->type & STREAMTYPE_RAWAUDIO || use_rawaudio) { + if(demuxer->stream->type() & STREAMTYPE_RAWAUDIO || use_rawaudio) { demuxer->file_format=Demuxer::Type_RAWAUDIO; return MPXP_Ok; } @@ -64,14 +64,14 @@ w->wBitsPerSample = samplesize*8; w->cbSize = 0; print_wave_header(w,sizeof(WAVEFORMATEX)); - demuxer->movi_start = demuxer->stream->start_pos; - demuxer->movi_end = demuxer->stream->end_pos; + demuxer->movi_start = demuxer->stream->start_pos(); + demuxer->movi_end = demuxer->stream->end_pos(); demuxer->movi_length = (demuxer->movi_end-demuxer->movi_start)/w->nAvgBytesPerSec; demuxer->audio->sh = sh_audio; demuxer->audio->id = 0; sh_audio->ds = demuxer->audio; - if(!(demuxer->stream->type & STREAMTYPE_SEEKABLE)) demuxer->flags &= ~Demuxer::Seekable; + if(!(demuxer->stream->type() & STREAMTYPE_SEEKABLE)) demuxer->flags &= ~Demuxer::Seekable; check_pin("demuxer",demuxer->pin,DEMUX_PIN); return demuxer; } Modified: mplayerxp/libmpdemux/demux_rawvideo.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -60,7 +60,7 @@ static MPXP_Rc rawvideo_probe(Demuxer* demuxer) { - if(demuxer->stream->type & STREAMTYPE_RAWVIDEO || priv.use_rawvideo) { + if(demuxer->stream->type() & STREAMTYPE_RAWVIDEO || priv.use_rawvideo) { priv.fps=25; demuxer->file_format=Demuxer::Type_RAWVIDEO; return MPXP_Ok; @@ -110,8 +110,8 @@ sh_video->src_w=priv.width; sh_video->src_h=priv.height; - demuxer->movi_start = demuxer->stream->start_pos; - demuxer->movi_end = demuxer->stream->end_pos; + demuxer->movi_start = demuxer->stream->start_pos(); + demuxer->movi_end = demuxer->stream->end_pos(); demuxer->movi_length = (demuxer->movi_end-demuxer->movi_start)/(priv.fps*priv.imgsize); demuxer->video->sh = sh_video; Modified: mplayerxp/libmpdemux/demux_roq.cpp =================================================================== --- mplayerxp/libmpdemux/demux_roq.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_roq.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -60,7 +60,7 @@ static MPXP_Rc roq_probe(Demuxer *demuxer) { stream_reset(demuxer->stream); - stream_seek(demuxer->stream, demuxer->stream->start_pos); + stream_seek(demuxer->stream, demuxer->stream->start_pos()); if ((stream_read_dword(demuxer->stream) == 0x8410FFFF) && ((stream_read_dword(demuxer->stream) & 0xFFFF0000) == 0xFFFF0000)) { @@ -118,7 +118,7 @@ roq_data->chunks = NULL; // position the stream and start traversing - stream_seek(demuxer->stream, demuxer->stream->start_pos+6); + stream_seek(demuxer->stream, demuxer->stream->start_pos()+6); fps = stream_read_word_le(demuxer->stream); while (!stream_eof(demuxer->stream)) { Modified: mplayerxp/libmpdemux/demux_ty.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ty.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demux_ty.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -408,13 +408,13 @@ { off_t offset; - numberParts = demux->stream->end_pos / TIVO_PART_LENGTH; + numberParts = demux->stream->end_pos() / TIVO_PART_LENGTH; offset = numberParts * TIVO_PART_LENGTH; MSG_DBG3( "ty:ty/ty+Number Parts %"PRId64"\n", (int64_t)numberParts ); - if ( offset + CHUNKSIZE < demux->stream->end_pos ) + if ( offset + CHUNKSIZE < demux->stream->end_pos() ) { stream_seek( demux->stream, offset ); readSize = stream_read( demux->stream, chunk, CHUNKSIZE ); @@ -441,8 +441,8 @@ } } - if ( demux->stream->start_pos > 0 ) - filePos = demux->stream->start_pos; + if ( demux->stream->start_pos() > 0 ) + filePos = demux->stream->start_pos(); stream_seek( demux->stream, filePos ); demux->filepos = stream_tell( demux->stream ); tivo->whichChunk = filePos / CHUNKSIZE; @@ -459,7 +459,7 @@ MSG_DBG3( "ty:ty which Chunk %d\n", tivo->whichChunk ); MSG_DBG3( - "ty:file end_pos %"PRIx64"\n", (int64_t)demux->stream->end_pos ); + "ty:file end_pos %"PRIx64"\n", (int64_t)demux->stream->end_pos()); MSG_DBG3( "\nty:wanted current offset %"PRIx64"\n", (int64_t)stream_tell( demux->stream ) ); Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -117,8 +117,8 @@ void Demuxer::_init(stream_t *_stream,int a_id,int v_id,int s_id) { stream=_stream; - movi_start=_stream->start_pos; - movi_end=_stream->end_pos; + movi_start=_stream->start_pos(); + movi_end=_stream->end_pos(); movi_length=UINT_MAX; flags|=Seekable; synced=0; @@ -127,7 +127,7 @@ video=new(zeromem) Demuxer_Stream(this,v_id); sub=new(zeromem) Demuxer_Stream(this,s_id); stream_reset(_stream); - stream_seek(_stream,stream->start_pos); + stream_seek(_stream,stream->start_pos()); } Demuxer::Demuxer() @@ -318,7 +318,7 @@ MSG_V("Forcing %s ... ",drv->name); /* don't remove it from loop!!! (for initializing) */ stream_reset(stream); - stream_seek(stream,stream->start_pos); + stream_seek(stream,stream->start_pos()); if(drv->probe(this)!=MPXP_Ok) { MSG_ERR("Can't probe stream with driver: '%s'\n",demux_conf.type); goto err_exit; @@ -331,7 +331,7 @@ MSG_V("Probing %s ... ",ddrivers[i]->name); /* don't remove it from loop!!! (for initializing) */ stream_reset(stream); - stream_seek(stream,stream->start_pos); + stream_seek(stream,stream->start_pos()); if(ddrivers[i]->probe(this)==MPXP_Ok) { MSG_V("OK\n"); dpriv.driver = ddrivers[i]; @@ -423,7 +423,7 @@ demuxer_priv_t& dpriv = static_cast<demuxer_priv_t&>(*demuxer_priv); sh_audio_t *sh_audio=reinterpret_cast<sh_audio_t*>(audio->sh); - if(!(stream->type&STREAMTYPE_SEEKABLE)) + if(!(stream->type()&STREAMTYPE_SEEKABLE)) { MSG_WARN("Stream is not seekable\n"); return 0; Modified: mplayerxp/libmpdemux/demuxer_r.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_r.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demuxer_r.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -52,7 +52,7 @@ if(ds->pts_flags && ds->pts < 1.0 && ds->prev_pts > 2.0) { float spts; - spts=ds->demuxer->stream->stream_pts; + spts=ds->demuxer->stream->stream_pts(); ds->pts_corr=spts>0?spts:ds->prev_pts; ds->pts_flags=0; MSG_V("***PTS discontinuity happens*** correct audio %f pts as %f\n",ds->pts,ds->pts_corr); Modified: mplayerxp/libmpdemux/demuxer_stream.h =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.h 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/demuxer_stream.h 2012-12-06 13:53:54 UTC (rev 513) @@ -7,9 +7,9 @@ #include <stdint.h> #include "demuxer_packet.h" -struct stream_t; namespace mpxp { struct Demuxer; + struct stream_t; class Demuxer_Stream : public Opaque { public: Demuxer_Stream(Demuxer *demuxer,int id); Modified: mplayerxp/libmpdemux/stheader.cpp =================================================================== --- mplayerxp/libmpdemux/stheader.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpdemux/stheader.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -580,7 +580,7 @@ if(d_video.pts_flags && d_video.pts < 1.0 && d_video.prev_pts > 2.0) { float spts; - spts=d_video.demuxer->stream->stream_pts; + spts=d_video.demuxer->stream->stream_pts(); d_video.pts_corr=spts>0?spts:d_video.prev_pts; d_video.pts_flags=0; MSG_V("***PTS discontinuity happens*** correcting video %f pts as %f\n",d_video.pts,d_video.pts_corr); Modified: mplayerxp/libmpstream/Makefile =================================================================== --- mplayerxp/libmpstream/Makefile 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/Makefile 2012-12-06 13:53:54 UTC (rev 513) @@ -7,7 +7,7 @@ DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done CXXSRCS= s_file.cpp s_lavc.cpp s_null.cpp s_tv.cpp -CXXSRCS+= cache2.cpp mrl.cpp stream.cpp url.cpp +CXXSRCS+= mrl.cpp stream.cpp url.cpp cache2.cpp ifeq ($(HAVE_LIBCDIO_CDDA),yes) CXXSRCS += s_cdd.cpp CXXSRCS += cdda.cpp Modified: mplayerxp/libmpstream/asf_mmst_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_mmst_streaming.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/asf_mmst_streaming.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -205,7 +205,7 @@ } -static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) +static int get_header (int s, uint8_t *header, networking_t *networking) { unsigned char pre_header[8]; int header_len; @@ -240,7 +240,7 @@ if ( (header[header_len-1] == 1) && (header[header_len-2]==1)) { - if( streaming_bufferize( streaming_ctrl, header, header_len )<0 ) { + if( networking_bufferize( networking, header, header_len )<0 ) { return -1; } @@ -363,7 +363,7 @@ } -static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl) { +static int get_media_packet (int s, int padding, networking_t *stream_ctrl) { unsigned char pre_header[8]; unsigned char data[BUF_SIZE]; @@ -394,7 +394,7 @@ return 0; } - streaming_bufferize(stream_ctrl, data, padding); + networking_bufferize(stream_ctrl, data, padding); } else { @@ -454,7 +454,7 @@ static int packet_length1; -static int asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl ) +static int asf_mmst_networking_read( int fd, char *buffer, int size, networking_t *stream_ctrl ) { int len; @@ -482,16 +482,16 @@ } -static int asf_mmst_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) +static int asf_mmst_networking_seek( int fd, off_t pos, networking_t *networking ) { return -1; // Shut up gcc warning fd++; pos++; - streaming_ctrl=NULL; + networking=NULL; } -int asf_mmst_streaming_start(libinput_t* libinput,stream_t *stream) +int asf_mmst_networking_start(net_fd_t* fd, networking_t *networking) { char str[1024]; unsigned char data[BUF_SIZE]; @@ -499,12 +499,12 @@ int asf_header_len; int len, i, packet_length; char *path, *unescpath; - URL_t *url1 = stream->streaming_ctrl->url; - int s = stream->fd; + URL_t *url1 = networking->url; + net_fd_t s = *fd; if( s>0 ) { - closesocket( stream->fd ); - stream->fd = -1; + closesocket( *fd ); + *fd = -1; } /* parse url */ @@ -524,7 +524,7 @@ if( url1->port==0 ) { url1->port=1755; } - s = tcp_connect2Server(libinput, url1->hostname, url1->port, 0); + s = tcp_connect2Server(networking->libinput, url1->hostname, url1->port, 0); if( s<0 ) { delete path; return s; @@ -592,7 +592,7 @@ num_stream_ids = 0; /* get_headers(s, asf_header); */ - asf_header_len = get_header (s, asf_header, stream->streaming_ctrl); + asf_header_len = get_header (s, asf_header, networking); // printf("---------------------------------- asf_header %d\n",asf_header); if (asf_header_len==0) { //error reading header closesocket(s); @@ -646,11 +646,11 @@ send_command (s, 0x07, 1, 0xFFFF | stream_ids[0] << 16, 24, data); - stream->fd = s; - stream->streaming_ctrl->streaming_read = asf_mmst_streaming_read; - stream->streaming_ctrl->streaming_seek = asf_mmst_streaming_seek; - stream->streaming_ctrl->buffering = 1; - stream->streaming_ctrl->status = streaming_playing_e; + *fd = s; + networking->networking_read = asf_mmst_networking_read; + networking->networking_seek = asf_mmst_networking_seek; + networking->buffering = 1; + networking->status = networking_playing_e; packet_length1 = packet_length; MSG_V("mmst packet_length = %d\n",packet_length); Modified: mplayerxp/libmpstream/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_streaming.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/asf_streaming.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -34,12 +34,12 @@ ((guid)[3] << 24 | (guid)[2] << 16 | (guid)[1] << 8 | (guid)[0]) #endif -// ASF streaming support several network protocol. +// ASF networking support several network protocol. // One use UDP, not known, yet! // Another is HTTP, this one is known. // So for now, we use the HTTP protocol. // -// We can try several protocol for asf streaming +// We can try several protocol for asf networking // * first the UDP protcol, if there is a firewall, UDP // packets will not come back, so the mmsu will failed. // * Then we can try TCP, but if there is a proxy for @@ -52,15 +52,15 @@ // WMP sequence is MMSU then MMST and then HTTP. // In MPlayer case since HTTP support is more reliable, // we are doing HTTP first then we try MMST if HTTP fail. -static int asf_http_streaming_start(libinput_t*,stream_t *stream, int *demuxer_type ); +static int asf_http_networking_start(net_fd_t* fd, networking_t *networking ); /* - ASF streaming support several network protocol. + ASF networking support several network protocol. One use UDP, not known, yet! Another is HTTP, this one is known. So for now, we use the HTTP protocol. - We can try several protocol for asf streaming + We can try several protocol for asf networking * first the UDP protcol, if there is a firewall, UDP packets will not come back, so the mmsu will failed. * Then we can try TCP, but if there is a proxy for @@ -74,59 +74,54 @@ In MPlayer case since HTTP support is more reliable, we are doing HTTP first then we try MMST if HTTP fail. */ -int asf_streaming_start(libinput_t* libinput, stream_t *stream, int *demuxer_type) { - char *proto = stream->streaming_ctrl->url->protocol; - int fd = -1; - int port = stream->streaming_ctrl->url->port; +int asf_networking_start(net_fd_t* fd, networking_t *networking) { + char *proto = networking->url->protocol; + *fd = -1; + int port = networking->url->port; // Is protocol even valid mms,mmsu,mmst,http,http_proxy? if (!(!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mmsu", 4) || !strncasecmp(proto, "http_proxy", 10) || !strncasecmp(proto, "mms", 3) || - !strncasecmp(proto, "http", 4))) - { + !strncasecmp(proto, "http", 4))) { MSG_ERR("Unknown protocol: %s\n", proto ); return -1; } // Is protocol mms or mmsu? - if (!strncasecmp(proto, "mmsu", 4) || !strncasecmp(proto, "mms", 3)) - { - MSG_V("Trying ASF/UDP...\n"); - //fd = asf_mmsu_streaming_start( stream ); - if( fd>-1 ) return fd; //mmsu support is not implemented yet - using this code - MSG_V(" ===> ASF/UDP failed\n"); - if( fd==-2 ) return -1; - } + if (!strncasecmp(proto, "mmsu", 4) || !strncasecmp(proto, "mms", 3)) { + MSG_V("Trying ASF/UDP...\n"); + //fd = asf_mmsu_networking_start( stream ); + if( *fd>-1 ) return 0; //mmsu support is not implemented yet - using this code + MSG_V(" ===> ASF/UDP failed\n"); + if( *fd==-2 ) return -1; + } //Is protocol mms or mmst? - if (!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mms", 3)) - { - MSG_V("Trying ASF/TCP...\n"); - fd = asf_mmst_streaming_start(libinput, stream ); - stream->streaming_ctrl->url->port = port; - if( fd>-1 ) return fd; - MSG_V(" ===> ASF/TCP failed\n"); - if( fd==-2 ) return -1; - } + if (!strncasecmp(proto, "mmst", 4) || !strncasecmp(proto, "mms", 3)) { + MSG_V("Trying ASF/TCP...\n"); + *fd = asf_mmst_networking_start(fd,networking); + networking->url->port = port; + if( *fd>-1 ) return 0; + MSG_V(" ===> ASF/TCP failed\n"); + if( *fd==-2 ) return -1; + } //Is protocol http, http_proxy, or mms? if (!strncasecmp(proto, "http_proxy", 10) || !strncasecmp(proto, "http", 4) || - !strncasecmp(proto, "mms", 3)) - { - MSG_V("Trying ASF/HTTP...\n"); - fd = asf_http_streaming_start(libinput, stream, demuxer_type ); - stream->streaming_ctrl->url->port = port; - if( fd>-1 ) return fd; - MSG_V(" ===> ASF/HTTP failed\n"); - if( fd==-2 ) return -1; - } - + !strncasecmp(proto, "mms", 3)) { + MSG_V("Trying ASF/HTTP...\n"); + *fd = asf_http_networking_start(fd,networking); + networking->url->port = port; + if( *fd>-1 ) return 0; + MSG_V(" ===> ASF/HTTP failed\n"); + if( *fd==-2 ) return -1; + } //everything failed - return -1; + return -1; } static int -asf_streaming(ASF_stream_chunck_t *stream_chunck, int *drop_packet ) { +asf_networking(ASF_stream_chunck_t *stream_chunck, int *drop_packet ) { if( drop_packet!=NULL ) *drop_packet = 0; if( stream_chunck->size<8 ) { @@ -191,16 +186,16 @@ } static int -asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) { +asf_networking_parse_header(int fd, networking_t* networking) { ASF_header_t asfh; ASF_stream_chunck_t chunk; - asf_http_streaming_ctrl_t* asf_ctrl = (asf_http_streaming_ctrl_t*) streaming_ctrl->data; + asf_http_networking_t* asf_ctrl = (asf_http_networking_t*) networking->data; char* buffer=NULL, *chunk_buffer=NULL; int i,r,size,pos = 0; int start; int buffer_size = 0; int chunk_size2read = 0; - int bw = streaming_ctrl->bandwidth; + int bw = networking->bandwidth; int *v_rates = NULL, *a_rates = NULL; int v_rate = 0, a_rate = 0, a_idx = -1, v_idx = -1; @@ -211,13 +206,13 @@ // So we need to retrieve all the chunk before starting to parse the header. do { for( r=0; r < (int)sizeof(ASF_stream_chunck_t) ; ) { - i = nop_streaming_read(fd,((char*)&chunk)+r,sizeof(ASF_stream_chunck_t) - r,streaming_ctrl); + i = nop_networking_read(fd,((char*)&chunk)+r,sizeof(ASF_stream_chunck_t) - r,networking); if(i <= 0) return -1; r += i; } // Endian handling of the stream chunk le2me_ASF_stream_chunck_t(&chunk); - size = asf_streaming( &chunk, &r) - sizeof(ASF_stream_chunck_t); + size = asf_networking( &chunk, &r) - sizeof(ASF_stream_chunck_t); if(r) MSG_WARN("Warning : drop header ????\n"); if(size < 0){ MSG_ERR("Error while parsing chunk header\n"); @@ -244,7 +239,7 @@ buffer_size += size; for(r = 0; r < size;) { - i = nop_streaming_read(fd,buffer+r,size-r,streaming_ctrl); + i = nop_networking_read(fd,buffer+r,size-r,networking); if(i < 0) { MSG_ERR("Error while reading network stream\n"); return -1; @@ -288,7 +283,7 @@ asf_ctrl->packet_size = fileh->max_packet_size; // before playing. // preroll: time in ms to bufferize before playing - streaming_ctrl->prebuffer_size = (unsigned int)(((double)fileh->preroll/1000.0)*((double)fileh->max_bitrate/8.0)); + networking->prebuffer_size = (unsigned int)(((double)fileh->preroll/1000.0)*((double)fileh->max_bitrate/8.0)); } pos = start; @@ -443,19 +438,19 @@ } static int -asf_http_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *streaming_ctrl ) { +asf_http_networking_read( int fd, char *buffer, int size, networking_t *networking ) { static ASF_stream_chunck_t chunk; int read,chunk_size = 0; static int rest = 0, drop_chunk = 0, waiting = 0; - asf_http_streaming_ctrl_t *asf_http_ctrl = (asf_http_streaming_ctrl_t*)streaming_ctrl->data; + asf_http_networking_t *asf_http_ctrl = (asf_http_networking_t*)networking->data; while(1) { if (rest == 0 && waiting == 0) { read = 0; while(read < (int)sizeof(ASF_stream_chunck_t)){ - int r = nop_streaming_read( fd, ((char*)&chunk) + read, + int r = nop_networking_read( fd, ((char*)&chunk) + read, sizeof(ASF_stream_chunck_t)-read, - streaming_ctrl ); + networking ); if(r <= 0){ if( r < 0) MSG_ERR("Error while reading chunk header\n"); @@ -466,7 +461,7 @@ // Endian handling of the stream chunk le2me_ASF_stream_chunck_t(&chunk); - chunk_size = asf_streaming( &chunk, &drop_chunk ); + chunk_size = asf_networking( &chunk, &drop_chunk ); if(chunk_size < 0) { MSG_ERR("Error while parsing chunk header\n"); return -1; @@ -495,7 +490,7 @@ chunk_size = size; } while(read < chunk_size) { - int got = nop_streaming_read( fd,buffer+read,chunk_size-read,streaming_ctrl ); + int got = nop_networking_read( fd,buffer+read,chunk_size-read,networking ); if(got <= 0) { if(got < 0) MSG_ERR("Error while reading chunk\n"); @@ -519,12 +514,12 @@ } static int -asf_http_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) { +asf_http_networking_seek( int fd, off_t pos, networking_t *networking ) { return -1; // to shut up gcc warning fd++; pos++; - streaming_ctrl=NULL; + networking=NULL; } static int @@ -539,7 +534,7 @@ } static ASF_StreamType_e -asf_http_streaming_type(char *content_type, char *features, HTTP_header_t *http_hdr ) { +asf_http_networking_type(char *content_type, char *features, HTTP_header_t *http_hdr ) { if( content_type==NULL ) return ASF_Unknown_e; if( !strcasecmp(content_type, "application/octet-stream") || !strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") || // New in Corona, first request @@ -592,11 +587,11 @@ } static HTTP_header_t * -asf_http_request(streaming_ctrl_t *streaming_ctrl) { +asf_http_request(networking_t *networking) { HTTP_header_t *http_hdr; URL_t *url = NULL; URL_t *server_url = NULL; - asf_http_streaming_ctrl_t *asf_http_ctrl; + asf_http_networking_t *asf_http_ctrl; char str[250]; char *ptr; int i, enable; @@ -605,9 +600,9 @@ int asf_nb_stream=0, stream_id; // Sanity check - if( streaming_ctrl==NULL ) return NULL; - url = streaming_ctrl->url; - asf_http_ctrl = (asf_http_streaming_ctrl_t*)streaming_ctrl->data; + if( networking==NULL ) return NULL; + url = networking->url; + asf_http_ctrl = (asf_http_networking_t*)networking->data; if( url==NULL || asf_http_ctrl==NULL ) return NULL; // Common header for all requests. @@ -639,7 +634,7 @@ offset_hi, offset_lo, asf_http_ctrl->request, length ); http_set_field( http_hdr, str ); - switch( asf_http_ctrl->streaming_type ) { + switch( asf_http_ctrl->networking_type ) { case ASF_Live_e: case ASF_Prerecorded_e: http_set_field( http_hdr, "Pragma: xPlayStrm=1" ); @@ -691,7 +686,7 @@ } static int -asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTTP_header_t *http_hdr ) { +asf_http_parse_response(asf_http_networking_t *asf_http_ctrl, HTTP_header_t *http_hdr ) { char *content_type, *pragma; char features[64] = "\0"; size_t len; @@ -744,47 +739,46 @@ } while( comma_ptr!=NULL ); pragma = http_get_next_field( http_hdr ); } - asf_http_ctrl->streaming_type = asf_http_streaming_type( content_type, features, http_hdr ); + asf_http_ctrl->networking_type = asf_http_networking_type( content_type, features, http_hdr ); return 0; } -static int asf_http_streaming_start(libinput_t*libinput, stream_t *stream, int *demuxer_type ) { +static int asf_http_networking_start(net_fd_t* fd, networking_t *networking) { HTTP_header_t *http_hdr=NULL; - URL_t *url = stream->streaming_ctrl->url; - asf_http_streaming_ctrl_t *asf_http_ctrl; + URL_t *url = networking->url; + asf_http_networking_t *asf_http_ctrl; char buffer[BUFFER_SIZE]; int i, ret; - int fd = stream->fd; int done; int auth_retry = 0; - asf_http_ctrl = (asf_http_streaming_ctrl_t*)mp_malloc(sizeof(asf_http_streaming_ctrl_t)); + asf_http_ctrl = new(zeromem) asf_http_networking_t; if( asf_http_ctrl==NULL ) { MSG_FATAL("Memory allocation failed\n"); return -1; } - asf_http_ctrl->streaming_type = ASF_Unknown_e; + asf_http_ctrl->networking_type = ASF_Unknown_e; asf_http_ctrl->request = 1; asf_http_ctrl->audio_streams = asf_http_ctrl->video_streams = NULL; asf_http_ctrl->n_audio = asf_http_ctrl->n_video = 0; - stream->streaming_ctrl->data = (any_t*)asf_http_ctrl; + networking->data = (any_t*)asf_http_ctrl; do { done = 1; - if( fd>0 ) closesocket( fd ); + if( *fd>0 ) closesocket( *fd ); if( !strcasecmp( url->protocol, "http_proxy" ) ) { if( url->port==0 ) url->port = 8080; } else { if( url->port==0 ) url->port = 80; } - fd = tcp_connect2Server(libinput, url->hostname, url->port, 0); - if( fd<0 ) return fd; + *fd = tcp_connect2Server(networking->libinput, url->hostname, url->port, 0); + if( *fd<0 ) return 0; - http_hdr = asf_http_request( stream->streaming_ctrl ); + http_hdr = asf_http_request( networking ); MSG_DBG2("Request [%s]\n", http_hdr->buffer ); for(i=0; i < (int)http_hdr->buffer_size ; ) { - int r = send( fd, http_hdr->buffer+i, http_hdr->buffer_size-i, 0); + int r = send( *fd, http_hdr->buffer+i, http_hdr->buffer_size-i, 0); if(r <0) { MSG_ERR("Socket write error : %s\n",strerror(errno)); return -1; @@ -794,7 +788,7 @@ http_free( http_hdr ); http_hdr = http_new_header(); do { - i = recv( fd, buffer, BUFFER_SIZE, 0); + i = recv( *fd, buffer, BUFFER_SIZE, 0); if( i<=0 ) { perror("read"); http_free( http_hdr ); @@ -812,20 +806,20 @@ http_free( http_hdr ); return -1; } - switch( asf_http_ctrl->streaming_type ) { + switch( asf_http_ctrl->networking_type ) { case ASF_Live_e: case ASF_Prerecorded_e: case ASF_PlainText_e: if( http_hdr->body_size>0 ) { - if( streaming_bufferize( stream->streaming_ctrl, http_hdr->body, http_hdr->body_size )<0 ) { + if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { http_free( http_hdr ); return -1; } } if( asf_http_ctrl->request==1 ) { - if( asf_http_ctrl->streaming_type!=ASF_PlainText_e ) { + if( asf_http_ctrl->networking_type!=ASF_PlainText_e ) { // First request, we only got the ASF header. - ret = asf_streaming_parse_header(fd,stream->streaming_ctrl); + ret = asf_networking_parse_header(*fd,networking); if(ret < 0) return -1; if(asf_http_ctrl->n_audio == 0 && asf_http_ctrl->n_video == 0) { MSG_ERR("No stream found\n"); @@ -840,39 +834,39 @@ break; case ASF_Redirector_e: if( http_hdr->body_size>0 ) { - if( streaming_bufferize( stream->streaming_ctrl, http_hdr->body, http_hdr->body_size )<0 ) { + if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { http_free( http_hdr ); return -1; } } - stream->type |= STREAMTYPE_TEXT; +// type |= STREAMTYPE_TEXT; done = 1; break; case ASF_Authenticate_e: if( http_authenticate( http_hdr, url, &auth_retry)<0 ) return -1; - asf_http_ctrl->streaming_type = ASF_Unknown_e; + asf_http_ctrl->networking_type = ASF_Unknown_e; done = 0; break; case ASF_Unknown_e: default: - MSG_ERR("Unknown ASF streaming type\n"); - closesocket(fd); + MSG_ERR("Unknown ASF networking type\n"); + closesocket(*fd); http_free( http_hdr ); return -1; } // Check if we got a redirect. } while(!done); - stream->fd = fd; - if( asf_http_ctrl->streaming_type==ASF_PlainText_e || asf_http_ctrl->streaming_type==ASF_Redirector_e ) { - stream->streaming_ctrl->streaming_read = nop_streaming_read; - stream->streaming_ctrl->streaming_seek = nop_streaming_seek; + fd = fd; + if( asf_http_ctrl->networking_type==ASF_PlainText_e || asf_http_ctrl->networking_type==ASF_Redirector_e ) { + networking->networking_read = nop_networking_read; + networking->networking_seek = nop_networking_seek; } else { - stream->streaming_ctrl->streaming_read = asf_http_streaming_read; - stream->streaming_ctrl->streaming_seek = asf_http_streaming_seek; - stream->streaming_ctrl->buffering = 1; + networking->networking_read = asf_http_networking_read; + networking->networking_seek = asf_http_networking_seek; + networking->buffering = 1; } - stream->streaming_ctrl->status = streaming_playing_e; + networking->status = networking_playing_e; http_free( http_hdr ); return 0; Modified: mplayerxp/libmpstream/asf_streaming.h =================================================================== --- mplayerxp/libmpstream/asf_streaming.h 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/asf_streaming.h 2012-12-06 13:53:54 UTC (rev 513) @@ -2,7 +2,8 @@ #define __ASF_STEAMING_H_INCLUDED 1 #include "stream.h" -extern int asf_streaming_start(libinput_t* libinput, stream_t *stream, int *demuxer_type); -extern int asf_mmst_streaming_start(libinput_t* libinput,stream_t *stream); +typedef int net_fd_t; +extern int asf_networking_start(net_fd_t* fd, networking_t *networking); +extern int asf_mmst_networking_start(net_fd_t* fd, networking_t *networking); #endif Modified: mplayerxp/libmpstream/cache2.cpp =================================================================== --- mplayerxp/libmpstream/cache2.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/cache2.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -29,6 +29,7 @@ #include "mplayerxp.h" #include "stream_msg.h" +namespace mpxp { #define CPF_EMPTY 0x00000001UL #define CPF_EOF 0x80000000UL #define CPF_DONE 0x40000000UL /* special case for dvd packets to exclude them from sending again */ @@ -104,18 +105,18 @@ readpos=c->read_filepos; in_cache=(readpos>=START_FILEPOS(c)&&readpos<END_FILEPOS(c)); new_start = readpos - c->back_size; - if(new_start<c->stream->start_pos) new_start=c->stream->start_pos; + if(new_start<c->stream->start_pos()) new_start=c->stream->start_pos(); seek_eof=0; - if(!in_cache && c->stream->type&STREAMTYPE_SEEKABLE) { + if(!in_cache && c->stream->type()&STREAMTYPE_SEEKABLE) { /* seeking... */ MSG_DBG2("Out of boundaries... seeking to %lli {in_cache(%i) %lli<%lli>%lli} \n" ,new_start,in_cache,START_FILEPOS(c),readpos,END_FILEPOS(c)); if(c->stream->eof || c->eof) nc_stream_reset(c->stream); - c->stream->driver->seek(c->stream,new_start); - if(errno) { MSG_WARN("c2_seek(drv:%s) error: %s\n",c->stream->driver->mrl,strerror(errno)); errno=0; } - if((c->packets[c->first].filepos=c->stream->driver->tell(c->stream))<0) seek_eof=1; + c->stream->driver->seek(new_start); + if(errno) { MSG_WARN("c2_seek(drv:%s) error: %s\n",c->stream->driver_info->mrl,strerror(errno)); errno=0; } + if((c->packets[c->first].filepos=c->stream->driver->tell())<0) seek_eof=1; c->last=c->first; - if(c->packets[c->first].filepos < new_start-(off_t)c->stream->sector_size) + if(c->packets[c->first].filepos < new_start-(off_t)c->stream->sector_size()) MSG_WARN("CACHE2: found wrong offset after seeking %lli (wanted: %lli)\n",c->packets[c->first].filepos,new_start); MSG_DBG2("Seek done. new pos: %lli\n",START_FILEPOS(c)); } else { @@ -143,8 +144,8 @@ { CACHE2_PACKET_TLOCK(cidx); c->packets[cidx].sp.len=c->sector_size; - c->packets[cidx].filepos = c->stream->driver->tell(c->stream); - c->stream->driver->read(c->stream,&c->packets[cidx].sp); + c->packets[cidx].filepos = c->stream->driver->tell(); + c->stream->driver->read(&c->packets[cidx].sp); MSG_DBG2("CACHE2: read_packet at %lli (wanted %u got %u type %i)",c->packets[cidx].filepos,c->sector_size,c->packets[cidx].sp.len,c->packets[cidx].sp.type); if(mp_conf.verbose>1) if(c->packets[cidx].sp.len>8) { @@ -162,7 +163,7 @@ c->eof=1; c->packets[cidx].state&=~CPF_EMPTY; c->packets[cidx].state&=~CPF_DONE; - if(errno) { MSG_WARN("c2_fill_buffer(drv:%s) error: %s\n",c->stream->driver->mrl,strerror(errno)); errno=0; } + if(errno) { MSG_WARN("c2_fill_buffer(drv:%s) error: %s\n",c->stream->driver_info->mrl,strerror(errno)); errno=0; } CACHE2_PACKET_TUNLOCK(cidx); break; } @@ -267,10 +268,10 @@ } int stream_enable_cache(stream_t *stream,libinput_t* libinput,int size,int _min,int prefill){ - int ss=stream->sector_size>1?stream->sector_size:STREAM_BUFFER_SIZE; + int ss=stream->sector_size()>1?stream->sector_size():STREAM_BUFFER_SIZE; cache_vars_t* c; - if (!(stream->type&STREAMTYPE_SEEKABLE) && stream->fd < 0) { + if (!(stream->type()&STREAMTYPE_SEEKABLE) && stream->fd < 0) { // The stream has no 'fd' behind it, so is non-cacheable MSG_WARN("\rThis stream is non-cacheable\n"); return 1; @@ -282,7 +283,7 @@ if(!c) return 0; c->stream=stream; c->prefill=size*prefill; - c->read_filepos=stream->start_pos; + c->read_filepos=stream->start_pos(); unsigned rc; if((rc=xmp_register_thread(NULL,sig_cache2,cache2_routine,"cache2"))==UINT_MAX) return 0; @@ -292,7 +293,7 @@ START_FILEPOS(c),c->read_filepos,END_FILEPOS(c),_min,c->eof,ss); while((c->read_filepos<START_FILEPOS(c) || END_FILEPOS(c)-c->read_filepos<_min) && !c->eof && CP_NEXT(c,c->last)!=c->first){ - if(!(stream->type&STREAMTYPE_SEEKABLE)) + if(!(stream->type()&STREAMTYPE_SEEKABLE)) MSG_STATUS("\rCache fill: %5.2f%% (%d bytes) ", 100.0*(float)(END_FILEPOS(c)-c->read_filepos)/(float)(c->buffer_size), END_FILEPOS(c)-c->read_filepos); @@ -352,8 +353,8 @@ cidx=c->first; do{ c->packets[cidx].state|=CPF_EMPTY; cidx=CP_NEXT(c,cidx); }while(cidx!=c->first); c->last=c->first; - c->read_filepos=c->stream->start_pos; - c->stream->driver->seek(c->stream,c->read_filepos); + c->read_filepos=c->stream->start_pos(); + c->stream->driver->seek(c->read_filepos); } } @@ -364,7 +365,7 @@ while(c->in_fill) yield_timeslice(); CACHE2_LOCK(c); if(c->eof) c2_stream_reset(c); - C2_ASSERT(pos < c->stream->start_pos); + C2_ASSERT(pos < c->stream->start_pos()); c->read_filepos=pos; CACHE2_UNLOCK(c); c2_stream_fill_buffer(c); @@ -672,4 +673,4 @@ y=(y<<8)|stream_read_char(s); return y; } - +} // namespace mpxp Modified: mplayerxp/libmpstream/cdd.h =================================================================== --- mplayerxp/libmpstream/cdd.h 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/cdd.h 2012-12-06 13:53:54 UTC (rev 513) @@ -5,9 +5,8 @@ namespace mpxp { struct libinput_t; -} -typedef struct { + struct cddb_data_t { char cddb_hello[1024]; unsigned long disc_id; unsigned int tracks; @@ -20,13 +19,13 @@ size_t xmcd_file_size; any_t*user_data; libinput_t*libinput; -} cddb_data_t; + }; -typedef struct { + struct cd_toc_t { unsigned int min, sec, frame; -} cd_toc_t; + }; -typedef struct cd_track { + struct cd_track_t { char *name; unsigned int track_nb; unsigned int min; @@ -34,11 +33,11 @@ unsigned int msec; unsigned long frame_begin; unsigned long frame_length; - struct cd_track *prev; - struct cd_track *next; -} cd_track_t; + cd_track_t *prev; + cd_track_t *next; + }; -typedef struct { + struct cd_info_t { char *artist; char *album; char *genre; @@ -49,39 +48,42 @@ cd_track_t *first; cd_track_t *last; cd_track_t *current; -} cd_info_t; + }; -typedef struct my_track_s { + struct my_track_t { int play; lsn_t start_sector; lsn_t end_sector; -}my_track_t; + }; -struct cdda_priv : public Opaque { - public: - cdda_priv(); - virtual ~cdda_priv(); + struct cdda_priv : public Opaque { + public: + cdda_priv(); + virtual ~cdda_priv(); - cdrom_drive_t* cd; - my_track_t tracks[256]; /* hope that's enough */ - unsigned min; - unsigned sec; - unsigned msec; - lsn_t sector; - lsn_t start_sector; - lsn_t end_sector; -}; + cdrom_drive_t* cd; + my_track_t tracks[256]; /* hope that's enough */ + unsigned min; + unsigned sec; + unsigned msec; + lsn_t sector; + lsn_t start_sector; + lsn_t end_sector; + }; -cd_info_t* __FASTCALL__ cd_info_new(); -void __FASTCALL__ cd_info_free(cd_info_t *cd_info); -cd_track_t* __FASTCALL__ cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length); -cd_track_t* __FASTCALL__ cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb); + cd_info_t* __FASTCALL__ cd_info_new(); + void __FASTCALL__ cd_info_free(cd_info_t *cd_info); + cd_track_t* __FASTCALL__ cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length); + cd_track_t* __FASTCALL__ cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb); -MPXP_Rc __FASTCALL__ open_cdda(stream_t*,const char* dev,const char* track); -MPXP_Rc __FASTCALL__ open_cddb(stream_t*,const char* dev,const char* track); -int __FASTCALL__ read_cdda(const stream_t* s,char *buf,track_t* trackidx); -void __FASTCALL__ seek_cdda(stream_t* s,off_t pos,track_t *trackidx); -off_t __FASTCALL__ tell_cdda(const stream_t* s); -void __FASTCALL__ close_cdda(stream_t* s); -void cdda_register_options(m_config_t* cfg); + cdda_priv* __FASTCALL__ open_cdda(const char* dev,const char* track); + cdda_priv* __FASTCALL__ open_cddb(libinput_t*,const char* dev,const char* track); + int __FASTCALL__ read_cdda(cdda_priv* s,char *buf,track_t* trackidx); + void __FASTCALL__ seek_cdda(cdda_priv* s,off_t pos,track_t *trackidx); + off_t __FASTCALL__ tell_cdda(const cdda_priv* s); + void __FASTCALL__ close_cdda(cdda_priv*); + off_t __FASTCALL__ cdda_start(cdda_priv*); + off_t __FASTCALL__ cdda_size(cdda_priv*); + void cdda_register_options(m_config_t* cfg); +} // namespace mpxp #endif // __CDD_H__ Modified: mplayerxp/libmpstream/cdda.cpp =================================================================== --- mplayerxp/libmpstream/cdda.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/cdda.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -15,6 +15,7 @@ #include "cdd.h" #include "stream_msg.h" +namespace mpxp { static int speed = -1; static int search_overlap = -1; static int no_skip = 0; @@ -74,7 +75,7 @@ return rval; } -MPXP_Rc __FASTCALL__ open_cdda(stream_t *st,const char* dev,const char* arg) { +cdda_priv* __FASTCALL__ open_cdda(const char* dev,const char* arg) { unsigned cd_tracks; cdda_priv* priv; unsigned int audiolen=0; @@ -89,7 +90,7 @@ if(!priv->cd) { MSG_ERR("Can't open cdda device: %s\n",dev); delete priv; - return MPXP_False; + return NULL; } cdio_cddap_verbose_set(priv->cd, mp_conf.verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT, mp_conf.verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT); @@ -98,7 +99,7 @@ MSG_ERR("Can't open disc\n"); cdda_close(priv->cd); delete priv; - return MPXP_False; + return NULL; } cd_tracks=cdio_cddap_tracks(priv->cd); @@ -129,13 +130,12 @@ if(speed) cdio_cddap_speed_set(priv->cd,speed); priv->sector = priv->start_sector; - st->type = STREAMTYPE_SEEKABLE|STREAMTYPE_RAWAUDIO; - st->priv = priv; - st->start_pos = priv->start_sector*CDIO_CD_FRAMESIZE_RAW; - st->end_pos = priv->end_sector*CDIO_CD_FRAMESIZE_RAW; - return MPXP_Ok; + return priv; } +off_t __FASTCALL__ cdda_start(cdda_priv* priv) { return priv->start_sector*CDIO_CD_FRAMESIZE_RAW; } +off_t __FASTCALL__ cdda_size(cdda_priv* priv) { return priv->end_sector*CDIO_CD_FRAMESIZE_RAW; } + static lsn_t map_sector(cdda_priv*p,lsn_t sector,track_t *tr) { unsigned i,j; @@ -171,8 +171,7 @@ return 0; } -int __FASTCALL__ read_cdda(const stream_t* s,char *buf,track_t *tr) { - cdda_priv* p = static_cast<cdda_priv*>(s->priv); +int __FASTCALL__ read_cdda(cdda_priv* p,char *buf,track_t *tr) { track_t i=255; if(cdio_cddap_read(p->cd, buf, p->sector, 1)==0) { @@ -195,8 +194,7 @@ return CDIO_CD_FRAMESIZE_RAW; } -void __FASTCALL__ seek_cdda(stream_t* s,off_t pos,track_t *tr) { - cdda_priv* p = static_cast<cdda_priv*>(s->priv); +void __FASTCALL__ seek_cdda(cdda_priv* p,off_t pos,track_t *tr) { long sec; long seeked_track=0; track_t j=255; @@ -212,13 +210,11 @@ p->sector=seeked_track; } -off_t __FASTCALL__ tell_cdda(const stream_t* s) { - const cdda_priv* p = static_cast<const cdda_priv*>(s->priv); +off_t __FASTCALL__ tell_cdda(const cdda_priv* p) { return p->sector*CDIO_CD_FRAMESIZE_RAW; } -void __FASTCALL__ close_cdda(stream_t* s) { - cdda_priv* p = static_cast<cdda_priv*>(s->priv); +void __FASTCALL__ close_cdda(cdda_priv* p) { delete p; } @@ -226,5 +222,5 @@ cdda_priv::~cdda_priv() { cdio_cddap_close(cd); } - +} // namespace mpxp #endif Modified: mplayerxp/libmpstream/cddb.cpp =================================================================== --- mplayerxp/libmpstream/cddb.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/cddb.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -43,12 +43,13 @@ #include "stream.h" #include "libmpconf/cfgparser.h" - #include "cdd.h" #include "version.h" #include "network.h" #include "stream_msg.h" +namespace mpxp { + #define DEFAULT_FREEDB_SERVER "freedb.freedb.org" #define DEFAULT_CACHE_DIR "/.cddb/" @@ -780,19 +781,19 @@ return cd_info; } -MPXP_Rc __FASTCALL__ open_cddb(stream_t *stream,const char *dev, const char *track) { +cdda_priv* __FASTCALL__ open_cddb(libinput_t *libinput,const char *dev, const char *track) { cd_info_t *cd_info = NULL; char *xmcd_file = NULL; MPXP_Rc ret; - ret = cddb_resolve(stream->streaming_ctrl->libinput,&xmcd_file); + ret = cddb_resolve(libinput,&xmcd_file); if( ret==MPXP_False ) { cd_info = cddb_parse_xmcd(xmcd_file); delete xmcd_file; cd_info_debug( cd_info ); + return NULL; } - ret = open_cdda(stream, dev, track); - - return ret; + return open_cdda(dev, track); } +} // namespace mpxp #endif Modified: mplayerxp/libmpstream/mrl.cpp =================================================================== --- mplayerxp/libmpstream/mrl.cpp 2012-12-06 06:45:48 UTC (rev 512) +++ mplayerxp/libmpstream/mrl.cpp 2012-12-06 13:53:54 UTC (rev 513) @@ -12,7 +12,7 @@ #ifdef TEST_MRL #include <stdio.h> #endif - +namespace mpxp { const char *mrl_parse_line(const char *line,char **user,char **pass,char **ms,char **port) { unsigned ssize; @@ -180,3 +180,5 @@ if(value) delete value; return param; } +} // namespace mpxp + Modified: mplayerxp/libmpstream/mrl.h =================================================================== --- mpl... [truncated message content] |