00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "libavutil/intreadwrite.h"
00023 #include "avformat.h"
00024 #include "avio_internal.h"
00025 #include "internal.h"
00026 #include "rawenc.h"
00027 #include "ircam.h"
00028
00029 static int ircam_write_header(AVFormatContext *s)
00030 {
00031 AVCodecContext *codec = s->streams[0]->codec;
00032 uint32_t tag;
00033
00034 if (s->nb_streams != 1) {
00035 av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
00036 return AVERROR(EINVAL);
00037 }
00038
00039 tag = ff_codec_get_tag(ff_codec_ircam_le_tags, codec->codec_id);
00040 if (!tag) {
00041 av_log(s, AV_LOG_ERROR, "unsupported codec\n");
00042 return AVERROR(EINVAL);
00043 }
00044
00045 avio_wl32(s->pb, 0x0001A364);
00046 avio_wl32(s->pb, av_float2int(codec->sample_rate));
00047 avio_wl32(s->pb, codec->channels);
00048 avio_wl32(s->pb, tag);
00049 ffio_fill(s->pb, 0, 1008);
00050 return 0;
00051 }
00052
00053 AVOutputFormat ff_ircam_muxer = {
00054 .name = "ircam",
00055 .extensions = "sf,ircam",
00056 .long_name = NULL_IF_CONFIG_SMALL("Berkeley/IRCAM/CARL Sound Format"),
00057 .audio_codec = AV_CODEC_ID_PCM_S16LE,
00058 .video_codec = AV_CODEC_ID_NONE,
00059 .write_header = ircam_write_header,
00060 .write_packet = ff_raw_write_packet,
00061 .codec_tag = (const AVCodecTag *const []){ ff_codec_ircam_le_tags, 0 },
00062 };