Removing unnecessary SDL driver from video player.
All SDL-specific code moved to tfb_draw system. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1260 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -711,18 +711,6 @@ SOURCE=..\sc2code\libs\strings\strintrn.h
|
|||||||
# Begin Group "video"
|
# Begin Group "video"
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Group "sdl video"
|
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\video\sdl\sdlvideo.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\video\sdl\sdlvideo.h
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\sc2code\libs\video\vfileins.c
|
SOURCE=..\sc2code\libs\video\vfileins.c
|
||||||
|
|||||||
@@ -147,7 +147,8 @@ TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int
|
|||||||
UnlockMutex (img->mutex);
|
UnlockMutex (img->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
TFB_Canvas TFB_DrawCanvas_New_TrueColor (int w, int h, BOOLEAN hasalpha)
|
TFB_Canvas
|
||||||
|
TFB_DrawCanvas_New_TrueColor (int w, int h, BOOLEAN hasalpha)
|
||||||
{
|
{
|
||||||
SDL_Surface *new_surf;
|
SDL_Surface *new_surf;
|
||||||
new_surf = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, hasalpha ? 0xff000000 : 0);
|
new_surf = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, hasalpha ? 0xff000000 : 0);
|
||||||
@@ -158,6 +159,37 @@ TFB_Canvas TFB_DrawCanvas_New_TrueColor (int w, int h, BOOLEAN hasalpha)
|
|||||||
return new_surf;
|
return new_surf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TFB_Canvas
|
||||||
|
TFB_DrawCanvas_New_ForScreen (int w, int h, BOOLEAN withalpha)
|
||||||
|
{
|
||||||
|
SDL_Surface *new_surf;
|
||||||
|
SDL_PixelFormat* fmt = SDL_Screen->format;
|
||||||
|
|
||||||
|
if (fmt->palette)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "TFB_DrawCanvas_New_ForScreen() WARNING:"
|
||||||
|
"Paletted display format will be slow");
|
||||||
|
|
||||||
|
new_surf = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h,
|
||||||
|
32, 0x000000ff, 0x0000ff00, 0x00ff0000,
|
||||||
|
withalpha ? 0xff000000 : 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_surf = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h,
|
||||||
|
fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask,
|
||||||
|
withalpha ? fmt->Amask : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!new_surf)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "TFB_DrawCanvas_New_ForScreen() INTERNAL PANIC:"
|
||||||
|
"Failed to create TFB_Canvas: %s", SDL_GetError());
|
||||||
|
exit (-1);
|
||||||
|
}
|
||||||
|
return new_surf;
|
||||||
|
}
|
||||||
|
|
||||||
TFB_Canvas
|
TFB_Canvas
|
||||||
TFB_DrawCanvas_New_Paletted (int w, int h, TFB_Palette *palette, int transparent_index)
|
TFB_DrawCanvas_New_Paletted (int w, int h, TFB_Palette *palette, int transparent_index)
|
||||||
{
|
{
|
||||||
@@ -864,3 +896,36 @@ TFB_DrawCanvas_Rescale_Trilinear (TFB_Canvas src_canvas, TFB_Canvas dest_canvas,
|
|||||||
src->format->BitsPerPixel, dst->format->BitsPerPixel, mipmap->format->BitsPerPixel);
|
src->format->BitsPerPixel, dst->format->BitsPerPixel, mipmap->format->BitsPerPixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt)
|
||||||
|
{
|
||||||
|
SDL_PixelFormat *sdl = SDL_Screen->format;
|
||||||
|
|
||||||
|
if (sdl->palette)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "TFB_DrawCanvas_GetScreenFormat() WARNING:"
|
||||||
|
"Paletted display format will be slow");
|
||||||
|
|
||||||
|
fmt->BitsPerPixel = 32;
|
||||||
|
fmt->Rmask = 0x000000ff;
|
||||||
|
fmt->Gmask = 0x0000ff00;
|
||||||
|
fmt->Bmask = 0x00ff0000;
|
||||||
|
fmt->Amask = 0xff000000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fmt->BitsPerPixel = sdl->BitsPerPixel;
|
||||||
|
fmt->Rmask = sdl->Rmask;
|
||||||
|
fmt->Gmask = sdl->Gmask;
|
||||||
|
fmt->Bmask = sdl->Bmask;
|
||||||
|
fmt->Amask = sdl->Amask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void*
|
||||||
|
TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line)
|
||||||
|
{
|
||||||
|
SDL_Surface* surf = (SDL_Surface *)canvas;
|
||||||
|
return (uint8*)surf->pixels + surf->pitch * line;
|
||||||
|
}
|
||||||
|
|||||||
@@ -268,6 +268,22 @@ TFB_DrawImage_New (TFB_Canvas canvas)
|
|||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TFB_Image*
|
||||||
|
TFB_DrawImage_CreateForScreen (int w, int h, BOOLEAN withalpha)
|
||||||
|
{
|
||||||
|
TFB_Image* img = HMalloc (sizeof (TFB_Image));
|
||||||
|
img->mutex = CreateMutex ("image lock", SYNC_CLASS_VIDEO);
|
||||||
|
img->ScaledImg = NULL;
|
||||||
|
img->MipmapImg = NULL;
|
||||||
|
img->colormap_index = -1;
|
||||||
|
img->last_scale_type = -1;
|
||||||
|
img->Palette = NULL;
|
||||||
|
|
||||||
|
img->NormalImg = TFB_DrawCanvas_New_ForScreen (w, h, withalpha);
|
||||||
|
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_DrawImage_Delete (TFB_Image *image)
|
TFB_DrawImage_Delete (TFB_Image *image)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,6 +57,15 @@ typedef struct tfb_image
|
|||||||
BOOLEAN dirty;
|
BOOLEAN dirty;
|
||||||
} TFB_Image;
|
} TFB_Image;
|
||||||
|
|
||||||
|
// we do not support paletted format for now
|
||||||
|
typedef struct tfb_pixelformat
|
||||||
|
{
|
||||||
|
int BitsPerPixel;
|
||||||
|
int BytesPerPixel;
|
||||||
|
DWORD Rmask, Gmask, Bmask, Amask;
|
||||||
|
DWORD Rshift, Gshift, Bshift, Ashift;
|
||||||
|
DWORD Rloss, Gloss, Bloss, Aloss;
|
||||||
|
} TFB_PixelFormat;
|
||||||
|
|
||||||
// Drawing commands
|
// Drawing commands
|
||||||
|
|
||||||
@@ -72,6 +81,7 @@ void TFB_DrawScreen_SetPalette (int paletteIndex, int r, int g, int b);
|
|||||||
void TFB_FlushPaletteCache (void);
|
void TFB_FlushPaletteCache (void);
|
||||||
|
|
||||||
TFB_Image *TFB_DrawImage_New (TFB_Canvas canvas);
|
TFB_Image *TFB_DrawImage_New (TFB_Canvas canvas);
|
||||||
|
TFB_Image *TFB_DrawImage_CreateForScreen (int w, int h, BOOLEAN withalpha);
|
||||||
void TFB_DrawImage_Delete (TFB_Image *image);
|
void TFB_DrawImage_Delete (TFB_Image *image);
|
||||||
void TFB_DrawImage_FixScaling (TFB_Image *image, int target, int type);
|
void TFB_DrawImage_FixScaling (TFB_Image *image, int target, int type);
|
||||||
|
|
||||||
@@ -81,6 +91,7 @@ void TFB_DrawImage_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *
|
|||||||
void TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, TFB_Image *target);
|
void TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, TFB_Image *target);
|
||||||
|
|
||||||
TFB_Canvas TFB_DrawCanvas_New_TrueColor (int w, int h, BOOLEAN hasalpha);
|
TFB_Canvas TFB_DrawCanvas_New_TrueColor (int w, int h, BOOLEAN hasalpha);
|
||||||
|
TFB_Canvas TFB_DrawCanvas_New_ForScreen (int w, int h, BOOLEAN withalpha);
|
||||||
TFB_Canvas TFB_DrawCanvas_New_Paletted (int w, int h, TFB_Palette *palette, int transparent_index);
|
TFB_Canvas TFB_DrawCanvas_New_Paletted (int w, int h, TFB_Palette *palette, int transparent_index);
|
||||||
TFB_Canvas TFB_DrawCanvas_New_ScaleTarget (TFB_Canvas canvas, TFB_Canvas oldcanvas, int type, int last_type);
|
TFB_Canvas TFB_DrawCanvas_New_ScaleTarget (TFB_Canvas canvas, TFB_Canvas oldcanvas, int type, int last_type);
|
||||||
TFB_Canvas TFB_DrawCanvas_ToScreenFormat (TFB_Canvas canvas);
|
TFB_Canvas TFB_DrawCanvas_ToScreenFormat (TFB_Canvas canvas);
|
||||||
@@ -102,5 +113,7 @@ int TFB_DrawCanvas_GetTransparentIndex (TFB_Canvas canvas);
|
|||||||
void TFB_DrawCanvas_SetTransparentIndex (TFB_Canvas canvas, int i, BOOLEAN rleaccel);
|
void TFB_DrawCanvas_SetTransparentIndex (TFB_Canvas canvas, int i, BOOLEAN rleaccel);
|
||||||
void TFB_DrawCanvas_SetTransparentColor (TFB_Canvas canvas, int r, int g, int b, BOOLEAN rleaccel);
|
void TFB_DrawCanvas_SetTransparentColor (TFB_Canvas canvas, int r, int g, int b, BOOLEAN rleaccel);
|
||||||
void TFB_DrawCanvas_Initialize (void);
|
void TFB_DrawCanvas_Initialize (void);
|
||||||
|
void TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt);
|
||||||
|
void* TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
uqm_CFILES="vfileins.c video.c videodec.c vidplayer.c dukvid.c"
|
uqm_CFILES="vfileins.c video.c videodec.c vidplayer.c dukvid.c"
|
||||||
uqm_SUBDIRS="sdl"
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#define _THIS TFB_VideoDecoder* This
|
#define _THIS TFB_VideoDecoder* This
|
||||||
|
|
||||||
int dukv_GetError (_THIS);
|
int dukv_GetError (_THIS);
|
||||||
bool dukv_Init (_THIS, TFB_VideoFormat* fmt);
|
bool dukv_Init (_THIS, TFB_PixelFormat* fmt);
|
||||||
void dukv_Term (_THIS);
|
void dukv_Term (_THIS);
|
||||||
bool dukv_Open (_THIS, uio_DirHandle *dir, const char *filename);
|
bool dukv_Open (_THIS, uio_DirHandle *dir, const char *filename);
|
||||||
void dukv_Close (_THIS);
|
void dukv_Close (_THIS);
|
||||||
@@ -412,7 +412,7 @@ dukv_InitDeltas (TFB_DuckVideo* dukv, uint8* vectors, sint32* pl, sint32* pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
__inline__ uint32
|
__inline__ uint32
|
||||||
dukv_PixelConv (uint16 pix, const TFB_VideoFormat* fmt)
|
dukv_PixelConv (uint16 pix, const TFB_PixelFormat* fmt)
|
||||||
{
|
{
|
||||||
uint32 r, g, b;
|
uint32 r, g, b;
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ void
|
|||||||
dukv_RenderFrame (_THIS)
|
dukv_RenderFrame (_THIS)
|
||||||
{
|
{
|
||||||
TFB_DuckVideo* dukv = This->dec_data;
|
TFB_DuckVideo* dukv = This->dec_data;
|
||||||
const TFB_VideoFormat* fmt = This->format;
|
const TFB_PixelFormat* fmt = This->format;
|
||||||
uint32 h, x, y;
|
uint32 h, x, y;
|
||||||
uint32* dec = dukv->decbuf;
|
uint32* dec = dukv->decbuf;
|
||||||
|
|
||||||
@@ -508,7 +508,7 @@ int dukv_GetError (_THIS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
dukv_Init (_THIS, TFB_VideoFormat* fmt)
|
dukv_Init (_THIS, TFB_PixelFormat* fmt)
|
||||||
{
|
{
|
||||||
This->format = fmt;
|
This->format = fmt;
|
||||||
This->audio_synced = 1;
|
This->audio_synced = 1;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
uqm_CFILES="sdlvideo.c"
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "libs/graphics/sdl/sdl_common.h"
|
|
||||||
#include "libs/video/video.h"
|
|
||||||
#include "sdlvideo.h"
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
TFB_GetScreenFormat (TFB_VideoFormat *fmt)
|
|
||||||
{
|
|
||||||
SDL_PixelFormat *sdl = SDL_Video->format;
|
|
||||||
fmt->BitsPerPixel = sdl->BitsPerPixel;
|
|
||||||
fmt->Rmask = sdl->Rmask;
|
|
||||||
fmt->Gmask = sdl->Gmask;
|
|
||||||
fmt->Bmask = sdl->Bmask;
|
|
||||||
fmt->Amask = 0; // no alpha support for now
|
|
||||||
}
|
|
||||||
|
|
||||||
TFB_Image*
|
|
||||||
TFB_CreateVideoImage (int w, int h)
|
|
||||||
{
|
|
||||||
TFB_Image* img;
|
|
||||||
SDL_PixelFormat* fmt = SDL_Video->format;
|
|
||||||
|
|
||||||
img = HMalloc (sizeof (TFB_Image));
|
|
||||||
img->mutex = CreateMutex ("vid image lock", SYNC_CLASS_VIDEO);
|
|
||||||
img->ScaledImg = NULL;
|
|
||||||
img->MipmapImg = NULL;
|
|
||||||
img->colormap_index = -1;
|
|
||||||
img->last_scale_type = -1;
|
|
||||||
img->Palette = NULL;
|
|
||||||
|
|
||||||
img->NormalImg = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h,
|
|
||||||
fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, 0);
|
|
||||||
|
|
||||||
return img;
|
|
||||||
}
|
|
||||||
|
|
||||||
void*
|
|
||||||
TFB_GetVideoLine (TFB_Image* img, uint32 line)
|
|
||||||
{
|
|
||||||
SDL_Surface* surf = img->NormalImg;
|
|
||||||
return (uint8*)surf->pixels + surf->pitch * line;
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDLVIDEO_H
|
|
||||||
#define _SDLVIDEO_H
|
|
||||||
|
|
||||||
#include "libs/graphics/gfx_common.h"
|
|
||||||
#include "libs/graphics/tfb_draw.h"
|
|
||||||
#include "libs/gfxlib.h"
|
|
||||||
|
|
||||||
void TFB_GetScreenFormat (TFB_VideoFormat *fmt);
|
|
||||||
TFB_Image* TFB_CreateVideoImage (int w, int h);
|
|
||||||
void* TFB_GetVideoLine (TFB_Image* img, uint32 line);
|
|
||||||
|
|
||||||
#endif // _SDLVIDEO_H
|
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "sdl/sdlvideo.h"
|
|
||||||
#include "vidplayer.h"
|
#include "vidplayer.h"
|
||||||
|
|
||||||
#define NULL_VIDEO_REF (0)
|
#define NULL_VIDEO_REF (0)
|
||||||
@@ -27,11 +26,11 @@ BOOLEAN
|
|||||||
InitVideo (BOOLEAN useCDROM)
|
InitVideo (BOOLEAN useCDROM)
|
||||||
//useCDROM doesn't really apply to us
|
//useCDROM doesn't really apply to us
|
||||||
{
|
{
|
||||||
TFB_VideoFormat fmt;
|
TFB_PixelFormat fmt;
|
||||||
|
|
||||||
TFB_GetScreenFormat (&fmt);
|
TFB_DrawCanvas_GetScreenFormat (&fmt);
|
||||||
if (!VideoDecoder_Init (0, fmt.BitsPerPixel, fmt.Rmask,
|
if (!VideoDecoder_Init (0, fmt.BitsPerPixel, fmt.Rmask,
|
||||||
fmt.Gmask, fmt.Bmask, fmt.Amask))
|
fmt.Gmask, fmt.Bmask, 0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TFB_InitVideoPlayer ();
|
return TFB_InitVideoPlayer ();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include "dukvid.h"
|
#include "dukvid.h"
|
||||||
|
|
||||||
static bool vd_inited = 0;
|
static bool vd_inited = 0;
|
||||||
static TFB_VideoFormat vd_vidfmt;
|
static TFB_PixelFormat vd_vidfmt;
|
||||||
|
|
||||||
static struct vd_DecoderInfo
|
static struct vd_DecoderInfo
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@ vd_decoders[] =
|
|||||||
{NULL, NULL, NULL} // null term
|
{NULL, NULL, NULL} // null term
|
||||||
};
|
};
|
||||||
|
|
||||||
static void vd_computeMasks (uint32 mask, uint32* shift, uint32* loss);
|
static void vd_computeMasks (uint32 mask, DWORD* shift, DWORD* loss);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
VideoDecoder_Init (int flags, int depth, uint32 Rmask, uint32 Gmask,
|
VideoDecoder_Init (int flags, int depth, uint32 Rmask, uint32 Gmask,
|
||||||
@@ -208,7 +208,7 @@ VideoDecoder_Free (TFB_VideoDecoder *decoder)
|
|||||||
|
|
||||||
// BEGIN: adapted from SDL
|
// BEGIN: adapted from SDL
|
||||||
static void
|
static void
|
||||||
vd_computeMasks (uint32 mask, uint32* shift, uint32* loss)
|
vd_computeMasks (uint32 mask, DWORD* shift, DWORD* loss)
|
||||||
{
|
{
|
||||||
*shift = 0;
|
*shift = 0;
|
||||||
*loss = 8;
|
*loss = 8;
|
||||||
|
|||||||
@@ -24,23 +24,12 @@
|
|||||||
// forward-declare
|
// forward-declare
|
||||||
typedef struct tfb_videodecoder TFB_VideoDecoder;
|
typedef struct tfb_videodecoder TFB_VideoDecoder;
|
||||||
|
|
||||||
// we do not support paletted format for now
|
|
||||||
typedef struct tfb_videoformat
|
|
||||||
{
|
|
||||||
uint32 BitsPerPixel;
|
|
||||||
uint32 BytesPerPixel;
|
|
||||||
uint32 Rmask, Gmask, Bmask, Amask;
|
|
||||||
uint32 Rshift, Gshift, Bshift, Ashift;
|
|
||||||
uint32 Rloss, Gloss, Bloss, Aloss;
|
|
||||||
|
|
||||||
} TFB_VideoFormat;
|
|
||||||
|
|
||||||
#define _THIS TFB_VideoDecoder*
|
#define _THIS TFB_VideoDecoder*
|
||||||
|
|
||||||
typedef struct tfb_videodecoderfunc
|
typedef struct tfb_videodecoderfunc
|
||||||
{
|
{
|
||||||
int (* GetError) (_THIS);
|
int (* GetError) (_THIS);
|
||||||
bool (* Init) (_THIS, TFB_VideoFormat* fmt);
|
bool (* Init) (_THIS, TFB_PixelFormat* fmt);
|
||||||
void (* Term) (_THIS);
|
void (* Term) (_THIS);
|
||||||
bool (* Open) (_THIS, uio_DirHandle *dir, const char *filename);
|
bool (* Open) (_THIS, uio_DirHandle *dir, const char *filename);
|
||||||
void (* Close) (_THIS);
|
void (* Close) (_THIS);
|
||||||
@@ -74,7 +63,7 @@ struct tfb_videodecoder
|
|||||||
// decoder virtual funcs - R/O
|
// decoder virtual funcs - R/O
|
||||||
const TFB_VideoDecoderFuncs *funcs;
|
const TFB_VideoDecoderFuncs *funcs;
|
||||||
// video formats - R/O
|
// video formats - R/O
|
||||||
const TFB_VideoFormat *format;
|
const TFB_PixelFormat *format;
|
||||||
// decoder-set data - R/O
|
// decoder-set data - R/O
|
||||||
uint32 w, h;
|
uint32 w, h;
|
||||||
float length; // total length in seconds
|
float length; // total length in seconds
|
||||||
|
|||||||
@@ -14,8 +14,9 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libs/graphics/gfx_common.h"
|
||||||
|
#include "libs/graphics/tfb_draw.h"
|
||||||
#include "vidplayer.h"
|
#include "vidplayer.h"
|
||||||
#include "sdl/sdlvideo.h"
|
|
||||||
|
|
||||||
// video callbacks
|
// video callbacks
|
||||||
static void* vp_GetCanvasLine (TFB_VideoDecoder*, uint32 line);
|
static void* vp_GetCanvasLine (TFB_VideoDecoder*, uint32 line);
|
||||||
@@ -46,7 +47,7 @@ static TFB_SoundCallbacks vp_AudioCBs =
|
|||||||
|
|
||||||
// inter-thread param guarded by mutex
|
// inter-thread param guarded by mutex
|
||||||
static Semaphore vp_interthread_lock = 0;
|
static Semaphore vp_interthread_lock = 0;
|
||||||
void* vp_interthread_clip = NULL;
|
static void* vp_interthread_clip = NULL;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -304,7 +305,7 @@ TFB_PlayVideo (VIDEO_REF VidRef, uint32 x, uint32 y)
|
|||||||
vid->decoder->callbacks = vp_DecoderCBs;
|
vid->decoder->callbacks = vp_DecoderCBs;
|
||||||
vid->decoder->data = vid;
|
vid->decoder->data = vid;
|
||||||
|
|
||||||
vid->frame = TFB_CreateVideoImage (vid->w, vid->h);
|
vid->frame = TFB_DrawImage_CreateForScreen (vid->w, vid->h, FALSE);
|
||||||
vid->cur_frame = -1;
|
vid->cur_frame = -1;
|
||||||
vid->want_frame = -1;
|
vid->want_frame = -1;
|
||||||
|
|
||||||
@@ -455,7 +456,7 @@ vp_GetCanvasLine (TFB_VideoDecoder* decoder, uint32 line)
|
|||||||
if (!vid)
|
if (!vid)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return TFB_GetVideoLine (vid->frame, line);
|
return TFB_DrawCanvas_GetLine (vid->frame->NormalImg, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32
|
static uint32
|
||||||
|
|||||||
Reference in New Issue
Block a user