aboutsummaryrefslogtreecommitdiffhomepage
path: root/libmpcodecs
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad.c54
-rw-r--r--libmpcodecs/ad.h6
-rw-r--r--libmpcodecs/ad_acm.c2
-rw-r--r--libmpcodecs/ad_alaw.c2
-rw-r--r--libmpcodecs/ad_dk3adpcm.c2
-rw-r--r--libmpcodecs/ad_dmo.c2
-rw-r--r--libmpcodecs/ad_dshow.c2
-rw-r--r--libmpcodecs/ad_dvdpcm.c2
-rw-r--r--libmpcodecs/ad_faad.c2
-rw-r--r--libmpcodecs/ad_ffmpeg.c2
-rw-r--r--libmpcodecs/ad_hwac3.c2
-rw-r--r--libmpcodecs/ad_hwmpa.c2
-rw-r--r--libmpcodecs/ad_imaadpcm.c2
-rw-r--r--libmpcodecs/ad_internal.h2
-rw-r--r--libmpcodecs/ad_liba52.c6
-rw-r--r--libmpcodecs/ad_libdca.c2
-rw-r--r--libmpcodecs/ad_libdv.c2
-rw-r--r--libmpcodecs/ad_libmad.c2
-rw-r--r--libmpcodecs/ad_libvorbis.c2
-rw-r--r--libmpcodecs/ad_mp3lib.c2
-rw-r--r--libmpcodecs/ad_mpc.c2
-rw-r--r--libmpcodecs/ad_msadpcm.c2
-rw-r--r--libmpcodecs/ad_msgsm.c2
-rw-r--r--libmpcodecs/ad_pcm.c41
-rw-r--r--libmpcodecs/ad_qtaudio.c2
-rw-r--r--libmpcodecs/ad_realaud.c2
-rw-r--r--libmpcodecs/ad_sample.c2
-rw-r--r--libmpcodecs/ad_speex.c2
-rw-r--r--libmpcodecs/ad_twin.c2
-rw-r--r--libmpcodecs/dec_video.c580
-rw-r--r--libmpcodecs/dec_video.h5
-rw-r--r--libmpcodecs/mp_image.h2
-rw-r--r--libmpcodecs/native/rtjpegn.c34
-rw-r--r--libmpcodecs/native/xa_gsm.c2
-rw-r--r--libmpcodecs/vd.c518
-rw-r--r--libmpcodecs/vd.h8
-rw-r--r--libmpcodecs/vd_dmo.c2
-rw-r--r--libmpcodecs/vd_dshow.c2
-rw-r--r--libmpcodecs/vd_ffmpeg.c149
-rw-r--r--libmpcodecs/vd_hmblck.c2
-rw-r--r--libmpcodecs/vd_ijpg.c4
-rw-r--r--libmpcodecs/vd_internal.h2
-rw-r--r--libmpcodecs/vd_libdv.c2
-rw-r--r--libmpcodecs/vd_libmpeg2.c6
-rw-r--r--libmpcodecs/vd_lzo.c2
-rw-r--r--libmpcodecs/vd_mpegpes.c2
-rw-r--r--libmpcodecs/vd_mpng.c2
-rw-r--r--libmpcodecs/vd_mtga.c2
-rw-r--r--libmpcodecs/vd_null.c2
-rw-r--r--libmpcodecs/vd_nuv.c2
-rw-r--r--libmpcodecs/vd_qtvideo.c2
-rw-r--r--libmpcodecs/vd_raw.c2
-rw-r--r--libmpcodecs/vd_realvid.c2
-rw-r--r--libmpcodecs/vd_sgi.c2
-rw-r--r--libmpcodecs/vd_theora.c2
-rw-r--r--libmpcodecs/vd_vfw.c2
-rw-r--r--libmpcodecs/vd_xanim.c2
-rw-r--r--libmpcodecs/vd_xvid4.c2
-rw-r--r--libmpcodecs/vd_zrmjpeg.c2
-rw-r--r--libmpcodecs/ve.c4
-rw-r--r--libmpcodecs/ve_lavc.c14
-rw-r--r--libmpcodecs/ve_libdv.c8
-rw-r--r--libmpcodecs/ve_nuv.c10
-rw-r--r--libmpcodecs/ve_qtvideo.c8
-rw-r--r--libmpcodecs/ve_raw.c10
-rw-r--r--libmpcodecs/ve_vfw.c10
-rw-r--r--libmpcodecs/ve_x264.c16
-rw-r--r--libmpcodecs/ve_xvid4.c10
-rw-r--r--libmpcodecs/vf.c43
-rw-r--r--libmpcodecs/vf.h52
-rw-r--r--libmpcodecs/vf_1bpp.c8
-rw-r--r--libmpcodecs/vf_2xsai.c10
-rw-r--r--libmpcodecs/vf_ass.c131
-rw-r--r--libmpcodecs/vf_blackframe.c10
-rw-r--r--libmpcodecs/vf_bmovl.c8
-rw-r--r--libmpcodecs/vf_boxblur.c6
-rw-r--r--libmpcodecs/vf_crop.c15
-rw-r--r--libmpcodecs/vf_cropdetect.c6
-rw-r--r--libmpcodecs/vf_decimate.c4
-rw-r--r--libmpcodecs/vf_delogo.c16
-rw-r--r--libmpcodecs/vf_denoise3d.c8
-rw-r--r--libmpcodecs/vf_detc.c10
-rw-r--r--libmpcodecs/vf_dint.c4
-rw-r--r--libmpcodecs/vf_divtc.c8
-rw-r--r--libmpcodecs/vf_down3dright.c8
-rw-r--r--libmpcodecs/vf_dsize.c2
-rw-r--r--libmpcodecs/vf_dvbscale.c2
-rw-r--r--libmpcodecs/vf_eq.c12
-rw-r--r--libmpcodecs/vf_expand.c62
-rw-r--r--libmpcodecs/vf_field.c6
-rw-r--r--libmpcodecs/vf_fil.c6
-rw-r--r--libmpcodecs/vf_filmdint.c17
-rw-r--r--libmpcodecs/vf_flip.c6
-rw-r--r--libmpcodecs/vf_format.c6
-rw-r--r--libmpcodecs/vf_framestep.c4
-rw-r--r--libmpcodecs/vf_fspp.c12
-rw-r--r--libmpcodecs/vf_geq.c18
-rw-r--r--libmpcodecs/vf_halfpack.c8
-rw-r--r--libmpcodecs/vf_harddup.c6
-rw-r--r--libmpcodecs/vf_hqdn3d.c8
-rw-r--r--libmpcodecs/vf_hue.c12
-rw-r--r--libmpcodecs/vf_il.c2
-rw-r--r--libmpcodecs/vf_ilpack.c6
-rw-r--r--libmpcodecs/vf_ivtc.c8
-rw-r--r--libmpcodecs/vf_kerndeint.c10
-rw-r--r--libmpcodecs/vf_lavc.c6
-rw-r--r--libmpcodecs/vf_lavcdeint.c6
-rw-r--r--libmpcodecs/vf_mcdeint.c10
-rw-r--r--libmpcodecs/vf_mirror.c2
-rw-r--r--libmpcodecs/vf_noformat.c6
-rw-r--r--libmpcodecs/vf_noise.c12
-rw-r--r--libmpcodecs/vf_ow.c10
-rw-r--r--libmpcodecs/vf_palette.c14
-rw-r--r--libmpcodecs/vf_perspective.c8
-rw-r--r--libmpcodecs/vf_phase.c4
-rw-r--r--libmpcodecs/vf_pp.c14
-rw-r--r--libmpcodecs/vf_pp7.c12
-rw-r--r--libmpcodecs/vf_pullup.c12
-rw-r--r--libmpcodecs/vf_qp.c10
-rw-r--r--libmpcodecs/vf_rectangle.c6
-rw-r--r--libmpcodecs/vf_remove_logo.c10
-rw-r--r--libmpcodecs/vf_rgb2bgr.c6
-rw-r--r--libmpcodecs/vf_rgbtest.c6
-rw-r--r--libmpcodecs/vf_rotate.c6
-rw-r--r--libmpcodecs/vf_sab.c8
-rw-r--r--libmpcodecs/vf_scale.c39
-rw-r--r--libmpcodecs/vf_screenshot.c14
-rw-r--r--libmpcodecs/vf_smartblur.c8
-rw-r--r--libmpcodecs/vf_softpulldown.c6
-rw-r--r--libmpcodecs/vf_softskip.c8
-rw-r--r--libmpcodecs/vf_spp.c12
-rw-r--r--libmpcodecs/vf_swapuv.c6
-rw-r--r--libmpcodecs/vf_telecine.c8
-rw-r--r--libmpcodecs/vf_test.c6
-rw-r--r--libmpcodecs/vf_tfields.c21
-rw-r--r--libmpcodecs/vf_tile.c8
-rw-r--r--libmpcodecs/vf_tinterlace.c8
-rw-r--r--libmpcodecs/vf_unsharp.c12
-rw-r--r--libmpcodecs/vf_uspp.c12
-rw-r--r--libmpcodecs/vf_vo.c83
-rw-r--r--libmpcodecs/vf_yadif.c21
-rw-r--r--libmpcodecs/vf_yuvcsp.c8
-rw-r--r--libmpcodecs/vf_yuy2.c6
-rw-r--r--libmpcodecs/vf_yvu9.c6
-rw-r--r--libmpcodecs/vf_zrmjpeg.c6
145 files changed, 1343 insertions, 1278 deletions
diff --git a/libmpcodecs/ad.c b/libmpcodecs/ad.c
index 11d6f350fe..3f191826fa 100644
--- a/libmpcodecs/ad.c
+++ b/libmpcodecs/ad.c
@@ -16,34 +16,34 @@
/* Missed vorbis, mad, dshow */
//extern ad_functions_t mpcodecs_ad_null;
-extern ad_functions_t mpcodecs_ad_mp3lib;
-extern ad_functions_t mpcodecs_ad_ffmpeg;
-extern ad_functions_t mpcodecs_ad_liba52;
-extern ad_functions_t mpcodecs_ad_hwac3;
-extern ad_functions_t mpcodecs_ad_hwmpa;
-extern ad_functions_t mpcodecs_ad_pcm;
-extern ad_functions_t mpcodecs_ad_dvdpcm;
-extern ad_functions_t mpcodecs_ad_alaw;
-extern ad_functions_t mpcodecs_ad_imaadpcm;
-extern ad_functions_t mpcodecs_ad_msadpcm;
-extern ad_functions_t mpcodecs_ad_dk3adpcm;
-extern ad_functions_t mpcodecs_ad_dk4adpcm;
-extern ad_functions_t mpcodecs_ad_dshow;
-extern ad_functions_t mpcodecs_ad_dmo;
-extern ad_functions_t mpcodecs_ad_acm;
-extern ad_functions_t mpcodecs_ad_msgsm;
-extern ad_functions_t mpcodecs_ad_faad;
-extern ad_functions_t mpcodecs_ad_libvorbis;
-extern ad_functions_t mpcodecs_ad_speex;
-extern ad_functions_t mpcodecs_ad_libmad;
-extern ad_functions_t mpcodecs_ad_realaud;
-extern ad_functions_t mpcodecs_ad_libdv;
-extern ad_functions_t mpcodecs_ad_qtaudio;
-extern ad_functions_t mpcodecs_ad_twin;
-extern ad_functions_t mpcodecs_ad_libmusepack;
-extern ad_functions_t mpcodecs_ad_libdca;
+extern const ad_functions_t mpcodecs_ad_mp3lib;
+extern const ad_functions_t mpcodecs_ad_ffmpeg;
+extern const ad_functions_t mpcodecs_ad_liba52;
+extern const ad_functions_t mpcodecs_ad_hwac3;
+extern const ad_functions_t mpcodecs_ad_hwmpa;
+extern const ad_functions_t mpcodecs_ad_pcm;
+extern const ad_functions_t mpcodecs_ad_dvdpcm;
+extern const ad_functions_t mpcodecs_ad_alaw;
+extern const ad_functions_t mpcodecs_ad_imaadpcm;
+extern const ad_functions_t mpcodecs_ad_msadpcm;
+extern const ad_functions_t mpcodecs_ad_dk3adpcm;
+extern const ad_functions_t mpcodecs_ad_dk4adpcm;
+extern const ad_functions_t mpcodecs_ad_dshow;
+extern const ad_functions_t mpcodecs_ad_dmo;
+extern const ad_functions_t mpcodecs_ad_acm;
+extern const ad_functions_t mpcodecs_ad_msgsm;
+extern const ad_functions_t mpcodecs_ad_faad;
+extern const ad_functions_t mpcodecs_ad_libvorbis;
+extern const ad_functions_t mpcodecs_ad_speex;
+extern const ad_functions_t mpcodecs_ad_libmad;
+extern const ad_functions_t mpcodecs_ad_realaud;
+extern const ad_functions_t mpcodecs_ad_libdv;
+extern const ad_functions_t mpcodecs_ad_qtaudio;
+extern const ad_functions_t mpcodecs_ad_twin;
+extern const ad_functions_t mpcodecs_ad_libmusepack;
+extern const ad_functions_t mpcodecs_ad_libdca;
-ad_functions_t* mpcodecs_ad_drivers[] =
+const ad_functions_t * const mpcodecs_ad_drivers[] =
{
// &mpcodecs_ad_null,
#ifdef CONFIG_MP3LIB
diff --git a/libmpcodecs/ad.h b/libmpcodecs/ad.h
index 6f1d5e7566..a23faa24e7 100644
--- a/libmpcodecs/ad.h
+++ b/libmpcodecs/ad.h
@@ -7,9 +7,9 @@
typedef mp_codec_info_t ad_info_t;
/* interface of video decoder drivers */
-typedef struct ad_functions_s
+typedef struct ad_functions
{
- ad_info_t *info;
+ const ad_info_t *info;
int (*preinit)(sh_audio_t *sh);
int (*init)(sh_audio_t *sh);
void (*uninit)(sh_audio_t *sh);
@@ -18,7 +18,7 @@ typedef struct ad_functions_s
} ad_functions_t;
// NULL terminated array of all drivers
-extern ad_functions_t* mpcodecs_ad_drivers[];
+extern const ad_functions_t * const mpcodecs_ad_drivers[];
// fallback if ADCTRL_RESYNC not implemented: sh_audio->a_in_buffer_len=0;
#define ADCTRL_RESYNC_STREAM 1 /* resync, called after seeking! */
diff --git a/libmpcodecs/ad_acm.c b/libmpcodecs/ad_acm.c
index bd94d5366a..8480da3f2e 100644
--- a/libmpcodecs/ad_acm.c
+++ b/libmpcodecs/ad_acm.c
@@ -11,7 +11,7 @@
#include "ad_internal.h"
#include "osdep/timer.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Win32/ACM decoders",
"acm",
diff --git a/libmpcodecs/ad_alaw.c b/libmpcodecs/ad_alaw.c
index 0085b12f85..61bb7e39ec 100644
--- a/libmpcodecs/ad_alaw.c
+++ b/libmpcodecs/ad_alaw.c
@@ -5,7 +5,7 @@
#include "config.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"aLaw/uLaw audio decoder",
"alaw",
diff --git a/libmpcodecs/ad_dk3adpcm.c b/libmpcodecs/ad_dk3adpcm.c
index 2e966a1ca5..b4eec81b5f 100644
--- a/libmpcodecs/ad_dk3adpcm.c
+++ b/libmpcodecs/ad_dk3adpcm.c
@@ -19,7 +19,7 @@
#include "mpbswap.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Duck Corp. DK3 ADPCM decoder",
"dk3adpcm",
diff --git a/libmpcodecs/ad_dmo.c b/libmpcodecs/ad_dmo.c
index d1133667c3..6b0c2b9ed3 100644
--- a/libmpcodecs/ad_dmo.c
+++ b/libmpcodecs/ad_dmo.c
@@ -9,7 +9,7 @@
#include "ad_internal.h"
#include "libaf/reorder_ch.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Win32/DMO decoders",
"dmo",
diff --git a/libmpcodecs/ad_dshow.c b/libmpcodecs/ad_dshow.c
index 24c34966bc..e9d1c450c3 100644
--- a/libmpcodecs/ad_dshow.c
+++ b/libmpcodecs/ad_dshow.c
@@ -8,7 +8,7 @@
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Win32/DirectShow decoders",
"dshow",
diff --git a/libmpcodecs/ad_dvdpcm.c b/libmpcodecs/ad_dvdpcm.c
index 1962594961..73c265666b 100644
--- a/libmpcodecs/ad_dvdpcm.c
+++ b/libmpcodecs/ad_dvdpcm.c
@@ -7,7 +7,7 @@
#include "help_mp.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Uncompressed DVD/VOB LPCM audio decoder",
"dvdpcm",
diff --git a/libmpcodecs/ad_faad.c b/libmpcodecs/ad_faad.c
index 4613f30937..4da0bebc0f 100644
--- a/libmpcodecs/ad_faad.c
+++ b/libmpcodecs/ad_faad.c
@@ -12,7 +12,7 @@
#include "ad_internal.h"
#include "libaf/reorder_ch.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"AAC (MPEG2/4 Advanced Audio Coding)",
"faad",
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index b04d5a5f35..cef9819831 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -11,7 +11,7 @@
#include "mpbswap.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"FFmpeg/libavcodec audio decoders",
"ffmpeg",
diff --git a/libmpcodecs/ad_hwac3.c b/libmpcodecs/ad_hwac3.c
index 0cb480ddfd..40281528e2 100644
--- a/libmpcodecs/ad_hwac3.c
+++ b/libmpcodecs/ad_hwac3.c
@@ -22,7 +22,7 @@
static int isdts = -1;
-static ad_info_t info =
+static const ad_info_t info =
{
"AC3/DTS pass-through S/PDIF",
"hwac3",
diff --git a/libmpcodecs/ad_hwmpa.c b/libmpcodecs/ad_hwmpa.c
index 3b9bdedc8c..e17f994ead 100644
--- a/libmpcodecs/ad_hwmpa.c
+++ b/libmpcodecs/ad_hwmpa.c
@@ -15,7 +15,7 @@
//based on ad_hwac3.c and ad_libmad.c
-static ad_info_t info =
+static const ad_info_t info =
{
"MPEG audio pass-through (fake decoder)",
"hwmpa",
diff --git a/libmpcodecs/ad_imaadpcm.c b/libmpcodecs/ad_imaadpcm.c
index a85cc68099..7c7f2362e5 100644
--- a/libmpcodecs/ad_imaadpcm.c
+++ b/libmpcodecs/ad_imaadpcm.c
@@ -62,7 +62,7 @@ static const int8_t adpcm_index[8] =
// clamp a number above 16
#define CLAMP_ABOVE_16(x) if (x < 16) x = 16;
-static ad_info_t info =
+static const ad_info_t info =
{
"IMA ADPCM audio decoder",
"imaadpcm",
diff --git a/libmpcodecs/ad_internal.h b/libmpcodecs/ad_internal.h
index 0bd01bcd6c..4018b57657 100644
--- a/libmpcodecs/ad_internal.h
+++ b/libmpcodecs/ad_internal.h
@@ -17,7 +17,7 @@ static void uninit(sh_audio_t *sh);
static int control(sh_audio_t *sh,int cmd,void* arg, ...);
static int decode_audio(sh_audio_t *sh,unsigned char *buffer,int minlen,int maxlen);
-#define LIBAD_EXTERN(x) ad_functions_t mpcodecs_ad_##x = {\
+#define LIBAD_EXTERN(x) const ad_functions_t mpcodecs_ad_##x = {\
&info,\
preinit,\
init,\
diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c
index 8c32c81319..5f3e48ae2c 100644
--- a/libmpcodecs/ad_liba52.c
+++ b/libmpcodecs/ad_liba52.c
@@ -38,7 +38,7 @@ static sample_t a52_level = 1;
float a52_drc_level = 1.0;
static int a52_drc_action = DRC_NO_ACTION;
-static ad_info_t info =
+static const ad_info_t info =
{
"AC3 decoding with liba52",
"liba52",
@@ -49,7 +49,7 @@ static ad_info_t info =
LIBAD_EXTERN(liba52)
-int a52_fillbuff(sh_audio_t *sh_audio){
+static int a52_fillbuff(sh_audio_t *sh_audio){
int length=0;
int flags=0;
int sample_rate=0;
@@ -111,7 +111,7 @@ int channels=0;
return (flags&A52_LFE) ? (channels+1) : channels;
}
-sample_t dynrng_call (sample_t c, void *data) {
+static sample_t dynrng_call (sample_t c, void *data) {
// fprintf(stderr, "(%lf, %lf): %lf\n", (double)c, (double)a52_drc_level, (double)pow((double)c, a52_drc_level));
return pow((double)c, a52_drc_level);
}
diff --git a/libmpcodecs/ad_libdca.c b/libmpcodecs/ad_libdca.c
index 1514a9953a..c167c92490 100644
--- a/libmpcodecs/ad_libdca.c
+++ b/libmpcodecs/ad_libdca.c
@@ -32,7 +32,7 @@
#include <dts.h>
-static ad_info_t info =
+static const ad_info_t info =
{
"DTS decoding with libdca",
"libdca",
diff --git a/libmpcodecs/ad_libdv.c b/libmpcodecs/ad_libdv.c
index e0dfbb2166..fdfdf6cc6c 100644
--- a/libmpcodecs/ad_libdv.c
+++ b/libmpcodecs/ad_libdv.c
@@ -20,7 +20,7 @@
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Raw DV Audio Decoder",
"libdv",
diff --git a/libmpcodecs/ad_libmad.c b/libmpcodecs/ad_libmad.c
index 076359a5b6..fb20f2a77f 100644
--- a/libmpcodecs/ad_libmad.c
+++ b/libmpcodecs/ad_libmad.c
@@ -8,7 +8,7 @@
#include "ad_internal.h"
-static ad_info_t info = {
+static const ad_info_t info = {
"libmad mpeg audio decoder",
"libmad",
"A'rpi",
diff --git a/libmpcodecs/ad_libvorbis.c b/libmpcodecs/ad_libvorbis.c
index dd20c34984..6f37e27710 100644
--- a/libmpcodecs/ad_libvorbis.c
+++ b/libmpcodecs/ad_libvorbis.c
@@ -9,7 +9,7 @@
#include "ad_internal.h"
#include "libaf/reorder_ch.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Ogg/Vorbis audio decoder",
"libvorbis",
diff --git a/libmpcodecs/ad_mp3lib.c b/libmpcodecs/ad_mp3lib.c
index 1afb1eafbe..f10a718b09 100644
--- a/libmpcodecs/ad_mp3lib.c
+++ b/libmpcodecs/ad_mp3lib.c
@@ -6,7 +6,7 @@
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"MPEG layer-2, layer-3",
"mp3lib",
diff --git a/libmpcodecs/ad_mpc.c b/libmpcodecs/ad_mpc.c
index 97ffdfed44..d994951368 100644
--- a/libmpcodecs/ad_mpc.c
+++ b/libmpcodecs/ad_mpc.c
@@ -16,7 +16,7 @@
#include "libaf/af_format.h"
#include "libvo/fastmemcpy.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Musepack audio decoder",
"mpcdec",
diff --git a/libmpcodecs/ad_msadpcm.c b/libmpcodecs/ad_msadpcm.c
index 11929d5e18..641992e18d 100644
--- a/libmpcodecs/ad_msadpcm.c
+++ b/libmpcodecs/ad_msadpcm.c
@@ -17,7 +17,7 @@
#include "mpbswap.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"MS ADPCM audio decoder",
"msadpcm",
diff --git a/libmpcodecs/ad_msgsm.c b/libmpcodecs/ad_msgsm.c
index c558595656..de1ea52aa2 100644
--- a/libmpcodecs/ad_msgsm.c
+++ b/libmpcodecs/ad_msgsm.c
@@ -5,7 +5,7 @@
#include "config.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"native GSM/MSGSM audio decoder",
"msgsm",
diff --git a/libmpcodecs/ad_pcm.c b/libmpcodecs/ad_pcm.c
index 1717cdd75d..058f6c25cb 100644
--- a/libmpcodecs/ad_pcm.c
+++ b/libmpcodecs/ad_pcm.c
@@ -2,12 +2,13 @@
#include <stdlib.h>
#include <unistd.h>
+#include "talloc.h"
#include "config.h"
#include "ad_internal.h"
#include "libaf/af_format.h"
#include "libaf/reorder_ch.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Uncompressed PCM audio decoder",
"pcm",
@@ -16,6 +17,11 @@ static ad_info_t info =
""
};
+struct ad_pcm_context {
+ unsigned char *packet_ptr;
+ int packet_len;
+};
+
LIBAD_EXTERN(pcm)
static int init(sh_audio_t *sh_audio)
@@ -91,6 +97,7 @@ static int init(sh_audio_t *sh_audio)
}
if (!sh_audio->samplesize) // this would cause MPlayer to hang later
sh_audio->samplesize = 2;
+ sh_audio->context = talloc_zero(NULL, struct ad_pcm_context);
return 1;
}
@@ -102,6 +109,7 @@ static int preinit(sh_audio_t *sh)
static void uninit(sh_audio_t *sh)
{
+ talloc_free(sh->context);
}
static int control(sh_audio_t *sh,int cmd,void* arg, ...)
@@ -121,12 +129,37 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...)
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
{
unsigned len = sh_audio->channels*sh_audio->samplesize;
- len = (minlen + len - 1) / len * len;
- if (len > maxlen)
+ minlen = (minlen + len - 1) / len * len;
+ if (minlen > maxlen)
// if someone needs hundreds of channels adjust audio_out_minsize
// based on channels in preinit()
return -1;
- len=demux_read_data(sh_audio->ds,buf,len);
+
+ len = 0;
+ struct ad_pcm_context *ctx = sh_audio->context;
+ while (len < minlen) {
+ if (ctx->packet_len == 0) {
+ double pts;
+ int plen = ds_get_packet_pts(sh_audio->ds, &ctx->packet_ptr, &pts);
+ if (plen < 0)
+ break;
+ ctx->packet_len = plen;
+ if (pts != MP_NOPTS_VALUE) {
+ sh_audio->pts = pts;
+ sh_audio->pts_bytes = 0;
+ }
+ }
+ int from_stored = ctx->packet_len;
+ if (from_stored > minlen - len)
+ from_stored = minlen - len;
+ memcpy(buf + len, ctx->packet_ptr, from_stored);
+ ctx->packet_len -= from_stored;
+ ctx->packet_ptr += from_stored;
+ sh_audio->pts_bytes += from_stored;
+ len += from_stored;
+ }
+ if (len == 0)
+ len = -1; // The loop above only exits at error/EOF
if (len > 0 && sh_audio->channels >= 5) {
reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT,
AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
diff --git a/libmpcodecs/ad_qtaudio.c b/libmpcodecs/ad_qtaudio.c
index ffd2a381bd..cfc5dd26f8 100644
--- a/libmpcodecs/ad_qtaudio.c
+++ b/libmpcodecs/ad_qtaudio.c
@@ -20,7 +20,7 @@
#include "loader/ldt_keeper.h"
#endif
-static ad_info_t info = {
+static const ad_info_t info = {
"QuickTime Audio Decoder",
"qtaudio",
"A'rpi",
diff --git a/libmpcodecs/ad_realaud.c b/libmpcodecs/ad_realaud.c
index 785811bfcd..8135e21e41 100644
--- a/libmpcodecs/ad_realaud.c
+++ b/libmpcodecs/ad_realaud.c
@@ -14,7 +14,7 @@
#include "ad_internal.h"
#include "loader/wine/windef.h"
-static ad_info_t info = {
+static const ad_info_t info = {
"RealAudio decoder",
"realaud",
"Alex Beregszaszi",
diff --git a/libmpcodecs/ad_sample.c b/libmpcodecs/ad_sample.c
index 848152c68e..69d1440987 100644
--- a/libmpcodecs/ad_sample.c
+++ b/libmpcodecs/ad_sample.c
@@ -7,7 +7,7 @@
#include "config.h"
#include "ad_internal.h"
-static ad_info_t info = {
+static const ad_info_t info = {
"Sample audio decoder", // name of the driver
"sample", // driver name. should be the same as filename without ad_
"A'rpi", // writer/maintainer of _this_ file
diff --git a/libmpcodecs/ad_speex.c b/libmpcodecs/ad_speex.c
index c41dfe8e3e..f77b0b7e89 100644
--- a/libmpcodecs/ad_speex.c
+++ b/libmpcodecs/ad_speex.c
@@ -11,7 +11,7 @@
#include <speex/speex_header.h>
#include "ad_internal.h"
-static ad_info_t info = {
+static const ad_info_t info ={
"Speex audio decoder",
"speex",
"Reimar Döffinger",
diff --git a/libmpcodecs/ad_twin.c b/libmpcodecs/ad_twin.c
index 58d1074682..3915101ae4 100644
--- a/libmpcodecs/ad_twin.c
+++ b/libmpcodecs/ad_twin.c
@@ -11,7 +11,7 @@
#include "help_mp.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"TWinVQ decoder",
"vqf",
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index 0a76fc06bb..7a3e826e45 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -1,5 +1,5 @@
-
#include "config.h"
+#include "options.h"
#include <stdio.h>
#ifdef HAVE_MALLOC_H
@@ -39,334 +39,374 @@ extern double vout_time_usage;
#include "cpudetect.h"
-int field_dominance=-1;
-
-int divx_quality=0;
+int field_dominance = -1;
-vd_functions_t* mpvdec=NULL;
+int divx_quality = 0;
-int get_video_quality_max(sh_video_t *sh_video){
- vf_instance_t* vf=sh_video->vfilter;
- if(vf){
- int ret=vf->control(vf,VFCTRL_QUERY_MAX_PP_LEVEL,NULL);
- if(ret>0){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_UsingExternalPP,ret);
- return ret;
+int get_video_quality_max(sh_video_t *sh_video)
+{
+ vf_instance_t *vf = sh_video->vfilter;
+ if (vf) {
+ int ret = vf->control(vf, VFCTRL_QUERY_MAX_PP_LEVEL, NULL);
+ if (ret > 0) {
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_UsingExternalPP, ret);
+ return ret;
+ }
}
- }
- if(mpvdec){
- int ret=mpvdec->control(sh_video,VDCTRL_QUERY_MAX_PP_LEVEL,NULL);
- if(ret>0){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_UsingCodecPP,ret);
- return ret;
+ 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) {
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_UsingCodecPP, ret);
+ return ret;
+ }
}
- }
-// mp_msg(MSGT_DECVIDEO,MSGL_INFO,"[PP] Sorry, postprocessing is not available\n");
- return 0;
+ return 0;
}
-void set_video_quality(sh_video_t *sh_video,int quality){
- vf_instance_t* vf=sh_video->vfilter;
- if(vf){
- int ret=vf->control(vf,VFCTRL_SET_PP_LEVEL, (void*)(&quality));
- if(ret==CONTROL_TRUE) return; // success
- }
- if(mpvdec)
- mpvdec->control(sh_video,VDCTRL_SET_PP_LEVEL, (void*)(&quality));
+void set_video_quality(sh_video_t *sh_video, int quality)
+{
+ vf_instance_t *vf = sh_video->vfilter;
+ if (vf) {
+ int ret = vf->control(vf, VFCTRL_SET_PP_LEVEL, (void *) (&quality));
+ if (ret == CONTROL_TRUE)
+ return; // success
+ }
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (vd)
+ vd->control(sh_video, VDCTRL_SET_PP_LEVEL, (void *) (&quality));
}
-int set_video_colors(sh_video_t *sh_video,const char *item,int value)
+int set_video_colors(sh_video_t *sh_video, const char *item, int value)
{
- vf_instance_t* vf=sh_video->vfilter;
+ vf_instance_t *vf = sh_video->vfilter;
vf_equalizer_t data;
data.item = item;
data.value = value;
- mp_dbg(MSGT_DECVIDEO,MSGL_V,"set video colors %s=%d \n", item, value);
- if (vf)
- {
- int ret = vf->control(vf, VFCTRL_SET_EQUALIZER, &data);
- if (ret == CONTROL_TRUE)
- return 1;
+ mp_dbg(MSGT_DECVIDEO, MSGL_V, "set video colors %s=%d \n", item, value);
+ if (vf) {
+ int ret = vf->control(vf, VFCTRL_SET_EQUALIZER, &data);
+ if (ret == CONTROL_TRUE)
+ return 1;
}
/* try software control */
- if(mpvdec)
- if( mpvdec->control(sh_video,VDCTRL_SET_EQUALIZER, item, (int *)value)
- == CONTROL_OK) return 1;
- mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_VideoAttributeNotSupportedByVO_VD,item);
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (vd &&
+ vd->control(sh_video, VDCTRL_SET_EQUALIZER, item, (int *) value)
+ == CONTROL_OK)
+ return 1;
+ mp_msg(MSGT_DECVIDEO, MSGL_V, MSGTR_VideoAttributeNotSupportedByVO_VD,
+ item);
return 0;
}
-int get_video_colors(sh_video_t *sh_video,const char *item,int *value)
+int get_video_colors(sh_video_t *sh_video, const char *item, int *value)
{
- vf_instance_t* vf=sh_video->vfilter;
+ vf_instance_t *vf = sh_video->vfilter;
vf_equalizer_t data;
data.item = item;
- mp_dbg(MSGT_DECVIDEO,MSGL_V,"get video colors %s \n", item);
- if (vf)
- {
+ mp_dbg(MSGT_DECVIDEO, MSGL_V, "get video colors %s \n", item);
+ if (vf) {
int ret = vf->control(vf, VFCTRL_GET_EQUALIZER, &data);
- if (ret == CONTROL_TRUE){
- *value = data.value;
- return 1;
- }
+ if (ret == CONTROL_TRUE) {
+ *value = data.value;
+ return 1;
+ }
}
/* try software control */
- if(mpvdec) return mpvdec->control(sh_video,VDCTRL_GET_EQUALIZER, item, value);
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (vd)
+ return vd->control(sh_video, VDCTRL_GET_EQUALIZER, item, value);
return 0;
}
-int set_rectangle(sh_video_t *sh_video,int param,int value)
+int set_rectangle(sh_video_t *sh_video, int param, int value)
{
- vf_instance_t* vf=sh_video->vfilter;
- int data[] = {param, value};
+ vf_instance_t *vf = sh_video->vfilter;
+ int data[] = { param, value };
- mp_dbg(MSGT_DECVIDEO,MSGL_V,"set rectangle \n");
- if (vf)
- {
+ mp_dbg(MSGT_DECVIDEO, MSGL_V, "set rectangle \n");
+ if (vf) {
int ret = vf->control(vf, VFCTRL_CHANGE_RECTANGLE, data);
- if (ret)
- return 1;
+ if (ret)
+ return 1;
}
return 0;
}
void resync_video_stream(sh_video_t *sh_video)
{
- if(mpvdec) mpvdec->control(sh_video, VDCTRL_RESYNC_STREAM, NULL);
+ 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)
{
- int ret;
-
- if (!mpvdec)
- return -1;
- ret = mpvdec->control(sh_video, VDCTRL_QUERY_UNSEEN_FRAMES, NULL);
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (!vd)
+ return -1;
+ int ret = vd->control(sh_video, VDCTRL_QUERY_UNSEEN_FRAMES, NULL);
if (ret >= 10)
- return ret-10;
+ return ret - 10;
return -1;
}
-void uninit_video(sh_video_t *sh_video){
- if(!sh_video->initialized) return;
- mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_UninitVideoStr,sh_video->codec->drv);
- mpvdec->uninit(sh_video);
+void uninit_video(sh_video_t *sh_video)
+{
+ if (!sh_video->initialized)
+ return;
+ mp_msg(MSGT_DECVIDEO, MSGL_V, MSGTR_UninitVideoStr, sh_video->codec->drv);
+ sh_video->vd_driver->uninit(sh_video);
#ifdef CONFIG_DYNAMIC_PLUGINS
if (sh_video->dec_handle)
- dlclose(sh_video->dec_handle);
+ dlclose(sh_video->dec_handle);
#endif
vf_uninit_filter_chain(sh_video->vfilter);
- sh_video->initialized=0;
+ sh_video->initialized = 0;
}
-void vfm_help(void){
+void vfm_help(void)
+{
int i;
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_AvailableVideoFm);
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_AvailableVideoFm);
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_DRIVERS\n");
- mp_msg(MSGT_DECVIDEO,MSGL_INFO," vfm: info: (comment)\n");
- for (i=0; mpcodecs_vd_drivers[i] != NULL; i++)
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,"%8s %s (%s)\n",
- mpcodecs_vd_drivers[i]->info->short_name,
- mpcodecs_vd_drivers[i]->info->name,
- mpcodecs_vd_drivers[i]->info->comment);
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, " vfm: info: (comment)\n");
+ for (i = 0; mpcodecs_vd_drivers[i] != NULL; i++)
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, "%8s %s (%s)\n",
+ mpcodecs_vd_drivers[i]->info->short_name,
+ mpcodecs_vd_drivers[i]->info->name,
+ mpcodecs_vd_drivers[i]->info->comment);
}
-static int init_video(sh_video_t *sh_video,char* codecname,char* vfm,int status,
- stringset_t *selected){
+static int init_video(sh_video_t *sh_video, char *codecname, char *vfm,
+ int status, stringset_t *selected)
+{
int force = 0;
- unsigned int orig_fourcc=sh_video->bih?sh_video->bih->biCompression:0;
- sh_video->codec=NULL;
- sh_video->vf_initialized=0;
+ unsigned int orig_fourcc =
+ sh_video->bih ? sh_video->bih->biCompression : 0;
+ sh_video->codec = NULL;
+ sh_video->vf_initialized = 0;
if (codecname && codecname[0] == '+') {
- codecname = &codecname[1];
- force = 1;
+ codecname = &codecname[1];
+ force = 1;
}
- while(1){
- int i;
- int orig_w, orig_h;
- // restore original fourcc:
- if(sh_video->bih) sh_video->bih->biCompression=orig_fourcc;
- if(!(sh_video->codec=find_video_codec(sh_video->format,
- sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,
- sh_video->codec,force) )) break;
- // ok we found one codec
- if(stringset_test(selected, sh_video->codec->name)) continue; // already tried & failed
- if(codecname && strcmp(sh_video->codec->name,codecname)) continue; // -vc
- if(vfm && strcmp(sh_video->codec->drv,vfm)) continue; // vfm doesn't match
- if(!force && sh_video->codec->status<status) continue; // too unstable
- stringset_add(selected, sh_video->codec->name); // tagging it
- // ok, it matches all rules, let's find the driver!
- for (i=0; mpcodecs_vd_drivers[i] != NULL; i++)
-// if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver) break;
- if(!strcmp(mpcodecs_vd_drivers[i]->info->short_name,sh_video->codec->drv)) break;
- mpvdec=mpcodecs_vd_drivers[i];
+ while (1) {
+ int i;
+ int orig_w, orig_h;
+ // restore original fourcc:
+ if (sh_video->bih)
+ sh_video->bih->biCompression = orig_fourcc;
+ if (!
+ (sh_video->codec =
+ find_video_codec(sh_video->format,
+ sh_video->bih ? ((unsigned int *) &sh_video->
+ bih->biCompression) : NULL,
+ sh_video->codec, force)))
+ break;
+ // ok we found one codec
+ if (stringset_test(selected, sh_video->codec->name))
+ continue; // already tried & failed
+ if (codecname && strcmp(sh_video->codec->name, codecname))
+ continue; // -vc
+ if (vfm && strcmp(sh_video->codec->drv, vfm))
+ continue; // vfm doesn't match
+ if (!force && sh_video->codec->status < status)
+ continue; // too unstable
+ stringset_add(selected, sh_video->codec->name); // tagging it
+ // ok, it matches all rules, let's find the driver!
+ for (i = 0; mpcodecs_vd_drivers[i] != NULL; i++)
+ if (!strcmp(mpcodecs_vd_drivers[i]->info->short_name,
+ sh_video->codec->drv))
+ break;
+ sh_video->vd_driver = mpcodecs_vd_drivers[i];
#ifdef CONFIG_DYNAMIC_PLUGINS
- if (!mpvdec)
- {
- /* try to open shared decoder plugin */
- int buf_len;
- char *buf;
- vd_functions_t *funcs_sym;
- vd_info_t *info_sym;
-
- buf_len = strlen(MPLAYER_LIBDIR)+strlen(sh_video->codec->drv)+16;
- buf = malloc(buf_len);
- if (!buf)
- break;
- snprintf(buf, buf_len, "%s/mplayer/vd_%s.so", MPLAYER_LIBDIR, sh_video->codec->drv);
- mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Trying to open external plugin: %s\n", buf);
- sh_video->dec_handle = dlopen(buf, RTLD_LAZY);
- if (!sh_video->dec_handle)
- break;
- snprintf(buf, buf_len, "mpcodecs_vd_%s", sh_video->codec->drv);
- funcs_sym = dlsym(sh_video->dec_handle, buf);
- if (!funcs_sym || !funcs_sym->info || !funcs_sym->init ||
- !funcs_sym->uninit || !funcs_sym->control || !funcs_sym->decode)
- break;
- info_sym = funcs_sym->info;
- if (strcmp(info_sym->short_name, sh_video->codec->drv))
- break;
- free(buf);
- mpvdec = funcs_sym;
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Using external decoder plugin (%s/mplayer/vd_%s.so)!\n",
- MPLAYER_LIBDIR, sh_video->codec->drv);
- }
+ if (!sh_video->vd_driver) {
+ /* try to open shared decoder plugin */
+ int buf_len;
+ char *buf;
+ vd_functions_t *funcs_sym;
+ vd_info_t *info_sym;
+
+ buf_len =
+ strlen(MPLAYER_LIBDIR) + strlen(sh_video->codec->drv) + 16;
+ buf = malloc(buf_len);
+ if (!buf)
+ break;
+ snprintf(buf, buf_len, "%s/mplayer/vd_%s.so", MPLAYER_LIBDIR,
+ sh_video->codec->drv);
+ mp_msg(MSGT_DECVIDEO, MSGL_DBG2,
+ "Trying to open external plugin: %s\n", buf);
+ sh_video->dec_handle = dlopen(buf, RTLD_LAZY);
+ if (!sh_video->dec_handle)
+ break;
+ snprintf(buf, buf_len, "mpcodecs_vd_%s", sh_video->codec->drv);
+ funcs_sym = dlsym(sh_video->dec_handle, buf);
+ if (!funcs_sym || !funcs_sym->info || !funcs_sym->init
+ || !funcs_sym->uninit || !funcs_sym->control
+ || !funcs_sym->decode)
+ break;
+ info_sym = funcs_sym->info;
+ if (strcmp(info_sym->short_name, sh_video->codec->drv))
+ break;
+ free(buf);
+ sh_video->vd_driver = funcs_sym;
+ mp_msg(MSGT_DECVIDEO, MSGL_V,
+ "Using external decoder plugin (%s/mplayer/vd_%s.so)!\n",
+ MPLAYER_LIBDIR, sh_video->codec->drv);
+ }
#endif
- if(!mpvdec){ // driver not available (==compiled in)
- mp_msg(MSGT_DECVIDEO,MSGL_WARN,MSGTR_VideoCodecFamilyNotAvailableStr,
- sh_video->codec->name, sh_video->codec->drv);
- continue;
- }
- orig_w = sh_video->bih ? sh_video->bih->biWidth : sh_video->disp_w;
- orig_h = sh_video->bih ? sh_video->bih->biHeight : sh_video->disp_h;
- sh_video->disp_w = orig_w;
- sh_video->disp_h = orig_h;
- // it's available, let's try to init!
- if(sh_video->codec->flags & CODECS_FLAG_ALIGN16){
- // align width/height to n*16
- sh_video->disp_w=(sh_video->disp_w+15)&(~15);
- sh_video->disp_h=(sh_video->disp_h+15)&(~15);
- }
- if (sh_video->bih) {
- sh_video->bih->biWidth = sh_video->disp_w;
- sh_video->bih->biHeight = sh_video->disp_h;
- }
- // init()
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_OpeningVideoDecoder,mpvdec->info->short_name,mpvdec->info->name);
- // clear vf init error, it is no longer relevant
- if (sh_video->vf_initialized < 0)
- sh_video->vf_initialized = 0;
- if(!mpvdec->init(sh_video)){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_VDecoderInitFailed);
- sh_video->disp_w=orig_w;
- sh_video->disp_h=orig_h;
- if (sh_video->bih) {
- sh_video->bih->biWidth = sh_video->disp_w;
- sh_video->bih->biHeight = sh_video->disp_h;
- }
- continue; // try next...
- }
- // Yeah! We got it!
- sh_video->initialized=1;
- return 1;
+ if (!sh_video->vd_driver) { // driver not available (==compiled in)
+ mp_msg(MSGT_DECVIDEO, MSGL_WARN,
+ MSGTR_VideoCodecFamilyNotAvailableStr,
+ sh_video->codec->name, sh_video->codec->drv);
+ continue;
+ }
+ orig_w = sh_video->bih ? sh_video->bih->biWidth : sh_video->disp_w;
+ orig_h = sh_video->bih ? sh_video->bih->biHeight : sh_video->disp_h;
+ sh_video->disp_w = orig_w;
+ sh_video->disp_h = orig_h;
+ // it's available, let's try to init!
+ if (sh_video->codec->flags & CODECS_FLAG_ALIGN16) {
+ // align width/height to n*16
+ sh_video->disp_w = (sh_video->disp_w + 15) & (~15);
+ sh_video->disp_h = (sh_video->disp_h + 15) & (~15);
+ }
+ if (sh_video->bih) {
+ sh_video->bih->biWidth = sh_video->disp_w;
+ sh_video->bih->biHeight = sh_video->disp_h;
+ }
+
+ // init()
+ 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
+ if (sh_video->vf_initialized < 0)
+ sh_video->vf_initialized = 0;
+ if (!vd->init(sh_video)) {
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_VDecoderInitFailed);
+ sh_video->disp_w = orig_w;
+ sh_video->disp_h = orig_h;
+ if (sh_video->bih) {
+ sh_video->bih->biWidth = sh_video->disp_w;
+ sh_video->bih->biHeight = sh_video->disp_h;
+ }
+ continue; // try next...
+ }
+ // Yeah! We got it!
+ sh_video->initialized = 1;
+ return 1;
}
return 0;
}
-int init_best_video_codec(sh_video_t *sh_video,char** video_codec_list,char** video_fm_list){
-char* vc_l_default[2]={"",(char*)NULL};
-stringset_t selected;
-// hack:
-if(!video_codec_list) video_codec_list=vc_l_default;
-// Go through the codec.conf and find the best codec...
-sh_video->initialized=0;
-stringset_init(&selected);
-while(!sh_video->initialized && *video_codec_list){
- char* video_codec=*(video_codec_list++);
- if(video_codec[0]){
- if(video_codec[0]=='-'){
- // disable this codec:
- stringset_add(&selected, video_codec+1);
- } else {
- // forced codec by name:
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_ForcedVideoCodec,video_codec);
- init_video(sh_video,video_codec,NULL,-1, &selected);
- }
- } else {
- int status;
- // try in stability order: UNTESTED, WORKING, BUGGY. never try CRASHING.
- if(video_fm_list){
- char** fmlist=video_fm_list;
- // try first the preferred codec families:
- while(!sh_video->initialized && *fmlist){
- char* video_fm=*(fmlist++);
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_TryForceVideoFmtStr,video_fm);
- for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status)
- if(init_video(sh_video,NULL,video_fm,status, &selected)) break;
- }
+int init_best_video_codec(sh_video_t *sh_video, char **video_codec_list,
+ char **video_fm_list)
+{
+ char *vc_l_default[2] = { "", (char *) NULL };
+ stringset_t selected;
+ // hack:
+ if (!video_codec_list)
+ video_codec_list = vc_l_default;
+ // Go through the codec.conf and find the best codec...
+ sh_video->initialized = 0;
+ stringset_init(&selected);
+ while (!sh_video->initialized && *video_codec_list) {
+ char *video_codec = *(video_codec_list++);
+ if (video_codec[0]) {
+ if (video_codec[0] == '-') {
+ // disable this codec:
+ stringset_add(&selected, video_codec + 1);
+ } else {
+ // forced codec by name:
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_ForcedVideoCodec,
+ video_codec);
+ init_video(sh_video, video_codec, NULL, -1, &selected);
+ }
+ } else {
+ int status;
+ // try in stability order: UNTESTED, WORKING, BUGGY. never try CRASHING.
+ if (video_fm_list) {
+ char **fmlist = video_fm_list;
+ // try first the preferred codec families:
+ while (!sh_video->initialized && *fmlist) {
+ char *video_fm = *(fmlist++);
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_TryForceVideoFmtStr,
+ video_fm);
+ for (status = CODECS_STATUS__MAX;
+ status >= CODECS_STATUS__MIN; --status)
+ if (init_video
+ (sh_video, NULL, video_fm, status, &selected))
+ break;
+ }
+ }
+ if (!sh_video->initialized)
+ for (status = CODECS_STATUS__MAX; status >= CODECS_STATUS__MIN;
+ --status)
+ if (init_video(sh_video, NULL, NULL, status, &selected))
+ break;
+ }
}
- if(!sh_video->initialized)
- for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status)
- if(init_video(sh_video,NULL,NULL,status, &selected)) break;
- }
-}
-stringset_free(&selected);
+ stringset_free(&selected);
-if(!sh_video->initialized){
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
- mp_msg(MSGT_DECAUDIO,MSGL_HINT, MSGTR_RTFMCodecs);
- return 0; // failed
-}
+ if (!sh_video->initialized) {
+ mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_CantFindVideoCodec,
+ sh_video->format);
+ mp_msg(MSGT_DECAUDIO, MSGL_HINT, MSGTR_RTFMCodecs);
+ return 0; // failed
+ }
-mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_SelectedVideoCodec,
- sh_video->codec->name,sh_video->codec->drv,sh_video->codec->info);
-return 1; // success
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_SelectedVideoCodec,
+ sh_video->codec->name, sh_video->codec->drv, sh_video->codec->info);
+ return 1; // success
}
void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
- int drop_frame, double pts)
+ int drop_frame, double pts)
{
mp_image_t *mpi = NULL;
unsigned int t = GetTimer();
unsigned int t2;
double tt;
+ struct MPOpts *opts = sh_video->opts;
- if (correct_pts && pts != MP_NOPTS_VALUE) {
- int delay = get_current_video_decoder_lag(sh_video);
- if (delay >= 0) {
- if (delay > sh_video->num_buffered_pts)
+ if (opts->correct_pts && pts != MP_NOPTS_VALUE) {
+ int delay = get_current_video_decoder_lag(sh_video);
+ if (delay >= 0) {
+ if (delay > sh_video->num_buffered_pts)
#if 0
- // this is disabled because vd_ffmpeg reports the same lag
- // after seek even when there are no buffered frames,
- // leading to incorrect error messages
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Not enough buffered pts\n");
+ // this is disabled because vd_ffmpeg reports the same lag
+ // after seek even when there are no buffered frames,
+ // leading to incorrect error messages
+ mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Not enough buffered pts\n");
#else
- ;
+ ;
#endif
- else
- sh_video->num_buffered_pts = delay;
- }
- if (sh_video->num_buffered_pts ==
- sizeof(sh_video->buffered_pts)/sizeof(double))
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
- else {
- int i, j;
- for (i = 0; i < sh_video->num_buffered_pts; i++)
- if (sh_video->buffered_pts[i] < pts)
- break;
- for (j = sh_video->num_buffered_pts; j > i; j--)
- sh_video->buffered_pts[j] = sh_video->buffered_pts[j-1];
- sh_video->buffered_pts[i] = pts;
- sh_video->num_buffered_pts++;
- }
+ else
+ sh_video->num_buffered_pts = delay;
+ }
+ if (sh_video->num_buffered_pts ==
+ sizeof(sh_video->buffered_pts) / sizeof(double))
+ mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
+ else {
+ int i, j;
+ for (i = 0; i < sh_video->num_buffered_pts; i++)
+ if (sh_video->buffered_pts[i] < pts)
+ break;
+ for (j = sh_video->num_buffered_pts; j > i; j--)
+ sh_video->buffered_pts[j] = sh_video->buffered_pts[j - 1];
+ sh_video->buffered_pts[i] = pts;
+ sh_video->num_buffered_pts++;
+ }
}
- mpi = mpvdec->decode(sh_video, start, in_size, drop_frame);
+ mpi = sh_video->vd_driver->decode(sh_video, start, in_size, drop_frame);
//------------------------ frame decoded. --------------------
@@ -374,40 +414,40 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
// some codecs are broken, and doesn't restore MMX state :(
// it happens usually with broken/damaged files.
if (gCpuCaps.has3DNow) {
- __asm __volatile ("femms\n\t":::"memory");
- }
- else if (gCpuCaps.hasMMX) {
- __asm __volatile ("emms\n\t":::"memory");
+ __asm __volatile("femms\n\t":::"memory");
+ } else if (gCpuCaps.hasMMX) {
+ __asm __volatile("emms\n\t":::"memory");
}
#endif
- t2 = GetTimer(); t = t2-t;
- tt = t*0.000001f;
+ t2 = GetTimer();
+ t = t2 - t;
+ tt = t * 0.000001f;
video_time_usage += tt;
if (!mpi || drop_frame)
- return NULL; // error / skipped frame
+ return NULL; // error / skipped frame
if (field_dominance == 0)
- mpi->fields |= MP_IMGFIELD_TOP_FIRST;
+ mpi->fields |= MP_IMGFIELD_TOP_FIRST;
else if (field_dominance == 1)
- mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
-
- if (correct_pts) {
- if (sh_video->num_buffered_pts) {
- sh_video->num_buffered_pts--;
- sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts];
- }
- else {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "No pts value from demuxer to "
- "use for frame!\n");
- sh_video->pts = MP_NOPTS_VALUE;
- }
+ mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
+
+ if (opts->correct_pts) {
+ if (sh_video->num_buffered_pts) {
+ sh_video->num_buffered_pts--;
+ sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts];
+ } else {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR,
+ "No pts value from demuxer to " "use for frame!\n");
+ sh_video->pts = MP_NOPTS_VALUE;
+ }
}
return mpi;
}
-int filter_video(sh_video_t *sh_video, void *frame, double pts)
+int filter_video(sh_video_t *sh_video, void *frame, double pts,
+ struct osd_state *osd)
{
mp_image_t *mpi = frame;
unsigned int t2 = GetTimer();
@@ -415,14 +455,14 @@ int filter_video(sh_video_t *sh_video, void *frame, double pts)
// apply video filters and call the leaf vo/ve
int ret = vf->put_image(vf, mpi, pts);
if (ret > 0) {
- vf->control(vf, VFCTRL_DRAW_OSD, NULL);
+ vf->control(vf, VFCTRL_DRAW_OSD, osd);
#ifdef CONFIG_ASS
- vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
+ vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
#endif
}
- t2 = GetTimer()-t2;
- vout_time_usage += t2*0.000001;
+ t2 = GetTimer() - t2;
+ vout_time_usage += t2 * 0.000001;
return ret;
}
diff --git a/libmpcodecs/dec_video.h b/libmpcodecs/dec_video.h
index 3cd8f832bf..271d08850e 100644
--- a/libmpcodecs/dec_video.h
+++ b/libmpcodecs/dec_video.h
@@ -3,6 +3,8 @@
#include "libmpdemux/stheader.h"
+struct osd_state;
+
// dec_video.c:
extern void vfm_help(void);
@@ -10,7 +12,8 @@ extern int init_best_video_codec(sh_video_t *sh_video,char** video_codec_list,ch
extern void uninit_video(sh_video_t *sh_video);
extern void *decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, double pts);
-extern int filter_video(sh_video_t *sh_video, void *frame, double pts);
+extern int filter_video(sh_video_t *sh_video, void *frame, double pts,
+ struct osd_state *osd);
extern int get_video_quality_max(sh_video_t *sh_video);
extern void set_video_quality(sh_video_t *sh_video,int quality);
diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h
index 512f83e8c5..364c7937ab 100644
--- a/libmpcodecs/mp_image.h
+++ b/libmpcodecs/mp_image.h
@@ -75,7 +75,7 @@
#define MP_IMGFIELD_BOTTOM 0x10
#define MP_IMGFIELD_INTERLACED 0x20
-typedef struct mp_image_s {
+typedef struct mp_image {
unsigned short flags;
unsigned char type;
unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8
diff --git a/libmpcodecs/native/rtjpegn.c b/libmpcodecs/native/rtjpegn.c
index de72e5bd8e..be24f12851 100644
--- a/libmpcodecs/native/rtjpegn.c
+++ b/libmpcodecs/native/rtjpegn.c
@@ -136,7 +136,7 @@ static const unsigned char RTjpeg_chrom_quant_tbl[64] = {
/* Block to Stream (encoding) */
/* */
-int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8)
+static int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8)
{
register int ci, co=1;
register __s16 ZZvalue;
@@ -306,7 +306,7 @@ fprintf(stdout, "\n\n");
/* Stream to Block (decoding) */
/* */
-int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl)
+static int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl)
{
int ci;
register int co;
@@ -450,7 +450,7 @@ fprintf(stdout, "\n\n");
#else
-int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8)
+static int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8)
{
register int ci, co=1, tmp;
register __s16 ZZvalue;
@@ -509,7 +509,7 @@ int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8)
return (int)co;
}
-int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl)
+static int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl)
{
int ci=1, co=1, tmp;
register int i;
@@ -542,7 +542,7 @@ int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl)
#endif
#if defined(MMX)
-void RTjpeg_quant_init(void)
+static void RTjpeg_quant_init(void)
{
int i;
__s16 *qtbl;
@@ -557,7 +557,7 @@ void RTjpeg_quant_init(void)
static mmx_t RTjpeg_ones={0x0001000100010001LL};
static mmx_t RTjpeg_half={0x7fff7fff7fff7fffLL};
-void RTjpeg_quant(__s16 *block, __s32 *qtbl)
+static void RTjpeg_quant(__s16 *block, __s32 *qtbl)
{
int i;
mmx_t *bl, *ql;
@@ -594,11 +594,11 @@ void RTjpeg_quant(__s16 *block, __s32 *qtbl)
}
}
#else
-void RTjpeg_quant_init(void)
+static void RTjpeg_quant_init(void)
{
}
-void RTjpeg_quant(__s16 *block, __s32 *qtbl)
+static void RTjpeg_quant(__s16 *block, __s32 *qtbl)
{
int i;
@@ -629,7 +629,7 @@ static mmx_t RTjpeg_zero ={0x0000000000000000LL};
#define D_MULTIPLY(var,const) ((__s32) ((var) * (const)))
#endif
-void RTjpeg_dct_init(void)
+static void RTjpeg_dct_init(void)
{
int i;
@@ -640,7 +640,7 @@ void RTjpeg_dct_init(void)
}
}
-void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip)
+static void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip)
{
#ifndef MMX
__s32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
@@ -1557,7 +1557,7 @@ void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip)
#define RL(x) ((x)>235) ? 235 : (((x)<16) ? 16 : (x))
#define MULTIPLY(var,const) (((__s32) ((var) * (const)) + 128)>>8)
-void RTjpeg_idct_init(void)
+static void RTjpeg_idct_init(void)
{
int i;
@@ -1568,7 +1568,7 @@ void RTjpeg_idct_init(void)
}
}
-void RTjpeg_idct(__u8 *odata, __s16 *data, int rskip)
+static void RTjpeg_idct(__u8 *odata, __s16 *data, int rskip)
{
#ifdef MMX
@@ -2705,7 +2705,7 @@ Initialise all the cache-aliged data blocks
*/
-void RTjpeg_init_data(void)
+static void RTjpeg_init_data(void)
{
unsigned long dptr;
@@ -3143,7 +3143,7 @@ void RTjpeg_init_mcompress(void)
#ifdef MMX
-int RTjpeg_bcomp(__s16 *old, mmx_t *mask)
+static int RTjpeg_bcomp(__s16 *old, mmx_t *mask)
{
int i;
mmx_t *mold=(mmx_t *)old;
@@ -3189,7 +3189,7 @@ int RTjpeg_bcomp(__s16 *old, mmx_t *mask)
}
#else
-int RTjpeg_bcomp(__s16 *old, __u16 *mask)
+static int RTjpeg_bcomp(__s16 *old, __u16 *mask)
{
int i;
@@ -3415,10 +3415,6 @@ int RTjpeg_mcompress8(__s8 *sp, unsigned char *bp, __u16 lmask)
return (sp-sb);
}
-void RTjpeg_color_init(void)
-{
-}
-
#define KcrR 76284
#define KcrG 53281
#define KcbG 25625
diff --git a/libmpcodecs/native/xa_gsm.c b/libmpcodecs/native/xa_gsm.c
index 546edf81dc..86cedeb48b 100644
--- a/libmpcodecs/native/xa_gsm.c
+++ b/libmpcodecs/native/xa_gsm.c
@@ -258,7 +258,7 @@ register word * s;
}
/**** 4.3.2 */
-void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp)
+static void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp)
XA_GSM_STATE * S;
word Ncr;
word bcr;
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 281e67ba0c..1e23d2eced 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -5,13 +5,9 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
-
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
+#include "options.h"
#include "codec-cfg.h"
-//#include "mp_image.h"
#include "img_format.h"
@@ -23,311 +19,309 @@
#include "vd.h"
#include "vf.h"
-//#include "vd_internal.h"
-
-extern vd_functions_t mpcodecs_vd_null;
-extern vd_functions_t mpcodecs_vd_ffmpeg;
-extern vd_functions_t mpcodecs_vd_theora;
-extern vd_functions_t mpcodecs_vd_dshow;
-extern vd_functions_t mpcodecs_vd_dmo;
-extern vd_functions_t mpcodecs_vd_vfw;
-extern vd_functions_t mpcodecs_vd_vfwex;
-extern vd_functions_t mpcodecs_vd_raw;
-extern vd_functions_t mpcodecs_vd_hmblck;
-extern vd_functions_t mpcodecs_vd_xanim;
-extern vd_functions_t mpcodecs_vd_nuv;
-extern vd_functions_t mpcodecs_vd_mpng;
-extern vd_functions_t mpcodecs_vd_ijpg;
-extern vd_functions_t mpcodecs_vd_mtga;
-extern vd_functions_t mpcodecs_vd_sgi;
-extern vd_functions_t mpcodecs_vd_libmpeg2;
-extern vd_functions_t mpcodecs_vd_mpegpes;
-extern vd_functions_t mpcodecs_vd_zrmjpeg;
-extern vd_functions_t mpcodecs_vd_realvid;
-extern vd_functions_t mpcodecs_vd_xvid;
-extern vd_functions_t mpcodecs_vd_libdv;
-extern vd_functions_t mpcodecs_vd_lzo;
-extern vd_functions_t mpcodecs_vd_qtvideo;
+extern const vd_functions_t mpcodecs_vd_null;
+extern const vd_functions_t mpcodecs_vd_ffmpeg;
+extern const vd_functions_t mpcodecs_vd_theora;
+extern const vd_functions_t mpcodecs_vd_dshow;
+extern const vd_functions_t mpcodecs_vd_dmo;
+extern const vd_functions_t mpcodecs_vd_vfw;
+extern const vd_functions_t mpcodecs_vd_vfwex;
+extern const vd_functions_t mpcodecs_vd_raw;
+extern const vd_functions_t mpcodecs_vd_hmblck;
+extern const vd_functions_t mpcodecs_vd_xanim;
+extern const vd_functions_t mpcodecs_vd_nuv;
+extern const vd_functions_t mpcodecs_vd_mpng;
+extern const vd_functions_t mpcodecs_vd_ijpg;
+extern const vd_functions_t mpcodecs_vd_mtga;
+extern const vd_functions_t mpcodecs_vd_sgi;
+extern const vd_functions_t mpcodecs_vd_libmpeg2;
+extern const vd_functions_t mpcodecs_vd_mpegpes;
+extern const vd_functions_t mpcodecs_vd_zrmjpeg;
+extern const vd_functions_t mpcodecs_vd_realvid;
+extern const vd_functions_t mpcodecs_vd_xvid;
+extern const vd_functions_t mpcodecs_vd_libdv;
+extern const vd_functions_t mpcodecs_vd_lzo;
+extern const vd_functions_t mpcodecs_vd_qtvideo;
/* Please do not add any new decoders here. If you want to implement a new
* decoder, add it to libavcodec, except for wrappers around external
* libraries and decoders requiring binary support. */
-vd_functions_t* mpcodecs_vd_drivers[] = {
- &mpcodecs_vd_null,
+const vd_functions_t * const mpcodecs_vd_drivers[] = {
+ &mpcodecs_vd_null,
#ifdef CONFIG_LIBAVCODEC
- &mpcodecs_vd_ffmpeg,
+ &mpcodecs_vd_ffmpeg,
#endif
#ifdef CONFIG_OGGTHEORA
- &mpcodecs_vd_theora,
+ &mpcodecs_vd_theora,
#endif
#ifdef CONFIG_WIN32DLL
- &mpcodecs_vd_dshow,
- &mpcodecs_vd_dmo,
- &mpcodecs_vd_vfw,
- &mpcodecs_vd_vfwex,
+ &mpcodecs_vd_dshow,
+ &mpcodecs_vd_dmo,
+ &mpcodecs_vd_vfw,
+ &mpcodecs_vd_vfwex,
#endif
- &mpcodecs_vd_lzo,
- &mpcodecs_vd_raw,
- &mpcodecs_vd_hmblck,
- &mpcodecs_vd_nuv,
+ &mpcodecs_vd_lzo,
+ &mpcodecs_vd_raw,
+ &mpcodecs_vd_hmblck,
+ &mpcodecs_vd_nuv,
#ifdef CONFIG_XANIM
- &mpcodecs_vd_xanim,
+ &mpcodecs_vd_xanim,
#endif
#ifdef CONFIG_PNG
- &mpcodecs_vd_mpng,
+ &mpcodecs_vd_mpng,
#endif
#ifdef CONFIG_JPEG
- &mpcodecs_vd_ijpg,
+ &mpcodecs_vd_ijpg,
#endif
- &mpcodecs_vd_mtga,
- &mpcodecs_vd_sgi,
+ &mpcodecs_vd_mtga,
+ &mpcodecs_vd_sgi,
#ifdef CONFIG_LIBMPEG2
- &mpcodecs_vd_libmpeg2,
+ &mpcodecs_vd_libmpeg2,
#endif
- &mpcodecs_vd_mpegpes,
+ &mpcodecs_vd_mpegpes,
#ifdef CONFIG_ZR
- &mpcodecs_vd_zrmjpeg,
+ &mpcodecs_vd_zrmjpeg,
#endif
#ifdef CONFIG_REALCODECS
- &mpcodecs_vd_realvid,
+ &mpcodecs_vd_realvid,
#endif
#ifdef CONFIG_XVID4
- &mpcodecs_vd_xvid,
+ &mpcodecs_vd_xvid,
#endif
#ifdef CONFIG_LIBDV095
- &mpcodecs_vd_libdv,
+ &mpcodecs_vd_libdv,
#endif
#ifdef CONFIG_QTX_CODECS
- &mpcodecs_vd_qtvideo,
+ &mpcodecs_vd_qtvideo,
#endif
/* Please do not add any new decoders here. If you want to implement a new
* decoder, add it to libavcodec, except for wrappers around external
* libraries and decoders requiring binary support. */
- NULL
+ NULL
};
#include "libvo/video_out.h"
-// libvo opts:
-int fullscreen=0;
-int vidmode=0;
-int softzoom=0;
-int flip=-1;
-int opt_screen_size_x=0;
-int opt_screen_size_y=0;
-float screen_size_xy=0;
-float movie_aspect=-1.0;
-int vo_flags=0;
-int vd_use_slices=1;
-
-/** global variables for gamma, brightness, contrast, saturation and hue
- modified by mplayer.c and gui/mplayer/gtk/eq.c:
- ranges -100 - 100
- 1000 if the vo default should be used
-*/
-int vo_gamma_gamma = 1000;
-int vo_gamma_brightness = 1000;
-int vo_gamma_contrast = 1000;
-int vo_gamma_saturation = 1000;
-int vo_gamma_hue = 1000;
-
-extern vd_functions_t* mpvdec; // FIXME!
-
-int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt){
- 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_instance_t* vf=sh->vfilter,*sc=NULL;
- int palette=0;
- int vocfg_flags=0;
-
- if(w)
- sh->disp_w=w;
- if(h)
- sh->disp_h=h;
-
- if(!sh->disp_w || !sh->disp_h)
- return 0;
-
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_VoConfigRequest,w,h,vo_format_name(preferred_outfmt));
-
-// if(!vf) return 1; // temp hack
-
- if(get_video_quality_max(sh)<=0 && divx_quality){
- // user wants postprocess but no pp filter yet:
- sh->vfilter=vf=vf_open_filter(vf,"pp",NULL);
+int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
+ unsigned int preferred_outfmt)
+{
+ struct MPOpts *opts = sh->opts;
+ 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_instance_t *vf = sh->vfilter, *sc = NULL;
+ int palette = 0;
+ int vocfg_flags = 0;
+
+ if (w)
+ sh->disp_w = w;
+ if (h)
+ sh->disp_h = h;
+
+ if (!sh->disp_w || !sh->disp_h)
+ return 0;
+
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_VoConfigRequest, w, h,
+ vo_format_name(preferred_outfmt));
+
+ if (get_video_quality_max(sh) <= 0 && divx_quality) {
+ // user wants postprocess but no pp filter yet:
+ sh->vfilter = vf = vf_open_filter(opts, vf, "pp", NULL);
}
-
// check if libvo and codec has common outfmt (no conversion):
-csp_again:
-
- if( mp_msg_test(MSGT_DECVIDEO,MSGL_V) ){
- vf_instance_t* f=vf;
- mp_msg(MSGT_DECVIDEO,MSGL_V,"Trying filter chain:");
- for(f = vf ; f ; f = f->next)
- mp_msg(MSGT_DECVIDEO,MSGL_V," %s",f->info->name);
- mp_msg(MSGT_DECVIDEO,MSGL_V,"\n");
+ csp_again:
+
+ if (mp_msg_test(MSGT_DECVIDEO, MSGL_V)) {
+ vf_instance_t *f = vf;
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "Trying filter chain:");
+ for (f = vf; f; f = f->next)
+ mp_msg(MSGT_DECVIDEO, MSGL_V, " %s", f->info->name);
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "\n");
}
- j=-1;
- for(i=0;i<CODECS_MAX_OUTFMT;i++){
- int flags;
- out_fmt=sh->codec->outfmt[i];
- if(out_fmt==(unsigned int)0xFFFFFFFF) continue;
- flags=vf->query_format(vf,out_fmt);
- mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X (i=%d) \n",vo_format_name(out_fmt),flags,i);
- if((flags&VFCAP_CSP_SUPPORTED_BY_HW) || (flags&VFCAP_CSP_SUPPORTED && j<0)){
- // check (query) if codec really support this outfmt...
- sh->outfmtidx=j; // pass index to the control() function this way
- if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)==CONTROL_FALSE){
- mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: codec query_format(%s) returned FALSE\n",vo_format_name(out_fmt));
- continue;
- }
- j=i; vo_flags=flags; if(flags&VFCAP_CSP_SUPPORTED_BY_HW) break;
- } else
- if(!palette && !(flags&(VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_CSP_SUPPORTED)) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){
- sh->outfmtidx=j; // pass index to the control() function this way
- if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)!=CONTROL_FALSE)
- palette=1;
- }
+ j = -1;
+ for (i = 0; i < CODECS_MAX_OUTFMT; i++) {
+ int flags;
+ out_fmt = sh->codec->outfmt[i];
+ if (out_fmt == (unsigned int) 0xFFFFFFFF)
+ continue;
+ flags = vf->query_format(vf, out_fmt);
+ mp_msg(MSGT_CPLAYER, MSGL_DBG2,
+ "vo_debug: query(%s) returned 0x%X (i=%d) \n",
+ vo_format_name(out_fmt), flags, i);
+ if ((flags & VFCAP_CSP_SUPPORTED_BY_HW)
+ || (flags & VFCAP_CSP_SUPPORTED && j < 0)) {
+ // check (query) if codec really support this outfmt...
+ sh->outfmtidx = j; // pass index to the control() function this way
+ if (sh->vd_driver->control(sh, VDCTRL_QUERY_FORMAT, &out_fmt) ==
+ CONTROL_FALSE) {
+ mp_msg(MSGT_CPLAYER, MSGL_DBG2,
+ "vo_debug: codec query_format(%s) returned FALSE\n",
+ vo_format_name(out_fmt));
+ continue;
+ }
+ j = i;
+ sh->output_flags = flags;
+ if (flags & VFCAP_CSP_SUPPORTED_BY_HW)
+ break;
+ } else if (!palette
+ && !(flags &
+ (VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_CSP_SUPPORTED))
+ && (out_fmt == IMGFMT_RGB8 || out_fmt == IMGFMT_BGR8)) {
+ sh->outfmtidx = j; // pass index to the control() function this way
+ if (sh->vd_driver->control(sh, VDCTRL_QUERY_FORMAT, &out_fmt) !=
+ CONTROL_FALSE)
+ palette = 1;
+ }
}
- if(j<0){
- // TODO: no match - we should use conversion...
- if(strcmp(vf->info->name,"scale") && palette!=-1){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_CouldNotFindColorspace);
- sc=vf=vf_open_filter(vf,"scale",NULL);
- goto csp_again;
- } else
- if(palette==1){
- mp_msg(MSGT_DECVIDEO,MSGL_V,"vd: Trying -vf palette...\n");
- palette=-1;
- vf=vf_open_filter(vf,"palette",NULL);
- goto csp_again;
- } else
- { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc
- vf_instance_t* vo, *vp = NULL, *ve;
- // Remove the scale filter if we added it ourself
- if(vf == sc) {
- ve = vf;
- vf = vf->next;
- vf_uninit_filter(ve);
- }
- // Find the last filter (vf_vo)
- for(vo = vf ; vo->next ; vo = vo->next)
- vp = vo;
- if(vo->query_format(vo,IMGFMT_MPEGPES) && (!vp || (vp && strcmp(vp->info->name,"lavc")))) {
- ve = vf_open_filter(vo,"lavc",NULL);
- if(vp) vp->next = ve;
- else vf = ve;
- goto csp_again;
- }
- }
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_VOincompCodec);
- sh->vf_initialized=-1;
- return 0; // failed
+ if (j < 0) {
+ // TODO: no match - we should use conversion...
+ if (strcmp(vf->info->name, "scale") && palette != -1) {
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_CouldNotFindColorspace);
+ sc = vf = vf_open_filter(opts, vf, "scale", NULL);
+ goto csp_again;
+ } else if (palette == 1) {
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "vd: Trying -vf palette...\n");
+ palette = -1;
+ vf = vf_open_filter(opts, vf, "palette", NULL);
+ goto csp_again;
+ } else {
+ // sws failed, if the last filter (vf_vo) support MPEGPES try
+ // to append vf_lavc
+ vf_instance_t *vo, *vp = NULL, *ve;
+ // Remove the scale filter if we added it ourselves
+ if (vf == sc) {
+ ve = vf;
+ vf = vf->next;
+ vf_uninit_filter(ve);
+ }
+ // Find the last filter (vf_vo)
+ for (vo = vf; vo->next; vo = vo->next)
+ vp = vo;
+ if (vo->query_format(vo, IMGFMT_MPEGPES)
+ && (!vp || (vp && strcmp(vp->info->name, "lavc")))) {
+ ve = vf_open_filter(opts, vo, "lavc", NULL);
+ if (vp)
+ vp->next = ve;
+ else
+ vf = ve;
+ goto csp_again;
+ }
+ }
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_VOincompCodec);
+ sh->vf_initialized = -1;
+ return 0; // failed
}
- out_fmt=sh->codec->outfmt[j];
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_UsingXAsOutputCspNoY,vo_format_name(out_fmt),j);
- sh->outfmtidx=j;
- sh->vfilter=vf;
+ out_fmt = sh->codec->outfmt[j];
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_UsingXAsOutputCspNoY,
+ vo_format_name(out_fmt), j);
+ sh->outfmtidx = j;
+ sh->vfilter = vf;
// autodetect flipping
- if(flip==-1){
- flip=0;
- if(sh->codec->outflags[j]&CODECS_FLAG_FLIP)
- if(!(sh->codec->outflags[j]&CODECS_FLAG_NOFLIP))
- flip=1;
+ if (opts->flip == -1) {
+ opts->flip = 0;
+ if (sh->codec->outflags[j] & CODECS_FLAG_FLIP)
+ if (!(sh->codec->outflags[j] & CODECS_FLAG_NOFLIP))
+ opts->flip = 1;
}
- if(vo_flags&VFCAP_FLIPPED) flip^=1;
- if(flip && !(vo_flags&VFCAP_FLIP)){
- // we need to flip, but no flipping filter avail.
- vf_add_before_vo(&vf, "flip", NULL);
- sh->vfilter = vf;
+ if (sh->output_flags & VFCAP_FLIPPED)
+ opts->flip ^= 1;
+ if (opts->flip && !(sh->output_flags & VFCAP_FLIP)) {
+ // we need to flip, but no flipping filter avail.
+ vf_add_before_vo(&vf, "flip", NULL);
+ sh->vfilter = vf;
}
-
// time to do aspect ratio corrections...
- if(movie_aspect>-1.0) sh->aspect = movie_aspect; // cmdline overrides autodetect
- else if(sh->stream_aspect!=0.0) sh->aspect = sh->stream_aspect;
-// if(!sh->aspect) sh->aspect=1.0;
-
- if(opt_screen_size_x||opt_screen_size_y){
- screen_size_x = opt_screen_size_x;
- screen_size_y = opt_screen_size_y;
- if(!vidmode){
- if(!screen_size_x) screen_size_x=SCREEN_SIZE_X;
- if(!screen_size_y) screen_size_y=SCREEN_SIZE_Y;
- if(screen_size_x<=8) screen_size_x*=sh->disp_w;
- if(screen_size_y<=8) screen_size_y*=sh->disp_h;
- }
- } else {
- // check source format aspect, calculate prescale ::atmos
- screen_size_x=sh->disp_w;
- screen_size_y=sh->disp_h;
- if(screen_size_xy>=0.001){
- if(screen_size_xy<=8){
- // -xy means x+y scale
- screen_size_x*=screen_size_xy;
- screen_size_y*=screen_size_xy;
- } else {
- // -xy means forced width while keeping correct aspect
- screen_size_x=screen_size_xy;
- screen_size_y=screen_size_xy*sh->disp_h/sh->disp_w;
- }
- }
- if(sh->aspect>0.01){
- int w;
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MovieAspectIsSet,sh->aspect);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ASPECT=%1.4f\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 || screen_size_xy>8){
- screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect));
- screen_size_y+=screen_size_y%2; // round
- } else screen_size_x=w; // keep new width
+ if (opts->movie_aspect > -1.0)
+ sh->aspect = opts->movie_aspect; // cmdline overrides autodetect
+ else if (sh->stream_aspect != 0.0)
+ sh->aspect = sh->stream_aspect;
+
+ if (opts->screen_size_x || opts->screen_size_y) {
+ screen_size_x = opts->screen_size_x;
+ screen_size_y = opts->screen_size_y;
+ if (!opts->vidmode) {
+ if (!screen_size_x)
+ screen_size_x = SCREEN_SIZE_X;
+ if (!screen_size_y)
+ screen_size_y = SCREEN_SIZE_Y;
+ if (screen_size_x <= 8)
+ screen_size_x *= sh->disp_w;
+ if (screen_size_y <= 8)
+ screen_size_y *= sh->disp_h;
+ }
} else {
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MovieAspectUndefined);
+ // check source format aspect, calculate prescale ::atmos
+ screen_size_x = sh->disp_w;
+ screen_size_y = sh->disp_h;
+ if (opts->screen_size_xy >= 0.001) {
+ if (opts->screen_size_xy <= 8) {
+ // -xy means x+y scale
+ screen_size_x *= opts->screen_size_xy;
+ screen_size_y *= opts->screen_size_xy;
+ } else {
+ // -xy means forced width while keeping correct aspect
+ screen_size_x = opts->screen_size_xy;
+ screen_size_y = opts->screen_size_xy * sh->disp_h / sh->disp_w;
+ }
+ }
+ if (sh->aspect > 0.01) {
+ int w;
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_MovieAspectIsSet,
+ sh->aspect);
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ASPECT=%1.4f\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 || opts->screen_size_xy > 8) {
+ screen_size_y =
+ (int) ((float) screen_size_x * (1.0 / sh->aspect));
+ screen_size_y += screen_size_y % 2; // round
+ } else
+ screen_size_x = w; // keep new width
+ } else {
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_MovieAspectUndefined);
+ }
}
- }
- vocfg_flags = (fullscreen ? VOFLAG_FULLSCREEN:0)
- | (vidmode ? VOFLAG_MODESWITCHING:0)
- | (softzoom ? VOFLAG_SWSCALE:0)
- | (flip ? VOFLAG_FLIPPING:0);
+ vocfg_flags = (opts->fullscreen ? VOFLAG_FULLSCREEN : 0)
+ | (opts->vidmode ? VOFLAG_MODESWITCHING : 0)
+ | (opts->softzoom ? VOFLAG_SWSCALE : 0)
+ | (opts->flip ? VOFLAG_FLIPPING : 0);
// Time to config libvo!
- mp_msg(MSGT_CPLAYER,MSGL_V,"VO Config (%dx%d->%dx%d,flags=%d,'%s',0x%X)\n",
- sh->disp_w,sh->disp_h,
- screen_size_x,screen_size_y,
- vocfg_flags,
- "MPlayer",out_fmt);
+ mp_msg(MSGT_CPLAYER, MSGL_V,
+ "VO Config (%dx%d->%dx%d,flags=%d,'%s',0x%X)\n", sh->disp_w,
+ sh->disp_h, screen_size_x, screen_size_y, vocfg_flags, "MPlayer",
+ out_fmt);
vf->w = sh->disp_w;
vf->h = sh->disp_h;
- if(vf_config_wrapper(vf,sh->disp_w,sh->disp_h,
- screen_size_x,screen_size_y,
- vocfg_flags,
- out_fmt)==0){
-// "MPlayer",out_fmt)){
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CannotInitVO);
- sh->vf_initialized=-1;
- return 0;
+ if (vf_config_wrapper
+ (vf, sh->disp_w, sh->disp_h, screen_size_x, screen_size_y, vocfg_flags,
+ out_fmt) == 0) {
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_CannotInitVO);
+ sh->vf_initialized = -1;
+ return 0;
}
- sh->vf_initialized=1;
+ sh->vf_initialized = 1;
- if (vo_gamma_gamma != 1000)
- set_video_colors(sh, "gamma", vo_gamma_gamma);
- if (vo_gamma_brightness != 1000)
- set_video_colors(sh, "brightness", vo_gamma_brightness);
- if (vo_gamma_contrast != 1000)
- set_video_colors(sh, "contrast", vo_gamma_contrast);
- if (vo_gamma_saturation != 1000)
- set_video_colors(sh, "saturation", vo_gamma_saturation);
- if (vo_gamma_hue != 1000)
- set_video_colors(sh, "hue", vo_gamma_hue);
+ if (opts->vo_gamma_gamma != 1000)
+ set_video_colors(sh, "gamma", opts->vo_gamma_gamma);
+ if (opts->vo_gamma_brightness != 1000)
+ set_video_colors(sh, "brightness", opts->vo_gamma_brightness);
+ if (opts->vo_gamma_contrast != 1000)
+ set_video_colors(sh, "contrast", opts->vo_gamma_contrast);
+ if (opts->vo_gamma_saturation != 1000)
+ set_video_colors(sh, "saturation", opts->vo_gamma_saturation);
+ if (opts->vo_gamma_hue != 1000)
+ set_video_colors(sh, "hue", opts->vo_gamma_hue);
return 1;
}
@@ -336,15 +330,21 @@ csp_again:
// mp_imgflag: buffer requirements (read/write, preserve, stride limits), see mp_image.h
// returns NULL or allocated mp_image_t*
// Note: buffer allocation may be moved to mpcodecs_config_vo() later...
-mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h){
- mp_image_t* mpi=vf_get_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h);
- mpi->x=mpi->y=0;
- return mpi;
+mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,
+ int w, int h)
+{
+ mp_image_t *mpi =
+ vf_get_image(sh->vfilter, sh->codec->outfmt[sh->outfmtidx], mp_imgtype,
+ mp_imgflag, w, h);
+ mpi->x = mpi->y = 0;
+ return mpi;
}
-void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y) {
- struct vf_instance_s* vf = sh->vfilter;
+void mpcodecs_draw_slice(sh_video_t *sh, unsigned char **src, int *stride,
+ int w, int h, int x, int y)
+{
+ struct vf_instance *vf = sh->vfilter;
- if(vf->draw_slice)
- vf->draw_slice(vf,src,stride,w,h,x,y);
+ if (vf->draw_slice)
+ vf->draw_slice(vf, src, stride, w, h, x, y);
}
diff --git a/libmpcodecs/vd.h b/libmpcodecs/vd.h
index a3d77339c4..df71970f7d 100644
--- a/libmpcodecs/vd.h
+++ b/libmpcodecs/vd.h
@@ -8,9 +8,9 @@
typedef mp_codec_info_t vd_info_t;
/* interface of video decoder drivers */
-typedef struct vd_functions_s
+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,9 +18,7 @@ typedef struct vd_functions_s
} vd_functions_t;
// NULL terminated array of all drivers
-extern vd_functions_t* mpcodecs_vd_drivers[];
-
-extern int vd_use_slices;
+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) */
diff --git a/libmpcodecs/vd_dmo.c b/libmpcodecs/vd_dmo.c
index 22682675ca..abce6a9da6 100644
--- a/libmpcodecs/vd_dmo.c
+++ b/libmpcodecs/vd_dmo.c
@@ -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",
diff --git a/libmpcodecs/vd_dshow.c b/libmpcodecs/vd_dshow.c
index 391c59fe94..febdbb4e3f 100644
--- a/libmpcodecs/vd_dshow.c
+++ b/libmpcodecs/vd_dshow.c
@@ -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",
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index e082d2a5a0..78e705318d 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -6,6 +6,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "av_opts.h"
#include "libavutil/common.h"
@@ -14,7 +15,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"FFmpeg's libavcodec codec family",
"ffmpeg",
"A'rpi",
@@ -48,6 +49,7 @@ typedef struct {
int ip_count;
int b_count;
AVRational last_sample_aspect_ratio;
+ int lowres;
} vd_ffmpeg_ctx;
//#ifdef CONFIG_LIBPOSTPROC
@@ -65,52 +67,32 @@ static enum PixelFormat get_format(struct AVCodecContext * avctx,
static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic);
static void mc_release_buffer(AVCodecContext *avctx, AVFrame *pic);
static void mc_render_slice(struct AVCodecContext *s,
- AVFrame *src, int offset[4],
+ const AVFrame *src, int offset[4],
int y, int type, int height);
#endif
-static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT;
-static int lavc_param_error_resilience=2;
-static int lavc_param_error_concealment=3;
-static int lavc_param_gray=0;
-static int lavc_param_vstats=0;
-static int lavc_param_idct_algo=0;
-static int lavc_param_debug=0;
-static int lavc_param_vismv=0;
-static int lavc_param_skip_top=0;
-static int lavc_param_skip_bottom=0;
-static int lavc_param_fast=0;
-static int lavc_param_lowres=0;
-static char *lavc_param_lowres_str=NULL;
-static char *lavc_param_skip_loop_filter_str = NULL;
-static char *lavc_param_skip_idct_str = NULL;
-static char *lavc_param_skip_frame_str = NULL;
-static int lavc_param_threads=1;
-static int lavc_param_bitexact=0;
-static char *lavc_avopt = NULL;
-
const m_option_t lavc_decode_opts_conf[]={
- {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 999999, NULL},
- {"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
- {"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL},
- {"idct", &lavc_param_idct_algo, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
- {"ec", &lavc_param_error_concealment, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
- {"vstats", &lavc_param_vstats, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"debug", &lavc_param_debug, CONF_TYPE_INT, CONF_RANGE, 0, 9999999, NULL},
- {"vismv", &lavc_param_vismv, CONF_TYPE_INT, CONF_RANGE, 0, 9999999, NULL},
- {"st", &lavc_param_skip_top, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL},
- {"sb", &lavc_param_skip_bottom, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL},
+ OPT_INTRANGE("bug", lavc_param.workaround_bugs, 0, -1, 999999),
+ OPT_INTRANGE("er", lavc_param.error_resilience, 0, 0, 99),
+ OPT_FLAG_ON("gray", lavc_param.gray, 0),
+ OPT_INTRANGE("idct", lavc_param.idct_algo, 0, 0, 99),
+ OPT_INTRANGE("ec", lavc_param.error_concealment, 0, 0, 99),
+ OPT_FLAG_ON("vstats", lavc_param.vstats, 0),
+ OPT_INTRANGE("debug", lavc_param.debug, 0, 0, 9999999),
+ OPT_INTRANGE("vismv", lavc_param.vismv, 0, 0, 9999999),
+ OPT_INTRANGE("st", lavc_param.skip_top, 0, 0, 999),
+ OPT_INTRANGE("sb", lavc_param.skip_bottom, 0, 0, 999),
#ifdef CODEC_FLAG2_FAST
- {"fast", &lavc_param_fast, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG2_FAST, NULL},
+ OPT_FLAG_CONSTANTS("fast", lavc_param.fast, 0, 0, CODEC_FLAG2_FAST),
#endif
- {"lowres", &lavc_param_lowres_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"skiploopfilter", &lavc_param_skip_loop_filter_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"skipidct", &lavc_param_skip_idct_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"skipframe", &lavc_param_skip_frame_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"threads", &lavc_param_threads, CONF_TYPE_INT, CONF_RANGE, 1, 8, NULL},
- {"bitexact", &lavc_param_bitexact, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_BITEXACT, NULL},
- {"o", &lavc_avopt, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {NULL, NULL, 0, 0, 0, 0, NULL}
+ OPT_STRING("lowres", lavc_param.lowres_str, 0),
+ OPT_STRING("skiploopfilter", lavc_param.skip_loop_filter_str, 0),
+ OPT_STRING("skipidct", lavc_param.skip_idct_str, 0),
+ OPT_STRING("skipframe", lavc_param.skip_frame_str, 0),
+ OPT_INTRANGE("threads", lavc_param.threads, 0, 1, 8),
+ OPT_FLAG_CONSTANTS("bitexact", lavc_param.bitexact, 0, 0, CODEC_FLAG_BITEXACT),
+ OPT_STRING("o", lavc_param.avopt, 0),
+ {NULL, NULL, 0, 0, 0, 0, NULL}
};
static enum AVDiscard str2AVDiscard(char *str) {
@@ -161,7 +143,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
return CONTROL_UNKNOWN;
}
-void mp_msp_av_log_callback(void* ptr, int level, const char* fmt, va_list vl)
+static void mp_msp_av_log_callback(void* ptr, int level, const char* fmt, va_list vl)
{
static int print_prefix=1;
AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
@@ -213,11 +195,12 @@ void mp_msp_av_log_callback(void* ptr, int level, const char* fmt, va_list vl)
// init driver
static int init(sh_video_t *sh){
+ struct lavc_param *lavc_param = &sh->opts->lavc_param;
AVCodecContext *avctx;
vd_ffmpeg_ctx *ctx;
AVCodec *lavc_codec;
int lowres_w=0;
- int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
+ int do_vis_debug= lavc_param->vismv || (lavc_param->debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
if(!avcodec_initialized){
avcodec_init();
@@ -238,7 +221,7 @@ static int init(sh_video_t *sh){
return 0;
}
- if(vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug)
+ if(sh->opts->vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug)
ctx->do_slices=1;
if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ)
@@ -278,40 +261,40 @@ static int init(sh_video_t *sh){
#ifdef CODEC_FLAG_NOT_TRUNCATED
avctx->flags|= CODEC_FLAG_NOT_TRUNCATED;
#endif
- avctx->flags|= lavc_param_bitexact;
+ avctx->flags|= lavc_param->bitexact;
avctx->width = sh->disp_w;
avctx->height= sh->disp_h;
- avctx->workaround_bugs= lavc_param_workaround_bugs;
- avctx->error_resilience= lavc_param_error_resilience;
- if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY;
+ avctx->workaround_bugs= lavc_param->workaround_bugs;
+ avctx->error_resilience= lavc_param->error_resilience;
+ if(lavc_param->gray) avctx->flags|= CODEC_FLAG_GRAY;
#ifdef CODEC_FLAG2_FAST
- avctx->flags2|= lavc_param_fast;
+ avctx->flags2|= lavc_param->fast;
#endif
avctx->codec_tag= sh->format;
avctx->stream_codec_tag= sh->video.fccHandler;
- avctx->idct_algo= lavc_param_idct_algo;
- avctx->error_concealment= lavc_param_error_concealment;
- avctx->debug= lavc_param_debug;
- if (lavc_param_debug)
+ avctx->idct_algo= lavc_param->idct_algo;
+ avctx->error_concealment= lavc_param->error_concealment;
+ avctx->debug= lavc_param->debug;
+ if (lavc_param->debug)
av_log_set_level(AV_LOG_DEBUG);
- avctx->debug_mv= lavc_param_vismv;
- avctx->skip_top = lavc_param_skip_top;
- avctx->skip_bottom= lavc_param_skip_bottom;
- if(lavc_param_lowres_str != NULL)
+ avctx->debug_mv= lavc_param->vismv;
+ avctx->skip_top = lavc_param->skip_top;
+ avctx->skip_bottom= lavc_param->skip_bottom;
+ if(lavc_param->lowres_str != NULL)
{
- sscanf(lavc_param_lowres_str, "%d,%d", &lavc_param_lowres, &lowres_w);
- if(lavc_param_lowres < 1 || lavc_param_lowres > 16 || (lowres_w > 0 && avctx->width < lowres_w))
- lavc_param_lowres = 0;
- avctx->lowres = lavc_param_lowres;
+ sscanf(lavc_param->lowres_str, "%d,%d", &ctx->lowres, &lowres_w);
+ if(ctx->lowres < 1 || ctx->lowres > 16 || (lowres_w > 0 && avctx->width < lowres_w))
+ ctx->lowres = 0;
+ avctx->lowres = ctx->lowres;
}
- avctx->skip_loop_filter = str2AVDiscard(lavc_param_skip_loop_filter_str);
- avctx->skip_idct = str2AVDiscard(lavc_param_skip_idct_str);
- avctx->skip_frame = str2AVDiscard(lavc_param_skip_frame_str);
+ avctx->skip_loop_filter = str2AVDiscard(lavc_param->skip_loop_filter_str);
+ avctx->skip_idct = str2AVDiscard(lavc_param->skip_idct_str);
+ avctx->skip_frame = str2AVDiscard(lavc_param->skip_frame_str);
- if(lavc_avopt){
- if(parse_avopts(avctx, lavc_avopt) < 0){
- mp_msg(MSGT_DECVIDEO,MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", lavc_avopt);
+ if(lavc_param->avopt){
+ if(parse_avopts(avctx, lavc_param->avopt) < 0){
+ mp_msg(MSGT_DECVIDEO,MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", lavc_param->avopt);
uninit(sh);
return 0;
}
@@ -403,8 +386,8 @@ static int init(sh_video_t *sh){
if(sh->bih)
avctx->bits_per_sample= sh->bih->biBitCount;
- if(lavc_param_threads > 1)
- avcodec_thread_init(avctx, lavc_param_threads);
+ if(lavc_param->threads > 1)
+ avcodec_thread_init(avctx, lavc_param->threads);
/* open it */
if (avcodec_open(avctx, lavc_codec) < 0) {
mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec);
@@ -420,7 +403,7 @@ static void uninit(sh_video_t *sh){
vd_ffmpeg_ctx *ctx = sh->context;
AVCodecContext *avctx = ctx->avctx;
- if(lavc_param_vstats){
+ if(sh->opts->lavc_param.vstats){
int i;
for(i=1; i<32; i++){
mp_msg(MSGT_DECVIDEO, MSGL_INFO,"QP: %d, count: %d\n", i, ctx->qp_stat[i]);
@@ -447,14 +430,15 @@ static void uninit(sh_video_t *sh){
}
static void draw_slice(struct AVCodecContext *s,
- AVFrame *src, int offset[4],
+ const AVFrame *src, int offset[4],
int y, int type, int height){
sh_video_t * sh = s->opaque;
uint8_t *source[3]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2]};
#if 0
int start=0, i;
int width= s->width;
- int skip_stride= ((width<<lavc_param_lowres)+15)>>4;
+ vd_ffmpeg_ctx *ctx = sh->context;
+ int skip_stride= ((width << ctx->lowres)+15)>>4;
uint8_t *skip= &s->coded_frame->mbskip_table[(y>>4)*skip_stride];
int threshold= s->coded_frame->age;
if(s->pict_type!=B_TYPE){
@@ -492,8 +476,8 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){
// if sh->ImageDesc is non-NULL, it means we decode QuickTime(tm) video.
// use dimensions from BIH to avoid black borders at the right and bottom.
if (sh->bih && sh->ImageDesc) {
- width = sh->bih->biWidth>>lavc_param_lowres;
- height = sh->bih->biHeight>>lavc_param_lowres;
+ width = sh->bih->biWidth >> ctx->lowres;
+ height = sh->bih->biHeight >> ctx->lowres;
}
// it is possible another vo buffers to be used after vo config()
@@ -720,7 +704,7 @@ typedef struct dp_hdr_s {
uint32_t chunktab; // offset to chunk offset array
} dp_hdr_t;
-void swap_palette(void *pal) {
+static void swap_palette(void *pal) {
int i;
uint32_t *p = pal;
for (i = 0; i < AVPALETTE_COUNT; i++)
@@ -734,6 +718,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
vd_ffmpeg_ctx *ctx = sh->context;
AVFrame *pic= ctx->pic;
AVCodecContext *avctx = ctx->avctx;
+ struct lavc_param *lavc_param = &sh->opts->lavc_param;
mp_image_t* mpi=NULL;
int dr1= ctx->do_dr1;
@@ -764,7 +749,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|| sh->format == mmioFOURCC('R', 'V', '4', '0'))
{
dp_hdr_t *hdr= (dp_hdr_t*)data;
- uint32_t *offsets = (uint32_t*)(data + hdr->chunktab);
+ uint32_t *offsets = (uint32_t*)((char *)data + hdr->chunktab);
uint8_t *offstab = av_malloc((hdr->chunks+1) * 8);
uint8_t *buf = data;
int chunks = hdr->chunks;
@@ -772,7 +757,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
buf[0] = chunks;
memcpy(offstab, offsets, (chunks + 1) * 8);
- memmove(buf + 1 + (chunks + 1) * 8, data + sizeof(dp_hdr_t), dlen);
+ memmove(buf + 1 + (chunks + 1) * 8, (char *)data + sizeof(dp_hdr_t), dlen);
memcpy(buf + 1, offstab, (chunks + 1) * 8);
av_free(offstab);
}
@@ -786,7 +771,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
//printf("repeat: %d\n", pic->repeat_pict);
//-- vstats generation
- while(lavc_param_vstats){ // always one time loop
+ while(lavc_param->vstats){ // always one time loop
static FILE *fvstats=NULL;
char filename[20];
static long long int all_len=0;
@@ -805,7 +790,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
fvstats = fopen(filename,"w");
if(!fvstats) {
perror("fopen");
- lavc_param_vstats=0; // disable block
+ lavc_param->vstats=0; // disable block
break;
/*exit(1);*/
}
@@ -814,8 +799,8 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
// average MB quantizer
{
int x, y;
- int w = ((avctx->width << lavc_param_lowres)+15) >> 4;
- int h = ((avctx->height << lavc_param_lowres)+15) >> 4;
+ int w = ((avctx->width << ctx->lowres)+15) >> 4;
+ int h = ((avctx->height << ctx->lowres)+15) >> 4;
int8_t *q = pic->qscale_table;
for( y = 0; y < h; y++ ) {
for( x = 0; x < w; x++ )
@@ -1057,7 +1042,7 @@ static void mc_release_buffer(AVCodecContext *avctx, AVFrame *pic){
}
static void mc_render_slice(struct AVCodecContext *s,
- AVFrame *src, int offset[4],
+ const AVFrame *src, int offset[4],
int y, int type, int height){
int width= s->width;
sh_video_t * sh = s->opaque;
diff --git a/libmpcodecs/vd_hmblck.c b/libmpcodecs/vd_hmblck.c
index 18f26f45e1..096f081d18 100644
--- a/libmpcodecs/vd_hmblck.c
+++ b/libmpcodecs/vd_hmblck.c
@@ -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",
diff --git a/libmpcodecs/vd_ijpg.c b/libmpcodecs/vd_ijpg.c
index a54b339c8f..3338067872 100644
--- a/libmpcodecs/vd_ijpg.c
+++ b/libmpcodecs/vd_ijpg.c
@@ -16,7 +16,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"JPEG Images decoder",
"ijpg",
"Pontscho",
@@ -93,7 +93,7 @@ METHODDEF(void) skip_input_data (j_decompress_ptr cinfo, long num_bytes)
METHODDEF(void) term_source (j_decompress_ptr cinfo) { }
-GLOBAL(void) jpeg_buf_src ( j_decompress_ptr cinfo, char * inbuf,int bufsize )
+static void jpeg_buf_src ( j_decompress_ptr cinfo, char * inbuf,int bufsize )
{
my_src_ptr src;
if (cinfo->src == NULL) cinfo->src=malloc( sizeof( my_source_mgr ) );
diff --git a/libmpcodecs/vd_internal.h b/libmpcodecs/vd_internal.h
index d04903e26a..dee8448cb1 100644
--- a/libmpcodecs/vd_internal.h
+++ b/libmpcodecs/vd_internal.h
@@ -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,\
diff --git a/libmpcodecs/vd_libdv.c b/libmpcodecs/vd_libdv.c
index f7c1e4db03..8f5c6996ed 100644
--- a/libmpcodecs/vd_libdv.c
+++ b/libmpcodecs/vd_libdv.c
@@ -18,7 +18,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"Raw DV Video Decoder",
"libdv",
diff --git a/libmpcodecs/vd_libmpeg2.c b/libmpcodecs/vd_libmpeg2.c
index 2847491e55..3bd17a4e0e 100644
--- a/libmpcodecs/vd_libmpeg2.c
+++ b/libmpcodecs/vd_libmpeg2.c
@@ -2,14 +2,14 @@
#include <stdlib.h>
#include "config.h"
-
+#include "options.h"
#include "mp_msg.h"
#include "vd_internal.h"
//#undef MPEG12_POSTPROC
-static vd_info_t info =
+static const vd_info_t info =
{
"MPEG 1/2 Video decoder libmpeg2-v0.4.0b",
"libmpeg2",
@@ -223,7 +223,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
}
mpeg2_skip(mpeg2dec, 0); //mpeg2skip skips frames until set again to 0
- use_callback = (!framedrop && vd_use_slices &&
+ use_callback = (!framedrop && sh->opts->vd_use_slices &&
(info->current_picture->flags&PIC_FLAG_PROGRESSIVE_FRAME)) ?
MP_IMGFLAG_DRAW_CALLBACK:0;
diff --git a/libmpcodecs/vd_lzo.c b/libmpcodecs/vd_lzo.c
index a2e92a5301..a49a418e26 100644
--- a/libmpcodecs/vd_lzo.c
+++ b/libmpcodecs/vd_lzo.c
@@ -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",
diff --git a/libmpcodecs/vd_mpegpes.c b/libmpcodecs/vd_mpegpes.c
index 033df36fa6..598b1203ba 100644
--- a/libmpcodecs/vd_mpegpes.c
+++ b/libmpcodecs/vd_mpegpes.c
@@ -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",
diff --git a/libmpcodecs/vd_mpng.c b/libmpcodecs/vd_mpng.c
index f4af973e8d..cab4cf66d4 100644
--- a/libmpcodecs/vd_mpng.c
+++ b/libmpcodecs/vd_mpng.c
@@ -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",
diff --git a/libmpcodecs/vd_mtga.c b/libmpcodecs/vd_mtga.c
index c9e0c24555..61022c71c8 100644
--- a/libmpcodecs/vd_mtga.c
+++ b/libmpcodecs/vd_mtga.c
@@ -16,7 +16,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"TGA Images decoder",
"mtga",
diff --git a/libmpcodecs/vd_null.c b/libmpcodecs/vd_null.c
index a82a3ba036..34392962b1 100644
--- a/libmpcodecs/vd_null.c
+++ b/libmpcodecs/vd_null.c
@@ -6,7 +6,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"Null video decoder",
"null",
diff --git a/libmpcodecs/vd_nuv.c b/libmpcodecs/vd_nuv.c
index cb89ddb391..21ed42ec1d 100644
--- a/libmpcodecs/vd_nuv.c
+++ b/libmpcodecs/vd_nuv.c
@@ -6,7 +6,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"NuppelVideo decoder",
"nuv",
"A'rpi",
diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c
index e67549933c..9b5ad87165 100644
--- a/libmpcodecs/vd_qtvideo.c
+++ b/libmpcodecs/vd_qtvideo.c
@@ -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",
diff --git a/libmpcodecs/vd_raw.c b/libmpcodecs/vd_raw.c
index d025fd0060..7eeda88c00 100644
--- a/libmpcodecs/vd_raw.c
+++ b/libmpcodecs/vd_raw.c
@@ -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",
diff --git a/libmpcodecs/vd_realvid.c b/libmpcodecs/vd_realvid.c
index a54d11b853..dde327d925 100644
--- a/libmpcodecs/vd_realvid.c
+++ b/libmpcodecs/vd_realvid.c
@@ -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",
diff --git a/libmpcodecs/vd_sgi.c b/libmpcodecs/vd_sgi.c
index 1496b041e3..e4e72285b9 100644
--- a/libmpcodecs/vd_sgi.c
+++ b/libmpcodecs/vd_sgi.c
@@ -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",
diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c
index 3ed2f88354..69beb08198 100644
--- a/libmpcodecs/vd_theora.c
+++ b/libmpcodecs/vd_theora.c
@@ -9,7 +9,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"Theora/VP3",
"theora",
"David Kuehling",
diff --git a/libmpcodecs/vd_vfw.c b/libmpcodecs/vd_vfw.c
index f21a6d2c82..e74007803e 100644
--- a/libmpcodecs/vd_vfw.c
+++ b/libmpcodecs/vd_vfw.c
@@ -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",
diff --git a/libmpcodecs/vd_xanim.c b/libmpcodecs/vd_xanim.c
index 05f8945bbb..eb06eef122 100644
--- a/libmpcodecs/vd_xanim.c
+++ b/libmpcodecs/vd_xanim.c
@@ -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",
diff --git a/libmpcodecs/vd_xvid4.c b/libmpcodecs/vd_xvid4.c
index c144043946..54d3a2a563 100644
--- a/libmpcodecs/vd_xvid4.c
+++ b/libmpcodecs/vd_xvid4.c
@@ -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",
diff --git a/libmpcodecs/vd_zrmjpeg.c b/libmpcodecs/vd_zrmjpeg.c
index c33c71778a..6f8ce58fcf 100644
--- a/libmpcodecs/vd_zrmjpeg.c
+++ b/libmpcodecs/vd_zrmjpeg.c
@@ -19,7 +19,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"Zoran MJPEG Video passthrough",
"zrmjpeg",
diff --git a/libmpcodecs/ve.c b/libmpcodecs/ve.c
index dd7f650ba8..9d083f5d86 100644
--- a/libmpcodecs/ve.c
+++ b/libmpcodecs/ve.c
@@ -51,8 +51,8 @@ static vf_info_t* encoder_list[]={
NULL
};
-vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args){
+vf_instance_t* vf_open_encoder(struct MPOpts *opts, vf_instance_t* next, const char *name, char *args){
char* vf_args[] = { "_oldargs_", args, NULL };
- return vf_open_plugin(encoder_list,next,name,vf_args);
+ return vf_open_plugin(opts, encoder_list,next,name,vf_args);
}
diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c
index 9b898fa236..1904330ac3 100644
--- a/libmpcodecs/ve_lavc.c
+++ b/libmpcodecs/ve_lavc.c
@@ -321,9 +321,9 @@ struct vf_priv_s {
#define mux_v (vf->priv->mux)
#define lavc_venc_context (vf->priv->context)
-static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts);
+static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts);
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int size, i;
@@ -713,7 +713,7 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch(request){
case VFCTRL_FLUSH_FRAMES:
@@ -725,7 +725,7 @@ static int control(struct vf_instance_s* vf, int request, void* data){
}
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_IYUV:
@@ -762,7 +762,7 @@ static double psnr(double d){
return -10.0*log(d)/log(10);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
AVFrame *pic= vf->priv->pic;
pic->data[0]=mpi->planes[0];
@@ -785,7 +785,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return encode_frame(vf, pic, pts) >= 0;
}
-static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts){
+static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts){
const char pict_type_char[5]= {'?', 'I', 'P', 'B', 'S'};
int out_size;
double dts;
@@ -890,7 +890,7 @@ static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts){
return out_size;
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(lavc_param_psnr){
double f= lavc_venc_context->width*lavc_venc_context->height*255.0*255.0;
diff --git a/libmpcodecs/ve_libdv.c b/libmpcodecs/ve_libdv.c
index fab9628d3c..da0f261d58 100644
--- a/libmpcodecs/ve_libdv.c
+++ b/libmpcodecs/ve_libdv.c
@@ -37,7 +37,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -59,18 +59,18 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_YUY2) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
if(fmt==IMGFMT_RGB24) return VFCAP_CSP_SUPPORTED;
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
dv_encode_full_frame(vf->priv->enc, mpi->planes,
(mpi->flags&MP_IMGFLAG_YUV) ? e_dv_color_yuv : e_dv_color_rgb,
diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c
index 0b670179cd..91473627da 100644
--- a/libmpcodecs/ve_nuv.c
+++ b/libmpcodecs/ve_nuv.c
@@ -68,7 +68,7 @@ m_option_t nuvopts_conf[]={
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -88,17 +88,17 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_I420) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
struct rtframeheader* ench = (struct rtframeheader*)vf->priv->buffer;
uint8_t* data = vf->priv->buffer + FRAMEHEADERSIZE;
uint8_t* zdata = vf->priv->zbuffer + FRAMEHEADERSIZE;
@@ -180,7 +180,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return 1;
}
-static void uninit(struct vf_instance_s* vf) {
+static void uninit(struct vf_instance* vf) {
if(vf->priv->buffer)
free(vf->priv->buffer);
diff --git a/libmpcodecs/ve_qtvideo.c b/libmpcodecs/ve_qtvideo.c
index a41cb00e96..fc9e1ff531 100644
--- a/libmpcodecs/ve_qtvideo.c
+++ b/libmpcodecs/ve_qtvideo.c
@@ -121,7 +121,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
// OSErr cres;
@@ -159,19 +159,19 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_YUY2) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
return 0;
}
static int codec_initialized = 0;
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
OSErr cres;
long framesizemax;
diff --git a/libmpcodecs/ve_raw.c b/libmpcodecs/ve_raw.c
index 9cbc75c256..225fd3bfaf 100644
--- a/libmpcodecs/ve_raw.c
+++ b/libmpcodecs/ve_raw.c
@@ -26,7 +26,7 @@ struct vf_priv_s {
};
#define mux_v (vf->priv->mux)
-static int set_format(struct vf_instance_s *vf, unsigned int fmt) {
+static int set_format(struct vf_instance *vf, unsigned int fmt) {
if (!force_fourcc)
mux_v->bih->biCompression = fmt;
@@ -82,7 +82,7 @@ static int set_format(struct vf_instance_s *vf, unsigned int fmt) {
}
-static int config(struct vf_instance_s *vf,
+static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -97,11 +97,11 @@ static int config(struct vf_instance_s *vf,
return 1;
}
-static int control(struct vf_instance_s *vf, int request, void *data) {
+static int control(struct vf_instance *vf, int request, void *data) {
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s *vf, unsigned int fmt) {
+static int query_format(struct vf_instance *vf, unsigned int fmt) {
if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt))
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
switch (fmt) {
@@ -122,7 +122,7 @@ static int query_format(struct vf_instance_s *vf, unsigned int fmt) {
return 0;
}
-static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts) {
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) {
mux_v->buffer = mpi->planes[0];
muxer_write_chunk(mux_v, mpi->width*mpi->height*mux_v->bih->biBitCount/8, 0x10, pts, pts);
return 1;
diff --git a/libmpcodecs/ve_vfw.c b/libmpcodecs/ve_vfw.c
index d9425601bd..ddceb428a2 100644
--- a/libmpcodecs/ve_vfw.c
+++ b/libmpcodecs/ve_vfw.c
@@ -259,7 +259,7 @@ static int vfw_encode_frame(BITMAPINFOHEADER* biOutput,void* OutBuf,
#define mux_v (vf->priv->mux)
#define vfw_bih (vf->priv->bih)
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -277,17 +277,17 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_BGR24) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_FLIPPED;
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
long flags=0;
int ret;
// flip_upside_down(vo_image_ptr,vo_image_ptr,3*vo_w,vo_h); // dirty hack
@@ -298,7 +298,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return 1;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
HRESULT ret;
diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c
index 04d0bd342a..724619ad04 100644
--- a/libmpcodecs/ve_x264.c
+++ b/libmpcodecs/ve_x264.c
@@ -73,8 +73,8 @@ static int encode_nals(uint8_t *buf, int size, x264_nal_t *nals, int nnal){
return p - buf;
}
-static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts);
-static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in);
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts);
+static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in);
void x264enc_set_param(const m_option_t* opt, char* arg)
{
@@ -148,7 +148,7 @@ void x264enc_set_param(const m_option_t* opt, char* arg)
}
}
-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) {
+static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) {
h264_module_t *mod=(h264_module_t*)vf->priv;
if(parse_error)
@@ -215,7 +215,7 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void *data)
+static int control(struct vf_instance* vf, int request, void *data)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
switch(request){
@@ -228,7 +228,7 @@ static int control(struct vf_instance_s* vf, int request, void *data)
}
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt) {
case IMGFMT_I420:
@@ -247,7 +247,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
int i;
@@ -265,7 +265,7 @@ static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts)
return encode_frame(vf, &mod->pic) >= 0;
}
-static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in)
+static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
x264_picture_t pic_out;
@@ -296,7 +296,7 @@ static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in)
return i_size;
}
-static void uninit(struct vf_instance_s *vf)
+static void uninit(struct vf_instance *vf)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
if (mod->x264)
diff --git a/libmpcodecs/ve_xvid4.c b/libmpcodecs/ve_xvid4.c
index 6b50885647..3e400eb9bd 100644
--- a/libmpcodecs/ve_xvid4.c
+++ b/libmpcodecs/ve_xvid4.c
@@ -374,7 +374,7 @@ static const char *errorstring(int err);
*==========================================================================*/
static int
-config(struct vf_instance_s* vf,
+config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -439,7 +439,7 @@ config(struct vf_instance_s* vf,
*==========================================================================*/
static void
-uninit(struct vf_instance_s* vf)
+uninit(struct vf_instance* vf)
{
xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
@@ -477,7 +477,7 @@ uninit(struct vf_instance_s* vf)
*==========================================================================*/
static int
-control(struct vf_instance_s* vf, int request, void* data)
+control(struct vf_instance* vf, int request, void* data)
{
xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
@@ -495,7 +495,7 @@ xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
*==========================================================================*/
static int
-query_format(struct vf_instance_s* vf, unsigned int fmt)
+query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YV12:
@@ -514,7 +514,7 @@ query_format(struct vf_instance_s* vf, unsigned int fmt)
*==========================================================================*/
static int
-put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
int size;
xvid_enc_stats_t stats;
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index 37ada3c59e..085e2b641b 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -195,7 +195,6 @@ static const vf_info_t* const filter_list[]={
};
// For the vf option
-m_obj_settings_t* vf_settings = NULL;
const m_obj_list_t vf_obj_list = {
(void**)filter_list,
M_ST_OFF(vf_info_t,name),
@@ -421,12 +420,12 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype,
//============================================================================
// By default vf doesn't accept MPEGPES
-static int vf_default_query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int vf_default_query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt == IMGFMT_MPEGPES) return 0;
return vf_next_query_format(vf,fmt);
}
-vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args){
+vf_instance_t* vf_open_plugin(struct MPOpts *opts, const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args){
vf_instance_t* vf;
int i;
for(i=0;;i++){
@@ -436,8 +435,8 @@ vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t
}
if(!strcmp(filter_list[i]->name,name)) break;
}
- vf=malloc(sizeof(vf_instance_t));
- memset(vf,0,sizeof(vf_instance_t));
+ vf = calloc(1, sizeof *vf);
+ vf->opts = opts;
vf->info=filter_list[i];
vf->next=next;
vf->config=vf_next_config;
@@ -465,7 +464,7 @@ vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t
return NULL;
}
-vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args){
+vf_instance_t* vf_open_filter(struct MPOpts *opts, vf_instance_t* next, const char *name, char **args){
if(args && strcmp(args[0],"_oldargs_")) {
int i,l = 0;
for(i = 0 ; args && args[2*i] ; i++)
@@ -487,7 +486,7 @@ vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args
mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter
"[%s]\n", name);
}
- return vf_open_plugin(filter_list,next,name,args);
+ return vf_open_plugin(opts, filter_list,next,name,args);
}
/**
@@ -498,11 +497,12 @@ vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args
* \return pointer to the filter instance that was created.
*/
vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args) {
+ struct MPOpts *opts = (*vf)->opts;
vf_instance_t *vo, *prev = NULL, *new;
// Find the last filter (should be vf_vo)
for (vo = *vf; vo->next; vo = vo->next)
prev = vo;
- new = vf_open_filter(vo, name, args);
+ new = vf_open_filter(opts, vo, name, args);
if (prev)
prev->next = new;
else
@@ -514,6 +514,7 @@ vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args) {
unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred){
vf_instance_t* vf=*vfp;
+ struct MPOpts *opts = vf->opts;
const unsigned int* p;
unsigned int best=0;
int ret;
@@ -527,7 +528,7 @@ unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned
if(best) return best; // bingo, they have common csp!
// ok, then try with scale:
if(vf->info == &vf_info_scale) return 0; // avoid infinite recursion!
- vf=vf_open_filter(vf,"scale",NULL);
+ vf=vf_open_filter(opts, vf,"scale",NULL);
if(!vf) return 0; // failed to init "scale"
// try the preferred csp first:
if(preferred && vf->query_format(vf,preferred)) best=preferred; else
@@ -596,7 +597,7 @@ int vf_output_queued_frame(vf_instance_t *vf)
* are unchanged, and returns either success or error.
*
*/
-int vf_config_wrapper(struct vf_instance_s* vf,
+int vf_config_wrapper(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -619,9 +620,10 @@ int vf_config_wrapper(struct vf_instance_s* vf,
return r;
}
-int vf_next_config(struct vf_instance_s* vf,
+int vf_next_config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int voflags, unsigned int outfmt){
+ struct MPOpts *opts = vf->opts;
int miss;
int flags=vf->next->query_format(vf->next,outfmt);
if(!flags){
@@ -629,7 +631,7 @@ int vf_next_config(struct vf_instance_s* vf,
// let's insert the 'scale' filter, it does the job for us:
vf_instance_t* vf2;
if(vf->next->info==&vf_info_scale) return 0; // scale->scale
- vf2=vf_open_filter(vf->next,"scale",NULL);
+ vf2=vf_open_filter(opts, vf->next,"scale",NULL);
if(!vf2) return 0; // shouldn't happen!
vf->next=vf2;
flags=vf->next->query_format(vf->next,outfmt);
@@ -643,7 +645,7 @@ int vf_next_config(struct vf_instance_s* vf,
if(miss&VFCAP_ACCEPT_STRIDE){
// vf requires stride support but vf->next doesn't support it!
// let's insert the 'expand' filter, it does the job for us:
- vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL);
+ vf_instance_t* vf2=vf_open_filter(opts, vf->next,"expand",NULL);
if(!vf2) return 0; // shouldn't happen!
vf->next=vf2;
}
@@ -651,21 +653,21 @@ int vf_next_config(struct vf_instance_s* vf,
return vf_config_wrapper(vf->next,width,height,d_width,d_height,voflags,outfmt);
}
-int vf_next_control(struct vf_instance_s* vf, int request, void* data){
+int vf_next_control(struct vf_instance* vf, int request, void* data){
return vf->next->control(vf->next,request,data);
}
-int vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt){
+int vf_next_query_format(struct vf_instance* vf, unsigned int fmt){
int flags=vf->next->query_format(vf->next,fmt);
if(flags) flags|=vf->default_caps;
return flags;
}
-int vf_next_put_image(struct vf_instance_s* vf,mp_image_t *mpi, double pts){
+int vf_next_put_image(struct vf_instance* vf,mp_image_t *mpi, double pts){
return vf->next->put_image(vf->next,mpi, pts);
}
-void vf_next_draw_slice(struct vf_instance_s* vf,unsigned char** src, int * stride,int w, int h, int x, int y){
+void vf_next_draw_slice(struct vf_instance* vf,unsigned char** src, int * stride,int w, int h, int x, int y){
if (vf->next->draw_slice) {
vf->next->draw_slice(vf->next,src,stride,w,h,x,y);
return;
@@ -689,7 +691,10 @@ void vf_next_draw_slice(struct vf_instance_s* vf,unsigned char** src, int * stri
//============================================================================
-vf_instance_t* append_filters(vf_instance_t* last){
+vf_instance_t *append_filters(vf_instance_t* last,
+ struct m_obj_settings *vf_settings)
+{
+ struct MPOpts *opts = last->opts;
vf_instance_t* vf;
int i;
@@ -699,7 +704,7 @@ vf_instance_t* append_filters(vf_instance_t* last){
/* NOP */;
for(i-- ; i >= 0 ; i--) {
//printf("Open filter %s\n",vf_settings[i].name);
- vf = vf_open_filter(last,vf_settings[i].name,vf_settings[i].attribs);
+ vf = vf_open_filter(opts, last,vf_settings[i].name,vf_settings[i].attribs);
if(vf) last=vf;
}
}
diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h
index 27a48eadf2..504c616a73 100644
--- a/libmpcodecs/vf.h
+++ b/libmpcodecs/vf.h
@@ -3,7 +3,8 @@
#include "mp_image.h"
-struct vf_instance_s;
+struct MPOpts;
+struct vf_instance;
struct vf_priv_s;
typedef struct vf_info_s {
@@ -11,7 +12,7 @@ typedef struct vf_info_s {
const char *name;
const char *author;
const char *comment;
- int (*open)(struct vf_instance_s* vf,char* args);
+ int (*open)(struct vf_instance* vf,char* args);
// Ptr to a struct dscribing the options
const void* opts;
} vf_info_t;
@@ -28,27 +29,27 @@ typedef struct vf_format_context_t {
int orig_width, orig_height, orig_fmt;
} vf_format_context_t;
-typedef struct vf_instance_s {
+typedef struct vf_instance {
const vf_info_t* info;
// funcs:
- int (*config)(struct vf_instance_s* vf,
+ int (*config)(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt);
- int (*control)(struct vf_instance_s* vf,
+ int (*control)(struct vf_instance* vf,
int request, void* data);
- int (*query_format)(struct vf_instance_s* vf,
+ int (*query_format)(struct vf_instance* vf,
unsigned int fmt);
- void (*get_image)(struct vf_instance_s* vf,
+ void (*get_image)(struct vf_instance* vf,
mp_image_t *mpi);
- int (*put_image)(struct vf_instance_s* vf,
+ int (*put_image)(struct vf_instance* vf,
mp_image_t *mpi, double pts);
- void (*start_slice)(struct vf_instance_s* vf,
+ void (*start_slice)(struct vf_instance* vf,
mp_image_t *mpi);
- void (*draw_slice)(struct vf_instance_s* vf,
+ void (*draw_slice)(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y);
- void (*uninit)(struct vf_instance_s* vf);
+ void (*uninit)(struct vf_instance* vf);
- int (*continue_buffered_image)(struct vf_instance_s* vf);
+ int (*continue_buffered_image)(struct vf_instance* vf);
// caps:
unsigned int default_caps; // used by default query_format()
unsigned int default_reqs; // used by default config()
@@ -56,9 +57,10 @@ typedef struct vf_instance_s {
int w, h;
vf_image_context_t imgctx;
vf_format_context_t fmt;
- struct vf_instance_s* next;
+ struct vf_instance* next;
mp_image_t *dmpi;
struct vf_priv_s* priv;
+ struct MPOpts *opts;
} vf_instance_t;
// control codes:
@@ -86,6 +88,9 @@ typedef struct vf_seteq_s
#define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/
#define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
#define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
+/* Hack to make the OSD state object available to vf_expand which accesses
+ * the OSD state outside of normal OSD draw time. */
+#define VFCTRL_SET_OSD_OBJ 20
#include "vfcap.h"
@@ -97,10 +102,10 @@ typedef struct vf_seteq_s
void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h);
-vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
-vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args);
+vf_instance_t* vf_open_plugin(struct MPOpts *opts, const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
+vf_instance_t* vf_open_filter(struct MPOpts *opts, vf_instance_t* next, const char *name, char **args);
vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
-vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args);
+vf_instance_t* vf_open_encoder(struct MPOpts *opts, vf_instance_t* next, const char *name, char *args);
unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred);
void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src);
@@ -108,20 +113,21 @@ void vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
int vf_output_queued_frame(vf_instance_t *vf);
// default wrappers:
-int vf_next_config(struct vf_instance_s* vf,
+int vf_next_config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt);
-int vf_next_control(struct vf_instance_s* vf, int request, void* data);
-int vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt);
-int vf_next_put_image(struct vf_instance_s* vf,mp_image_t *mpi, double pts);
-void vf_next_draw_slice (struct vf_instance_s* vf, unsigned char** src, int* stride, int w,int h, int x, int y);
+int vf_next_control(struct vf_instance* vf, int request, void* data);
+int vf_next_query_format(struct vf_instance* vf, unsigned int fmt);
+int vf_next_put_image(struct vf_instance* vf,mp_image_t *mpi, double pts);
+void vf_next_draw_slice (struct vf_instance* vf, unsigned char** src, int* stride, int w,int h, int x, int y);
-vf_instance_t* append_filters(vf_instance_t* last);
+struct m_obj_settings;
+vf_instance_t* append_filters(vf_instance_t* last, struct m_obj_settings *vf_settings);
void vf_uninit_filter(vf_instance_t* vf);
void vf_uninit_filter_chain(vf_instance_t* vf);
-int vf_config_wrapper(struct vf_instance_s* vf,
+int vf_config_wrapper(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt);
diff --git a/libmpcodecs/vf_1bpp.c b/libmpcodecs/vf_1bpp.c
index 873e431855..c4fd04c338 100644
--- a/libmpcodecs/vf_1bpp.c
+++ b/libmpcodecs/vf_1bpp.c
@@ -40,7 +40,7 @@ static const unsigned int bgr_list[]={
0
};
-static unsigned int find_best(struct vf_instance_s* vf){
+static unsigned int find_best(struct vf_instance* vf){
unsigned int best=0;
int ret;
const unsigned int* p=bgr_list;
@@ -60,7 +60,7 @@ struct vf_priv_s {
unsigned int fmt;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if (!vf->priv->fmt)
@@ -103,7 +103,7 @@ static void convert(mp_image_t *mpi, mp_image_t *dmpi, int value0, int value1,in
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -154,7 +154,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
int best;
if(fmt!=IMGFMT_RGB1 && fmt!=IMGFMT_BGR1) return 0;
best=find_best(vf);
diff --git a/libmpcodecs/vf_2xsai.c b/libmpcodecs/vf_2xsai.c
index 97a0182767..7405606697 100644
--- a/libmpcodecs/vf_2xsai.c
+++ b/libmpcodecs/vf_2xsai.c
@@ -25,7 +25,7 @@ static int PixelsPerMask = 2;
#define makecol(r,g,b) (r+(g<<8)+(b<<16))
#define makecol_depth(d,r,g,b) (r+(g<<8)+(b<<16))
-int Init_2xSaI(int d)
+static int Init_2xSaI(int d)
{
int minr = 0, ming = 0, minb = 0;
@@ -77,7 +77,7 @@ int Init_2xSaI(int d)
+ ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask)
-void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch,
+static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch,
uint8_t *dst, uint32_t dst_pitch,
uint32_t width, uint32_t height, int sbpp) {
@@ -262,7 +262,7 @@ void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch,
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -271,7 +271,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,2*width,2*height,2*d_width,2*d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -288,7 +288,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
// case IMGFMT_BGR15:
// case IMGFMT_BGR16:
diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c
index f33aba44b7..30bdcb0149 100644
--- a/libmpcodecs/vf_ass.c
+++ b/libmpcodecs/vf_ass.c
@@ -31,6 +31,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -65,33 +66,34 @@ static const struct vf_priv_s {
ass_renderer_t* ass_priv;
unsigned char* planes[3];
- unsigned char* dirty_rows;
+ struct line_limits {
+ uint16_t start;
+ uint16_t end;
+ } *line_limits;
} vf_priv_dflt;
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
extern ass_track_t* ass_track;
extern float sub_delay;
extern int sub_visibility;
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
+ struct MPOpts *opts = vf->opts;
if (outfmt == IMGFMT_IF09) return 0;
vf->priv->outh = height + ass_top_margin + ass_bottom_margin;
vf->priv->outw = width;
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if (!opts->screen_size_x && !opts->screen_size_y) {
d_width = d_width * vf->priv->outw / width;
d_height = d_height * vf->priv->outh / height;
}
vf->priv->planes[1] = malloc(vf->priv->outw * vf->priv->outh);
vf->priv->planes[2] = malloc(vf->priv->outw * vf->priv->outh);
- vf->priv->dirty_rows = malloc(vf->priv->outh);
+ vf->priv->line_limits = malloc((vf->priv->outh + 1) / 2 * sizeof(*vf->priv->line_limits));
if (vf->priv->ass_priv) {
ass_configure(vf->priv->ass_priv, vf->priv->outw, vf->priv->outh, 0);
@@ -101,7 +103,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf, vf->priv->outw, vf->priv->outh, d_width, d_height, flags, outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
if(mpi->type == MP_IMGTYPE_IPB) return;
if(mpi->flags & MP_IMGFLAG_PRESERVE) return;
@@ -160,7 +162,7 @@ static void blank(mp_image_t *mpi, int y1, int y2)
}
}
-static int prepare_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static int prepare_image(struct vf_instance* vf, mp_image_t *mpi)
{
if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
vf->dmpi = mpi->priv;
@@ -205,55 +207,58 @@ static int prepare_image(struct vf_instance_s* vf, mp_image_t *mpi)
return 0;
}
+static void update_limits(struct vf_instance *vf, int starty, int endy,
+ int startx, int endx)
+{
+ starty >>= 1;
+ endy = (endy + 1) >> 1;
+ startx >>= 1;
+ endx = (endx + 1) >> 1;
+ for (int i = starty; i < endy; i++) {
+ struct line_limits *ll = vf->priv->line_limits + i;
+ if (startx < ll->start)
+ ll->start = startx;
+ if (endx > ll->end)
+ ll->end = endx;
+ }
+}
+
/**
* \brief Copy specified rows from render_context.dmpi to render_context.planes, upsampling to 4:4:4
*/
-static void copy_from_image(struct vf_instance_s* vf, int first_row, int last_row)
+static void copy_from_image(struct vf_instance* vf)
{
int pl;
- int i, j, k;
- unsigned char val;
- int chroma_rows;
-
- first_row -= (first_row % 2);
- last_row += (last_row % 2);
- chroma_rows = (last_row - first_row) / 2;
for (pl = 1; pl < 3; ++pl) {
int dst_stride = vf->priv->outw;
int src_stride = vf->dmpi->stride[pl];
- unsigned char* src = vf->dmpi->planes[pl] + (first_row/2) * src_stride;
- unsigned char* dst = vf->priv->planes[pl] + first_row * dst_stride;
- unsigned char* dst_next = dst + dst_stride;
- for(i = 0; i < chroma_rows; ++i)
- {
- if ((vf->priv->dirty_rows[first_row + i*2] == 0) ||
- (vf->priv->dirty_rows[first_row + i*2 + 1] == 0)) {
- for (j = 0, k = 0; j < vf->dmpi->chroma_width; ++j, k+=2) {
- val = *(src + j);
- *(dst + k) = val;
- *(dst + k + 1) = val;
- *(dst_next + k) = val;
- *(dst_next + k + 1) = val;
- }
+ unsigned char* src = vf->dmpi->planes[pl];
+ unsigned char* dst = vf->priv->planes[pl];
+ for (int i = 0; i < (vf->priv->outh + 1) / 2; i++) {
+ struct line_limits *ll = vf->priv->line_limits + i;
+ unsigned char* dst_next = dst + dst_stride;
+ for (int j = ll->start; j < ll->end; j++) {
+ unsigned char val = src[j];
+ dst[j << 1] = val;
+ dst[(j << 1) + 1] = val;
+ dst_next[j << 1] = val;
+ dst_next[(j << 1) + 1] = val;
}
src += src_stride;
dst = dst_next + dst_stride;
- dst_next = dst + dst_stride;
}
}
- for (i = first_row; i < last_row; ++i)
- vf->priv->dirty_rows[i] = 1;
}
/**
* \brief Copy all previously copied rows back to render_context.dmpi
*/
-static void copy_to_image(struct vf_instance_s* vf)
+static void copy_to_image(struct vf_instance* vf)
{
int pl;
- int i, j, k;
+ int i, j;
for (pl = 1; pl < 3; ++pl) {
int dst_stride = vf->dmpi->stride[pl];
int src_stride = vf->priv->outw;
@@ -261,18 +266,14 @@ static void copy_to_image(struct vf_instance_s* vf)
unsigned char* dst = vf->dmpi->planes[pl];
unsigned char* src = vf->priv->planes[pl];
unsigned char* src_next = vf->priv->planes[pl] + src_stride;
- for(i = 0; i < vf->dmpi->chroma_height; ++i)
- {
- if ((vf->priv->dirty_rows[i*2] == 1)) {
- assert(vf->priv->dirty_rows[i*2 + 1] == 1);
- for (j = 0, k = 0; j < vf->dmpi->chroma_width; ++j, k+=2) {
- unsigned val = 0;
- val += *(src + k);
- val += *(src + k + 1);
- val += *(src_next + k);
- val += *(src_next + k + 1);
- *(dst + j) = val >> 2;
- }
+ for (i = 0; i < vf->dmpi->chroma_height; ++i) {
+ for (j = vf->priv->line_limits[i].start; j < vf->priv->line_limits[i].end; j++) {
+ unsigned val = 0;
+ val += src[j << 1];
+ val += src[(j << 1) + 1];
+ val += src_next[j << 1];
+ val += src_next[(j << 1) + 1];
+ dst[j] = val >> 2;
}
dst += dst_stride;
src = src_next + src_stride;
@@ -281,7 +282,7 @@ static void copy_to_image(struct vf_instance_s* vf)
}
}
-static void my_draw_bitmap(struct vf_instance_s* vf, unsigned char* bitmap, int bitmap_w, int bitmap_h, int stride, int dst_x, int dst_y, unsigned color)
+static void my_draw_bitmap(struct vf_instance* vf, unsigned char* bitmap, int bitmap_w, int bitmap_h, int stride, int dst_x, int dst_y, unsigned color)
{
unsigned char y = rgba2y(color);
unsigned char u = rgba2u(color);
@@ -297,10 +298,10 @@ static void my_draw_bitmap(struct vf_instance_s* vf, unsigned char* bitmap, int
dstv = vf->priv->planes[2] + dst_x + dst_y * vf->priv->outw;
for (i = 0; i < bitmap_h; ++i) {
for (j = 0; j < bitmap_w; ++j) {
- unsigned k = ((unsigned)src[j]) * opacity / 255;
- dsty[j] = (k*y + (255-k)*dsty[j]) / 255;
- dstu[j] = (k*u + (255-k)*dstu[j]) / 255;
- dstv[j] = (k*v + (255-k)*dstv[j]) / 255;
+ unsigned k = (src[j] * opacity + 255) >> 8;
+ dsty[j] = (k*y + (255-k)*dsty[j] + 255) >> 8;
+ dstu[j] = (k*u + (255-k)*dstu[j] + 255) >> 8;
+ dstv[j] = (k*v + (255-k)*dstv[j] + 255) >> 8;
}
src += stride;
dsty += dmpi->stride[0];
@@ -309,12 +310,15 @@ static void my_draw_bitmap(struct vf_instance_s* vf, unsigned char* bitmap, int
}
}
-static int render_frame(struct vf_instance_s* vf, mp_image_t *mpi, const ass_image_t* img)
+static int render_frame(struct vf_instance* vf, mp_image_t *mpi, const ass_image_t* img)
{
if (img) {
- memset(vf->priv->dirty_rows, 0, vf->priv->outh); // reset dirty rows
+ for (int i = 0; i < (vf->priv->outh + 1) / 2; i++)
+ vf->priv->line_limits[i] = (struct line_limits){65535, 0};
+ for (const ass_image_t *im = img; im; im = im->next)
+ update_limits(vf, im->dst_y, im->dst_y + im->h, im->dst_x, im->dst_x + im->w);
+ copy_from_image(vf);
while (img) {
- copy_from_image(vf, img->dst_y, img->dst_y + img->h);
my_draw_bitmap(vf, img->bitmap, img->w, img->h, img->stride,
img->dst_x, img->dst_y, img->color);
img = img->next;
@@ -324,7 +328,7 @@ static int render_frame(struct vf_instance_s* vf, mp_image_t *mpi, const ass_ima
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
ass_image_t* images = 0;
if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE))
@@ -336,7 +340,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, vf->dmpi, pts);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YV12:
@@ -362,16 +366,13 @@ static int control(vf_instance_t *vf, int request, void *data)
return vf_next_control(vf, request, data);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if (vf->priv->ass_priv)
ass_renderer_done(vf->priv->ass_priv);
- if (vf->priv->planes[1])
- free(vf->priv->planes[1]);
- if (vf->priv->planes[2])
- free(vf->priv->planes[2]);
- if (vf->priv->dirty_rows)
- free(vf->priv->dirty_rows);
+ free(vf->priv->planes[1]);
+ free(vf->priv->planes[2]);
+ free(vf->priv->line_limits);
}
static const unsigned int fmt_list[]={
diff --git a/libmpcodecs/vf_blackframe.c b/libmpcodecs/vf_blackframe.c
index dce13ea927..34d2f1f506 100644
--- a/libmpcodecs/vf_blackframe.c
+++ b/libmpcodecs/vf_blackframe.c
@@ -40,12 +40,12 @@ struct vf_priv_s {
unsigned int bamount, bthresh, frame, lastkeyframe;
};
-static int config(struct vf_instance_s* vf, int width, int height, int d_width,
+static int config(struct vf_instance* vf, int width, int height, int d_width,
int d_height, unsigned int flags, unsigned int outfmt) {
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int query_format(struct vf_instance_s *vf, unsigned fmt) {
+static int query_format(struct vf_instance *vf, unsigned fmt) {
switch(fmt) {
case IMGFMT_YVU9:
case IMGFMT_IF09:
@@ -66,7 +66,7 @@ static int query_format(struct vf_instance_s *vf, unsigned fmt) {
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int x, y;
int nblack=0, pblack=0;
@@ -110,11 +110,11 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf, dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return vf_next_control(vf,request,data);
}
-static void uninit(struct vf_instance_s *vf) {
+static void uninit(struct vf_instance *vf) {
if (vf->priv) free(vf->priv);
}
diff --git a/libmpcodecs/vf_bmovl.c b/libmpcodecs/vf_bmovl.c
index ab2c23944c..0cadc63b70 100644
--- a/libmpcodecs/vf_bmovl.c
+++ b/libmpcodecs/vf_bmovl.c
@@ -107,14 +107,14 @@ struct vf_priv_s {
};
static int
-query_format(struct vf_instance_s* vf, unsigned int fmt){
+query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_YV12) return VFCAP_CSP_SUPPORTED;
return 0;
}
static int
-config(struct vf_instance_s* vf,
+config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -144,7 +144,7 @@ config(struct vf_instance_s* vf,
}
static void
-uninit(struct vf_instance_s *vf)
+uninit(struct vf_instance *vf)
{
if(vf->priv) {
free(vf->priv->bitmap.y);
@@ -196,7 +196,7 @@ _read_cmd(int fd, char *cmd, char *args) {
static int
-put_image(struct vf_instance_s* vf, mp_image_t* mpi, double pts){
+put_image(struct vf_instance* vf, mp_image_t* mpi, double pts){
int buf_x=0, buf_y=0, buf_pos=0;
int have, got, want;
int xpos=0, ypos=0, pos=0;
diff --git a/libmpcodecs/vf_boxblur.c b/libmpcodecs/vf_boxblur.c
index b27b1a6d01..bad900f45c 100644
--- a/libmpcodecs/vf_boxblur.c
+++ b/libmpcodecs/vf_boxblur.c
@@ -52,7 +52,7 @@ struct vf_priv_s {
/***************************************************************************/
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -133,7 +133,7 @@ static void vBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int s
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
@@ -162,7 +162,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_crop.c b/libmpcodecs/vf_crop.c
index c9bd11c6c7..ca14927956 100644
--- a/libmpcodecs/vf_crop.c
+++ b/libmpcodecs/vf_crop.c
@@ -5,6 +5,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -21,14 +22,12 @@ static const struct vf_priv_s {
-1,-1
};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
+ struct MPOpts *opts = vf->opts;
// calculate the missing parameters:
if(vf->priv->crop_w<=0 || vf->priv->crop_w>width) vf->priv->crop_w=width;
if(vf->priv->crop_h<=0 || vf->priv->crop_h>height) vf->priv->crop_h=height;
@@ -61,14 +60,14 @@ static int config(struct vf_instance_s* vf,
mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_CropBadPositionWidthHeight);
return 0;
}
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if(!opts->screen_size_x && !opts->screen_size_y){
d_width=d_width*vf->priv->crop_w/width;
d_height=d_height*vf->priv->crop_h/height;
}
return vf_next_config(vf,vf->priv->crop_w,vf->priv->crop_h,d_width,d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)
return vf_next_put_image(vf,vf->dmpi, pts);
@@ -95,12 +94,12 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi){
vf->dmpi = vf_get_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags,
vf->priv->crop_w, vf->priv->crop_h);
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
unsigned char *src2[3];
src2[0] = src[0];
diff --git a/libmpcodecs/vf_cropdetect.c b/libmpcodecs/vf_cropdetect.c
index 31389d5fb0..68e6eb1011 100644
--- a/libmpcodecs/vf_cropdetect.c
+++ b/libmpcodecs/vf_cropdetect.c
@@ -42,7 +42,7 @@ static int checkline(unsigned char* src,int stride,int len,int bpp){
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
vf->priv->x1=width - 1;
@@ -53,7 +53,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int bpp=mpi->bpp/8;
int w,h,x,y,shrink_by;
@@ -136,7 +136,7 @@ if(++vf->priv->fno>2){ // ignore first 2 frames - they may be empty
return vf_next_put_image(vf,dmpi, pts);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt) {
+static int query_format(struct vf_instance* vf, unsigned int fmt) {
switch(fmt) {
// the default limit value works only right with YV12 right now.
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_decimate.c b/libmpcodecs/vf_decimate.c
index fd591bdca3..5fb633d3c5 100644
--- a/libmpcodecs/vf_decimate.c
+++ b/libmpcodecs/vf_decimate.c
@@ -110,7 +110,7 @@ static int diff_to_drop(int hi, int lo, float frac, mp_image_t *old, mp_image_t
new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -146,7 +146,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c
index 2afa0afc33..666a5b8690 100644
--- a/libmpcodecs/vf_delogo.c
+++ b/libmpcodecs/vf_delogo.c
@@ -123,7 +123,7 @@ static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -131,7 +131,7 @@ static int config(struct vf_instance_s* vf,
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ
// ok, we can do pp in-place (or pp disabled):
@@ -149,7 +149,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -175,7 +175,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
free(vf->priv);
@@ -184,7 +184,7 @@ static void uninit(struct vf_instance_s* vf){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
@@ -195,7 +195,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static unsigned int fmt_list[]={
+static const unsigned int fmt_list[]={
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_IYUV,
@@ -255,7 +255,7 @@ static int open(vf_instance_t *vf, char* args){
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{ "x", ST_OFF(xoff), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "y", ST_OFF(yoff), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "w", ST_OFF(lw), CONF_TYPE_INT, 0, 0, 0, NULL },
@@ -265,7 +265,7 @@ static m_option_t vf_opts_fields[] = {
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"delogo",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_denoise3d.c b/libmpcodecs/vf_denoise3d.c
index 090f89674a..12bf22f5a2 100644
--- a/libmpcodecs/vf_denoise3d.c
+++ b/libmpcodecs/vf_denoise3d.c
@@ -51,7 +51,7 @@ struct vf_priv_s {
/***************************************************************************/
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -64,7 +64,7 @@ static int config(struct vf_instance_s* vf,
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv->Line);
}
@@ -115,7 +115,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
int W = mpi->w, H = mpi->h;
@@ -153,7 +153,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_detc.c b/libmpcodecs/vf_detc.c
index d76e34efd2..4e935cd01b 100644
--- a/libmpcodecs/vf_detc.c
+++ b/libmpcodecs/vf_detc.c
@@ -267,7 +267,7 @@ static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field)
}
}
-static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
+static int do_put_image(struct vf_instance* vf, mp_image_t *dmpi)
{
struct vf_priv_s *p = vf->priv;
int dropflag;
@@ -295,7 +295,7 @@ static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
int ret=0;
mp_image_t *dmpi;
@@ -339,7 +339,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -351,14 +351,14 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_dint.c b/libmpcodecs/vf_dint.c
index b978062d73..62422fb1c4 100644
--- a/libmpcodecs/vf_dint.c
+++ b/libmpcodecs/vf_dint.c
@@ -24,7 +24,7 @@ struct vf_priv_s {
#define MAXROWSIZE 1200
-static int config (struct vf_instance_s* vf,
+static int config (struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -61,7 +61,7 @@ static int config (struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int put_image (struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image (struct vf_instance* vf, mp_image_t *mpi, double pts)
{
char rrow0[MAXROWSIZE];
char rrow1[MAXROWSIZE];
diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c
index d2fcb48dbe..4dade860f1 100644
--- a/libmpcodecs/vf_divtc.c
+++ b/libmpcodecs/vf_divtc.c
@@ -206,7 +206,7 @@ static int imgop(int(*planeop)(unsigned char *, unsigned char *,
static int match(struct vf_priv_s *p, int *diffs,
int phase1, int phase2, double *strength)
{
- static const int pattern1[]={ -4, 1, 1, 1, 1 },
+ const int pattern1[]={ -4, 1, 1, 1, 1 },
pattern2[]={ -2, -3, 4, 4, -3 }, *pattern;
int f, m, n, t[5];
@@ -239,7 +239,7 @@ static int match(struct vf_priv_s *p, int *diffs,
return m;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi, *tmpi=0;
int n, m, f, newphase;
@@ -550,7 +550,7 @@ static int analyze(struct vf_priv_s *p)
return 1;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt)
{
@@ -565,7 +565,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if(vf->priv)
{
diff --git a/libmpcodecs/vf_down3dright.c b/libmpcodecs/vf_down3dright.c
index feb591cb30..3ad2209d33 100644
--- a/libmpcodecs/vf_down3dright.c
+++ b/libmpcodecs/vf_down3dright.c
@@ -78,7 +78,7 @@ static void toright(unsigned char *dst[3], unsigned char *src[3],
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -95,7 +95,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -105,7 +105,7 @@ static int config(struct vf_instance_s* vf,
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - really any YUV 4:2:0 input format should work */
switch (fmt) {
@@ -117,7 +117,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_dsize.c b/libmpcodecs/vf_dsize.c
index 324ddf169a..2ec4acfe3d 100644
--- a/libmpcodecs/vf_dsize.c
+++ b/libmpcodecs/vf_dsize.c
@@ -17,7 +17,7 @@ struct vf_priv_s {
float aspect;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
diff --git a/libmpcodecs/vf_dvbscale.c b/libmpcodecs/vf_dvbscale.c
index fedf07046c..d54490d6fc 100644
--- a/libmpcodecs/vf_dvbscale.c
+++ b/libmpcodecs/vf_dvbscale.c
@@ -16,7 +16,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
diff --git a/libmpcodecs/vf_eq.c b/libmpcodecs/vf_eq.c
index 0c910b0556..0b65720849 100644
--- a/libmpcodecs/vf_eq.c
+++ b/libmpcodecs/vf_eq.c
@@ -114,7 +114,7 @@ static void (*process)(unsigned char *dest, int dstride, unsigned char *src, int
/* FIXME: add packed yuv version of process */
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -143,7 +143,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
vf_equalizer_t *eq;
@@ -174,7 +174,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return vf_next_control(vf, request, data);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
case IMGFMT_YVU9:
@@ -195,7 +195,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if (vf->priv->buf) free(vf->priv->buf);
free(vf->priv);
@@ -223,13 +223,13 @@ static int open(vf_instance_t *vf, char* args)
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"brightness", ST_OFF(brightness), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
{"contrast", ST_OFF(contrast), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"eq",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index 0f25766f09..cdde44f82b 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -7,6 +7,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -27,12 +28,13 @@
static struct vf_priv_s {
int exp_w,exp_h;
int exp_x,exp_y;
- int osd;
+ int osd_enabled;
double aspect;
int round;
unsigned char* fb_ptr;
int passthrough;
int first_slice;
+ struct osd_state *osd;
} const vf_priv_dflt = {
-1,-1,
-1,-1,
@@ -44,13 +46,10 @@ static struct vf_priv_s {
0
};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
//===========================================================================//
#ifdef OSD_SUPPORT
-static struct vf_instance_s* vf=NULL; // fixme (needs sub.c changes)
+static struct vf_instance* vf=NULL; // fixme (needs sub.c changes)
static int orig_w,orig_h;
static void remove_func_2(int x0,int y0, int w,int h){
@@ -96,7 +95,7 @@ static void remove_func(int x0,int y0, int w,int h){
}
}
-static void draw_func(int x0,int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride){
+static void draw_func(void *ctx, int x0,int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride){
unsigned char* dst;
if(!vo_osd_changed_flag && vf->dmpi->planes[0]==vf->priv->fb_ptr){
// ok, enough to update the area inside the video, leave the black bands
@@ -156,7 +155,7 @@ static void draw_func(int x0,int y0, int w,int h,unsigned char* src, unsigned ch
}
}
-static void draw_osd(struct vf_instance_s* vf_,int w,int h){
+static void draw_osd(struct vf_instance* vf_,int w,int h){
vf=vf_;orig_w=w;orig_h=h;
// printf("======================================\n");
if(vf->priv->exp_w!=w || vf->priv->exp_h!=h ||
@@ -174,10 +173,10 @@ static void draw_osd(struct vf_instance_s* vf_,int w,int h){
remove_func_2(vf->priv->exp_x+w,vf->priv->exp_y,vf->priv->exp_w-w-vf->priv->exp_x,h);
} else {
// partial clear:
- vo_remove_text(vf->priv->exp_w,vf->priv->exp_h,remove_func);
+ osd_remove_text(vf->priv->osd, vf->priv->exp_w,vf->priv->exp_h,remove_func);
}
}
- vo_draw_text(vf->priv->exp_w,vf->priv->exp_h,draw_func);
+ osd_draw_text(vf->priv->osd, vf->priv->exp_w,vf->priv->exp_h,draw_func, NULL);
// save buffer pointer for double buffering detection - yes, i know it's
// ugly method, but note that codecs with DR support does the same...
if(vf->dmpi)
@@ -187,9 +186,11 @@ static void draw_osd(struct vf_instance_s* vf_,int w,int h){
#endif
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
+ unsigned int flags, unsigned int outfmt)
+{
+ struct MPOpts *opts = vf->opts;
if(outfmt == IMGFMT_MPEGPES) {
vf->priv->passthrough = 1;
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
@@ -225,7 +226,7 @@ static int config(struct vf_instance_s* vf,
if(vf->priv->exp_y<0 || vf->priv->exp_y+height>vf->priv->exp_h) vf->priv->exp_y=(vf->priv->exp_h-height)/2;
vf->priv->fb_ptr=NULL;
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if(!opts->screen_size_x && !opts->screen_size_y){
d_width=d_width*vf->priv->exp_w/width;
d_height=d_height*vf->priv->exp_h/height;
}
@@ -238,12 +239,12 @@ static int config(struct vf_instance_s* vf,
// codec -copy-> expand --DR--> vo
// codec -copy-> expand -copy-> vo (worst case)
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
// if(mpi->type==MP_IMGTYPE_IPB) return; // not yet working
#ifdef OSD_SUPPORT
- if(vf->priv->osd && (mpi->flags&MP_IMGFLAG_PRESERVE)){
+ if(vf->priv->osd_enabled && (mpi->flags&MP_IMGFLAG_PRESERVE)){
// check if we have to render osd!
- vo_update_osd(vf->priv->exp_w, vf->priv->exp_h);
+ osd_update(vf->priv->osd, vf->priv->exp_w, vf->priv->exp_h);
if(vo_osd_check_range_update(vf->priv->exp_x,vf->priv->exp_y,
vf->priv->exp_x+mpi->w,vf->priv->exp_y+mpi->h)) return;
}
@@ -285,7 +286,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
}
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi){
// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
if(!vf->next->draw_slice){
mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
@@ -303,7 +304,7 @@ static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
vf->priv->first_slice = 1;
}
-static void draw_top_blackbar_slice(struct vf_instance_s* vf,
+static void draw_top_blackbar_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
if(vf->priv->exp_y>0 && y == 0) {
vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
@@ -312,7 +313,7 @@ static void draw_top_blackbar_slice(struct vf_instance_s* vf,
}
-static void draw_bottom_blackbar_slice(struct vf_instance_s* vf,
+static void draw_bottom_blackbar_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
if(vf->priv->exp_y+vf->h<vf->dmpi->h && y+h == vf->h) {
unsigned char *src2[MP_MAX_PLANES];
@@ -332,7 +333,7 @@ static void draw_bottom_blackbar_slice(struct vf_instance_s* vf,
}
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
// printf("draw_slice() called %d at %d\n",h,y);
@@ -355,7 +356,7 @@ static void draw_slice(struct vf_instance_s* vf,
vf->priv->first_slice = 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if (vf->priv->passthrough) {
mp_image_t *dmpi = vf_get_image(vf->next, IMGFMT_MPEGPES,
MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h);
@@ -368,7 +369,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
if(!vf->dmpi) { mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_FunWhydowegetNULL); return 0; }
mpi->priv=NULL;
#ifdef OSD_SUPPORT
- if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
+ if(vf->priv->osd_enabled) draw_osd(vf,mpi->w,mpi->h);
#endif
// we've used DR, so we're ready...
if(!(mpi->flags&MP_IMGFLAG_PLANAR))
@@ -403,24 +404,27 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
vf->dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette
}
#ifdef OSD_SUPPORT
- if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
+ if(vf->priv->osd_enabled) draw_osd(vf,mpi->w,mpi->h);
#endif
return vf_next_put_image(vf,vf->dmpi, pts);
}
//===========================================================================//
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
#ifdef OSD_SUPPORT
switch(request){
+ case VFCTRL_SET_OSD_OBJ:
+ vf->priv->osd = data;
+ break;
case VFCTRL_DRAW_OSD:
- if(vf->priv->osd) return CONTROL_TRUE;
+ if(vf->priv->osd_enabled) return CONTROL_TRUE;
}
#endif
return vf_next_control(vf,request,data);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
return vf_next_query_format(vf,fmt);
}
@@ -437,25 +441,25 @@ static int open(vf_instance_t *vf, char* args){
vf->priv->exp_h,
vf->priv->exp_x,
vf->priv->exp_y,
- vf->priv->osd,
+ vf->priv->osd_enabled,
vf->priv->aspect,
vf->priv->round);
return 1;
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"w", ST_OFF(exp_w), CONF_TYPE_INT, 0, 0 ,0, NULL},
{"h", ST_OFF(exp_h), CONF_TYPE_INT, 0, 0 ,0, NULL},
{"x", ST_OFF(exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
{"y", ST_OFF(exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
- {"osd", ST_OFF(osd), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
+ {"osd", ST_OFF(osd_enabled), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
{"aspect", ST_OFF(aspect), CONF_TYPE_DOUBLE, M_OPT_MIN, 0, 0, NULL},
{"round", ST_OFF(round), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"expand",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_field.c b/libmpcodecs/vf_field.c
index 00e37f0b59..cbbb7bc104 100644
--- a/libmpcodecs/vf_field.c
+++ b/libmpcodecs/vf_field.c
@@ -14,13 +14,13 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->width, mpi->height/2);
@@ -43,7 +43,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_fil.c b/libmpcodecs/vf_fil.c
index 7648a92adc..5e36c4774d 100644
--- a/libmpcodecs/vf_fil.c
+++ b/libmpcodecs/vf_fil.c
@@ -17,7 +17,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int pixel_stride= (width+15)&~15; //FIXME this is ust a guess ... especially for non planar its somewhat bad one
@@ -45,7 +45,7 @@ static int config(struct vf_instance_s* vf,
(d_width*vf->priv->stridefactor)>>1, 2*d_height/vf->priv->stridefactor, flags, outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if(mpi->flags&MP_IMGFLAG_DIRECT){
// we've used DR, so we're ready...
return vf_next_put_image(vf,(mp_image_t*)mpi->priv, pts);
@@ -71,7 +71,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_filmdint.c b/libmpcodecs/vf_filmdint.c
index 2fea3897b1..f479569536 100644
--- a/libmpcodecs/vf_filmdint.c
+++ b/libmpcodecs/vf_filmdint.c
@@ -6,6 +6,7 @@
#include "config.h"
#include "mp_msg.h"
#include "cpudetect.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -79,9 +80,6 @@ struct vf_priv_s {
static const struct frame_stats ppzs = {PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,0,0,9999};
static const struct frame_stats pprs = {PPR,PPR,PPR,PPR,PPR,PPR,PPR,0,0,9999};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
@@ -916,7 +914,7 @@ static inline double get_time(void)
return tv.tv_sec + tv.tv_usec * 1e-6;
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
struct vf_priv_s *p = vf->priv;
static unsigned char **planes, planes_idx;
@@ -1120,7 +1118,7 @@ find_breaks(struct vf_priv_s *p, struct frame_stats *s)
#define ITOC(X) (!(X) ? ' ' : (X) + ((X)>9 ? 'a'-10 : '0'))
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
struct vf_priv_s *p = vf->priv;
@@ -1318,7 +1316,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return show_fields ? vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE) : 0;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - support more formats */
switch (fmt) {
@@ -1333,10 +1331,11 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
+ struct MPOpts *opts = vf->opts;
unsigned long cxm = 0;
unsigned long cym = 0;
struct vf_priv_s *p = vf->priv;
@@ -1371,14 +1370,14 @@ static int config(struct vf_instance_s* vf,
if (p->crop_x + p->w > width ) p->crop_x = 0;
if (p->crop_y + p->h > height) p->crop_y = 0;
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if(!opts->screen_size_x && !opts->screen_size_y){
d_width = d_width * p->w/width;
d_height = d_height * p->h/height;
}
return vf_next_config(vf, p->w, p->h, d_width, d_height, flags, outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
struct vf_priv_s *p = vf->priv;
mp_msg(MSGT_VFILTER, MSGL_INFO, "diff_time: %.3f, merge_time: %.3f, "
diff --git a/libmpcodecs/vf_flip.c b/libmpcodecs/vf_flip.c
index 8134ff83b6..061c727eb9 100644
--- a/libmpcodecs/vf_flip.c
+++ b/libmpcodecs/vf_flip.c
@@ -12,14 +12,14 @@
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
flags&=~VOFLAG_FLIPPING; // remove the FLIP flag
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE){
// try full DR !
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -41,7 +41,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if(mpi->flags&MP_IMGFLAG_DIRECT){
// we've used DR, so we're ready...
if(!(mpi->flags&MP_IMGFLAG_PLANAR))
diff --git a/libmpcodecs/vf_format.c b/libmpcodecs/vf_format.c
index 36280b243c..1a2fa5ce20 100644
--- a/libmpcodecs/vf_format.c
+++ b/libmpcodecs/vf_format.c
@@ -22,7 +22,7 @@ static struct vf_priv_s {
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==vf->priv->fmt)
return vf_next_query_format(vf,fmt);
return 0;
@@ -74,12 +74,12 @@ static int open(vf_instance_t *vf, char* args){
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"fmt", ST_OFF(fmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"format",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_framestep.c b/libmpcodecs/vf_framestep.c
index 956fe03ae3..c5f93244de 100644
--- a/libmpcodecs/vf_framestep.c
+++ b/libmpcodecs/vf_framestep.c
@@ -74,7 +74,7 @@ struct vf_priv_s {
};
/* Filter handler */
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
struct vf_priv_s *priv;
@@ -131,7 +131,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
/* Free private data */
free(vf->priv);
diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c
index a04d851de5..a6c2c58a3b 100644
--- a/libmpcodecs/vf_fspp.c
+++ b/libmpcodecs/vf_fspp.c
@@ -486,7 +486,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src,
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -500,7 +500,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
@@ -518,7 +518,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -566,7 +566,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if(!vf->priv) return;
@@ -585,7 +585,7 @@ static void uninit(struct vf_instance_s* vf)
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YVU9:
@@ -604,7 +604,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
switch(request){
case VFCTRL_QUERY_MAX_PP_LEVEL:
diff --git a/libmpcodecs/vf_geq.c b/libmpcodecs/vf_geq.c
index bc339994ea..e8f16776d7 100644
--- a/libmpcodecs/vf_geq.c
+++ b/libmpcodecs/vf_geq.c
@@ -43,13 +43,13 @@ struct vf_priv_s {
mp_image_t *mpi;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static inline double getpix(struct vf_instance_s* vf, double x, double y, int plane){
+static inline double getpix(struct vf_instance* vf, double x, double y, int plane){
int xi, yi;
mp_image_t *mpi= vf->priv->mpi;
int stride= mpi->stride[plane];
@@ -67,19 +67,19 @@ static inline double getpix(struct vf_instance_s* vf, double x, double y, int pl
//FIXME cubic interpolate
//FIXME keep the last few frames
-static double lum(struct vf_instance_s* vf, double x, double y){
+static double lum(struct vf_instance* vf, double x, double y){
return getpix(vf, x, y, 0);
}
-static double cb(struct vf_instance_s* vf, double x, double y){
+static double cb(struct vf_instance* vf, double x, double y){
return getpix(vf, x, y, 1);
}
-static double cr(struct vf_instance_s* vf, double x, double y){
+static double cr(struct vf_instance* vf, double x, double y){
return getpix(vf, x, y, 2);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int x,y, plane;
@@ -127,7 +127,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
av_free(vf->priv);
@@ -152,7 +152,7 @@ static int open(vf_instance_t *vf, char* args){
if (!eq[2][0]) strncpy(eq[2], eq[1], sizeof(eq[0])-1);
for(plane=0; plane<3; plane++){
- static const char *const_names[]={
+ const char * const const_names[]={
"PI",
"E",
"X",
@@ -164,7 +164,7 @@ static int open(vf_instance_t *vf, char* args){
"SH",
NULL
};
- static const char *func2_names[]={
+ const char * const func2_names[]={
"lum",
"cb",
"cr",
diff --git a/libmpcodecs/vf_halfpack.c b/libmpcodecs/vf_halfpack.c
index cb8cc28fc4..39ba69bb81 100644
--- a/libmpcodecs/vf_halfpack.c
+++ b/libmpcodecs/vf_halfpack.c
@@ -142,7 +142,7 @@ static void (*halfpack)(unsigned char *dst, unsigned char *src[3],
int dststride, int srcstride[3], int w, int h);
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -166,7 +166,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -175,7 +175,7 @@ static int config(struct vf_instance_s* vf,
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - really any YUV 4:2:0 input format should work */
switch (fmt) {
@@ -187,7 +187,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_harddup.c b/libmpcodecs/vf_harddup.c
index 64e3094fda..6bb84143d3 100644
--- a/libmpcodecs/vf_harddup.c
+++ b/libmpcodecs/vf_harddup.c
@@ -13,7 +13,7 @@ struct vf_priv_s {
mp_image_t *last_mpi;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -34,7 +34,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
switch (request) {
case VFCTRL_DUPLICATE_FRAME:
@@ -50,7 +50,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return vf_next_control(vf, request, data);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_hqdn3d.c b/libmpcodecs/vf_hqdn3d.c
index 4e737d73ec..4764c32077 100644
--- a/libmpcodecs/vf_hqdn3d.c
+++ b/libmpcodecs/vf_hqdn3d.c
@@ -50,14 +50,14 @@ struct vf_priv_s {
/***************************************************************************/
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(vf->priv->Line){free(vf->priv->Line);vf->priv->Line=NULL;}
if(vf->priv->Frame[0]){free(vf->priv->Frame[0]);vf->priv->Frame[0]=NULL;}
if(vf->priv->Frame[1]){free(vf->priv->Frame[1]);vf->priv->Frame[1]=NULL;}
if(vf->priv->Frame[2]){free(vf->priv->Frame[2]);vf->priv->Frame[2]=NULL;}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -208,7 +208,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
int W = mpi->w, H = mpi->h;
@@ -243,7 +243,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_hue.c b/libmpcodecs/vf_hue.c
index 317d3b027d..04697ea537 100644
--- a/libmpcodecs/vf_hue.c
+++ b/libmpcodecs/vf_hue.c
@@ -58,7 +58,7 @@ static void (*process)(uint8_t *udst, uint8_t *vdst, uint8_t *usrc, uint8_t *vsr
/* FIXME: add packed yuv version of process */
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -92,7 +92,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
vf_equalizer_t *eq;
@@ -121,7 +121,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return vf_next_control(vf, request, data);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
case IMGFMT_YVU9:
@@ -138,7 +138,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if (vf->priv->buf[0]) free(vf->priv->buf[0]);
if (vf->priv->buf[1]) free(vf->priv->buf[1]);
@@ -168,13 +168,13 @@ static int open(vf_instance_t *vf, char* args)
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"hue", ST_OFF(hue), CONF_TYPE_FLOAT, M_OPT_RANGE,-180.0 ,180.0, NULL},
{"saturation", ST_OFF(saturation), CONF_TYPE_FLOAT, M_OPT_RANGE,-10.0 ,10.0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"hue",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c
index 63626aa469..089b14684e 100644
--- a/libmpcodecs/vf_il.c
+++ b/libmpcodecs/vf_il.c
@@ -79,7 +79,7 @@ static void interleave(uint8_t *dst, uint8_t *src, int w, int h, int dstStride,
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int w;
FilterParam *luma = &vf->priv->lumaParam;
FilterParam *chroma= &vf->priv->chromaParam;
diff --git a/libmpcodecs/vf_ilpack.c b/libmpcodecs/vf_ilpack.c
index 67e14dd0cf..0ffca173da 100644
--- a/libmpcodecs/vf_ilpack.c
+++ b/libmpcodecs/vf_ilpack.c
@@ -349,7 +349,7 @@ static void ilpack(unsigned char *dst, unsigned char *src[3],
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -363,7 +363,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -372,7 +372,7 @@ static int config(struct vf_instance_s* vf,
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - really any YUV 4:2:0 input format should work */
switch (fmt) {
diff --git a/libmpcodecs/vf_ivtc.c b/libmpcodecs/vf_ivtc.c
index b6db4c18a8..c54405a4eb 100644
--- a/libmpcodecs/vf_ivtc.c
+++ b/libmpcodecs/vf_ivtc.c
@@ -408,7 +408,7 @@ static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field)
}
}
-static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
+static int do_put_image(struct vf_instance* vf, mp_image_t *dmpi)
{
struct vf_priv_s *p = vf->priv;
int dropflag=0;
@@ -437,7 +437,7 @@ static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
int ret=0;
struct vf_priv_s *p = vf->priv;
@@ -488,7 +488,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
case IMGFMT_YV12:
@@ -499,7 +499,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_kerndeint.c b/libmpcodecs/vf_kerndeint.c
index 9fa0df255b..cdc26883eb 100644
--- a/libmpcodecs/vf_kerndeint.c
+++ b/libmpcodecs/vf_kerndeint.c
@@ -53,7 +53,7 @@ struct vf_priv_s {
/***************************************************************************/
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -61,7 +61,7 @@ static int config(struct vf_instance_s* vf,
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -80,7 +80,7 @@ static inline int IsYUY2(mp_image_t *mpi)
#define PLANAR_U 1
#define PLANAR_V 2
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
int W = mpi->w, H = mpi->h;
@@ -284,7 +284,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
@@ -295,7 +295,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch (request)
{
case VFCTRL_GET_DEINTERLACE:
diff --git a/libmpcodecs/vf_lavc.c b/libmpcodecs/vf_lavc.c
index 7e904b440b..40bd100d73 100644
--- a/libmpcodecs/vf_lavc.c
+++ b/libmpcodecs/vf_lavc.c
@@ -27,7 +27,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if(vf_next_query_format(vf,IMGFMT_MPEGPES)<=0) return 0;
@@ -69,7 +69,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_MPEGPES);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t* dmpi;
int out_size;
AVFrame *pic= vf->priv->pic;
@@ -102,7 +102,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
diff --git a/libmpcodecs/vf_lavcdeint.c b/libmpcodecs/vf_lavcdeint.c
index 27d7f96d0b..ff8aea54dd 100644
--- a/libmpcodecs/vf_lavcdeint.c
+++ b/libmpcodecs/vf_lavcdeint.c
@@ -70,7 +70,7 @@ imgfmt_to_pixfmt (int imgfmt)
static int
-config (struct vf_instance_s* vf,
+config (struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -96,7 +96,7 @@ config (struct vf_instance_s* vf,
}
static int
-put_image (struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+put_image (struct vf_instance* vf, mp_image_t *mpi, double pts)
{
struct vf_priv_s *priv = vf->priv;
mp_image_t* dmpi;
@@ -133,7 +133,7 @@ put_image (struct vf_instance_s* vf, mp_image_t *mpi, double pts)
static int
-query_format (struct vf_instance_s* vf, unsigned int fmt)
+query_format (struct vf_instance* vf, unsigned int fmt)
{
if(imgfmt_to_pixfmt(fmt) == -1)
return 0;
diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c
index 7e89c33e08..f1b816d8ba 100644
--- a/libmpcodecs/vf_mcdeint.c
+++ b/libmpcodecs/vf_mcdeint.c
@@ -179,7 +179,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int ds
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int i;
@@ -236,7 +236,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
return; //caused problems, dunno why
// ok, we can do pp in-place (or pp disabled):
@@ -254,7 +254,7 @@ return; //caused problems, dunno why
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -273,7 +273,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
#if 0
@@ -295,7 +295,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
diff --git a/libmpcodecs/vf_mirror.c b/libmpcodecs/vf_mirror.c
index f2cf09ee08..5d7d3be80d 100644
--- a/libmpcodecs/vf_mirror.c
+++ b/libmpcodecs/vf_mirror.c
@@ -65,7 +65,7 @@ static void mirror(unsigned char* dst,unsigned char* src,int dststride,int srcst
//===========================================================================//
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
diff --git a/libmpcodecs/vf_noformat.c b/libmpcodecs/vf_noformat.c
index 293e1be4e7..2e97744c54 100644
--- a/libmpcodecs/vf_noformat.c
+++ b/libmpcodecs/vf_noformat.c
@@ -22,7 +22,7 @@ static struct vf_priv_s {
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt!=vf->priv->fmt)
return vf_next_query_format(vf,fmt);
return 0;
@@ -74,12 +74,12 @@ static int open(vf_instance_t *vf, char* args){
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"fmt", ST_OFF(fmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"noformat",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_noise.c b/libmpcodecs/vf_noise.c
index 2ffaa76f52..ab88cb5964 100644
--- a/libmpcodecs/vf_noise.c
+++ b/libmpcodecs/vf_noise.c
@@ -312,14 +312,14 @@ static void noise(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int
if (fp->shiftptr == 3) fp->shiftptr = 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ
// ok, we can do pp in-place (or pp disabled):
@@ -337,7 +337,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -366,7 +366,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->chromaParam.noise) free(vf->priv->chromaParam.noise);
@@ -381,7 +381,7 @@ static void uninit(struct vf_instance_s* vf){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
@@ -416,7 +416,7 @@ static void parse(FilterParam *fp, char* args){
if(fp->strength) initNoise(fp);
}
-static unsigned int fmt_list[]={
+static const unsigned int fmt_list[]={
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_IYUV,
diff --git a/libmpcodecs/vf_ow.c b/libmpcodecs/vf_ow.c
index 8c1f8f1c48..74f546b082 100644
--- a/libmpcodecs/vf_ow.c
+++ b/libmpcodecs/vf_ow.c
@@ -210,7 +210,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
// printf("%f\n", sum/height/width);
}
-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){
+static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){
int h= (height+15)&(~15);
int i,j;
@@ -223,7 +223,7 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -240,7 +240,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -261,7 +261,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
int i,j;
if(!vf->priv) return;
@@ -277,7 +277,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YVU9:
case IMGFMT_IF09:
diff --git a/libmpcodecs/vf_palette.c b/libmpcodecs/vf_palette.c
index 70b4379759..449516f758 100644
--- a/libmpcodecs/vf_palette.c
+++ b/libmpcodecs/vf_palette.c
@@ -19,14 +19,14 @@
// routines are incorrrect. they assume the palette to be of the same
// depth as the output, which is incorrect. --Joey
-static unsigned int bgr_list[]={
+static const unsigned int bgr_list[]={
IMGFMT_BGR32,
IMGFMT_BGR24,
// IMGFMT_BGR16,
// IMGFMT_BGR15,
0
};
-static unsigned int rgb_list[]={
+static const unsigned int rgb_list[]={
IMGFMT_RGB32,
IMGFMT_RGB24,
// IMGFMT_RGB16,
@@ -36,10 +36,10 @@ static unsigned int rgb_list[]={
static unsigned int gray_pal[256];
-static unsigned int find_best(struct vf_instance_s* vf, unsigned int fmt){
+static unsigned int find_best(struct vf_instance* vf, unsigned int fmt){
unsigned int best=0;
int ret;
- unsigned int* p;
+ const unsigned int* p;
if(fmt==IMGFMT_BGR8) p=bgr_list;
else if(fmt==IMGFMT_RGB8) p=rgb_list;
else return 0;
@@ -60,7 +60,7 @@ struct vf_priv_s {
int pal_msg;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if (!vf->priv->fmt)
@@ -74,7 +74,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -158,7 +158,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
int best=find_best(vf,fmt);
if(!best) return 0; // no match
return vf->next->query_format(vf->next,best);
diff --git a/libmpcodecs/vf_perspective.c b/libmpcodecs/vf_perspective.c
index 8ef90d9b5a..fd7fe4885d 100644
--- a/libmpcodecs/vf_perspective.c
+++ b/libmpcodecs/vf_perspective.c
@@ -102,7 +102,7 @@ static double getCoeff(double d){
return coeff;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int i, j;
@@ -129,7 +129,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->pv) free(vf->priv->pv);
@@ -258,7 +258,7 @@ static inline void resampleLinear(uint8_t *dst, uint8_t *src, int w, int h, int
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
@@ -289,7 +289,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_phase.c b/libmpcodecs/vf_phase.c
index 348ea4ea45..86d57bfc7f 100644
--- a/libmpcodecs/vf_phase.c
+++ b/libmpcodecs/vf_phase.c
@@ -178,7 +178,7 @@ static enum mode analyze_plane(unsigned char *old, unsigned char *new,
return mode;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
int w;
@@ -222,7 +222,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv->buf[0]);
free(vf->priv->buf[1]);
diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c
index 2b4b6931b0..219fe920f1 100644
--- a/libmpcodecs/vf_pp.c
+++ b/libmpcodecs/vf_pp.c
@@ -31,7 +31,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int voflags, unsigned int outfmt){
int flags=
@@ -52,7 +52,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,voflags,outfmt);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
int i;
for(i=0; i<=PP_QUALITY_MAX; i++){
if(vf->priv->ppMode[i])
@@ -61,7 +61,7 @@ static void uninit(struct vf_instance_s* vf){
if(vf->priv->context) pp_free_context(vf->priv->context);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -74,7 +74,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch(request){
case VFCTRL_QUERY_MAX_PP_LEVEL:
return PP_QUALITY_MAX;
@@ -85,7 +85,7 @@ static int control(struct vf_instance_s* vf, int request, void* data){
return vf_next_control(vf,request,data);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(vf->priv->pp&0xFFFF) return; // non-local filters enabled
if((mpi->type==MP_IMGTYPE_IPB || vf->priv->pp) &&
mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
@@ -106,7 +106,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
// no DR, so get a new image! hope we'll get DR buffer:
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -138,7 +138,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
extern int divx_quality;
-static unsigned int fmt_list[]={
+static const unsigned int fmt_list[]={
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_IYUV,
diff --git a/libmpcodecs/vf_pp7.c b/libmpcodecs/vf_pp7.c
index 81ebbb4df8..2fc76b1752 100644
--- a/libmpcodecs/vf_pp7.c
+++ b/libmpcodecs/vf_pp7.c
@@ -344,7 +344,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int h= (height+16+15)&(~15);
@@ -355,7 +355,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -372,7 +372,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(mpi->flags&MP_IMGFLAG_DIRECT){
@@ -407,7 +407,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->src) free(vf->priv->src);
@@ -418,7 +418,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YVU9:
case IMGFMT_IF09:
@@ -436,7 +436,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return vf_next_control(vf,request,data);
}
diff --git a/libmpcodecs/vf_pullup.c b/libmpcodecs/vf_pullup.c
index b1d6cfb393..faf195b613 100644
--- a/libmpcodecs/vf_pullup.c
+++ b/libmpcodecs/vf_pullup.c
@@ -24,7 +24,7 @@ struct vf_priv_s {
char *qbuf;
};
-static void init_pullup(struct vf_instance_s* vf, mp_image_t *mpi)
+static void init_pullup(struct vf_instance* vf, mp_image_t *mpi)
{
struct pullup_context *c = vf->priv->ctx;
@@ -60,7 +60,7 @@ static void init_pullup(struct vf_instance_s* vf, mp_image_t *mpi)
#if 0
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
struct pullup_context *c = vf->priv->ctx;
struct pullup_buffer *b;
@@ -86,7 +86,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
}
#endif
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
struct pullup_context *c = vf->priv->ctx;
struct pullup_buffer *b;
@@ -236,7 +236,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - support more formats */
switch (fmt) {
@@ -248,7 +248,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -256,7 +256,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
pullup_free_context(vf->priv->ctx);
free(vf->priv);
diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c
index 00c67383e0..c8605c76c5 100644
--- a/libmpcodecs/vf_qp.c
+++ b/libmpcodecs/vf_qp.c
@@ -50,7 +50,7 @@ struct vf_priv_s {
int qp_stride;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int h= (height+15)>>4;
@@ -67,7 +67,7 @@ static int config(struct vf_instance_s* vf,
i,
0
};
- static const char *const_names[]={
+ const char * const const_names[]={
"PI",
"E",
"known",
@@ -81,7 +81,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -98,7 +98,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int x,y;
@@ -141,7 +141,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->qp) av_free(vf->priv->qp);
diff --git a/libmpcodecs/vf_rectangle.c b/libmpcodecs/vf_rectangle.c
index 5a18869c80..221f9dbe8e 100644
--- a/libmpcodecs/vf_rectangle.c
+++ b/libmpcodecs/vf_rectangle.c
@@ -13,7 +13,7 @@ struct vf_priv_s {
};
static int
-config(struct vf_instance_s* vf,
+config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -34,7 +34,7 @@ config(struct vf_instance_s* vf,
}
static int
-control(struct vf_instance_s* vf, int request, void *data)
+control(struct vf_instance* vf, int request, void *data)
{
const int *const tmp = data;
switch(request){
@@ -65,7 +65,7 @@ control(struct vf_instance_s* vf, int request, void *data)
return 0;
}
static int
-put_image(struct vf_instance_s* vf, mp_image_t* mpi, double pts){
+put_image(struct vf_instance* vf, mp_image_t* mpi, double pts){
mp_image_t* dmpi;
unsigned int bpp = mpi->bpp / 8;
int x, y, w, h;
diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c
index f175138160..d378fec59c 100644
--- a/libmpcodecs/vf_remove_logo.c
+++ b/libmpcodecs/vf_remove_logo.c
@@ -674,7 +674,7 @@ static pgm_structure * generate_half_size_image(vf_instance_t * vf, pgm_structur
/**
* \brief Checks if YV12 is supported by the next filter.
*/
-static unsigned int find_best(struct vf_instance_s* vf){
+static unsigned int find_best(struct vf_instance* vf){
int is_format_okay = vf->next->query_format(vf->next, IMGFMT_YV12);
if ((is_format_okay & VFCAP_CSP_SUPPORTED_BY_HW) || (is_format_okay & VFCAP_CSP_SUPPORTED))
return IMGFMT_YV12;
@@ -687,7 +687,7 @@ static unsigned int find_best(struct vf_instance_s* vf){
/**
* \brief Configure the filter and call the next filter's config function.
*/
-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt)
+static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt)
{
if(!(((vf_priv_s *)vf->priv)->fmt=find_best(vf)))
return 0;
@@ -768,7 +768,7 @@ static void convert_yv12(const vf_instance_t * const vf, const char * const sour
* filter, has the logo removed by the filter, and is then sent to the next
* filter.
*/
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
dmpi=vf_get_image(vf->next,((vf_priv_s *)vf->priv)->fmt,
@@ -815,7 +815,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
/**
* \brief Checks to see if the next filter accepts YV12 images.
*/
-static int query_format(struct vf_instance_s * vf, unsigned int fmt)
+static int query_format(struct vf_instance * vf, unsigned int fmt)
{
if (fmt == IMGFMT_YV12)
return vf->next->query_format(vf->next, IMGFMT_YV12);
@@ -881,7 +881,7 @@ static int open(vf_instance_t * vf, char * args)
*
* This is called at exit-time.
*/
-void uninit(vf_instance_t * vf)
+static void uninit(vf_instance_t * vf)
{
/* Destroy our masks and images. */
destroy_pgm(((vf_priv_s *)vf->priv)->filter);
diff --git a/libmpcodecs/vf_rgb2bgr.c b/libmpcodecs/vf_rgb2bgr.c
index 9e372fc719..bf00ab7f07 100644
--- a/libmpcodecs/vf_rgb2bgr.c
+++ b/libmpcodecs/vf_rgb2bgr.c
@@ -36,14 +36,14 @@ static unsigned int getfmt(unsigned int outfmt,int forced){
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
vf->priv->fmt=getfmt(outfmt,vf->priv->forced);
return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -76,7 +76,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int outfmt){
+static int query_format(struct vf_instance* vf, unsigned int outfmt){
unsigned int fmt=getfmt(outfmt,vf->priv->forced);
if(!fmt) return 0;
return vf_next_query_format(vf,fmt) & (~VFCAP_CSP_SUPPORTED_BY_HW);
diff --git a/libmpcodecs/vf_rgbtest.c b/libmpcodecs/vf_rgbtest.c
index 4351956da2..c9f134ad6a 100644
--- a/libmpcodecs/vf_rgbtest.c
+++ b/libmpcodecs/vf_rgbtest.c
@@ -77,7 +77,7 @@ static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if (vf->priv->w > 0) { d_width = width = vf->priv->w; }
@@ -87,7 +87,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int x, y;
int w = vf->priv->w > 0 ? vf->priv->w : mpi->w;
@@ -116,7 +116,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int outfmt){
+static int query_format(struct vf_instance* vf, unsigned int outfmt){
unsigned int fmt=getfmt(outfmt);
if(!fmt) return 0;
return vf_next_query_format(vf,fmt) & (~VFCAP_CSP_SUPPORTED_BY_HW);
diff --git a/libmpcodecs/vf_rotate.c b/libmpcodecs/vf_rotate.c
index 0d1a23d9ac..24015d250b 100644
--- a/libmpcodecs/vf_rotate.c
+++ b/libmpcodecs/vf_rotate.c
@@ -50,7 +50,7 @@ static void rotate(unsigned char* dst,unsigned char* src,int dststride,int srcst
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if (vf->priv->direction & 4) {
@@ -66,7 +66,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,height,width,d_height,d_width,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -96,7 +96,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) return vf_next_query_format(vf, fmt);
// we can support only symmetric (chroma_x_shift==chroma_y_shift) YUV formats:
switch(fmt) {
diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c
index 9d81f44e67..1f7bdbccc1 100644
--- a/libmpcodecs/vf_sab.c
+++ b/libmpcodecs/vf_sab.c
@@ -135,7 +135,7 @@ static int allocStuff(FilterParam *f, int width, int height){
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -160,7 +160,7 @@ static void freeBuffers(FilterParam *f){
f->distCoeff=NULL;
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
freeBuffers(&vf->priv->luma);
@@ -238,7 +238,7 @@ if((x/32)&1){
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
@@ -257,7 +257,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index 2fdbb77c7c..0daa23c605 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -6,6 +6,7 @@
#include "config.h"
#include "mp_msg.h"
#include "cpudetect.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -41,15 +42,11 @@ static struct vf_priv_s {
NULL
};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-extern float screen_size_xy;
-
//===========================================================================//
void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam);
-static unsigned int outfmt_list[]={
+static const unsigned int outfmt_list[]={
// YUV:
IMGFMT_444P,
IMGFMT_422P,
@@ -109,9 +106,10 @@ static unsigned int find_best_out(vf_instance_t *vf){
return best;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
+ struct MPOpts *opts = vf->opts;
unsigned int best=find_best_out(vf);
int vo_flags;
int int_sws_flags=0;
@@ -293,7 +291,8 @@ static int config(struct vf_instance_s* vf,
break; }
}
- if(!opt_screen_size_x && !opt_screen_size_y && !(screen_size_xy >= 0.001)){
+ if (!opts->screen_size_x && !opts->screen_size_y
+ && !(opts->screen_size_xy >= 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) {
@@ -309,7 +308,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best);
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi){
// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen
// they want slices!!! allocate the buffer.
@@ -349,7 +348,7 @@ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src
}
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
mp_image_t *dmpi=vf->dmpi;
if(!dmpi){
@@ -360,7 +359,7 @@ static void draw_slice(struct vf_instance_s* vf,
scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi=mpi->priv;
// printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n",
@@ -387,7 +386,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
int *table;
int *inv_table;
int r;
@@ -450,7 +449,7 @@ static int control(struct vf_instance_s* vf, int request, void* data){
// supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -489,7 +488,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0; // nomatching in-fmt
}
-static void uninit(struct vf_instance_s *vf){
+static void uninit(struct vf_instance *vf){
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
if(vf->priv->ctx2) sws_freeContext(vf->priv->ctx2);
if(vf->priv->palette) free(vf->priv->palette);
@@ -610,7 +609,7 @@ struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat,
}
/// An example of presets usage
-static struct size_preset {
+static const struct size_preset {
char* name;
int w, h;
} vf_size_presets_defs[] = {
@@ -625,21 +624,21 @@ static struct size_preset {
};
#define ST_OFF(f) M_ST_OFF(struct size_preset,f)
-static m_option_t vf_size_preset_fields[] = {
+static const m_option_t vf_size_preset_fields[] = {
{"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
{"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_size_preset = {
+static const m_struct_t vf_size_preset = {
"scale_size_preset",
sizeof(struct size_preset),
NULL,
vf_size_preset_fields
};
-static m_struct_t vf_opts;
-static m_obj_presets_t size_preset = {
+static const m_struct_t vf_opts;
+static const m_obj_presets_t size_preset = {
&vf_size_preset, // Input struct desc
&vf_opts, // Output struct desc
vf_size_presets_defs, // The list of presets
@@ -649,7 +648,7 @@ static m_obj_presets_t size_preset = {
/// Now the options
#undef ST_OFF
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL},
{"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL},
{"interlaced", ST_OFF(interlaced), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL},
@@ -664,7 +663,7 @@ static m_option_t vf_opts_fields[] = {
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"scale",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c
index 56e0eb0d9a..7770dd4de0 100644
--- a/libmpcodecs/vf_screenshot.c
+++ b/libmpcodecs/vf_screenshot.c
@@ -40,7 +40,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -121,7 +121,7 @@ static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi)
sws_scale_ordered(priv->ctx, mpi->planes, mpi->stride, 0, priv->dh, dst, dst_stride);
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi){
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
mpi->type, mpi->flags, mpi->width, mpi->height);
if (vf->priv->shot) {
@@ -132,7 +132,7 @@ static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
if (vf->priv->store_slices) {
uint8_t *dst[3];
@@ -146,7 +146,7 @@ static void draw_slice(struct vf_instance_s* vf,
vf_next_draw_slice(vf,src,stride,w,h,x,y);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
// FIXME: should vf.c really call get_image when using slices??
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
return;
@@ -168,7 +168,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->priv=(void*)vf->dmpi;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi = (mp_image_t *)mpi->priv;
@@ -205,7 +205,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, pts);
}
-int control (vf_instance_t *vf, int request, void *data)
+static int control (vf_instance_t *vf, int request, void *data)
{
/** data contains an integer argument
* 0: take screenshot with the next frame
@@ -229,7 +229,7 @@ int control (vf_instance_t *vf, int request, void *data)
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c
index 31059740e0..ce98514fc7 100644
--- a/libmpcodecs/vf_smartblur.c
+++ b/libmpcodecs/vf_smartblur.c
@@ -100,7 +100,7 @@ static int allocStuff(FilterParam *f, int width, int height){
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -119,7 +119,7 @@ static void freeBuffers(FilterParam *f){
f->filterContext=NULL;
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
freeBuffers(&vf->priv->luma);
@@ -186,7 +186,7 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride,
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
FilterParam *f= &vf->priv;
@@ -207,7 +207,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_softpulldown.c b/libmpcodecs/vf_softpulldown.c
index 30bb405eb5..c8f1c4cf79 100644
--- a/libmpcodecs/vf_softpulldown.c
+++ b/libmpcodecs/vf_softpulldown.c
@@ -17,7 +17,7 @@ struct vf_priv_s {
long long out;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
int ret = 0;
@@ -111,14 +111,14 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
mp_msg(MSGT_VFILTER, MSGL_INFO, "softpulldown: %lld frames in, %lld frames out\n", vf->priv->in, vf->priv->out);
free(vf->priv);
diff --git a/libmpcodecs/vf_softskip.c b/libmpcodecs/vf_softskip.c
index 89727906ce..62fd0ce5ae 100644
--- a/libmpcodecs/vf_softskip.c
+++ b/libmpcodecs/vf_softskip.c
@@ -13,7 +13,7 @@ struct vf_priv_s {
int skipflag;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -36,7 +36,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
switch (request) {
case VFCTRL_SKIP_NEXT_FRAME:
@@ -47,7 +47,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
}
#if 0
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -60,7 +60,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
}
#endif
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c
index 77abc19441..b94948d549 100644
--- a/libmpcodecs/vf_spp.c
+++ b/libmpcodecs/vf_spp.c
@@ -434,7 +434,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
//FIXME reorder for better caching
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int h= (height+16+15)&(~15);
@@ -446,7 +446,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -463,7 +463,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -509,7 +509,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->temp) free(vf->priv->temp);
@@ -526,7 +526,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YVU9:
case IMGFMT_IF09:
@@ -544,7 +544,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch(request){
case VFCTRL_QUERY_MAX_PP_LEVEL:
return 6;
diff --git a/libmpcodecs/vf_swapuv.c b/libmpcodecs/vf_swapuv.c
index f9a65ae6b1..d466e2154e 100644
--- a/libmpcodecs/vf_swapuv.c
+++ b/libmpcodecs/vf_swapuv.c
@@ -38,7 +38,7 @@
//===========================================================================//
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt,
mpi->type, mpi->flags, mpi->w, mpi->h);
@@ -54,7 +54,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->priv=(void*)dmpi;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(mpi->flags&MP_IMGFLAG_DIRECT){
@@ -78,7 +78,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_telecine.c b/libmpcodecs/vf_telecine.c
index 3ce136e5bf..b524f395b6 100644
--- a/libmpcodecs/vf_telecine.c
+++ b/libmpcodecs/vf_telecine.c
@@ -15,7 +15,7 @@ struct vf_priv_s {
int frame;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
int ret;
@@ -88,7 +88,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
}
#if 0
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -100,7 +100,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -108,7 +108,7 @@ static int config(struct vf_instance_s* vf,
}
#endif
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_test.c b/libmpcodecs/vf_test.c
index 1f51011e57..a2ccd611e3 100644
--- a/libmpcodecs/vf_test.c
+++ b/libmpcodecs/vf_test.c
@@ -47,7 +47,7 @@ struct vf_priv_s {
int frame_num;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -269,7 +269,7 @@ static void ring2Test(uint8_t *dst, int stride, int off)
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int frame= vf->priv->frame_num;
@@ -307,7 +307,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
return vf_next_query_format(vf,IMGFMT_YV12) & (~VFCAP_CSP_SUPPORTED_BY_HW);
}
diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c
index b95b4f83ef..893c059972 100644
--- a/libmpcodecs/vf_tfields.c
+++ b/libmpcodecs/vf_tfields.c
@@ -3,6 +3,7 @@
#include <string.h>
#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "cpudetect.h"
@@ -299,10 +300,9 @@ static void qpel_4tap_C(unsigned char *d, unsigned char *s, int w, int h, int ds
static void (*qpel_li)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up);
static void (*qpel_4tap)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up);
-static int continue_buffered_image(struct vf_instance_s *);
-extern int correct_pts;
+static int continue_buffered_image(struct vf_instance *);
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
vf->priv->buffered_mpi = mpi;
vf->priv->buffered_pts = pts;
@@ -310,8 +310,9 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return continue_buffered_image(vf);
}
-static int continue_buffered_image(struct vf_instance_s *vf)
+static int continue_buffered_image(struct vf_instance *vf)
{
+ struct MPOpts *opts = vf->opts;
int i=vf->priv->buffered_i;
double pts = vf->priv->buffered_pts;
mp_image_t *mpi = vf->priv->buffered_mpi;
@@ -362,7 +363,7 @@ static int continue_buffered_image(struct vf_instance_s *vf)
dmpi->stride[2] = 2*mpi->stride[2];
}
ret |= vf_next_put_image(vf, dmpi, pts);
- if (correct_pts)
+ if (opts->correct_pts)
break;
else
if (!i) vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL);
@@ -392,7 +393,7 @@ static int continue_buffered_image(struct vf_instance_s *vf)
mpi->chroma_width, mpi->chroma_height, (i^!tff));
}
ret |= vf_next_put_image(vf, dmpi, pts);
- if (correct_pts)
+ if (opts->correct_pts)
break;
else
if (!i) vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL);
@@ -418,7 +419,7 @@ static int continue_buffered_image(struct vf_instance_s *vf)
dmpi->stride[2], mpi->stride[2]*2, (i^!tff));
}
ret |= vf_next_put_image(vf, dmpi, pts);
- if (correct_pts)
+ if (opts->correct_pts)
break;
else
if (!i) vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL);
@@ -430,7 +431,7 @@ static int continue_buffered_image(struct vf_instance_s *vf)
}
#if 0
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -443,7 +444,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
}
#endif
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -459,7 +460,7 @@ static int config(struct vf_instance_s* vf,
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_tile.c b/libmpcodecs/vf_tile.c
index 8fc4b702fc..c5b4b90e96 100644
--- a/libmpcodecs/vf_tile.c
+++ b/libmpcodecs/vf_tile.c
@@ -68,7 +68,7 @@ struct vf_priv_s {
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -91,7 +91,7 @@ static int config(struct vf_instance_s* vf,
}
/* Filter handler */
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
struct vf_priv_s *priv;
@@ -176,14 +176,14 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
}
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
/* free local data */
free(vf->priv);
}
/* rgb/bgr 15->32 supported & some Yxxx */
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
/* rgb 15 -> 32 bit */
diff --git a/libmpcodecs/vf_tinterlace.c b/libmpcodecs/vf_tinterlace.c
index 3593091e5c..0658b2b322 100644
--- a/libmpcodecs/vf_tinterlace.c
+++ b/libmpcodecs/vf_tinterlace.c
@@ -37,7 +37,7 @@ struct vf_priv_s {
mp_image_t *dmpi;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
int ret = 0;
mp_image_t *dmpi;
@@ -176,7 +176,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -188,7 +188,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -204,7 +204,7 @@ static int config(struct vf_instance_s* vf,
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_unsharp.c b/libmpcodecs/vf_unsharp.c
index aed1a2e98f..26f66917e9 100644
--- a/libmpcodecs/vf_unsharp.c
+++ b/libmpcodecs/vf_unsharp.c
@@ -126,7 +126,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i
//===========================================================================//
-static int config( struct vf_instance_s* vf,
+static int config( struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt ) {
@@ -159,7 +159,7 @@ static int config( struct vf_instance_s* vf,
//===========================================================================//
-static void get_image( struct vf_instance_s* vf, mp_image_t *mpi ) {
+static void get_image( struct vf_instance* vf, mp_image_t *mpi ) {
if( mpi->flags & MP_IMGFLAG_PRESERVE )
return; // don't change
if( mpi->imgfmt!=vf->priv->outfmt )
@@ -178,7 +178,7 @@ static void get_image( struct vf_instance_s* vf, mp_image_t *mpi ) {
mpi->flags |= MP_IMGFLAG_DIRECT;
}
-static int put_image( struct vf_instance_s* vf, mp_image_t *mpi, double pts) {
+static int put_image( struct vf_instance* vf, mp_image_t *mpi, double pts) {
mp_image_t *dmpi;
if( !(mpi->flags & MP_IMGFLAG_DIRECT) )
@@ -204,7 +204,7 @@ static int put_image( struct vf_instance_s* vf, mp_image_t *mpi, double pts) {
return vf_next_put_image( vf, dmpi, pts);
}
-static void uninit( struct vf_instance_s* vf ) {
+static void uninit( struct vf_instance* vf ) {
unsigned int z;
FilterParam *fp;
@@ -227,7 +227,7 @@ static void uninit( struct vf_instance_s* vf ) {
//===========================================================================//
-static int query_format( struct vf_instance_s* vf, unsigned int fmt ) {
+static int query_format( struct vf_instance* vf, unsigned int fmt ) {
switch(fmt) {
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -263,7 +263,7 @@ static void parse( FilterParam *fp, char* args ) {
//===========================================================================//
-static unsigned int fmt_list[] = {
+static const unsigned int fmt_list[] = {
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_IYUV,
diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c
index 3a05a37fbd..95fe34f762 100644
--- a/libmpcodecs/vf_uspp.c
+++ b/libmpcodecs/vf_uspp.c
@@ -208,7 +208,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int ds
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int i;
@@ -249,7 +249,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -266,7 +266,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -301,7 +301,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
int i;
if(!vf->priv) return;
@@ -320,7 +320,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -332,7 +332,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch(request){
case VFCTRL_QUERY_MAX_PP_LEVEL:
return 8;
diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c
index 7e42c77034..4f47bc1847 100644
--- a/libmpcodecs/vf_vo.c
+++ b/libmpcodecs/vf_vo.c
@@ -23,7 +23,7 @@ extern float sub_delay;
struct vf_priv_s {
double pts;
- const vo_functions_t *vo;
+ struct vo *vo;
#ifdef CONFIG_ASS
ass_renderer_t* ass_priv;
int prev_visibility;
@@ -31,9 +31,9 @@ struct vf_priv_s {
};
#define video_out (vf->priv->vo)
-static int query_format(struct vf_instance_s* vf, unsigned int fmt); /* forward declaration */
+static int query_format(struct vf_instance* vf, unsigned int fmt); /* forward declaration */
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -43,8 +43,7 @@ static int config(struct vf_instance_s* vf,
return 0;
}
- if(video_out->info)
- { const vo_info_t *info = video_out->info;
+ const vo_info_t *info = video_out->driver->info;
mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
width, height,
d_width, d_height,
@@ -57,12 +56,11 @@ static int config(struct vf_instance_s* vf,
mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author);
if(info->comment && strlen(info->comment) > 0)
mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment);
- }
// save vo's stride capability for the wanted colorspace:
vf->default_caps=query_format(vf,outfmt);
- if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt))
+ if (vo_config(video_out, width, height, d_width, d_height, flags, "MPlayer", outfmt))
return 0;
#ifdef CONFIG_ASS
@@ -70,46 +68,45 @@ static int config(struct vf_instance_s* vf,
ass_configure(vf->priv->ass_priv, width, height, !!(vf->default_caps & VFCAP_EOSD_UNSCALED));
#endif
- ++vo_config_count;
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
switch(request){
case VFCTRL_GET_DEINTERLACE:
{
if(!video_out) return CONTROL_FALSE; // vo not configured?
- return(video_out->control(VOCTRL_GET_DEINTERLACE, data)
- == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ return vo_control(video_out, VOCTRL_GET_DEINTERLACE, data) == VO_TRUE;
}
case VFCTRL_SET_DEINTERLACE:
{
if(!video_out) return CONTROL_FALSE; // vo not configured?
- return(video_out->control(VOCTRL_SET_DEINTERLACE, data)
- == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ return vo_control(video_out, VOCTRL_SET_DEINTERLACE, data) == VO_TRUE;
}
case VFCTRL_DRAW_OSD:
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
- video_out->draw_osd();
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
+ vo_draw_osd(video_out, data);
return CONTROL_TRUE;
case VFCTRL_FLIP_PAGE:
{
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
- video_out->flip_page();
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
+ vo_flip_page(video_out);
return CONTROL_TRUE;
}
case VFCTRL_SET_EQUALIZER:
{
vf_equalizer_t *eq=data;
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
- return (video_out->control(VOCTRL_SET_EQUALIZER, eq->item, eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
+ struct voctrl_set_equalizer_args param = {eq->item, eq->value};
+ return vo_control(video_out, VOCTRL_SET_EQUALIZER, &param) == VO_TRUE;
}
case VFCTRL_GET_EQUALIZER:
{
vf_equalizer_t *eq=data;
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
- return (video_out->control(VOCTRL_GET_EQUALIZER, eq->item, &eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
+ struct voctrl_get_equalizer_args param = {eq->item, &eq->value};
+ return vo_control(video_out, VOCTRL_GET_EQUALIZER, &param) == VO_TRUE;
}
#ifdef CONFIG_ASS
case VFCTRL_INIT_EOSD:
@@ -124,11 +121,11 @@ static int control(struct vf_instance_s* vf, int request, void* data)
{
mp_eosd_images_t images = {NULL, 2};
double pts = vf->priv->pts;
- if (!vo_config_count || !vf->priv->ass_priv) return CONTROL_FALSE;
+ if (!video_out->config_ok || !vf->priv->ass_priv) return CONTROL_FALSE;
if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) {
mp_eosd_res_t res;
memset(&res, 0, sizeof(res));
- if (video_out->control(VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
+ if (vo_control(video_out, VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
ass_set_frame_size(vf->priv->ass_priv, res.w, res.h);
ass_set_margins(vf->priv->ass_priv, res.mt, res.mb, res.ml, res.mr);
ass_set_aspect_ratio(vf->priv->ass_priv, (double)res.w / res.h);
@@ -141,7 +138,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
} else
vf->priv->prev_visibility = 0;
vf->priv->prev_visibility = sub_visibility;
- return (video_out->control(VOCTRL_DRAW_EOSD, &images) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ return vo_control(video_out, VOCTRL_DRAW_EOSD, &images) == VO_TRUE;
}
#endif
case VFCTRL_GET_PTS:
@@ -150,12 +147,11 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return CONTROL_TRUE;
}
}
- // return video_out->control(request,data);
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
- int flags=video_out->control(VOCTRL_QUERY_FORMAT,&fmt);
+static int query_format(struct vf_instance* vf, unsigned int fmt){
+ int flags = vo_control(video_out, VOCTRL_QUERY_FORMAT, &fmt);
// draw_slice() accepts stride, draw_frame() doesn't:
if(flags)
if(fmt==IMGFMT_YV12 || fmt==IMGFMT_I420 || fmt==IMGFMT_IYUV)
@@ -163,44 +159,44 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return flags;
}
-static void get_image(struct vf_instance_s* vf,
+static void get_image(struct vf_instance* vf,
mp_image_t *mpi){
- if(vo_directrendering && vo_config_count)
- video_out->control(VOCTRL_GET_IMAGE,mpi);
+ if(vo_directrendering && video_out->config_ok)
+ vo_control(video_out, VOCTRL_GET_IMAGE, mpi);
}
-static int put_image(struct vf_instance_s* vf,
+static int put_image(struct vf_instance* vf,
mp_image_t *mpi, double pts){
- if(!vo_config_count) return 0; // vo not configured?
+ if(!video_out->config_ok) return 0; // vo not configured?
// record pts (potentially modified by filters) for main loop
vf->priv->pts = pts;
// first check, maybe the vo/vf plugin implements draw_image using mpi:
- if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done.
+ if (vo_control(video_out, VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done.
// nope, fallback to old draw_frame/draw_slice:
if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){
// blit frame:
// if(mpi->flags&MP_IMGFLAG_PLANAR)
if(vf->default_caps&VFCAP_ACCEPT_STRIDE)
- video_out->draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y);
+ vo_draw_slice(video_out, mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y);
else
- video_out->draw_frame(mpi->planes);
+ vo_draw_frame(video_out, mpi->planes);
}
return 1;
}
-static void start_slice(struct vf_instance_s* vf,
+static void start_slice(struct vf_instance* vf,
mp_image_t *mpi) {
- if(!vo_config_count) return; // vo not configured?
- video_out->control(VOCTRL_START_SLICE,mpi);
+ if(!video_out->config_ok) return; // vo not configured?
+ vo_control(video_out, VOCTRL_START_SLICE,mpi);
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
- if(!vo_config_count) return; // vo not configured?
- video_out->draw_slice(src,stride,w,h,x,y);
+ if(!video_out->config_ok) return; // vo not configured?
+ vo_draw_slice(video_out, src,stride,w,h,x,y);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if (vf->priv) {
#ifdef CONFIG_ASS
@@ -222,9 +218,8 @@ static int open(vf_instance_t *vf, char* args){
vf->start_slice=start_slice;
vf->uninit=uninit;
vf->priv=calloc(1, sizeof(struct vf_priv_s));
- vf->priv->vo = (const vo_functions_t *)args;
+ vf->priv->vo = (struct vo *)args;
if(!video_out) return 0; // no vo ?
-// if(video_out->preinit(args)) return 0; // preinit failed
return 1;
}
diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c
index 5b39738693..12d85da97e 100644
--- a/libmpcodecs/vf_yadif.c
+++ b/libmpcodecs/vf_yadif.c
@@ -26,6 +26,7 @@
#include "config.h"
#include "cpudetect.h"
+#include "options.h"
#include "mp_msg.h"
@@ -374,7 +375,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], int dst_stride[3], int
#endif
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int i, j;
@@ -392,10 +393,9 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int continue_buffered_image(struct vf_instance_s *vf);
-extern int correct_pts;
+static int continue_buffered_image(struct vf_instance *vf);
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int tff;
if(vf->priv->parity < 0) {
@@ -422,8 +422,9 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return continue_buffered_image(vf);
}
-static int continue_buffered_image(struct vf_instance_s *vf)
+static int continue_buffered_image(struct vf_instance *vf)
{
+ struct MPOpts *opts = vf->opts;
mp_image_t *mpi = vf->priv->buffered_mpi;
int tff = vf->priv->buffered_tff;
double pts = vf->priv->buffered_pts;
@@ -440,10 +441,10 @@ static int continue_buffered_image(struct vf_instance_s *vf)
mpi->width,mpi->height);
vf_clone_mpi_attributes(dmpi, mpi);
filter(vf->priv, dmpi->planes, dmpi->stride, mpi->w, mpi->h, i ^ tff ^ 1, tff);
- if (correct_pts && i < (vf->priv->mode & 1))
+ if (opts->correct_pts && i < (vf->priv->mode & 1))
vf_queue_frame(vf, continue_buffered_image);
ret |= vf_next_put_image(vf, dmpi, pts /*FIXME*/);
- if (correct_pts)
+ if (opts->correct_pts)
break;
if(i<(vf->priv->mode&1))
vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL);
@@ -452,7 +453,7 @@ static int continue_buffered_image(struct vf_instance_s *vf)
return ret;
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
int i;
if(!vf->priv) return;
@@ -466,7 +467,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -478,7 +479,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch (request){
case VFCTRL_GET_DEINTERLACE:
*(int*)data = vf->priv->do_deinterlace;
diff --git a/libmpcodecs/vf_yuvcsp.c b/libmpcodecs/vf_yuvcsp.c
index 1cb6a187f5..891bc095df 100644
--- a/libmpcodecs/vf_yuvcsp.c
+++ b/libmpcodecs/vf_yuvcsp.c
@@ -16,7 +16,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
@@ -30,7 +30,7 @@ static inline int clamp_c(int x){
return (x > 240) ? 240 : (x < 16) ? 16 : x;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int i,j;
uint8_t *y_in, *cb_in, *cr_in;
uint8_t *y_out, *cb_out, *cr_out;
@@ -64,12 +64,12 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
/*
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
free(vf->priv);
}
*/
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
diff --git a/libmpcodecs/vf_yuy2.c b/libmpcodecs/vf_yuy2.c
index f8b9e5372c..58752db6aa 100644
--- a/libmpcodecs/vf_yuy2.c
+++ b/libmpcodecs/vf_yuy2.c
@@ -16,7 +16,7 @@
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -30,7 +30,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YUY2);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -52,7 +52,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
diff --git a/libmpcodecs/vf_yvu9.c b/libmpcodecs/vf_yvu9.c
index e82ab48f61..d0c2aab3a3 100644
--- a/libmpcodecs/vf_yvu9.c
+++ b/libmpcodecs/vf_yvu9.c
@@ -15,7 +15,7 @@
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -27,7 +27,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YV12);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int y,w,h;
@@ -62,7 +62,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if (fmt == IMGFMT_YVU9 || fmt == IMGFMT_IF09)
return vf_next_query_format(vf,IMGFMT_YV12) & (~VFCAP_CSP_SUPPORTED_BY_HW);
return 0;
diff --git a/libmpcodecs/vf_zrmjpeg.c b/libmpcodecs/vf_zrmjpeg.c
index 731569ba19..193ac6e5da 100644
--- a/libmpcodecs/vf_zrmjpeg.c
+++ b/libmpcodecs/vf_zrmjpeg.c
@@ -667,7 +667,7 @@ struct vf_priv_s {
* arrange to dispatch to the config() entry pointer for the one
* selected.
*/
-static int config(struct vf_instance_s* vf, int width, int height, int d_width,
+static int config(struct vf_instance* vf, int width, int height, int d_width,
int d_height, unsigned int flags, unsigned int outfmt){
struct vf_priv_s *priv = vf->priv;
float aspect_decision;
@@ -827,7 +827,7 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
* \param mpi pointer to mp_image_t structure
* \param pts
*/
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
struct vf_priv_s *priv = vf->priv;
int size = 0;
int i;
@@ -856,7 +856,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
* Given the image format specified by \a fmt, this routine is called
* to ask if the format is supported or not.
*/
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
VERBOSE("query_format() called\n");
switch (fmt) {