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) {
420 if (!strcmp(key,
"audiosamplerate") && acodec) {
423 if (!strcmp(key,
"width") && vcodec) {
424 vcodec->
width = num_val;
426 if (!strcmp(key,
"height") && vcodec) {
433 ((!acodec && !strcmp(key,
"audiocodecid")) ||
434 (!vcodec && !strcmp(key,
"videocodecid"))))
437 if (!strcmp(key,
"duration") ||
438 !strcmp(key,
"filesize") ||
439 !strcmp(key,
"width") ||
440 !strcmp(key,
"height") ||
441 !strcmp(key,
"videodatarate") ||
442 !strcmp(key,
"framerate") ||
443 !strcmp(key,
"videocodecid") ||
444 !strcmp(key,
"audiodatarate") ||
445 !strcmp(key,
"audiosamplerate") ||
446 !strcmp(key,
"audiosamplesize") ||
447 !strcmp(key,
"stereo") ||
448 !strcmp(key,
"audiocodecid"))
452 av_strlcpy(str_val, num_val > 0 ?
"true" :
"false",
sizeof(str_val));
455 snprintf(str_val,
sizeof(str_val),
"%.f", num_val);
466 AVStream *stream, *astream, *vstream, *dstream;
471 vstream = astream = dstream =
NULL;
480 if (!strcmp(buffer,
"onTextData"))
483 if (strcmp(buffer,
"onMetaData"))
586 int64_t dts, int64_t next)
660 av_dlog(s,
"type:%d, size:%d, dts:%"PRId64
"\n", type, size, dts);
668 if (pos == validate_pos) {
676 }
else if (pos > validate_pos) {
698 if (size > 13+1+4 && dts == 0) {
701 }
else if (dts != 0) {
707 av_log(s,
AV_LOG_DEBUG,
"skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
771 else if (fsize >= 8 && fsize - 8 >= size){
782 int bits_per_coded_sample;
841 av_dlog(s,
"mp4a config channels %d sample rate %d\n",
891 int64_t ts,
int flags)
898 #define OFFSET(x) offsetof(FLVContext, x)
899 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
901 {
"flv_metadata",
"Allocate streams according the onMetaData array",
OFFSET(trust_metadata),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
VD},
922 .priv_class = &
class,