62 #if CONFIG_WAV_DEMUXER
73 offset += offset < INT64_MAX && offset + wav->
unaligned & 1;
87 size = next_tag(pb, &tag);
90 wav_seek_tag(wav, pb, size, SEEK_CUR);
100 if (!memcmp(p->
buf + 8,
"WAVE", 4)) {
101 if (!memcmp(p->
buf,
"RIFF", 4))
106 else if (!memcmp(p->
buf,
"RF64", 4) &&
107 !memcmp(p->
buf + 12,
"ds64", 4))
113 static void handle_stream_probing(
AVStream *st)
134 handle_stream_probing(*st);
143 static inline int wav_parse_bext_string(
AVFormatContext *s,
const char *key,
163 char temp[131], *coding_history;
165 uint64_t time_reference;
166 int64_t umid_parts[8], umid_mask = 0;
168 if ((ret = wav_parse_bext_string(s,
"description", 256)) < 0 ||
169 (ret = wav_parse_bext_string(s,
"originator", 32)) < 0 ||
170 (ret = wav_parse_bext_string(s,
"originator_reference", 32)) < 0 ||
171 (ret = wav_parse_bext_string(s,
"origination_date", 10)) < 0 ||
172 (ret = wav_parse_bext_string(s,
"origination_time", 8)) < 0)
176 snprintf(temp,
sizeof(temp),
"%"PRIu64, time_reference);
182 for (x = 0; x < 8; x++)
187 if (umid_parts[4] == 0 && umid_parts[5] == 0 &&
188 umid_parts[6] == 0 && umid_parts[7] == 0) {
191 "0x%016"PRIX64
"%016"PRIX64
"%016"PRIX64
"%016"PRIX64,
192 umid_parts[0], umid_parts[1],
193 umid_parts[2], umid_parts[3]);
197 "0x%016"PRIX64
"%016"PRIX64
"%016"PRIX64
"%016"PRIX64
198 "%016"PRIX64
"%016"PRIX64
"%016"PRIX64
"%016"PRIX64,
199 umid_parts[0], umid_parts[1],
200 umid_parts[2], umid_parts[3],
201 umid_parts[4], umid_parts[5],
202 umid_parts[6], umid_parts[7]);
217 if (!(coding_history =
av_malloc(size + 1)))
220 if ((ret =
avio_read(s->
pb, coding_history, size)) < 0)
223 coding_history[
size] = 0;
233 {
"description",
"comment" },
234 {
"originator",
"encoded_by" },
235 {
"origination_date",
"date" },
236 {
"origination_time",
"creation_time" },
244 int64_t sample_count = 0;
250 int ret, got_fmt = 0;
251 int64_t next_tag_ofs, data_ofs = -1;
260 rf64 = tag ==
MKTAG(
'R',
'F',
'6',
'4');
261 if (!rf64 && tag !=
MKTAG(
'R',
'I',
'F',
'F'))
265 if (tag !=
MKTAG(
'W',
'A',
'V',
'E'))
281 "ds64: data_size = %"PRId64
", sample_count = %"PRId64
"\n",
291 size = next_tag(pb, &tag);
298 case MKTAG(
'f',
'm',
't',
' '):
300 if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st)) < 0) {
307 case MKTAG(
'd',
'a',
't',
'a'):
310 "found no 'fmt ' tag before the 'data' tag\n");
318 next_tag_ofs = wav->
data_end = size ? next_tag_ofs : INT64_MAX;
326 if (!pb->
seekable || (!rf64 && !size))
329 case MKTAG(
'f',
'a',
'c',
't'):
333 case MKTAG(
'b',
'e',
'x',
't'):
334 if ((ret = wav_parse_bext_tag(s, size)) < 0)
337 case MKTAG(
'S',
'M',
'V',
'0'):
343 if (size !=
MKTAG(
'0',
'2',
'0',
'0')) {
378 case MKTAG(
'L',
'I',
'S',
'T'):
384 case MKTAG(
'I',
'N',
'F',
'O'):
392 wav_seek_tag(wav, pb, next_tag_ofs, SEEK_SET) < 0) {
437 if (!memcmp(guid, guid1, 16))
444 #define MAX_SIZE 4096
453 if (CONFIG_SPDIF_DEMUXER && wav->
spdif == 0 &&
465 if (CONFIG_SPDIF_DEMUXER && wav->
spdif == 1)
469 int64_t audio_dts, video_dts;
521 if (CONFIG_W64_DEMUXER && wav->
w64)
524 left = find_tag(wav, s->
pb,
MKTAG(
'd',
'a',
't',
'a'));
540 size =
FFMIN(size, left);
550 int stream_index, int64_t timestamp,
int flags)
557 int64_t smv_timestamp = timestamp;
558 if (stream_index == 0)
582 #define OFFSET(x) offsetof(WAVDemuxContext, x)
583 #define DEC AV_OPT_FLAG_DECODING_PARAM
584 static const AVOption demux_options[] = {
589 static const AVClass wav_demuxer_class = {
592 .option = demux_options,
605 .priv_class = &wav_demuxer_class,
609 #if CONFIG_W64_DEMUXER
623 int64_t
size, data_ofs = 0;
635 if (
avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8)
654 if (size <= 24 || INT64_MAX - size <
avio_tell(pb))
681 uint32_t
count, chunk_size, i;
684 end = start +
FFALIGN(size, INT64_C(8)) - 24;
687 for (i = 0; i <
count; i++) {
688 char chunk_key[5], *
value;
720 handle_stream_probing(st);