22#include "config_components.h"
41static const int mmf_rates[] = { 4000, 8000, 11025, 22050, 44100 };
51static int mmf_rate_code(
int rate)
54 for (
i = 0;
i < 5;
i++)
81 rate = mmf_rate_code(
s->streams[0]->codecpar->sample_rate);
83 av_log(
s,
AV_LOG_ERROR,
"Unsupported sample rate %d, supported are 4000, 8000, 11025, 22050 and 44100\n",
84 s->streams[0]->codecpar->sample_rate);
88 mmf->
stereo =
s->streams[0]->codecpar->ch_layout.nb_channels > 1;
92 "add '-strict %d' if you want to use it.\n",
125 avio_write(pb,
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
155 end_tag_be(pb, mmf->
awapos);
156 end_tag_be(pb, mmf->
atrpos);
168 gatetime =
size * 500 /
s->streams[0]->codecpar->sample_rate;
169 put_varlength(pb, gatetime);
172 put_varlength(pb, gatetime);
187 if (p->buf[0] ==
'M' && p->buf[1] ==
'M' &&
188 p->buf[2] ==
'M' && p->buf[3] ==
'D' &&
189 p->buf[8] ==
'C' && p->buf[9] ==
'N' &&
190 p->buf[10] ==
'T' && p->buf[11] ==
'I')
207 if (
tag !=
MKTAG(
'M',
'M',
'M',
'D'))
215 if (
tag ==
MKTAG(
'C',
'N',
'T',
'I'))
217 if (
tag ==
MKTAG(
'O',
'P',
'D',
'A'))
223 if ((
tag & 0xffffff) ==
MKTAG(
'M',
'T',
'R', 0)) {
227 if ((
tag & 0xffffff) !=
MKTAG(
'A',
'T',
'R', 0)) {
248 if (
tag ==
MKTAG(
'A',
't',
's',
'q'))
250 if (
tag ==
MKTAG(
'A',
's',
'p',
'I'))
256 if ((
tag & 0xffffff) !=
MKTAG(
'A',
'w',
'a', 0)) {
296 pkt->stream_index = 0;
301#if CONFIG_MMF_DEMUXER
317 .p.mime_type =
"application/vnd.smaf",
318 .p.extensions =
"mmf",
325 .write_header = mmf_write_header,
327 .write_trailer = mmf_write_trailer,
SwsAArch64OpImplParams params
static double val(void *priv, double ch)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
void avio_w8(AVIOContext *s, int b)
void avio_wb32(AVIOContext *s, unsigned int val)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned int avio_rl32(AVIOContext *s)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
#define i(width, name, range_min, range_max)
static int read_probe(const AVProbeData *p)
Public libavutil channel layout APIs header.
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
static int read_header(FFV1Context *f, RangeCoder *c)
@ AV_CODEC_ID_ADPCM_YAMAHA
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define MKTAG(a, b, c, d)
static int mmf_read_header(AVFormatContext *s)
static int mmf_read_packet(AVFormatContext *s, AVPacket *pkt)
static int mmf_rate(int code)
static int mmf_probe(const AVProbeData *p)
static const int mmf_rates[]
#define FF_OFMT_FLAG_MAX_ONE_OF_EACH
If this flag is set, it indicates that for each codec type whose corresponding default codec (i....
#define FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
If this flag is set, then the only permitted audio/video/subtitle codec ids are AVOutputFormat....
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
internal header for RIFF based (de)muxers do NOT include this in end user applications
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
AVChannelLayout ch_layout
The channel layout and number of channels.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
This structure stores compressed data.
This structure contains the data a format has to probe a file.
AVCodecParameters * codecpar
Codec parameters associated with this stream.