40 #define VALIDATE_INDEX_TS_THRESH 2500
64 if (d[0] ==
'F' && d[1] ==
'L' && d[2] ==
'V' && d[3] < 5 && d[5]==0 &&
AV_RB32(d+5)>8) {
105 return codec_id == acodec->
codec_id;
108 return codec_id == acodec->
codec_id;
133 switch(flv_codecid) {
184 switch (flv_codecid) {
204 switch(flv_codecid) {
241 if(length >= buffsize) {
248 buffer[length] =
'\0';
255 unsigned int timeslen = 0, fileposlen = 0, i;
257 int64_t *times =
NULL;
258 int64_t *filepositions =
NULL;
271 int64_t** current_array;
272 unsigned int arraylen;
283 current_array= ×
286 current_array= &filepositions;
287 fileposlen= arraylen;
291 if (!(*current_array =
av_mallocz(
sizeof(**current_array) * arraylen))) {
296 for (i = 0; i < arraylen &&
avio_tell(ioc) < max_pos - 1; i++) {
301 if (times && filepositions) {
309 if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) {
310 for (i = 0; i < fileposlen; i++) {
381 unsigned int arraylen, i;
384 for(i = 0; i < arraylen &&
avio_tell(ioc) < max_pos - 1; i++) {
397 if(depth == 1 && key) {
398 acodec = astream ? astream->
codec :
NULL;
399 vcodec = vstream ? vstream->
codec :
NULL;
402 if (!strcmp(key,
"duration"))
404 else if (!strcmp(key,
"videodatarate") && vcodec && 0 <= (
int)(num_val * 1024.0))
405 vcodec->
bit_rate = num_val * 1024.0;
406 else if (!strcmp(key,
"audiodatarate") && acodec && 0 <= (
int)(num_val * 1024.0))
407 acodec->
bit_rate = num_val * 1024.0;
408 else if (!strcmp(key,
"datastream")) {
414 if (!strcmp(key,
"videocodecid") && vcodec) {
417 if (!strcmp(key,
"audiocodecid") && acodec) {
421 if (!strcmp(key,
"audiosamplerate") && acodec) {
423 }
else if (!strcmp(key,
"audiosamplesize") && acodec) {
425 }
else if (!strcmp(key,
"stereo") && acodec) {
431 if (!strcmp(key,
"width") && vcodec) {
432 vcodec->
width = num_val;
434 if (!strcmp(key,
"height") && vcodec) {
441 ((!acodec && !strcmp(key,
"audiocodecid")) ||
442 (!vcodec && !strcmp(key,
"videocodecid"))))
445 if (!strcmp(key,
"duration") ||
446 !strcmp(key,
"filesize") ||
447 !strcmp(key,
"width") ||
448 !strcmp(key,
"height") ||
449 !strcmp(key,
"videodatarate") ||
450 !strcmp(key,
"framerate") ||
451 !strcmp(key,
"videocodecid") ||
452 !strcmp(key,
"audiodatarate") ||
453 !strcmp(key,
"audiosamplerate") ||
454 !strcmp(key,
"audiosamplesize") ||
455 !strcmp(key,
"stereo") ||
456 !strcmp(key,
"audiocodecid"))
460 av_strlcpy(str_val, num_val > 0 ?
"true" :
"false",
sizeof(str_val));
463 snprintf(str_val,
sizeof(str_val),
"%.f", num_val);
474 AVStream *stream, *astream, *vstream, *dstream;
479 vstream = astream = dstream =
NULL;
488 if (!strcmp(buffer,
"onTextData"))
491 if (strcmp(buffer,
"onMetaData"))
594 int64_t dts, int64_t next)
668 av_dlog(s,
"type:%d, size:%d, dts:%"PRId64
"\n", type, size, dts);
676 if (pos == validate_pos) {
684 }
else if (pos > validate_pos) {
706 if (size > 13+1+4 && dts == 0) {
709 }
else if (dts != 0) {
715 av_log(s,
AV_LOG_DEBUG,
"skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
779 else if (fsize >= 8 && fsize - 8 >= size){
790 int bits_per_coded_sample;
849 av_dlog(s,
"mp4a config channels %d sample rate %d\n",
899 int64_t ts,
int flags)
906 #define OFFSET(x) offsetof(FLVContext, x)
907 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
909 {
"flv_metadata",
"Allocate streams according the onMetaData array",
OFFSET(trust_metadata),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
VD},
930 .priv_class = &
class,