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;
}
}
struct vd_functions *vd = sh_video->vd_driver;
const struct vd_functions *vd = sh_video->vd_driver;
if (vd) {
int ret = vd->control(sh_video, VDCTRL_QUERY_MAX_PP_LEVEL, NULL);
if (ret > 0) {
@ -72,7 +72,7 @@ void set_video_quality(sh_video_t *sh_video, int quality)
if (ret == CONTROL_TRUE)
return; // success
}
struct vd_functions *vd = sh_video->vd_driver;
const struct vd_functions *vd = sh_video->vd_driver;
if (vd)
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);
}
/* try software control */
struct vd_functions *vd = sh_video->vd_driver;
const struct vd_functions *vd = sh_video->vd_driver;
if (vd &&
vd->control(sh_video, VDCTRL_SET_EQUALIZER, item, (int *) value)
== CONTROL_OK)
@ -118,7 +118,7 @@ int get_video_colors(sh_video_t *sh_video, const char *item, int *value)
}
}
/* try software control */
struct vd_functions *vd = sh_video->vd_driver;
const struct vd_functions *vd = sh_video->vd_driver;
if (vd)
return vd->control(sh_video, VDCTRL_GET_EQUALIZER, item, value);
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)
{
struct vd_functions *vd = sh_video->vd_driver;
const struct vd_functions *vd = sh_video->vd_driver;
if (vd)
vd->control(sh_video, VDCTRL_RESYNC_STREAM, NULL);
}
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)
return -1;
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()
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,
vd->info->short_name, vd->info->name);
// 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
* libraries and decoders requiring binary support. */
vd_functions_t *mpcodecs_vd_drivers[] = {
const vd_functions_t * const mpcodecs_vd_drivers[] = {
&mpcodecs_vd_null,
#ifdef USE_LIBAVCODEC
&mpcodecs_vd_ffmpeg,

View File

@ -10,7 +10,7 @@ typedef mp_codec_info_t vd_info_t;
/* interface of video decoder drivers */
typedef struct vd_functions
{
vd_info_t *info;
const vd_info_t *info;
int (*init)(sh_video_t *sh);
void (*uninit)(sh_video_t *sh);
int (*control)(sh_video_t *sh,int cmd,void* arg, ...);
@ -18,7 +18,7 @@ typedef struct vd_functions
} vd_functions_t;
// 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_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ static int init(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);
#define LIBVD_EXTERN(x) vd_functions_t mpcodecs_vd_##x = {\
#define LIBVD_EXTERN(x) const vd_functions_t mpcodecs_vd_##x = {\
&info,\
init,\
uninit,\

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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