summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-01-28 00:37:32 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-01-28 00:37:32 +0200
commit6ece23f1b12e80960c66a8596a3c927bf7ee8621 (patch)
tree0163085cfa02840fe8b0e994657583120e8f574a /libmpcodecs
parent167322fa33b6efbc1f1d681327b4a928ba0b706a (diff)
parentb1f3c590c79534efb970220d4c186063adb225aa (diff)
downloadmpv-6ece23f1b12e80960c66a8596a3c927bf7ee8621.tar.bz2
mpv-6ece23f1b12e80960c66a8596a3c927bf7ee8621.tar.xz
Merge svn changes up to r30437
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_ffmpeg.c1
-rw-r--r--libmpcodecs/ad_pcm.c2
-rw-r--r--libmpcodecs/vf_cropdetect.c20
3 files changed, 19 insertions, 4 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index dfcef61b2a..c99cd47fec 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -153,6 +153,7 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...)
switch(cmd){
case ADCTRL_RESYNC_STREAM:
avcodec_flush_buffers(lavc_context);
+ ds_clear_parser(sh->ds);
return CONTROL_TRUE;
}
return CONTROL_UNKNOWN;
diff --git a/libmpcodecs/ad_pcm.c b/libmpcodecs/ad_pcm.c
index 058f6c25cb..cc0de742d8 100644
--- a/libmpcodecs/ad_pcm.c
+++ b/libmpcodecs/ad_pcm.c
@@ -27,6 +27,8 @@ LIBAD_EXTERN(pcm)
static int init(sh_audio_t *sh_audio)
{
WAVEFORMATEX *h=sh_audio->wf;
+ if (!h)
+ return 0;
sh_audio->i_bps=h->nAvgBytesPerSec;
sh_audio->channels=h->nChannels;
sh_audio->samplerate=h->nSamplesPerSec;
diff --git a/libmpcodecs/vf_cropdetect.c b/libmpcodecs/vf_cropdetect.c
index e91f537a04..811df5416e 100644
--- a/libmpcodecs/vf_cropdetect.c
+++ b/libmpcodecs/vf_cropdetect.c
@@ -15,6 +15,7 @@ struct vf_priv_s {
int x1,y1,x2,y2;
int limit;
int round;
+ int reset_count;
int fno;
};
@@ -49,7 +50,7 @@ static int config(struct vf_instance* vf,
vf->priv->y1=height - 1;
vf->priv->x2=0;
vf->priv->y2=0;
- vf->priv->fno=0;
+ vf->priv->fno=-2;
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
@@ -72,7 +73,16 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
dmpi->width=mpi->width;
dmpi->height=mpi->height;
-if(++vf->priv->fno>2){ // ignore first 2 frames - they may be empty
+if(++vf->priv->fno>0){ // ignore first 2 frames - they may be empty
+
+ // Reset the crop area every reset_count frames, if reset_count is > 0
+ if(vf->priv->reset_count > 0 && vf->priv->fno > vf->priv->reset_count){
+ vf->priv->x1=mpi->w-1;
+ vf->priv->y1=mpi->h-1;
+ vf->priv->x2=0;
+ vf->priv->y2=0;
+ vf->priv->fno=1;
+ }
for(y=0;y<vf->priv->y1;y++){
if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){
@@ -153,9 +163,11 @@ static int open(vf_instance_t *vf, char* args){
vf->priv=malloc(sizeof(struct vf_priv_s));
vf->priv->limit=24; // should be option
vf->priv->round = 0;
- if(args) sscanf(args, "%d:%d",
+ vf->priv->reset_count = 0;
+ if(args) sscanf(args, "%d:%d:%d",
&vf->priv->limit,
- &vf->priv->round);
+ &vf->priv->round,
+ &vf->priv->reset_count);
return 1;
}