summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-12-27 15:28:01 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-12-27 15:28:01 +0000
commitca2af2d0e78eb3457ff84b829d7ce683d7278876 (patch)
tree933eba47f963becafccc500ac4133b24710721b8 /libmpcodecs
parentbcda7b2f9990b56dfc12d31e95b8d507202df82c (diff)
downloadmpv-ca2af2d0e78eb3457ff84b829d7ce683d7278876.tar.bz2
mpv-ca2af2d0e78eb3457ff84b829d7ce683d7278876.tar.xz
Add support for parsing audio streams (though should be easy to extend to video)
via libavcodec. Parsing can be done at the demuxer stage (currently disabled) or at the decoder (ad_ffmpeg, enabled). Should allow using the libavcodec AAC, DTS, ... decoders independent of container format. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30130 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_ffmpeg.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index fa005b4a15..068a32a307 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -167,7 +167,17 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m
int len2=maxlen;
double pts;
int x=ds_get_packet_pts(sh_audio->ds,&start, &pts);
- if(x<=0) break; // error
+ if(x<=0) {
+ start = NULL;
+ x = 0;
+ ds_parse(sh_audio->ds, &start, &x, MP_NOPTS_VALUE, 0);
+ if (x <= 0)
+ break; // error
+ } else {
+ int in_size = x;
+ int consumed = ds_parse(sh_audio->ds, &start, &x, pts, 0);
+ sh_audio->ds->buffer_pos -= in_size - consumed;
+ }
av_init_packet(&pkt);
pkt.data = start;
pkt.size = x;
@@ -178,7 +188,8 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m
y=avcodec_decode_audio3(sh_audio->context,(int16_t*)buf,&len2,&pkt);
//printf("return:%d samples_out:%d bitstream_in:%d sample_sum:%d\n", y, len2, x, len); fflush(stdout);
if(y<0){ mp_msg(MSGT_DECAUDIO,MSGL_V,"lavc_audio: error\n");break; }
- if(y<x) sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!)
+ if(!sh_audio->needs_parsing && y<x)
+ sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!)
if(len2>0){
if (((AVCodecContext *)sh_audio->context)->channels >= 5) {
int samplesize = av_get_bits_per_sample_format(((AVCodecContext *)