@@ -428,9 +428,6 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) | |||||
avio_rl16(pb); //ds_data_size | avio_rl16(pb); //ds_data_size | ||||
avio_r8(pb); //ds_silence_data | avio_r8(pb); //ds_silence_data | ||||
} | } | ||||
//printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", | |||||
// asf_st->ds_packet_size, asf_st->ds_chunk_size, | |||||
// asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); | |||||
if (asf_st->ds_span > 1) { | if (asf_st->ds_span > 1) { | ||||
if (!asf_st->ds_chunk_size | if (!asf_st->ds_chunk_size | ||||
|| (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) | || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) | ||||
@@ -451,7 +448,6 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) | |||||
st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ | st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ | ||||
tag1 = avio_rl32(pb); | tag1 = avio_rl32(pb); | ||||
avio_skip(pb, 20); | avio_skip(pb, 20); | ||||
// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); | |||||
if (sizeX > 40) { | if (sizeX > 40) { | ||||
st->codec->extradata_size = sizeX - 40; | st->codec->extradata_size = sizeX - 40; | ||||
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); | st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); | ||||
@@ -697,9 +693,7 @@ static int asf_read_header(AVFormatContext *s) | |||||
uint64_t gpos= avio_tell(pb); | uint64_t gpos= avio_tell(pb); | ||||
ff_get_guid(pb, &g); | ff_get_guid(pb, &g); | ||||
gsize = avio_rl64(pb); | gsize = avio_rl64(pb); | ||||
av_dlog(s, "%08"PRIx64": ", gpos); | |||||
print_guid(&g); | print_guid(&g); | ||||
av_dlog(s, " size=0x%"PRIx64"\n", gsize); | |||||
if (!ff_guidcmp(&g, &ff_asf_data_header)) { | if (!ff_guidcmp(&g, &ff_asf_data_header)) { | ||||
asf->data_object_offset = avio_tell(pb); | asf->data_object_offset = avio_tell(pb); | ||||
// if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. | // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. | ||||
@@ -931,9 +925,6 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ | |||||
} | } | ||||
asf->packet_frag_timestamp = avio_rl32(pb); // timestamp | asf->packet_frag_timestamp = avio_rl32(pb); // timestamp | ||||
if(asf->packet_replic_size >= 8+38+4){ | if(asf->packet_replic_size >= 8+38+4){ | ||||
// for(i=0; i<asf->packet_replic_size-8; i++) | |||||
// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb)); | |||||
// av_log(s, AV_LOG_DEBUG, "\n"); | |||||
avio_skip(pb, 10); | avio_skip(pb, 10); | ||||
ts0= avio_rl64(pb); | ts0= avio_rl64(pb); | ||||
avio_skip(pb, 8);; | avio_skip(pb, 8);; | ||||
@@ -972,14 +963,12 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ | |||||
asf->packet_padsize -= diff; | asf->packet_padsize -= diff; | ||||
} | } | ||||
} | } | ||||
//printf("Fragsize %d\n", asf->packet_frag_size); | |||||
} else { | } else { | ||||
if (rsize > asf->packet_size_left) { | if (rsize > asf->packet_size_left) { | ||||
av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); | av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); | ||||
return -1; | return -1; | ||||
} | } | ||||
asf->packet_frag_size = asf->packet_size_left - rsize; | asf->packet_frag_size = asf->packet_size_left - rsize; | ||||
//printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize); | |||||
} | } | ||||
if (asf->packet_replic_size == 1) { | if (asf->packet_replic_size == 1) { | ||||
asf->packet_multi_size = asf->packet_frag_size; | asf->packet_multi_size = asf->packet_frag_size; | ||||
@@ -987,7 +976,6 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ | |||||
return -1; | return -1; | ||||
} | } | ||||
asf->packet_size_left -= rsize; | asf->packet_size_left -= rsize; | ||||
//printf("___objsize____ %d %d rs:%d\n", asf->packet_obj_size, asf->packet_frag_offset, rsize); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -1013,7 +1001,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk | |||||
|| asf->packet_segments < 1) { | || asf->packet_segments < 1) { | ||||
//asf->packet_size_left <= asf->packet_padsize) { | //asf->packet_size_left <= asf->packet_padsize) { | ||||
int ret = asf->packet_size_left + asf->packet_padsize; | int ret = asf->packet_size_left + asf->packet_padsize; | ||||
//printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb)); | |||||
assert(ret>=0); | assert(ret>=0); | ||||
/* fail safe */ | /* fail safe */ | ||||
avio_skip(pb, ret); | avio_skip(pb, ret); | ||||
@@ -1060,7 +1047,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk | |||||
continue; | continue; | ||||
} | } | ||||
asf->packet_multi_size -= asf->packet_obj_size; | asf->packet_multi_size -= asf->packet_obj_size; | ||||
//printf("COMPRESS size %d %d %d ms:%d\n", asf->packet_obj_size, asf->packet_frag_timestamp, asf->packet_size_left, asf->packet_multi_size); | |||||
} | } | ||||
if( /*asf->packet_frag_size == asf->packet_obj_size*/ | if( /*asf->packet_frag_size == asf->packet_obj_size*/ | ||||
asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size | asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size | ||||
@@ -1170,8 +1156,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk | |||||
int row = off / asf_st->ds_span; | int row = off / asf_st->ds_span; | ||||
int col = off % asf_st->ds_span; | int col = off % asf_st->ds_span; | ||||
int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size; | int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size; | ||||
//printf("off:%d row:%d col:%d idx:%d\n", off, row, col, idx); | |||||
assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size); | assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size); | ||||
assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size); | assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size); | ||||
memcpy(newdata + offset, | memcpy(newdata + offset, | ||||
@@ -1186,7 +1170,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk | |||||
} | } | ||||
asf_st->frag_offset = 0; | asf_st->frag_offset = 0; | ||||
*pkt= asf_st->pkt; | *pkt= asf_st->pkt; | ||||
//printf("packet %d %d\n", asf_st->pkt.size, asf->packet_frag_size); | |||||
asf_st->pkt.size = 0; | asf_st->pkt.size = 0; | ||||
asf_st->pkt.data = 0; | asf_st->pkt.data = 0; | ||||
asf_st->pkt.side_data_elems = 0; | asf_st->pkt.side_data_elems = 0; | ||||
@@ -1275,7 +1258,6 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, | |||||
*ppos= pos; | *ppos= pos; | ||||
avio_seek(s->pb, pos, SEEK_SET); | avio_seek(s->pb, pos, SEEK_SET); | ||||
//printf("asf_read_pts\n"); | |||||
asf_reset_header(s); | asf_reset_header(s); | ||||
for(;;){ | for(;;){ | ||||
if (asf_read_packet(s, pkt) < 0){ | if (asf_read_packet(s, pkt) < 0){ | ||||
@@ -1303,8 +1285,6 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, | |||||
} | } | ||||
*ppos= pos; | *ppos= pos; | ||||
//printf("found keyframe at %"PRId64" stream %d stamp:%"PRId64"\n", *ppos, stream_index, pts); | |||||
return pts; | return pts; | ||||
} | } | ||||
@@ -870,7 +870,6 @@ start_sync: | |||||
||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') | ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') | ||||
||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ | ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ | ||||
avio_skip(pb, size); | avio_skip(pb, size); | ||||
//av_log(s, AV_LOG_DEBUG, "SKIP\n"); | |||||
goto start_sync; | goto start_sync; | ||||
} | } | ||||
@@ -944,7 +943,6 @@ start_sync: | |||||
if (exit_early) | if (exit_early) | ||||
return 0; | return 0; | ||||
//av_log(s, AV_LOG_DEBUG, "OK\n"); | |||||
if(d[2]*256+d[3] == ast->prefix) | if(d[2]*256+d[3] == ast->prefix) | ||||
ast->prefix_count++; | ast->prefix_count++; | ||||
else{ | else{ | ||||
@@ -1025,12 +1023,10 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||
best_ast->frame_offset= best_st->index_entries[i].timestamp; | best_ast->frame_offset= best_st->index_entries[i].timestamp; | ||||
} | } | ||||
// av_log(s, AV_LOG_DEBUG, "%d\n", i); | |||||
if(i>=0){ | if(i>=0){ | ||||
int64_t pos= best_st->index_entries[i].pos; | int64_t pos= best_st->index_entries[i].pos; | ||||
pos += best_ast->packet_size - best_ast->remaining; | pos += best_ast->packet_size - best_ast->remaining; | ||||
avio_seek(s->pb, pos + 8, SEEK_SET); | avio_seek(s->pb, pos + 8, SEEK_SET); | ||||
// av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos); | |||||
assert(best_ast->remaining <= best_ast->packet_size); | assert(best_ast->remaining <= best_ast->packet_size); | ||||
@@ -520,7 +520,6 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) | |||||
AVCodecContext *enc= s->streams[stream_index]->codec; | AVCodecContext *enc= s->streams[stream_index]->codec; | ||||
int size= pkt->size; | int size= pkt->size; | ||||
// av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index); | |||||
while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count){ | while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count){ | ||||
AVPacket empty_packet; | AVPacket empty_packet; | ||||
@@ -529,7 +528,6 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) | |||||
empty_packet.data= NULL; | empty_packet.data= NULL; | ||||
empty_packet.stream_index= stream_index; | empty_packet.stream_index= stream_index; | ||||
avi_write_packet(s, &empty_packet); | avi_write_packet(s, &empty_packet); | ||||
// av_log(s, AV_LOG_DEBUG, "dup %"PRId64" %d\n", pkt->dts, avi->packet_count[stream_index]); | |||||
} | } | ||||
avist->packet_count++; | avist->packet_count++; | ||||
@@ -240,9 +240,6 @@ static void adjust_write_index(AVFormatContext *s) | |||||
ffm->write_index += pos_max; | ffm->write_index += pos_max; | ||||
} | } | ||||
//printf("Adjusted write index from %"PRId64" to %"PRId64": pts=%0.6f\n", orig_write_index, ffm->write_index, pts / 1000000.); | |||||
//printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. ); | |||||
end: | end: | ||||
avio_seek(pb, ptr, SEEK_SET); | avio_seek(pb, ptr, SEEK_SET); | ||||
} | } | ||||
@@ -423,9 +423,6 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) | |||||
uint8_t *data = NULL; | uint8_t *data = NULL; | ||||
int flags = 0, flags_size; | int flags = 0, flags_size; | ||||
// av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n", | |||||
// enc->codec_type, timestamp, size); | |||||
if (enc->codec_id == AV_CODEC_ID_VP6 || enc->codec_id == AV_CODEC_ID_VP6F || | if (enc->codec_id == AV_CODEC_ID_VP6 || enc->codec_id == AV_CODEC_ID_VP6F || | ||||
enc->codec_id == AV_CODEC_ID_AAC) | enc->codec_id == AV_CODEC_ID_AAC) | ||||
flags_size = 2; | flags_size = 2; | ||||
@@ -55,8 +55,6 @@ static int h263_probe(AVProbeData *p) | |||||
last_gn= gn; | last_gn= gn; | ||||
} | } | ||||
} | } | ||||
//av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change); | |||||
//h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg) | |||||
if(valid_psc > 2*invalid_psc + 2*res_change + 3){ | if(valid_psc > 2*invalid_psc + 2*res_change + 3){ | ||||
return 50; | return 50; | ||||
}else if(valid_psc > 2*invalid_psc) | }else if(valid_psc > 2*invalid_psc) | ||||
@@ -2002,7 +2002,6 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) | |||||
mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04); | mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04); | ||||
mov_write_psp_udta_tag(pb, title->value, "eng", 0x01); | mov_write_psp_udta_tag(pb, title->value, "eng", 0x01); | ||||
// snprintf(dt,32,"%04d/%02d/%02d %02d:%02d:%02d",t_st->tm_year+1900,t_st->tm_mon+1,t_st->tm_mday,t_st->tm_hour,t_st->tm_min,t_st->tm_sec); | |||||
mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03); | mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03); | ||||
update_size(pb, pos2); | update_size(pb, pos2); | ||||
@@ -84,7 +84,6 @@ static int mpegps_probe(AVProbeData *p) | |||||
if(vid+audio > invalid) /* invalid VDR files nd short PES streams */ | if(vid+audio > invalid) /* invalid VDR files nd short PES streams */ | ||||
score= AVPROBE_SCORE_MAX/4; | score= AVPROBE_SCORE_MAX/4; | ||||
//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d %d len:%d\n", sys, priv1, pspack,vid, audio, invalid, p->buf_size); | |||||
if(sys>invalid && sys*9 <= pspack*10) | if(sys>invalid && sys*9 <= pspack*10) | ||||
return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg | return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg | ||||
if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9) | if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9) | ||||
@@ -218,7 +217,6 @@ static int mpegps_read_pes_header(AVFormatContext *s, | |||||
size = MAX_SYNC_SIZE; | size = MAX_SYNC_SIZE; | ||||
startcode = find_next_start_code(s->pb, &size, &m->header_state); | startcode = find_next_start_code(s->pb, &size, &m->header_state); | ||||
last_sync = avio_tell(s->pb); | last_sync = avio_tell(s->pb); | ||||
//printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb)); | |||||
if (startcode < 0){ | if (startcode < 0){ | ||||
if(s->pb->eof_reached) | if(s->pb->eof_reached) | ||||
return AVERROR_EOF; | return AVERROR_EOF; | ||||
@@ -95,16 +95,12 @@ static int find_header_idx(AVFormatContext *s, AVCodecContext *c, int size, int | |||||
int i; | int i; | ||||
int len= find_expected_header(c, size, frame_type, out); | int len= find_expected_header(c, size, frame_type, out); | ||||
//av_log(NULL, AV_LOG_ERROR, "expected_h len=%d size=%d codec_id=%d\n", len, size, c->codec_id); | |||||
for(i=1; i<nut->header_count; i++){ | for(i=1; i<nut->header_count; i++){ | ||||
if( len == nut->header_len[i] | if( len == nut->header_len[i] | ||||
&& !memcmp(out, nut->header[i], len)){ | && !memcmp(out, nut->header[i], len)){ | ||||
// av_log(NULL, AV_LOG_ERROR, "found %d\n", i); | |||||
return i; | return i; | ||||
} | } | ||||
} | } | ||||
// av_log(NULL, AV_LOG_ERROR, "nothing found\n"); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -154,8 +154,6 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) | |||||
get_word_sep(buf, sizeof(buf), "-", &p); | get_word_sep(buf, sizeof(buf), "-", &p); | ||||
av_parse_time(end, buf, 1); | av_parse_time(end, buf, 1); | ||||
} | } | ||||
// av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start); | |||||
// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end); | |||||
} | } | ||||
static int get_sockaddr(const char *buf, struct sockaddr_storage *sock) | static int get_sockaddr(const char *buf, struct sockaddr_storage *sock) | ||||
@@ -45,7 +45,6 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr) | |||||
if (len == 0x3f) { | if (len == 0x3f) { | ||||
len = avio_rl32(pb); | len = avio_rl32(pb); | ||||
} | } | ||||
// av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len); | |||||
*len_ptr = len; | *len_ptr = len; | ||||
return tag; | return tag; | ||||
} | } | ||||
@@ -72,10 +72,8 @@ int main(void) | |||||
av_lfg_init(&state, 0xdeadbeef); | av_lfg_init(&state, 0xdeadbeef); | ||||
for (j = 0; j < 10000; j++) { | for (j = 0; j < 10000; j++) { | ||||
START_TIMER | START_TIMER | ||||
for (i = 0; i < 624; i++) { | |||||
//av_log(NULL, AV_LOG_ERROR, "%X\n", av_lfg_get(&state)); | |||||
for (i = 0; i < 624; i++) | |||||
x += av_lfg_get(&state); | x += av_lfg_get(&state); | ||||
} | |||||
STOP_TIMER("624 calls of av_lfg_get"); | STOP_TIMER("624 calls of av_lfg_get"); | ||||
} | } | ||||
av_log(NULL, AV_LOG_ERROR, "final value:%X\n", x); | av_log(NULL, AV_LOG_ERROR, "final value:%X\n", x); | ||||
@@ -113,7 +113,6 @@ int main(int argc, char **argv) | |||||
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_'); | (pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_'); | ||||
printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size, | printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size, | ||||
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_'); | (pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_'); | ||||
//printf("open(\"%s\")\n", pktfilename); | |||||
if (!nowrite) { | if (!nowrite) { | ||||
fd = open(pktfilename, O_WRONLY | O_CREAT, 0644); | fd = open(pktfilename, O_WRONLY | O_CREAT, 0644); | ||||
err = write(fd, pkt.data, pkt.size); | err = write(fd, pkt.data, pkt.size); | ||||