Make video decoder description structs const

This makes the per-decoder struct vd_functions and its ->info
struct constants. Same for the mpcodecs_vd_drivers[] table of
pointers to those structs.
This commit is contained in:
Uoti Urpala 2008-04-24 08:43:56 +03:00
parent 7dc4226348
commit 31db39d8ec
27 changed files with 34 additions and 34 deletions

View File

@ -53,7 +53,7 @@ int get_video_quality_max(sh_video_t *sh_video)
return ret; return ret;
} }
} }
struct vd_functions *vd = sh_video->vd_driver; const struct vd_functions *vd = sh_video->vd_driver;
if (vd) { if (vd) {
int ret = vd->control(sh_video, VDCTRL_QUERY_MAX_PP_LEVEL, NULL); int ret = vd->control(sh_video, VDCTRL_QUERY_MAX_PP_LEVEL, NULL);
if (ret > 0) { if (ret > 0) {
@ -72,7 +72,7 @@ void set_video_quality(sh_video_t *sh_video, int quality)
if (ret == CONTROL_TRUE) if (ret == CONTROL_TRUE)
return; // success return; // success
} }
struct vd_functions *vd = sh_video->vd_driver; const struct vd_functions *vd = sh_video->vd_driver;
if (vd) if (vd)
vd->control(sh_video, VDCTRL_SET_PP_LEVEL, (void *) (&quality)); vd->control(sh_video, VDCTRL_SET_PP_LEVEL, (void *) (&quality));
} }
@ -92,7 +92,7 @@ int set_video_colors(sh_video_t *sh_video, const char *item, int value)
return (1); return (1);
} }
/* try software control */ /* try software control */
struct vd_functions *vd = sh_video->vd_driver; const struct vd_functions *vd = sh_video->vd_driver;
if (vd && if (vd &&
vd->control(sh_video, VDCTRL_SET_EQUALIZER, item, (int *) value) vd->control(sh_video, VDCTRL_SET_EQUALIZER, item, (int *) value)
== CONTROL_OK) == CONTROL_OK)
@ -118,7 +118,7 @@ int get_video_colors(sh_video_t *sh_video, const char *item, int *value)
} }
} }
/* try software control */ /* try software control */
struct vd_functions *vd = sh_video->vd_driver; const struct vd_functions *vd = sh_video->vd_driver;
if (vd) if (vd)
return vd->control(sh_video, VDCTRL_GET_EQUALIZER, item, value); return vd->control(sh_video, VDCTRL_GET_EQUALIZER, item, value);
return 0; return 0;
@ -140,14 +140,14 @@ int set_rectangle(sh_video_t *sh_video, int param, int value)
void resync_video_stream(sh_video_t *sh_video) void resync_video_stream(sh_video_t *sh_video)
{ {
struct vd_functions *vd = sh_video->vd_driver; const struct vd_functions *vd = sh_video->vd_driver;
if (vd) if (vd)
vd->control(sh_video, VDCTRL_RESYNC_STREAM, NULL); vd->control(sh_video, VDCTRL_RESYNC_STREAM, NULL);
} }
int get_current_video_decoder_lag(sh_video_t *sh_video) int get_current_video_decoder_lag(sh_video_t *sh_video)
{ {
struct vd_functions *vd = sh_video->vd_driver; const struct vd_functions *vd = sh_video->vd_driver;
if (!vd) if (!vd)
return -1; return -1;
int ret = vd->control(sh_video, VDCTRL_QUERY_UNSEEN_FRAMES, NULL); int ret = vd->control(sh_video, VDCTRL_QUERY_UNSEEN_FRAMES, NULL);
@ -283,7 +283,7 @@ static int init_video(sh_video_t *sh_video, char *codecname, char *vfm,
} }
// init() // init()
struct vd_functions *vd = sh_video->vd_driver; const struct vd_functions *vd = sh_video->vd_driver;
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_OpeningVideoDecoder, mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_OpeningVideoDecoder,
vd->info->short_name, vd->info->name); vd->info->short_name, vd->info->name);
// clear vf init error, it is no longer relevant // clear vf init error, it is no longer relevant

View File

