1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Merge remote-tracking branch 'qatar/master'

* qatar/master: (24 commits)
  yop: set channel layout
  wtv: set channel layout for mpeg audio
  westwood_aud: set channel layout
  wc3movie: set channel layout
  tmv: set channel layout
  tiertexseq: set channel layout
  swfdec: set channel layout
  sol: set channel layout
  smacker: set channel layout
  siff: set channel layout
  sierravmd: set channel layout
  rtpdec_amr: set channel layout
  rsodec: set channel layout
  rmdec: set channel layout for RA version 3
  qcp: set channel layout
  psxstr: set channel layout
  omadec: set channel layout
  oggparsespeex: validate channel count and set channel layout
  nuv: set channel layout
  mxg: set channel layout
  ...

Conflicts:
	libavformat/swfdec.c
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-11-13 11:09:38 +01:00
commit 799d749c77
24 changed files with 95 additions and 7 deletions

View File

@ -31,6 +31,7 @@
* http://wiki.multimedia.cx/index.php?title=American_Laser_Games_MM
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -124,6 +125,7 @@ static int read_header(AVFormatContext *s)
st->codec->codec_tag = 0; /* no fourcc */
st->codec->codec_id = AV_CODEC_ID_PCM_U8;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = 8000;
avpriv_set_pts_info(st, 64, 1, 8000); /* 8000 hz */
}

View File

