Mercurial > libavformat.hg
comparison mpegts.c @ 4365:85ba93088fb5 libavformat
Fix probe & demuxing of Topfield 58XXPVR and 68XXPVR (topfield.rec)
author | michael |
---|---|
date | Tue, 03 Feb 2009 11:01:57 +0000 |
parents | 99d0dac39813 |
children | 5b0645175029 |
comparison
equal
deleted
inserted
replaced
4364:52e876e7c0cf | 4365:85ba93088fb5 |
---|---|
1175 static int mpegts_probe(AVProbeData *p) | 1175 static int mpegts_probe(AVProbeData *p) |
1176 { | 1176 { |
1177 #if 1 | 1177 #if 1 |
1178 const int size= p->buf_size; | 1178 const int size= p->buf_size; |
1179 int score, fec_score, dvhs_score; | 1179 int score, fec_score, dvhs_score; |
1180 int check_count= size / TS_FEC_PACKET_SIZE; | |
1180 #define CHECK_COUNT 10 | 1181 #define CHECK_COUNT 10 |
1181 | 1182 |
1182 if (size < (TS_FEC_PACKET_SIZE * CHECK_COUNT)) | 1183 if (check_count < CHECK_COUNT) |
1183 return -1; | 1184 return -1; |
1184 | 1185 |
1185 score = analyze(p->buf, TS_PACKET_SIZE *CHECK_COUNT, TS_PACKET_SIZE, NULL); | 1186 score = analyze(p->buf, TS_PACKET_SIZE *check_count, TS_PACKET_SIZE , NULL)*CHECK_COUNT/check_count; |
1186 dvhs_score = analyze(p->buf, TS_DVHS_PACKET_SIZE *CHECK_COUNT, TS_DVHS_PACKET_SIZE, NULL); | 1187 dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count; |
1187 fec_score= analyze(p->buf, TS_FEC_PACKET_SIZE*CHECK_COUNT, TS_FEC_PACKET_SIZE, NULL); | 1188 fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count; |
1188 // av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score); | 1189 // av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score); |
1189 | 1190 |
1190 // we need a clear definition for the returned score otherwise things will become messy sooner or later | 1191 // we need a clear definition for the returned score otherwise things will become messy sooner or later |
1191 if (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score - CHECK_COUNT; | 1192 if (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score - CHECK_COUNT; |
1192 else if(dvhs_score > score && dvhs_score > fec_score && dvhs_score > 6) return AVPROBE_SCORE_MAX + dvhs_score - CHECK_COUNT; | 1193 else if(dvhs_score > score && dvhs_score > fec_score && dvhs_score > 6) return AVPROBE_SCORE_MAX + dvhs_score - CHECK_COUNT; |
1233 static int mpegts_read_header(AVFormatContext *s, | 1234 static int mpegts_read_header(AVFormatContext *s, |
1234 AVFormatParameters *ap) | 1235 AVFormatParameters *ap) |
1235 { | 1236 { |
1236 MpegTSContext *ts = s->priv_data; | 1237 MpegTSContext *ts = s->priv_data; |
1237 ByteIOContext *pb = s->pb; | 1238 ByteIOContext *pb = s->pb; |
1238 uint8_t buf[1024]; | 1239 uint8_t buf[5*1024]; |
1239 int len; | 1240 int len; |
1240 int64_t pos; | 1241 int64_t pos; |
1241 | 1242 |
1242 if (ap) { | 1243 if (ap) { |
1243 ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr; | 1244 ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr; |