40 #define VALIDATE_INDEX_TS_THRESH 2500
67 d[3] < 5 && d[5] == 0 &&
101 switch (flv_codecid) {
104 codec_id = bits_per_coded_sample == 8
111 return codec_id == acodec->
codec_id;
113 codec_id = bits_per_coded_sample == 8
116 return codec_id == acodec->
codec_id;
143 switch (flv_codecid) {
207 switch (flv_codecid) {
226 int flv_codecid,
int read)
229 switch (flv_codecid) {
275 if (length >= buffsize) {
291 unsigned int timeslen = 0, fileposlen = 0, i;
293 int64_t *times = NULL;
294 int64_t *filepositions = NULL;
308 int64_t **current_array;
309 unsigned int arraylen;
320 current_array = ×
324 current_array = &filepositions;
325 fileposlen = arraylen;
331 if (!(*current_array =
av_mallocz(
sizeof(**current_array) * arraylen))) {
336 for (i = 0; i < arraylen &&
avio_tell(ioc) < max_pos - 1; i++) {
341 if (times && filepositions) {
349 if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) {
350 for (i = 0; i < fileposlen; i++) {
398 if ((vstream || astream) && key &&
431 unsigned int arraylen, i;
434 for (i = 0; i < arraylen &&
avio_tell(ioc) < max_pos - 1; i++)
448 if (depth == 1 && key) {
449 acodec = astream ? astream->
codec : NULL;
450 vcodec = vstream ? vstream->
codec : NULL;
454 if (!strcmp(key,
"duration"))
456 else if (!strcmp(key,
"videodatarate") && vcodec &&
457 0 <= (
int)(num_val * 1024.0))
458 vcodec->
bit_rate = num_val * 1024.0;
459 else if (!strcmp(key,
"audiodatarate") && acodec &&
460 0 <= (
int)(num_val * 1024.0))
461 acodec->
bit_rate = num_val * 1024.0;
462 else if (!strcmp(key,
"datastream")) {
468 if (!strcmp(key,
"videocodecid") && vcodec) {
470 }
else if (!strcmp(key,
"audiocodecid") && acodec) {
473 }
else if (!strcmp(key,
"audiosamplerate") && acodec) {
475 }
else if (!strcmp(key,
"audiosamplesize") && acodec) {
477 }
else if (!strcmp(key,
"stereo") && acodec) {
482 }
else if (!strcmp(key,
"width") && vcodec) {
483 vcodec->
width = num_val;
484 }
else if (!strcmp(key,
"height") && vcodec) {
491 ((!acodec && !strcmp(key,
"audiocodecid")) ||
492 (!vcodec && !strcmp(key,
"videocodecid"))))
495 if (!strcmp(key,
"duration") ||
496 !strcmp(key,
"filesize") ||
497 !strcmp(key,
"width") ||
498 !strcmp(key,
"height") ||
499 !strcmp(key,
"videodatarate") ||
500 !strcmp(key,
"framerate") ||
501 !strcmp(key,
"videocodecid") ||
502 !strcmp(key,
"audiodatarate") ||
503 !strcmp(key,
"audiosamplerate") ||
504 !strcmp(key,
"audiosamplesize") ||
505 !strcmp(key,
"stereo") ||
506 !strcmp(key,
"audiocodecid") ||
507 !strcmp(key,
"datastream"))
511 av_strlcpy(str_val, num_val > 0 ?
"true" :
"false",
515 snprintf(str_val,
sizeof(str_val),
"%.f", num_val);
527 AVStream *stream, *astream, *vstream;
546 if (!strcmp(buffer,
"onTextData"))
549 if (strcmp(buffer,
"onMetaData"))
582 "Broken FLV file, which says no streams present, "
583 "this might fail\n");
640 "Found invalid index entries, clearing the index.\n");
654 int nb = -1,
ret, parse_name = 1;
694 int64_t dts, int64_t next)
762 int64_t next, pos, meta_pos;
775 av_dlog(s,
"type:%d, size:%d, dts:%"PRId64
"\n", type, size, dts);
783 if (pos == validate_pos) {
791 }
else if (pos > validate_pos) {
814 if (size > 13 + 1 + 4 && dts == 0) {
823 "skipping flv packet: type %d, size %d, flags %d\n",
886 else if (fsize >= 8 && fsize - 8 >= size) {
897 int bits_per_coded_sample;
940 "negative cts, previous timestamps might be wrong\n");
973 av_dlog(s,
"mp4a config channels %d sample rate %d\n",
1024 int64_t ts,
int flags)
1031 #define OFFSET(x) offsetof(FLVContext, x)
1032 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
1034 {
"flv_metadata",
"Allocate streams according to the onMetaData array",
OFFSET(trust_metadata),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
VD },
1054 .extensions =
"flv",
1055 .priv_class = &flv_class,