diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2001-09-23 17:19:49 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2001-09-23 17:19:49 +0000 |
commit | 5ed8fafcb6299dcf788438356a0a311344001db3 (patch) | |
tree | 3f53c9af8c23d0ce27325c804ec9801e96995d06 /libav/raw.c | |
parent | f674bf7105377ba498eb6c4489fa3557b64d663a (diff) | |
download | ffmpeg-5ed8fafcb6299dcf788438356a0a311344001db3.tar.gz |
added pcm formats
Originally committed as revision 142 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/raw.c')
-rw-r--r-- | libav/raw.c | 161 |
1 files changed, 155 insertions, 6 deletions
diff --git a/libav/raw.c b/libav/raw.c index f0d0c86c75..02b56b48ee 100644 --- a/libav/raw.c +++ b/libav/raw.c @@ -68,7 +68,6 @@ static int raw_read_header(AVFormatContext *s, case CODEC_TYPE_AUDIO: st->codec.sample_rate = ap->sample_rate; st->codec.channels = ap->channels; - /* XXX: endianness */ break; case CODEC_TYPE_VIDEO: st->codec.frame_rate = ap->frame_rate; @@ -84,6 +83,26 @@ static int raw_read_header(AVFormatContext *s, return 0; } +/* raw input */ +static int pcm_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + AVStream *st; + + st = malloc(sizeof(AVStream)); + if (!st) + return -1; + s->nb_streams = 1; + s->streams[0] = st; + + st->id = 0; + + st->codec.codec_type = CODEC_TYPE_AUDIO; + st->codec.codec_id = s->format->audio_codec; + + return 0; +} + #define RAW_PACKET_SIZE 1024 int raw_read_packet(AVFormatContext *s, @@ -229,18 +248,148 @@ AVFormat mjpeg_format = { raw_read_close, }; -AVFormat pcm_format = { - "pcm", - "pcm raw format", +/* pcm formats */ + +AVFormat pcm_s16le_format = { + "s16le", + "pcm signed 16 bit little endian format", NULL, +#ifdef WORDS_BIGENDIAN + "", +#else "sw", - CODEC_ID_PCM, +#endif + CODEC_ID_PCM_S16LE, 0, raw_write_header, raw_write_packet, raw_write_trailer, - raw_read_header, + pcm_read_header, + raw_read_packet, + raw_read_close, +}; + +AVFormat pcm_s16be_format = { + "s16be", + "pcm signed 16 bit big endian format", + NULL, +#ifdef WORDS_BIGENDIAN + "sw", +#else + "", +#endif + CODEC_ID_PCM_S16BE, + 0, + raw_write_header, + raw_write_packet, + raw_write_trailer, + + pcm_read_header, + raw_read_packet, + raw_read_close, +}; + +AVFormat pcm_u16le_format = { + "u16le", + "pcm unsigned 16 bit little endian format", + NULL, +#ifdef WORDS_BIGENDIAN + "", +#else + "uw", +#endif + CODEC_ID_PCM_U16LE, + 0, + raw_write_header, + raw_write_packet, + raw_write_trailer, + + pcm_read_header, + raw_read_packet, + raw_read_close, +}; + +AVFormat pcm_u16be_format = { + "u16be", + "pcm unsigned 16 bit big endian format", + NULL, +#ifdef WORDS_BIGENDIAN + "uw", +#else + "", +#endif + CODEC_ID_PCM_U16BE, + 0, + raw_write_header, + raw_write_packet, + raw_write_trailer, + + pcm_read_header, + raw_read_packet, + raw_read_close, +}; + +AVFormat pcm_s8_format = { + "s8", + "pcm signed 8 bit format", + NULL, + "sb", + CODEC_ID_PCM_S8, + 0, + raw_write_header, + raw_write_packet, + raw_write_trailer, + + pcm_read_header, + raw_read_packet, + raw_read_close, +}; + +AVFormat pcm_u8_format = { + "u8", + "pcm unsigned 8 bit format", + NULL, + "ub", + CODEC_ID_PCM_U8, + 0, + raw_write_header, + raw_write_packet, + raw_write_trailer, + + pcm_read_header, + raw_read_packet, + raw_read_close, +}; + +AVFormat pcm_mulaw_format = { + "mulaw", + "pcm mu law format", + NULL, + "ul", + CODEC_ID_PCM_MULAW, + 0, + raw_write_header, + raw_write_packet, + raw_write_trailer, + + pcm_read_header, + raw_read_packet, + raw_read_close, +}; + +AVFormat pcm_alaw_format = { + "alaw", + "pcm A law format", + NULL, + "al", + CODEC_ID_PCM_ALAW, + 0, + raw_write_header, + raw_write_packet, + raw_write_trailer, + + pcm_read_header, raw_read_packet, raw_read_close, }; |