@ -18,6 +18,8 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
@ -249,6 +251,7 @@ static int mmf_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_ADPCM_YAMAHA;
st->codec->sample_rate = rate;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->bits_per_coded_sample = 4;
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample;

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "internal.h"
@ -91,6 +92,7 @@ static int mpc_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_MUSEPACK7;
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
st->codec->bits_per_coded_sample = 16;
st->codec->extradata_size = 16;

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
@ -81,6 +82,7 @@ static int read_header(AVFormatContext *s)
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->channels = 1;
ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
ast->codec->bits_per_coded_sample = 8;
ast->codec->bit_rate = ast->codec->sample_rate * 8;

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/mjpeg.h"
#include "avformat.h"
@ -56,6 +57,7 @@ static int mxg_read_header(AVFormatContext *s)
audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
audio_st->codec->codec_id = AV_CODEC_ID_PCM_ALAW;
audio_st->codec->channels = 1;
audio_st->codec->channel_layout = AV_CH_LAYOUT_MONO;
audio_st->codec->sample_rate = 8000;
audio_st->codec->bits_per_coded_sample = 8;
audio_st->codec->block_align = 1;

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "avformat.h"
@ -99,6 +100,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
ast->codec->sample_rate = avio_rl32(pb);
ast->codec->bits_per_coded_sample = avio_rl32(pb);
ast->codec->channels = avio_rl32(pb);
ast->codec->channel_layout = 0;
ast->codec->codec_id =
ff_wav_codec_get_id(ast->codec->codec_tag,
ast->codec->bits_per_coded_sample);
@ -179,6 +181,7 @@ static int nuv_header(AVFormatContext *s) {
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
ast->codec->channels = 2;
ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
ast->codec->sample_rate = 44100;
ast->codec->bit_rate = 2 * 2 * 44100 * 8;
ast->codec->block_align = 2 * 2;

View File

@ -25,6 +25,7 @@
#include <stdlib.h>
#include "libavutil/bswap.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
@ -59,6 +60,12 @@ static int speex_header(AVFormatContext *s, int idx) {
st->codec->sample_rate = AV_RL32(p + 36);
st->codec->channels = AV_RL32(p + 48);
if (st->codec->channels < 1 || st->codec->channels > 2) {
av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");
return AVERROR_INVALIDDATA;
}
st->codec->channel_layout = st->codec->channels == 1 ? AV_CH_LAYOUT_MONO :
AV_CH_LAYOUT_STEREO;
spxp->packet_size = AV_RL32(p + 56);
frames_per_packet = AV_RL32(p + 64);

View File

@ -40,6 +40,7 @@
* CODEC SUPPORT: Only ATRAC3 codec is currently supported!
*/
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
@ -318,6 +319,7 @@ static int oma_read_header(AVFormatContext *s)
framesize = (codec_params & 0x3FF) * 8;
jsflag = (codec_params >> 17) & 1; /* get stereo coding mode, 1 for joint-stereo */
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = samplerate;
st->codec->bit_rate = st->codec->sample_rate * framesize * 8 / 1024;
@ -352,6 +354,7 @@ static int oma_read_header(AVFormatContext *s)
case OMA_CODECID_LPCM:
/* PCM 44.1 kHz 16 bit stereo big-endian */
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = 44100;
framesize = 1024;
/* bit rate = sample rate x PCM block align (= 4) x 8 */

View File

@ -29,6 +29,7 @@
* RIFF headers, followed by CD sectors.
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -253,7 +254,13 @@ static int str_read_packet(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_ADPCM_XA;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->channels = (fmt&1)?2:1;
if (fmt & 1) {
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
st->codec->sample_rate = (fmt&4)?18900:37800;
// st->codec->bit_rate = 0; //FIXME;
st->codec->block_align = 128;

View File

@ -27,6 +27,7 @@
* http://tools.ietf.org/html/rfc3625
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
@ -96,6 +97,7 @@ static int qcp_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
avio_read(pb, buf, 16);
if (is_qcelp_13k_guid(buf)) {
st->codec->codec_id = AV_CODEC_ID_QCELP;

View File

@ -21,6 +21,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
@ -141,6 +142,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
avio_skip(pb, header_size + startpos - avio_tell(pb));
st->codec->sample_rate = 8000;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_RA_144;
ast->deint_id = DEINT_ID_INT0;

View File

@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -63,6 +64,7 @@ static int rso_read_header(AVFormatContext *s)
st->codec->codec_tag = id;
st->codec->codec_id = codec;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = rate;
avpriv_set_pts_info(st, 64, 1, rate);

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "rtpdec_formats.h"
#include "libavutil/avstring.h"
@ -77,6 +78,7 @@ static int amr_handle_packet(AVFormatContext *ctx,
av_log(ctx, AV_LOG_ERROR, "Only mono AMR is supported\n");
return AVERROR_INVALIDDATA;
}
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
/* The AMR RTP packet consists of one header byte, followed
* by one TOC byte for each AMR frame in the packet, followed

View File

@ -27,6 +27,7 @@
* http://www.pcisys.net/~melanson/codecs/
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -133,7 +134,13 @@ static int vmd_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_VMDAUDIO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1;
if (vmd->vmd_header[811] & 0x80) {
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
st->codec->sample_rate = vmd->sample_rate;
st->codec->block_align = AV_RL16(&vmd->vmd_header[806]);
if (st->codec->block_align & 0x8000) {

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -79,6 +80,7 @@ static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->channels = 1;
ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
ast->codec->bits_per_coded_sample = 8;
ast->codec->sample_rate = c->rate;
avpriv_set_pts_info(ast, 16, 1, c->rate);

View File

@ -24,6 +24,7 @@
*/
#include "libavutil/bswap.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -191,7 +192,13 @@ static int smacker_read_header(AVFormatContext *s)
} else {
ast[i]->codec->codec_id = AV_CODEC_ID_PCM_U8;
}
ast[i]->codec->channels = (smk->aflags[i] & SMK_AUD_STEREO) ? 2 : 1;
if (smk->aflags[i] & SMK_AUD_STEREO) {
ast[i]->codec->channels = 2;
ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
ast[i]->codec->channels = 1;
ast[i]->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
ast[i]->codec->sample_rate = smk->rates[i];
ast[i]->codec->bits_per_coded_sample = (smk->aflags[i] & SMK_AUD_16BITS) ? 16 : 8;
if(ast[i]->codec->bits_per_coded_sample == 16 && ast[i]->codec->codec_id == AV_CODEC_ID_PCM_U8)

View File

@ -23,6 +23,7 @@
* Based on documents from Game Audio Player and own research
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -116,6 +117,8 @@ static int sol_read_header(AVFormatContext *s)
st->codec->codec_tag = id;
st->codec->codec_id = codec;
st->codec->channels = channels;
st->codec->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO :
AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = rate;
avpriv_set_pts_info(st, 64, 1, rate);
return 0;

View File

@ -21,6 +21,7 @@
*/
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "swf.h"
@ -194,7 +195,13 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!ast)
return AVERROR(ENOMEM);
ast->id = -1; /* -1 to avoid clash with video stream ch_id */
ast->codec->channels = 1 + (v&1);
if (v & 1) {
ast->codec->channels = 2;
ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
ast->codec->channels = 1;
ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
ast->need_parsing = AVSTREAM_PARSE_FULL;

View File

@ -24,6 +24,7 @@
* Tiertex Limited SEQ file demuxer
*/
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
@ -231,6 +232,7 @@ static int seq_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = SEQ_SAMPLE_RATE;
st->codec->bits_per_coded_sample = 16;
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;

View File

@ -26,6 +26,7 @@
* @see http://www.oldskool.org/pc/8088_Corruption
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -112,7 +113,13 @@ static int tmv_read_header(AVFormatContext *s)
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->channels = features & TMV_STEREO ? 2 : 1;
if (features & TMV_STEREO) {
ast->codec->channels = 2;
ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
ast->codec->channels = 1;
ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
ast->codec->bits_per_coded_sample = 8;
ast->codec->bit_rate = ast->codec->sample_rate *
ast->codec->bits_per_coded_sample;

View File

@ -27,6 +27,7 @@
* http://www.pcisys.net/~melanson/codecs/
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
@ -183,6 +184,7 @@ static int wc3_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
st->codec->codec_tag = 1;
st->codec->channels = WC3_AUDIO_CHANNELS;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->bits_per_coded_sample = WC3_AUDIO_BITS;
st->codec->sample_rate = WC3_SAMPLE_RATE;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *

View File

@ -33,6 +33,7 @@
* qualify a file. Refer to wsaud_probe() for the precise parameters.
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -118,6 +119,8 @@ static int wsaud_read_header(AVFormatContext *s)
avpriv_set_pts_info(st, 64, 1, sample_rate);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->channels = channels;
st->codec->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO :
AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = sample_rate;
return 0;

View File

@ -25,6 +25,7 @@
* @author Peter Ross <pross@xvid.org>
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "avformat.h"
@ -558,8 +559,14 @@ static void parse_mpeg1waveformatex(AVStream *st)
/* dwHeadMode */
switch (AV_RL16(st->codec->extradata + 6)) {
case 1 : case 2 : case 4 : st->codec->channels = 2; break;
case 8 : st->codec->channels = 1; break;
case 1 :
case 2 :
case 4 : st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
break;
case 8 : st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
break;
}
}

View File

@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@ -81,6 +82,7 @@ static int yop_read_header(AVFormatContext *s)
audio_dec->codec_type = AVMEDIA_TYPE_AUDIO;
audio_dec->codec_id = AV_CODEC_ID_ADPCM_IMA_APC;
audio_dec->channels = 1;
audio_dec->channels = AV_CH_LAYOUT_MONO;
audio_dec->sample_rate = 22050;
// Video