@ -47,7 +47,7 @@ extern vd_functions_t mpcodecs_vd_qtvideo;
* decoder, add it to libavcodec, except for wrappers around external * decoder, add it to libavcodec, except for wrappers around external
* libraries and decoders requiring binary support. */ * libraries and decoders requiring binary support. */
vd_functions_t *mpcodecs_vd_drivers[] = { const vd_functions_t * const mpcodecs_vd_drivers[] = {
&mpcodecs_vd_null, &mpcodecs_vd_null,
#ifdef USE_LIBAVCODEC #ifdef USE_LIBAVCODEC
&mpcodecs_vd_ffmpeg, &mpcodecs_vd_ffmpeg,

View File

@ -10,7 +10,7 @@ typedef mp_codec_info_t vd_info_t;
/* interface of video decoder drivers */ /* interface of video decoder drivers */
typedef struct vd_functions typedef struct vd_functions
{ {
vd_info_t *info; const vd_info_t *info;
int (*init)(sh_video_t *sh); int (*init)(sh_video_t *sh);
void (*uninit)(sh_video_t *sh); void (*uninit)(sh_video_t *sh);
int (*control)(sh_video_t *sh,int cmd,void* arg, ...); int (*control)(sh_video_t *sh,int cmd,void* arg, ...);
@ -18,7 +18,7 @@ typedef struct vd_functions
} vd_functions_t; } vd_functions_t;
// NULL terminated array of all drivers // NULL terminated array of all drivers
extern vd_functions_t* mpcodecs_vd_drivers[]; extern const vd_functions_t * const mpcodecs_vd_drivers[];
#define VDCTRL_QUERY_FORMAT 3 /* test for availabilty of a format */ #define VDCTRL_QUERY_FORMAT 3 /* test for availabilty of a format */
#define VDCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ #define VDCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */

View File

@ -11,7 +11,7 @@
#include "loader/dmo/DMO_VideoDecoder.h" #include "loader/dmo/DMO_VideoDecoder.h"
static vd_info_t info = { static const vd_info_t info = {
"DMO video codecs", "DMO video codecs",
"dmo", "dmo",
"A'rpi", "A'rpi",

View File

@ -11,7 +11,7 @@
#include "loader/dshow/DS_VideoDecoder.h" #include "loader/dshow/DS_VideoDecoder.h"
static vd_info_t info = { static const vd_info_t info = {
"DirectShow video codecs", "DirectShow video codecs",
"dshow", "dshow",
"A'rpi", "A'rpi",

View File

@ -14,7 +14,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = { static const vd_info_t info = {
"FFmpeg's libavcodec codec family", "FFmpeg's libavcodec codec family",
"ffmpeg", "ffmpeg",
"A'rpi", "A'rpi",

View File

@ -8,7 +8,7 @@
#define TEMP_BUF_SIZE (720*576) #define TEMP_BUF_SIZE (720*576)
static vd_info_t info = { static const vd_info_t info = {
"Hauppauge Macroblock/NV12/NV21 Decoder", "Hauppauge Macroblock/NV12/NV21 Decoder",
"hmblck", "hmblck",
"Alex <d18c7db@hotmail.com>, A'rpi, Alex Beregszaszi", "Alex <d18c7db@hotmail.com>, A'rpi, Alex Beregszaszi",

View File

@ -16,7 +16,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = { static const vd_info_t info = {
"JPEG Images decoder", "JPEG Images decoder",
"ijpg", "ijpg",
"Pontscho", "Pontscho",

View File

@ -19,7 +19,7 @@ static int init(sh_video_t *sh);
static void uninit(sh_video_t *sh); static void uninit(sh_video_t *sh);
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags); static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags);
#define LIBVD_EXTERN(x) vd_functions_t mpcodecs_vd_##x = {\ #define LIBVD_EXTERN(x) const vd_functions_t mpcodecs_vd_##x = {\
&info,\ &info,\
init,\ init,\
uninit,\ uninit,\

View File

@ -18,7 +18,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = static const vd_info_t info =
{ {
"Raw DV Video Decoder", "Raw DV Video Decoder",
"libdv", "libdv",

View File

@ -9,7 +9,7 @@
//#undef MPEG12_POSTPROC //#undef MPEG12_POSTPROC
static vd_info_t info = static const vd_info_t info =
{ {
"MPEG 1/2 Video decoder libmpeg2-v0.4.0b", "MPEG 1/2 Video decoder libmpeg2-v0.4.0b",
"libmpeg2", "libmpeg2",

View File

@ -9,7 +9,7 @@
#define MOD_NAME "DecLZO" #define MOD_NAME "DecLZO"
static vd_info_t info = { static const vd_info_t info = {
"LZO compressed Video", "LZO compressed Video",
"lzo", "lzo",
"Tilmann Bitterberg", "Tilmann Bitterberg",

View File

@ -7,7 +7,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = static const vd_info_t info =
{ {
"MPEG 1/2 Video passthrough", "MPEG 1/2 Video passthrough",
"mpegpes", "mpegpes",

View File

@ -12,7 +12,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = { static const vd_info_t info = {
"PNG Images decoder", "PNG Images decoder",
"mpng", "mpng",
"A'rpi", "A'rpi",

View File

@ -16,7 +16,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = static const vd_info_t info =
{ {
"TGA Images decoder", "TGA Images decoder",
"mtga", "mtga",

View File

@ -6,7 +6,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = static const vd_info_t info =
{ {
"Null video decoder", "Null video decoder",
"null", "null",

View File

@ -6,7 +6,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = { static const vd_info_t info = {
"NuppelVideo decoder", "NuppelVideo decoder",
"nuv", "nuv",
"A'rpi", "A'rpi",

View File

@ -18,7 +18,7 @@
#include "loader/ldt_keeper.h" #include "loader/ldt_keeper.h"
#endif #endif
static vd_info_t info = { static const vd_info_t info = {
"Quicktime Video decoder", "Quicktime Video decoder",
"qtvideo", "qtvideo",
"A'rpi", "A'rpi",

View File

@ -6,7 +6,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = { static const vd_info_t info = {
"RAW Uncompressed Video", "RAW Uncompressed Video",
"raw", "raw",
"A'rpi", "A'rpi",

View File

@ -13,7 +13,7 @@
#include "vd_internal.h" #include "vd_internal.h"
#include "loader/wine/windef.h" #include "loader/wine/windef.h"
static vd_info_t info = { static const vd_info_t info = {
"RealVideo decoder", "RealVideo decoder",
"realvid", "realvid",
"Alex Beregszaszi", "Alex Beregszaszi",

View File

@ -21,7 +21,7 @@
#define OUT_PIXEL_STRIDE 3 /* RGB */ #define OUT_PIXEL_STRIDE 3 /* RGB */
static vd_info_t info = static const vd_info_t info =
{ {
"SGI Image decoder", "SGI Image decoder",
"sgi", "sgi",

View File

@ -9,7 +9,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = { static const vd_info_t info = {
"Theora/VP3", "Theora/VP3",
"theora", "theora",
"David Kuehling", "David Kuehling",

View File

@ -10,7 +10,7 @@
#include "loader/wine/driver.h" #include "loader/wine/driver.h"
#include "loader/wine/vfw.h" #include "loader/wine/vfw.h"
static vd_info_t info = { static const vd_info_t info = {
#ifdef BUILD_VFWEX #ifdef BUILD_VFWEX
"Win32/VfWex video codecs", "Win32/VfWex video codecs",
"vfwex", "vfwex",

View File

@ -18,7 +18,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = { static const vd_info_t info = {
"XAnim codecs", "XAnim codecs",
"xanim", "xanim",
"A'rpi & Alex", "A'rpi & Alex",

View File

@ -378,7 +378,7 @@ static float stats2aspect(xvid_dec_stats_t *stats)
* Module structure definition * Module structure definition
****************************************************************************/ ****************************************************************************/
static vd_info_t info = static const vd_info_t info =
{ {
"XviD 1.0 decoder", "XviD 1.0 decoder",
"xvid", "xvid",

View File

@ -19,7 +19,7 @@
#include "vd_internal.h" #include "vd_internal.h"
static vd_info_t info = static const vd_info_t info =
{ {
"Zoran MJPEG Video passthrough", "Zoran MJPEG Video passthrough",
"zrmjpeg", "zrmjpeg",

View File

@ -85,7 +85,7 @@ typedef struct sh_video {
unsigned int outfmtidx; unsigned int outfmtidx;
struct vf_instance *vfilter; // the video filter chain, used for this video stream struct vf_instance *vfilter; // the video filter chain, used for this video stream
int output_flags; // query_format() results for output filters+vo int output_flags; // query_format() results for output filters+vo
struct vd_functions *vd_driver; const struct vd_functions *vd_driver;
int vf_initialized; int vf_initialized;
#ifdef DYNAMIC_PLUGINS #ifdef DYNAMIC_PLUGINS
void *dec_handle; void *dec_handle;