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) {
274 if (length >= buffsize) {
290 unsigned int timeslen = 0, fileposlen = 0, i;
292 int64_t *times = NULL;
293 int64_t *filepositions = NULL;
307 int64_t **current_array;
308 unsigned int arraylen;
319 current_array = ×
323 current_array = &filepositions;
324 fileposlen = arraylen;
330 if (!(*current_array =
av_mallocz(
sizeof(**current_array) * arraylen))) {
335 for (i = 0; i < arraylen &&
avio_tell(ioc) < max_pos - 1; i++) {
340 if (times && filepositions) {
348 if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) {
349 for (i = 0; i < fileposlen; i++) {
397 if ((vstream || astream) && key &&
430 unsigned int arraylen, i;
433 for (i = 0; i < arraylen &&
avio_tell(ioc) < max_pos - 1; i++)
447 if (depth == 1 && key) {
448 acodec = astream ? astream->
codec : NULL;
449 vcodec = vstream ? vstream->
codec : NULL;
453 if (!strcmp(key,
"duration"))
455 else if (!strcmp(key,
"videodatarate") && vcodec &&
456 0 <= (
int)(num_val * 1024.0))
457 vcodec->
bit_rate = num_val * 1024.0;
458 else if (!strcmp(key,
"audiodatarate") && acodec &&
459 0 <= (
int)(num_val * 1024.0))
460 acodec->
bit_rate = num_val * 1024.0;
461 else if (!strcmp(key,
"datastream")) {
467 if (!strcmp(key,
"videocodecid") && vcodec) {
469 }
else if (!strcmp(key,
"audiocodecid") && acodec) {
472 }
else if (!strcmp(key,
"audiosamplerate") && acodec) {
474 }
else if (!strcmp(key,
"audiosamplesize") && acodec) {
476 }
else if (!strcmp(key,
"stereo") && acodec) {
481 }
else if (!strcmp(key,
"width") && vcodec) {
482 vcodec->
width = num_val;
483 }
else if (!strcmp(key,
"height") && vcodec) {
490 ((!acodec && !strcmp(key,
"audiocodecid")) ||
491 (!vcodec && !strcmp(key,
"videocodecid"))))
494 if (!strcmp(key,
"duration") ||
495 !strcmp(key,
"filesize") ||
496 !strcmp(key,
"width") ||
497 !strcmp(key,
"height") ||
498 !strcmp(key,
"videodatarate") ||
499 !strcmp(key,
"framerate") ||
500 !strcmp(key,
"videocodecid") ||
501 !strcmp(key,
"audiodatarate") ||
502 !strcmp(key,
"audiosamplerate") ||
503 !strcmp(key,
"audiosamplesize") ||
504 !strcmp(key,
"stereo") ||
505 !strcmp(key,
"audiocodecid") ||
506 !strcmp(key,
"datastream"))
510 av_strlcpy(str_val, num_val > 0 ?
"true" :
"false",
514 snprintf(str_val,
sizeof(str_val),
"%.f", num_val);
526 AVStream *stream, *astream, *vstream;
545 if (!strcmp(buffer,
"onTextData"))
548 if (strcmp(buffer,
"onMetaData"))
581 "Broken FLV file, which says no streams present, "
582 "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");
964 av_dlog(s,
"mp4a config channels %d sample rate %d\n",
1015 int64_t ts,
int flags)
1022 #define OFFSET(x) offsetof(FLVContext, x)
1023 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
1025 {
"flv_metadata",
"Allocate streams according to the onMetaData array",
OFFSET(trust_metadata),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
VD },
1045 .extensions =
"flv",
1046 .priv_class = &flv_class,