summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-05-02 00:46:03 +0300
committerUoti Urpala <uau@mplayer2.org>2011-05-02 00:46:03 +0300
commit7e65428712beacd416dc3410c52f22ebfd3b4c53 (patch)
tree79bb2f4388be7031b5505c7745e1a59aff6cff56 /libmpcodecs
parent5c4b059f1608f6d6a981b7d81a14f1c46e40ba52 (diff)
parentd0376729d171a6c0b4cc15928c168f68adefbaa6 (diff)
downloadmpv-7e65428712beacd416dc3410c52f22ebfd3b4c53.tar.bz2
mpv-7e65428712beacd416dc3410c52f22ebfd3b4c53.tar.xz
Merge branch 'mplayer1_changes'
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_liba52.c6
-rw-r--r--libmpcodecs/ad_pcm.c2
-rw-r--r--libmpcodecs/ad_qtaudio.c4
-rw-r--r--libmpcodecs/ad_speex.c27
-rw-r--r--libmpcodecs/vd_ffmpeg.c11
5 files changed, 31 insertions, 19 deletions
diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c
index 45126a0786..dd277fd20a 100644
--- a/libmpcodecs/ad_liba52.c
+++ b/libmpcodecs/ad_liba52.c
@@ -81,11 +81,11 @@ while(1){
if(c<0) return -1; /* EOF*/
sh_audio->a_in_buffer[sh_audio->a_in_buffer_len++]=c;
}
- if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8);
+ if(sh_audio->format==MKTAG('d','n','e','t')) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8);
length = a52_syncinfo (sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate);
if(length>=7 && length<=3840) break; /* we're done.*/
/* bad file => resync*/
- if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8);
+ if(sh_audio->format==MKTAG('d','n','e','t')) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8);
memmove(sh_audio->a_in_buffer,sh_audio->a_in_buffer+1,7);
--sh_audio->a_in_buffer_len;
}
@@ -94,7 +94,7 @@ while(1){
sh_audio->i_bps=bit_rate/8;
sh_audio->samplesize=sh_audio->sample_format==AF_FORMAT_FLOAT_NE ? 4 : 2;
demux_read_data(sh_audio->ds,sh_audio->a_in_buffer+8,length-8);
- if(sh_audio->format!=0x2000)
+ if(sh_audio->format==MKTAG('d','n','e','t'))
swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8);
#ifdef CONFIG_LIBA52_INTERNAL
diff --git a/libmpcodecs/ad_pcm.c b/libmpcodecs/ad_pcm.c
index 29e78d69af..1920f396f4 100644
--- a/libmpcodecs/ad_pcm.c
+++ b/libmpcodecs/ad_pcm.c
@@ -86,10 +86,12 @@ static int init(sh_audio_t * sh_audio)
sh_audio->sample_format = AF_FORMAT_S8;
break;
case 0x32336c66: // 'fl32', bigendian float32
+ case 0x32334C46: // 'FL32', bigendian float32 in aiff
sh_audio->sample_format = AF_FORMAT_FLOAT_BE;
sh_audio->samplesize = 4;
break;
case 0x666c3332: // '23lf', little endian float32, MPlayer internal fourCC
+ case 0x6D63706C: // 'lpcm'
sh_audio->sample_format = AF_FORMAT_FLOAT_LE;
sh_audio->samplesize = 4;
break;
diff --git a/libmpcodecs/ad_qtaudio.c b/libmpcodecs/ad_qtaudio.c
index fd1ad2151a..b6c7ef6299 100644
--- a/libmpcodecs/ad_qtaudio.c
+++ b/libmpcodecs/ad_qtaudio.c
@@ -279,7 +279,7 @@ static void uninit(sh_audio_t *sh){
unsigned long ConvertedFrames=0;
unsigned long ConvertedBytes=0;
-#ifdef WIN32_LOADER
+#if defined(WIN32_LOADER) && !defined(CONFIG_QUICKTIME)
Setup_FS_Segment();
#endif
@@ -306,7 +306,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen)
unsigned long ConvertedFrames=0;
unsigned long ConvertedBytes=0;
-#ifdef WIN32_LOADER
+#if defined(WIN32_LOADER) && !defined(CONFIG_QUICKTIME)
Setup_FS_Segment();
#endif
diff --git a/libmpcodecs/ad_speex.c b/libmpcodecs/ad_speex.c
index f8ddc2f336..c9ac1a42c6 100644
--- a/libmpcodecs/ad_speex.c
+++ b/libmpcodecs/ad_speex.c
@@ -63,11 +63,8 @@ static int init(sh_audio_t *sh) {
const uint8_t *hdr = (const uint8_t *)(sh->wf + 1);
const SpeexMode *spx_mode;
const SpeexStereoState st_st = SPEEX_STEREO_STATE_INIT; // hack
- if (!sh->wf || sh->wf->cbSize < 80) {
- mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Missing extradata!\n");
- goto err_out;
- }
- ctx->hdr = speex_packet_to_header((char *)&sh->wf[1], sh->wf->cbSize);
+ if (sh->wf && sh->wf->cbSize >= 80)
+ ctx->hdr = speex_packet_to_header((char *)&sh->wf[1], sh->wf->cbSize);
if (!ctx->hdr && sh->wf->cbSize == 0x72 && hdr[0] == 1 && hdr[1] == 0) {
// speex.acm format: raw SpeexHeader dump
ctx->hdr = calloc(1, sizeof(*ctx->hdr));
@@ -86,8 +83,18 @@ static int init(sh_audio_t *sh) {
ctx->hdr->frames_per_packet = read_le32(&hdr);
}
if (!ctx->hdr) {
- mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Invalid extradata!\n");
- goto err_out;
+ mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Invalid or missing extradata! Assuming defaults.\n");
+ ctx->hdr = calloc(1, sizeof(*ctx->hdr));
+ ctx->hdr->frames_per_packet = 1;
+ ctx->hdr->mode = 0;
+ if (sh->wf) {
+ ctx->hdr->nb_channels = sh->wf->nChannels;
+ ctx->hdr->rate = sh->wf->nSamplesPerSec;
+ if (ctx->hdr->rate > 16000)
+ ctx->hdr->mode = 2;
+ else if (ctx->hdr->rate > 8000)
+ ctx->hdr->mode = 1;
+ }
}
if (ctx->hdr->nb_channels != 1 && ctx->hdr->nb_channels != 2) {
mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Invalid number of channels (%i), "
@@ -119,12 +126,6 @@ static int init(sh_audio_t *sh) {
sh->sample_format = AF_FORMAT_S16_NE;
sh->context = ctx;
return 1;
-
-err_out:
- if (ctx)
- free(ctx->hdr);
- free(ctx);
- return 0;
}
static void uninit(sh_audio_t *sh) {
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 431b5cd340..598be093c1 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -521,10 +521,13 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
sh_video_t *sh = avctx->opaque;
vd_ffmpeg_ctx *ctx = sh->context;
mp_image_t *mpi=NULL;
- int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE;
+ int flags= MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE;
int type= MP_IMGTYPE_IPB;
int width= avctx->width;
int height= avctx->height;
+ // special case to handle reget_buffer without buffer hints
+ if (pic->opaque && pic->data[0] && !pic->buffer_hints)
+ return 0;
avcodec_align_dimensions(avctx, &width, &height);
//printf("get_buffer %d %d %d\n", pic->reference, ctx->ip_count, ctx->b_count);
@@ -557,6 +560,9 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
if(init_vo(sh, avctx->pix_fmt) < 0){
avctx->release_buffer= avcodec_default_release_buffer;
avctx->get_buffer= avcodec_default_get_buffer;
+ avctx->reget_buffer= avcodec_default_reget_buffer;
+ if (pic->data[0])
+ release_buffer(avctx, pic);
return avctx->get_buffer(avctx, pic);
}
@@ -569,6 +575,9 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
ctx->do_dr1=0; //FIXME
avctx->get_buffer= avcodec_default_get_buffer;
+ avctx->reget_buffer= avcodec_default_reget_buffer;
+ if (pic->data[0])
+ release_buffer(avctx, pic);
return avctx->get_buffer(avctx, pic);
}