31 #include "libavutil/dict.h"
32 #include "libavutil/common.h"
33 #include "libavutil/mathematics.h"
34 #include "libavutil/opt.h"
42 #define RF64_AUTO (-1)
59 static inline void bwf_write_bext_string(
AVFormatContext *
s,
const char *key,
int maxlen)
65 len = strlen(tag->
value);
66 len =
FFMIN(len, maxlen);
76 uint64_t time_reference = 0;
79 bwf_write_bext_string(s,
"description", 256);
80 bwf_write_bext_string(s,
"originator", 32);
81 bwf_write_bext_string(s,
"originator_reference", 32);
82 bwf_write_bext_string(s,
"origination_date", 10);
83 bwf_write_bext_string(s,
"origination_time", 8);
86 time_reference = strtoll(tmp_tag->
value, NULL, 10);
91 unsigned char umidpart_str[17] = {0};
96 for (i = 0; i < len/16; i++) {
97 memcpy(umidpart_str, tmp_tag->
value + 2 + (i*16), 16);
98 umidpart = strtoll(umidpart_str, NULL, 16);
154 bwf_write_bext_chunk(s);
189 int64_t file_size, data_size;
190 int64_t number_of_samples = 0;
198 data_size = file_size - wav->
data;
203 avio_wl32(pb, (uint32_t)(file_size - 8));
217 if (rf64 || (wav->
rf64 ==
RF64_AUTO && number_of_samples > UINT32_MAX)) {
253 #define OFFSET(x) offsetof(WAVMuxContext, x)
254 #define ENC AV_OPT_FLAG_ENCODING_PARAM
264 static const AVClass wav_muxer_class = {
274 .mime_type =
"audio/x-wav",
284 .priv_class = &wav_muxer_class,
347 end_guid(pb, wav->
data);
354 int64_t number_of_samples;
const uint8_t ff_w64_guid_wave[16]
void ff_end_tag(AVIOContext *pb, int64_t start)
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
const uint8_t ff_w64_guid_fact[16]
#define LIBAVUTIL_VERSION_INT
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
AVCodecContext * codec
Codec context associated with this stream.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
const char * av_default_item_name(void *ctx)
Return the context name.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static av_cold int end(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
const OptionDef options[]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * priv_data
Format private data.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const AVCodecTag ff_codec_wav_tags[]
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const
Rescale a 64-bit integer with rounding to nearest.
void ffio_fill(AVIOContext *s, int b, int count)
static int write_trailer(AVFormatContext *s1)
const uint8_t ff_w64_guid_data[16]
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
const uint8_t ff_w64_guid_riff[16]
int sample_rate
samples per second
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
Describe the class of an AVClass context structure.
const uint8_t ff_w64_guid_fmt[16]
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
static void write_header(FFV1Context *f)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.