summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-01 20:21:58 +0000
committerhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-01 20:21:58 +0000
commit18abbb69a1198ab205444219aad830d20a8acd9c (patch)
treea0a29016c7a1d17bc8e7cdac20108975f73b1608 /libmpcodecs
parent9bc6e8097212e5358a0dce1dda158b0f05e017d9 (diff)
downloadmpv-18abbb69a1198ab205444219aad830d20a8acd9c.tar.bz2
mpv-18abbb69a1198ab205444219aad830d20a8acd9c.tar.xz
fixes for encoding of multiple files
- do not uninitialize video encoder between files - checks for image size & format change moved from mencoder.c to vfilters by Oded Shimon <ods15@ods15.dyndns.org> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14879 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd.c8
-rw-r--r--libmpcodecs/ve_divx4.c1
-rw-r--r--libmpcodecs/ve_lavc.c1
-rw-r--r--libmpcodecs/ve_libdv.c1
-rw-r--r--libmpcodecs/ve_nuv.c1
-rw-r--r--libmpcodecs/ve_qtvideo.c1
-rw-r--r--libmpcodecs/ve_raw.c1
-rw-r--r--libmpcodecs/ve_vfw.c1
-rw-r--r--libmpcodecs/ve_x264.c1
-rw-r--r--libmpcodecs/ve_xvid.c1
-rw-r--r--libmpcodecs/ve_xvid4.c1
-rw-r--r--libmpcodecs/vf.c33
-rw-r--r--libmpcodecs/vf.h9
-rw-r--r--libmpcodecs/vfcap.h2
14 files changed, 57 insertions, 5 deletions
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 439cc8383a..4b20ab4fee 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -309,10 +309,10 @@ csp_again:
vf->w = sh->disp_w;
vf->h = sh->disp_h;
- if(vf->config(vf,sh->disp_w,sh->disp_h,
- screen_size_x,screen_size_y,
- fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3),
- out_fmt)==0){
+ if(vf_config_wrapper(vf,sh->disp_w,sh->disp_h,
+ screen_size_x,screen_size_y,
+ fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3),
+ out_fmt)==0){
// "MPlayer",out_fmt)){
mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CannotInitVO);
sh->vf_inited=-1;
diff --git a/libmpcodecs/ve_divx4.c b/libmpcodecs/ve_divx4.c
index 11f18b9f00..0e4a7e3c1d 100644
--- a/libmpcodecs/ve_divx4.c
+++ b/libmpcodecs/ve_divx4.c
@@ -453,6 +453,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
static int vf_open(vf_instance_t *vf, char* args){
vf->config=config;
+ vf->default_caps=VFCAP_CONSTANT;
vf->control=control;
vf->query_format=query_format;
vf->put_image=put_image;
diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c
index c9a43974e8..b6d6228c73 100644
--- a/libmpcodecs/ve_lavc.c
+++ b/libmpcodecs/ve_lavc.c
@@ -923,6 +923,7 @@ static void uninit(struct vf_instance_s* vf){
static int vf_open(vf_instance_t *vf, char* args){
vf->uninit=uninit;
vf->config=config;
+ vf->default_caps=VFCAP_CONSTANT;
vf->control=control;
vf->query_format=query_format;
vf->put_image=put_image;
diff --git a/libmpcodecs/ve_libdv.c b/libmpcodecs/ve_libdv.c
index cb8a7b7dbd..22d9e92b4b 100644
--- a/libmpcodecs/ve_libdv.c
+++ b/libmpcodecs/ve_libdv.c
@@ -85,6 +85,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
static int vf_open(vf_instance_t *vf, char* args){
vf->config=config;
+ vf->default_caps=VFCAP_CONSTANT;
vf->control=control;
vf->query_format=query_format;
vf->put_image=put_image;
diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c
index 96719e06c5..f1a9f92b4b 100644
--- a/libmpcodecs/ve_nuv.c
+++ b/libmpcodecs/ve_nuv.c
@@ -192,6 +192,7 @@ static void uninit(struct vf_instance_s* vf) {
static int vf_open(vf_instance_t *vf, char* args){
vf->config=config;
+ vf->default_caps=VFCAP_CONSTANT;
vf->control=control;
vf->query_format=query_format;
vf->put_image=put_image;
diff --git a/libmpcodecs/ve_qtvideo.c b/libmpcodecs/ve_qtvideo.c
index 58bfc30924..f871de2755 100644
--- a/libmpcodecs/ve_qtvideo.c
+++ b/libmpcodecs/ve_qtvideo.c
@@ -278,6 +278,7 @@ if(!codec_inited){
static int vf_open(vf_instance_t *vf, char* args){
OSErr cres = 1;
vf->config=config;
+ vf->default_caps=VFCAP_CONSTANT;
vf->control=control;
vf->query_format=query_format;
vf->put_image=put_image;
diff --git a/libmpcodecs/ve_raw.c b/libmpcodecs/ve_raw.c
index 620dec483f..fe4470017a 100644
--- a/libmpcodecs/ve_raw.c
+++ b/libmpcodecs/ve_raw.c
@@ -125,6 +125,7 @@ static int put_image(struct vf_instance_s *vf, mp_image_t *mpi) {
static int vf_open(vf_instance_t *vf, char* args){
vf->config = config;
+ vf->default_caps = VFCAP_CONSTANT;
vf->control = control;
vf->query_format = query_format;
vf->put_image = put_image;
diff --git a/libmpcodecs/ve_vfw.c b/libmpcodecs/ve_vfw.c
index f30b5b53df..1d31302085 100644
--- a/libmpcodecs/ve_vfw.c
+++ b/libmpcodecs/ve_vfw.c
@@ -251,6 +251,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
static int vf_open(vf_instance_t *vf, char* args){
vf->config=config;
+ vf->default_caps=VFCAP_CONSTANT;
vf->control=control;
vf->query_format=query_format;
vf->put_image=put_image;
diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c
index e26e7e11a4..06d5512fba 100644
--- a/libmpcodecs/ve_x264.c
+++ b/libmpcodecs/ve_x264.c
@@ -375,6 +375,7 @@ static int vf_open(vf_instance_t *vf, char *args) {
h264_module_t *mod;
vf->config = config;
+ vf->default_caps = VFCAP_CONSTANT;
vf->control = control;
vf->query_format = query_format;
vf->put_image = put_image;
diff --git a/libmpcodecs/ve_xvid.c b/libmpcodecs/ve_xvid.c
index 5303e13d2f..d2979dddb2 100644
--- a/libmpcodecs/ve_xvid.c
+++ b/libmpcodecs/ve_xvid.c
@@ -539,6 +539,7 @@ vf_open(vf_instance_t *vf, char* args)
{
XVID_INIT_PARAM params = { 0, 0, 0};
vf->config = config;
+ vf->default_caps = VFCAP_CONSTANT;
vf->control = control;
vf->uninit = uninit;
vf->query_format = query_format;
diff --git a/libmpcodecs/ve_xvid4.c b/libmpcodecs/ve_xvid4.c
index 8457b5f2ce..5e0c4087b0 100644
--- a/libmpcodecs/ve_xvid4.c
+++ b/libmpcodecs/ve_xvid4.c
@@ -546,6 +546,7 @@ vf_open(vf_instance_t *vf, char* args)
/* Setting libmpcodec module API pointers */
vf->config = config;
+ vf->default_caps = VFCAP_CONSTANT;
vf->control = control;
vf->uninit = uninit;
vf->query_format = query_format;
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index 0bebfcc49e..e510d99e31 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -541,6 +541,37 @@ void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src){
dst->qscale= src->qscale;
}
}
+/**
+ * \brief Video config() function wrapper
+ *
+ * Blocks config() calls with different size or format for filters
+ * with VFCAP_CONSTANT
+ *
+ * First call is redirected to vf->config.
+ *
+ * In following calls, it verifies that the configuration parameters
+ * are unchanged, and returns either success or error.
+ *
+*/
+int vf_config_wrapper(struct vf_instance_s* vf,
+ int width, int height, int d_width, int d_height,
+ unsigned int flags, unsigned int outfmt)
+{
+ if ((vf->default_caps&VFCAP_CONSTANT) && vf->fmt.have_configured) {
+ if ((vf->fmt.orig_width != width)
+ || (vf->fmt.orig_height != height)
+ || (vf->fmt.orig_fmt != outfmt)) {
+ mp_msg(MSGT_VFILTER,MSGL_FATAL,MSGTR_ResolutionDoesntMatch);
+ return 0;
+ }
+ return 1;
+ }
+ vf->fmt.have_configured = 1;
+ vf->fmt.orig_height = height;
+ vf->fmt.orig_width = width;
+ vf->fmt.orig_fmt = outfmt;
+ vf->config(vf, width, height, d_width, d_height, flags, outfmt);
+}
int vf_next_config(struct vf_instance_s* vf,
int width, int height, int d_width, int d_height,
@@ -571,7 +602,7 @@ int vf_next_config(struct vf_instance_s* vf,
vf->next=vf2;
}
vf->next->w = width; vf->next->h = height;
- return vf->next->config(vf->next,width,height,d_width,d_height,voflags,outfmt);
+ 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){
diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h
index 85ae9a6f89..77f80d2897 100644
--- a/libmpcodecs/vf.h
+++ b/libmpcodecs/vf.h
@@ -19,6 +19,11 @@ typedef struct vf_image_context_s {
int static_idx;
} vf_image_context_t;
+typedef struct vf_format_context_t {
+ int have_configured;
+ int orig_width, orig_height, orig_fmt;
+} vf_format_context_t;
+
typedef struct vf_instance_s {
vf_info_t* info;
// funcs:
@@ -44,6 +49,7 @@ typedef struct vf_instance_s {
// data:
int w, h;
vf_image_context_t imgctx;
+ vf_format_context_t fmt;
struct vf_instance_s* next;
mp_image_t *dmpi;
struct vf_priv_s* priv;
@@ -99,3 +105,6 @@ void vf_list_plugins();
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 width, int height, int d_width, int d_height,
+ unsigned int flags, unsigned int outfmt);
diff --git a/libmpcodecs/vfcap.h b/libmpcodecs/vfcap.h
index 2a0d12d4ff..aafdd334e7 100644
--- a/libmpcodecs/vfcap.h
+++ b/libmpcodecs/vfcap.h
@@ -24,4 +24,6 @@
#define VFCAP_ACCEPT_STRIDE 0x400
// filter does postprocessing (so you shouldn't scale/filter image before it)
#define VFCAP_POSTPROC 0x800
+// filter cannot be reconfigured to different size & format
+#define VFCAP_CONSTANT 0x1000