Mercurial > libavformat.hg
comparison mpegts.c @ 2111:4aafc6050f39 libavformat
kill completely idiotic code which hides all but 2 streams
author | michael |
---|---|
date | Sat, 02 Jun 2007 23:04:46 +0000 |
parents | 495161f79093 |
children | e6b06336f94b |
comparison
equal
deleted
inserted
replaced
2110:495161f79093 | 2111:4aafc6050f39 |
---|---|
86 AVFormatContext *stream; | 86 AVFormatContext *stream; |
87 /** raw packet size, including FEC if present */ | 87 /** raw packet size, including FEC if present */ |
88 int raw_packet_size; | 88 int raw_packet_size; |
89 /** if true, all pids are analyzed to find streams */ | 89 /** if true, all pids are analyzed to find streams */ |
90 int auto_guess; | 90 int auto_guess; |
91 int set_service_ret; | |
92 | 91 |
93 /** compute exact PCR for each transport stream packet */ | 92 /** compute exact PCR for each transport stream packet */ |
94 int mpeg2ts_compute_pcr; | 93 int mpeg2ts_compute_pcr; |
95 | 94 |
96 int64_t cur_pcr; /**< used to estimate the exact PCR */ | 95 int64_t cur_pcr; /**< used to estimate the exact PCR */ |
783 { | 782 { |
784 PESContext *pes = opaque; | 783 PESContext *pes = opaque; |
785 MpegTSContext *ts = pes->ts; | 784 MpegTSContext *ts = pes->ts; |
786 const uint8_t *p; | 785 const uint8_t *p; |
787 int len, code; | 786 int len, code; |
787 | |
788 if(!ts->pkt) | |
789 return; | |
788 | 790 |
789 if (is_start) { | 791 if (is_start) { |
790 pes->state = MPEGTS_HEADER; | 792 pes->state = MPEGTS_HEADER; |
791 pes->data_index = 0; | 793 pes->data_index = 0; |
792 } | 794 } |
1157 } | 1159 } |
1158 | 1160 |
1159 static void set_service_cb(void *opaque, int ret) | 1161 static void set_service_cb(void *opaque, int ret) |
1160 { | 1162 { |
1161 MpegTSContext *ts = opaque; | 1163 MpegTSContext *ts = opaque; |
1162 ts->set_service_ret = ret; | |
1163 ts->stop_parse = 1; | 1164 ts->stop_parse = 1; |
1164 } | 1165 } |
1165 | 1166 |
1166 /* return the 90 kHz PCR and the extension for the 27 MHz PCR. return | 1167 /* return the 90 kHz PCR and the extension for the 27 MHz PCR. return |
1167 (-1) if not available */ | 1168 (-1) if not available */ |
1223 | 1224 |
1224 if (s->iformat == &mpegts_demuxer) { | 1225 if (s->iformat == &mpegts_demuxer) { |
1225 /* normal demux */ | 1226 /* normal demux */ |
1226 | 1227 |
1227 if (!ts->auto_guess) { | 1228 if (!ts->auto_guess) { |
1228 ts->set_service_ret = -1; | |
1229 | |
1230 /* first do a scaning to get all the services */ | 1229 /* first do a scaning to get all the services */ |
1231 url_fseek(pb, pos, SEEK_SET); | 1230 url_fseek(pb, pos, SEEK_SET); |
1232 mpegts_scan_sdt(ts); | 1231 mpegts_scan_sdt(ts); |
1233 | 1232 |
1234 handle_packets(ts, s->probesize); | 1233 handle_packets(ts, s->probesize); |
1254 s->ctx_flags |= AVFMTCTX_NOHEADER; | 1253 s->ctx_flags |= AVFMTCTX_NOHEADER; |
1255 goto do_pcr; | 1254 goto do_pcr; |
1256 } | 1255 } |
1257 | 1256 |
1258 /* tune to first service found */ | 1257 /* tune to first service found */ |
1259 for(i=0; i<ts->nb_services && ts->set_service_ret; i++){ | 1258 for(i=0; i<ts->nb_services; i++){ |
1260 service = ts->services[i]; | 1259 service = ts->services[i]; |
1261 sid = service->sid; | 1260 sid = service->sid; |
1262 #ifdef DEBUG_SI | 1261 #ifdef DEBUG_SI |
1263 av_log(ts->stream, AV_LOG_DEBUG, "tuning to '%s'\n", service->name); | 1262 av_log(ts->stream, AV_LOG_DEBUG, "tuning to '%s'\n", service->name); |
1264 #endif | 1263 #endif |
1271 | 1270 |
1272 handle_packets(ts, s->probesize); | 1271 handle_packets(ts, s->probesize); |
1273 } | 1272 } |
1274 /* if could not find service, enable auto_guess */ | 1273 /* if could not find service, enable auto_guess */ |
1275 | 1274 |
1276 if (ts->set_service_ret != 0) | |
1277 ts->auto_guess = 1; | 1275 ts->auto_guess = 1; |
1278 | 1276 |
1279 #ifdef DEBUG_SI | 1277 #ifdef DEBUG_SI |
1280 av_log(ts->stream, AV_LOG_DEBUG, "tuning done\n"); | 1278 av_log(ts->stream, AV_LOG_DEBUG, "tuning done\n"); |
1281 #endif | 1279 #endif |