summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/mplayer.19
-rw-r--r--etc/codecs.conf3
-rw-r--r--libmpcodecs/ad_ffmpeg.c1
-rw-r--r--libmpcodecs/ad_pcm.c2
-rw-r--r--libmpcodecs/vf_cropdetect.c20
-rw-r--r--libmpdemux/asfheader.c1
-rw-r--r--libmpdemux/demux_ts.c2
-rw-r--r--libmpdemux/demuxer.c35
-rw-r--r--libmpdemux/demuxer.h1
9 files changed, 59 insertions, 15 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 7788e65668..41fec8df17 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -5742,7 +5742,7 @@ Position of the cropped picture, defaults to center.
.PD 1
.
.TP
-.B cropdetect[=limit:round]
+.B cropdetect[=limit:round[:reset]]
Calculates necessary cropping parameters and prints the recommended parameters
to stdout.
.PD 0
@@ -5756,6 +5756,13 @@ Value which the width/\:height should be divisible by (default: 16).
The offset is automatically adjusted to center the video.
Use 2 to get only even dimensions (needed for 4:2:2 video).
16 is best when encoding to most video codecs.
+.br
+.IPs <reset>
+Counter that determines after how many frames cropdetect will reset
+the previously detected largest video area and start over to detect
+the current optimal crop area. This can be useful when channel
+logos distort the video area. 0 indicates never reset and return
+the largest area encountered during playback. (default: 0).
.RE
.PD 1
.
diff --git a/etc/codecs.conf b/etc/codecs.conf
index 04662dd90d..3496604e49 100644
--- a/etc/codecs.conf
+++ b/etc/codecs.conf
@@ -130,7 +130,6 @@ videocodec mpegpes
fourcc m2v1,m1v1
fourcc PIM1 ; Pinnacle hardware-MPEG-1
fourcc PIM2 ; Pinnacle hardware-MPEG-2
- fourcc VCR2
fourcc LMP2 ; Lead mpeg2 in avi
driver mpegpes
out MPES
@@ -234,7 +233,6 @@ videocodec mpeg12
fourcc mpg1
fourcc PIM1 ; Pinnacle hardware-MPEG-1
fourcc PIM2 ; Pinnacle hardware-MPEG-2
- fourcc VCR2
fourcc mpg2,MPG2
fourcc MPEG
fourcc hdv1
@@ -307,7 +305,6 @@ videocodec ffmpeg12vdpau
fourcc mpg1,mpg2,MPG2
fourcc PIM1 ; Pinnacle hardware-MPEG-1
fourcc PIM2 ; Pinnacle hardware-MPEG-2
- fourcc VCR2
fourcc "DVR "
fourcc hdv2
fourcc MPEG
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;
}
diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c
index 186a1a967d..95d5f18e7f 100644
--- a/libmpdemux/asfheader.c
+++ b/libmpdemux/asfheader.c
@@ -444,6 +444,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
audio_pos += 64; //16+16+4+4+4+16+4;
buffer = &hdr[audio_pos];
sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F);
+ sh_audio->needs_parsing = 1;
mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "asfheader", streamh->stream_no & 0x7F);
++audio_streams;
if (!asf_init_audio_stream(demuxer, asf, sh_audio, streamh, &audio_pos, &buffer, hdr, hdr_len))
diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c
index 264a84f77d..6b56b55ffc 100644
--- a/libmpdemux/demux_ts.c
+++ b/libmpdemux/demux_ts.c
@@ -1418,7 +1418,7 @@ static int pes_parse2(unsigned char *buf, uint16_t packet_len, ES_stream_t *es,
int ssid = parse_pes_extension_fields(p, pkt_len);
if((audio_substream_id!=-1) && (ssid != audio_substream_id))
return 0;
- if(ssid == 0x72)
+ if(ssid == 0x72 && type_from_pmt != AUDIO_DTS)
es->type = type_from_pmt = AUDIO_TRUEHD;
}
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index 78c18e7640..80d4b556b3 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -59,6 +59,7 @@
// just be removed again.
#define PARSE_ON_ADD 0
+static void clear_parser(sh_common_t *sh);
void resync_video_stream(sh_video_t *sh_video);
void resync_audio_stream(sh_audio_t *sh_audio);
@@ -284,8 +285,7 @@ static void free_sh_sub(sh_sub_t *sh)
#endif
free(sh->lang);
#ifdef CONFIG_LIBAVCODEC
- av_parser_close(sh->parser);
- av_freep(&sh->avctx);
+ clear_parser((sh_common_t *)sh);
#endif
free(sh);
}
@@ -326,8 +326,7 @@ void free_sh_audio(demuxer_t *demuxer, int id)
free(sh->codecdata);
free(sh->lang);
#ifdef CONFIG_LIBAVCODEC
- av_parser_close(sh->parser);
- av_freep(&sh->avctx);
+ clear_parser((sh_common_t *)sh);
#endif
free(sh);
}
@@ -359,8 +358,7 @@ void free_sh_video(sh_video_t *sh)
mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_video at %p\n", sh);
free(sh->bih);
#ifdef CONFIG_LIBAVCODEC
- av_parser_close(sh->parser);
- av_freep(&sh->avctx);
+ clear_parser((sh_common_t *)sh);
#endif
free(sh);
}
@@ -460,6 +458,9 @@ static void allocate_parser(AVCodecContext **avctx, AVCodecParserContext **parse
case 0x86:
codec_id = CODEC_ID_DTS;
break;
+ case MKTAG('M', 'L', 'P', ' '):
+ codec_id = CODEC_ID_MLP;
+ break;
case 0x55:
case 0x5500736d:
case MKTAG('.', 'm', 'p', '3'):
@@ -472,6 +473,9 @@ static void allocate_parser(AVCodecContext **avctx, AVCodecParserContext **parse
case MKTAG('.', 'm', 'p', '1'):
codec_id = CODEC_ID_MP2;
break;
+ case MKTAG('T', 'R', 'H', 'D'):
+ codec_id = CODEC_ID_TRUEHD;
+ break;
}
if (codec_id != CODEC_ID_NONE) {
*avctx = avcodec_alloc_context();
@@ -510,6 +514,20 @@ int ds_parse(demux_stream_t *ds, uint8_t **buffer, int *len, double pts, off_t p
return *len;
return av_parser_parse2(parser, avctx, buffer, len, *buffer, *len, pts, pts, pos);
}
+
+static void clear_parser(sh_common_t *sh)
+{
+ av_parser_close(sh->parser);
+ sh->parser = NULL;
+ av_freep(&sh->avctx);
+}
+
+void ds_clear_parser(demux_stream_t *ds)
+{
+ if (!ds->sh)
+ return;
+ clear_parser(ds->sh);
+}
#endif
void ds_add_packet(demux_stream_t *ds, demux_packet_t *dp)
@@ -1201,6 +1219,11 @@ demuxer_t *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
void demux_flush(demuxer_t *demuxer)
{
+#if PARSE_ON_ADD
+ ds_clear_parser(demuxer->video);
+ ds_clear_parser(demuxer->audio);
+ ds_clear_parser(demuxer->sub);
+#endif
ds_free_packs(demuxer->video);
ds_free_packs(demuxer->audio);
ds_free_packs(demuxer->sub);
diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h
index 5da35efa03..c5499bd053 100644
--- a/libmpdemux/demuxer.h
+++ b/libmpdemux/demuxer.h
@@ -401,6 +401,7 @@ int ds_get_packet_pts(demux_stream_t *ds, unsigned char **start, double *pts);
int ds_get_packet_sub(demux_stream_t *ds,unsigned char **start);
double ds_get_next_pts(demux_stream_t *ds);
int ds_parse(demux_stream_t *sh, uint8_t **buffer, int *len, double pts, off_t pos);
+void ds_clear_parser(demux_stream_t *sh);
// This is defined here because demux_stream_t ins't defined in stream.h
stream_t* new_ds_stream(demux_stream_t *ds);