... | ... |
@@ -21,6 +21,7 @@ |
21 | 21 |
|
22 | 22 |
//#define DEBUG |
23 | 23 |
|
24 |
+#include "libavutil/attributes.h" |
|
24 | 25 |
#include "libavutil/bswap.h" |
25 | 26 |
#include "libavutil/common.h" |
26 | 27 |
#include "libavutil/avstring.h" |
... | ... |
@@ -618,16 +619,18 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) |
618 | 618 |
|
619 | 619 |
for(i=0;i<n;i++) { |
620 | 620 |
char name[1024]; |
621 |
+ int av_unused value_type; |
|
621 | 622 |
|
622 | 623 |
avio_rl16(pb); //lang_list_index |
623 | 624 |
stream_num= avio_rl16(pb); |
624 | 625 |
name_len= avio_rl16(pb); |
625 |
- avio_skip(pb, 2); /* value_type */ |
|
626 |
+ value_type = avio_rl16(pb); /* value_type */ |
|
626 | 627 |
value_len= avio_rl32(pb); |
627 | 628 |
|
628 | 629 |
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) |
629 | 630 |
avio_skip(pb, name_len - ret); |
630 |
- //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name); |
|
631 |
+ av_dlog(s, "%d %d %d %d %d <%s>\n", |
|
632 |
+ i, stream_num, name_len, value_type, value_len, name); |
|
631 | 633 |
value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere |
632 | 634 |
avio_skip(pb, value_len - 2); |
633 | 635 |
|
... | ... |
@@ -774,7 +777,9 @@ static int asf_read_header(AVFormatContext *s) |
774 | 774 |
&st->sample_aspect_ratio.den, |
775 | 775 |
asf->dar[0].num, asf->dar[0].den, INT_MAX); |
776 | 776 |
|
777 |
-//av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); |
|
777 |
+ av_dlog(s, "i=%d, st->codec->codec_type:%d, asf->dar %d:%d sar=%d:%d\n", |
|
778 |
+ i, st->codec->codec_type, asf->dar[i].num, asf->dar[i].den, |
|
779 |
+ st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); |
|
778 | 780 |
|
779 | 781 |
// copy and convert language codes to the frontend |
780 | 782 |
if (asf->streams[i].stream_language_index < 128) { |
... | ... |
@@ -916,7 +921,9 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ |
916 | 916 |
DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); |
917 | 917 |
DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); |
918 | 918 |
DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); |
919 |
-//printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size); |
|
919 |
+ av_dlog(asf, "key:%d stream:%d seq:%d offset:%d replic_size:%d\n", |
|
920 |
+ asf->packet_key_frame, asf->stream_index, asf->packet_seq, |
|
921 |
+ asf->packet_frag_offset, asf->packet_replic_size); |
|
920 | 922 |
if (asf->packet_replic_size >= 8) { |
921 | 923 |
asf->packet_obj_size = avio_rl32(pb); |
922 | 924 |
if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ |
... | ... |
@@ -1082,9 +1089,11 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk |
1082 | 1082 |
asf_st->palette_changed = 0; |
1083 | 1083 |
} |
1084 | 1084 |
} |
1085 |
-//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", |
|
1086 |
-//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY, |
|
1087 |
-//s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size); |
|
1085 |
+ av_dlog(asf, "new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", |
|
1086 |
+ asf->stream_index, asf->packet_key_frame, |
|
1087 |
+ asf_st->pkt.flags & AV_PKT_FLAG_KEY, |
|
1088 |
+ s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, |
|
1089 |
+ asf->packet_obj_size); |
|
1088 | 1090 |
if (s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO) |
1089 | 1091 |
asf->packet_key_frame = 1; |
1090 | 1092 |
if (asf->packet_key_frame) |
... | ... |
@@ -1092,9 +1101,9 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk |
1092 | 1092 |
} |
1093 | 1093 |
|
1094 | 1094 |
/* read data */ |
1095 |
- //printf("READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n", |
|
1096 |
- // s->packet_size, asf_st->pkt.size, asf->packet_frag_offset, |
|
1097 |
- // asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data); |
|
1095 |
+ av_dlog(asf, "READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n", |
|
1096 |
+ s->packet_size, asf_st->pkt.size, asf->packet_frag_offset, |
|
1097 |
+ asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data); |
|
1098 | 1098 |
asf->packet_size_left -= asf->packet_frag_size; |
1099 | 1099 |
if (asf->packet_size_left < 0) |
1100 | 1100 |
continue; |
... | ... |
@@ -60,7 +60,7 @@ static int64_t get_pts(const uint8_t *p) |
60 | 60 |
if(sscanf(p, "%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4) |
61 | 61 |
return AV_NOPTS_VALUE; |
62 | 62 |
|
63 |
-// av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d [%s]\n", i, hour, min, sec, hsec, p); |
|
63 |
+ av_dlog(NULL, "%d %d %d %d [%s]\n", hour, min, sec, hsec, p); |
|
64 | 64 |
|
65 | 65 |
min+= 60*hour; |
66 | 66 |
sec+= 60*min; |
... | ... |
@@ -513,7 +513,8 @@ static int avi_read_header(AVFormatContext *s) |
513 | 513 |
avio_rl32(pb); /* quality */ |
514 | 514 |
ast->sample_size = avio_rl32(pb); /* sample ssize */ |
515 | 515 |
ast->cum_len *= FFMAX(1, ast->sample_size); |
516 |
-// av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size); |
|
516 |
+ av_dlog(s, "%"PRIu32" %"PRIu32" %d\n", |
|
517 |
+ ast->rate, ast->scale, ast->sample_size); |
|
517 | 518 |
|
518 | 519 |
switch(tag1) { |
519 | 520 |
case MKTAG('v', 'i', 'd', 's'): |
... | ... |
@@ -690,7 +691,9 @@ static int avi_read_header(AVFormatContext *s) |
690 | 690 |
|
691 | 691 |
if(active_aspect.num && active_aspect.den && active.num && active.den){ |
692 | 692 |
st->sample_aspect_ratio= av_div_q(active_aspect, active); |
693 |
-//av_log(s, AV_LOG_ERROR, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den); |
|
693 |
+ av_dlog(s, "vprp %d/%d %d/%d\n", |
|
694 |
+ active_aspect.num, active_aspect.den, |
|
695 |
+ active.num, active.den); |
|
694 | 696 |
} |
695 | 697 |
size -= 9*4; |
696 | 698 |
} |
... | ... |
@@ -860,7 +863,8 @@ start_sync: |
860 | 860 |
size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); |
861 | 861 |
|
862 | 862 |
n= get_stream_idx(d+2); |
863 |
-//av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); |
|
863 |
+ av_dlog(s, "%X %X %X %X %X %X %X %X %"PRId64" %u %d\n", |
|
864 |
+ d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); |
|
864 | 865 |
if(i + (uint64_t)size > avi->fsize || d[0] > 127) |
865 | 866 |
continue; |
866 | 867 |
|
... | ... |
@@ -1003,7 +1007,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) |
1003 | 1003 |
|
1004 | 1004 |
ts = av_rescale_q(ts, st->time_base, (AVRational){FFMAX(1, ast->sample_size), AV_TIME_BASE}); |
1005 | 1005 |
|
1006 |
-// av_log(s, AV_LOG_DEBUG, "%"PRId64" %d/%d %"PRId64"\n", ts, st->time_base.num, st->time_base.den, ast->frame_offset); |
|
1006 |
+ av_dlog(s, "%"PRId64" %d/%d %"PRId64"\n", ts, |
|
1007 |
+ st->time_base.num, st->time_base.den, ast->frame_offset); |
|
1007 | 1008 |
if(ts < best_ts){ |
1008 | 1009 |
best_ts= ts; |
1009 | 1010 |
best_st= st; |
... | ... |
@@ -1092,7 +1097,9 @@ resync: |
1092 | 1092 |
// pkt->dts += ast->start; |
1093 | 1093 |
if(ast->sample_size) |
1094 | 1094 |
pkt->dts /= ast->sample_size; |
1095 |
-//av_log(s, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size); |
|
1095 |
+ av_dlog(s, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", |
|
1096 |
+ pkt->dts, ast->frame_offset, ast->scale, ast->rate, |
|
1097 |
+ ast->sample_size, AV_TIME_BASE, avi->stream_index, size); |
|
1096 | 1098 |
pkt->stream_index = avi->stream_index; |
1097 | 1099 |
|
1098 | 1100 |
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { |
... | ... |
@@ -1292,7 +1299,8 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp |
1292 | 1292 |
pos = st->index_entries[index].pos; |
1293 | 1293 |
timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1); |
1294 | 1294 |
|
1295 |
-// av_log(s, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp); |
|
1295 |
+ av_dlog(s, "XX %"PRId64" %d %"PRId64"\n", |
|
1296 |
+ timestamp, index, st->index_entries[index].timestamp); |
|
1296 | 1297 |
|
1297 | 1298 |
if (CONFIG_DV_DEMUXER && avi->dv_demux) { |
1298 | 1299 |
/* One and only one real stream for DV in AVI, and it has video */ |
... | ... |
@@ -1340,7 +1348,8 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp |
1340 | 1340 |
index++; |
1341 | 1341 |
} |
1342 | 1342 |
|
1343 |
-// av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %"PRId64"\n", timestamp, index, st2->index_entries[index].timestamp); |
|
1343 |
+ av_dlog(s, "%"PRId64" %d %"PRId64"\n", |
|
1344 |
+ timestamp, index, st2->index_entries[index].timestamp); |
|
1344 | 1345 |
/* extract the current frame number */ |
1345 | 1346 |
ast2->frame_offset = st2->index_entries[index].timestamp; |
1346 | 1347 |
} |
... | ... |
@@ -1003,7 +1003,10 @@ retry: |
1003 | 1003 |
} |
1004 | 1004 |
|
1005 | 1005 |
if(timestamp_packet){ |
1006 |
-//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts/90000.0, timestamp_packet->pts/90000.0, scr/90000.0, best_i); |
|
1006 |
+ av_dlog(ctx, "dts:%f pts:%f scr:%f stream:%d\n", |
|
1007 |
+ timestamp_packet->dts / 90000.0, |
|
1008 |
+ timestamp_packet->pts / 90000.0, |
|
1009 |
+ scr / 90000.0, best_i); |
|
1007 | 1010 |
es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size); |
1008 | 1011 |
}else{ |
1009 | 1012 |
assert(av_fifo_size(stream->fifo) == trailer_size); |
... | ... |
@@ -1062,7 +1065,9 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) |
1062 | 1062 |
dts += 2*preload; |
1063 | 1063 |
} |
1064 | 1064 |
|
1065 |
-//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE); |
|
1065 |
+ av_dlog(ctx, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", |
|
1066 |
+ dts / 90000.0, pts / 90000.0, pkt->flags, |
|
1067 |
+ pkt->stream_index, pts != AV_NOPTS_VALUE); |
|
1066 | 1068 |
if (!stream->premux_packet) |
1067 | 1069 |
stream->next_packet = &stream->premux_packet; |
1068 | 1070 |
*stream->next_packet= |
... | ... |
@@ -411,7 +411,8 @@ static int get_packet_size(const uint8_t *buf, int size) |
411 | 411 |
score = analyze(buf, size, TS_PACKET_SIZE, NULL); |
412 | 412 |
dvhs_score = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL); |
413 | 413 |
fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL); |
414 |
-// av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score); |
|
414 |
+ av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n", |
|
415 |
+ score, dvhs_score, fec_score); |
|
415 | 416 |
|
416 | 417 |
if (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE; |
417 | 418 |
else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE; |
... | ... |
@@ -1835,7 +1836,8 @@ static int mpegts_probe(AVProbeData *p) |
1835 | 1835 |
score = analyze(p->buf, TS_PACKET_SIZE *check_count, TS_PACKET_SIZE , NULL)*CHECK_COUNT/check_count; |
1836 | 1836 |
dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count; |
1837 | 1837 |
fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count; |
1838 |
-// av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score); |
|
1838 |
+ av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n", |
|
1839 |
+ score, dvhs_score, fec_score); |
|
1839 | 1840 |
|
1840 | 1841 |
// we need a clear definition for the returned score otherwise things will become messy sooner or later |
1841 | 1842 |
if (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score - CHECK_COUNT; |
... | ... |
@@ -1017,7 +1017,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) |
1017 | 1017 |
|
1018 | 1018 |
do { |
1019 | 1019 |
p = avpriv_mpv_find_start_code(p, buf_end, &state); |
1020 |
- //av_log(s, AV_LOG_INFO, "nal %d\n", state & 0x1f); |
|
1020 |
+ av_dlog(s, "nal %d\n", state & 0x1f); |
|
1021 | 1021 |
} while (p < buf_end && (state & 0x1f) != 9 && |
1022 | 1022 |
(state & 0x1f) != 5 && (state & 0x1f) != 1); |
1023 | 1023 |
|
... | ... |
@@ -1856,7 +1856,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket |
1856 | 1856 |
} |
1857 | 1857 |
|
1858 | 1858 |
*out = pktl->pkt; |
1859 |
- //av_log(s, AV_LOG_DEBUG, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts); |
|
1859 |
+ av_dlog(s, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts); |
|
1860 | 1860 |
s->packet_buffer = pktl->next; |
1861 | 1861 |
if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl) |
1862 | 1862 |
s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL; |
... | ... |
@@ -330,7 +330,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, |
330 | 330 |
st->codec->codec_tag = avio_rl32(pb); |
331 | 331 |
st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags, |
332 | 332 |
st->codec->codec_tag); |
333 |
-// av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); |
|
333 |
+ av_dlog(s, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); |
|
334 | 334 |
if (st->codec->codec_id == AV_CODEC_ID_NONE) |
335 | 335 |
goto fail1; |
336 | 336 |
st->codec->width = avio_rb16(pb); |
... | ... |
@@ -969,7 +969,8 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, |
969 | 969 |
} |
970 | 970 |
|
971 | 971 |
if((flags&2) && (seq&0x7F) == 1){ |
972 |
-// av_log(s, AV_LOG_DEBUG, "%d %d-%d %"PRId64" %d\n", flags, stream_index2, stream_index, dts, seq); |
|
972 |
+ av_dlog(s, "%d %d-%d %"PRId64" %d\n", |
|
973 |
+ flags, stream_index2, stream_index, dts, seq); |
|
973 | 974 |
av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME); |
974 | 975 |
if(stream_index2 == stream_index) |
975 | 976 |
break; |
... | ... |
@@ -952,7 +952,10 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, |
952 | 952 |
if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts) |
953 | 953 |
presentation_delayed = 1; |
954 | 954 |
|
955 |
-// av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc); |
|
955 |
+ av_dlog(NULL, |
|
956 |
+ "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", |
|
957 |
+ presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, |
|
958 |
+ pkt->stream_index, pc); |
|
956 | 959 |
/* interpolate PTS and DTS if they are not present */ |
957 | 960 |
//We skip H264 currently because delay and has_b_frames are not reliably set |
958 | 961 |
if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != AV_CODEC_ID_H264){ |
... | ... |
@@ -1022,7 +1025,9 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, |
1022 | 1022 |
st->cur_dts = pkt->dts; |
1023 | 1023 |
} |
1024 | 1024 |
|
1025 |
-// av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts); |
|
1025 |
+ av_dlog(NULL, |
|
1026 |
+ "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", |
|
1027 |
+ presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts); |
|
1026 | 1028 |
|
1027 | 1029 |
/* update flags */ |
1028 | 1030 |
if (is_intra_only(st->codec->codec_id)) |
... | ... |
@@ -3068,7 +3073,8 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){ |
3068 | 3068 |
return AVERROR(EINVAL); |
3069 | 3069 |
} |
3070 | 3070 |
|
3071 |
-// av_log(s, AV_LOG_DEBUG, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n", pkt->pts, pkt->dts); |
|
3071 |
+ av_dlog(s, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n", |
|
3072 |
+ pkt->pts, pkt->dts); |
|
3072 | 3073 |
st->cur_dts= pkt->dts; |
3073 | 3074 |
st->pts.val= pkt->dts; |
3074 | 3075 |
|