From 2a18cf6706831bdf3cca3d4b25c0701dee46f5cc Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 4 May 2009 11:51:21 +0000 Subject: fixed m4a support git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@931 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp') diff --git a/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp b/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp index 12e6d16ab..678aa3ddb 100644 --- a/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp +++ b/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2008 by Ilya Kotov * + * Copyright (C) 2006-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -139,13 +139,23 @@ bool DecoderFFmpeg::initialize() qDebug("DecoderFFmpeg: cannot open input file"); return FALSE; } + + av_find_stream_info(ic); + av_read_play(ic); + for (wma_idx = 0; wma_idx < ic->nb_streams; wma_idx++) { c = ic->streams[wma_idx]->codec; if (c->codec_type == CODEC_TYPE_AUDIO) break; } - av_find_stream_info(ic); + if (c->channels > 0) + c->channels = qMin(2, c->channels); + else + c->channels = 2; + + dump_format(ic,0,0,0); + //dump_stream_info(ic); codec = avcodec_find_decoder(c->codec_id); @@ -231,7 +241,7 @@ void DecoderFFmpeg::run() out_size = 0; - while (size > 0) + while (size > 0 && (pkt.stream_index == wma_idx)) { out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE*sizeof(int16_t); l = avcodec_decode_audio2(c, (int16_t *)(wma_outbuf), &out_size, inbuf_ptr, size); -- cgit v1.2.3-13-gbd6f