comparison mov.c @ 5371:a0846aa55f5e libavformat

use AVFormatContext in dprintf
author bcoudurier
date Thu, 19 Nov 2009 21:03:25 +0000
parents 347123a18feb
children 45d0832f48b6
comparison
equal deleted inserted replaced
5370:238bda5af58e 5371:a0846aa55f5e
2249 dprintf(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n", 2249 dprintf(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n",
2250 pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration); 2250 pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration);
2251 return 0; 2251 return 0;
2252 } 2252 }
2253 2253
2254 static int mov_seek_stream(AVStream *st, int64_t timestamp, int flags) 2254 static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags)
2255 { 2255 {
2256 MOVStreamContext *sc = st->priv_data; 2256 MOVStreamContext *sc = st->priv_data;
2257 int sample, time_sample; 2257 int sample, time_sample;
2258 int i; 2258 int i;
2259 2259
2260 sample = av_index_search_timestamp(st, timestamp, flags); 2260 sample = av_index_search_timestamp(st, timestamp, flags);
2261 dprintf(st->codec, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample); 2261 dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
2262 if (sample < 0) /* not sure what to do */ 2262 if (sample < 0) /* not sure what to do */
2263 return -1; 2263 return -1;
2264 sc->current_sample = sample; 2264 sc->current_sample = sample;
2265 dprintf(st->codec, "stream %d, found sample %d\n", st->index, sc->current_sample); 2265 dprintf(s, "stream %d, found sample %d\n", st->index, sc->current_sample);
2266 /* adjust ctts index */ 2266 /* adjust ctts index */
2267 if (sc->ctts_data) { 2267 if (sc->ctts_data) {
2268 time_sample = 0; 2268 time_sample = 0;
2269 for (i = 0; i < sc->ctts_count; i++) { 2269 for (i = 0; i < sc->ctts_count; i++) {
2270 int next = time_sample + sc->ctts_data[i].count; 2270 int next = time_sample + sc->ctts_data[i].count;
2290 return -1; 2290 return -1;
2291 if (sample_time < 0) 2291 if (sample_time < 0)
2292 sample_time = 0; 2292 sample_time = 0;
2293 2293
2294 st = s->streams[stream_index]; 2294 st = s->streams[stream_index];
2295 sample = mov_seek_stream(st, sample_time, flags); 2295 sample = mov_seek_stream(s, st, sample_time, flags);
2296 if (sample < 0) 2296 if (sample < 0)
2297 return -1; 2297 return -1;
2298 2298
2299 /* adjust seek timestamp to found sample timestamp */ 2299 /* adjust seek timestamp to found sample timestamp */
2300 seek_timestamp = st->index_entries[sample].timestamp; 2300 seek_timestamp = st->index_entries[sample].timestamp;
2303 st = s->streams[i]; 2303 st = s->streams[i];
2304 if (stream_index == i) 2304 if (stream_index == i)
2305 continue; 2305 continue;
2306 2306
2307 timestamp = av_rescale_q(seek_timestamp, s->streams[stream_index]->time_base, st->time_base); 2307 timestamp = av_rescale_q(seek_timestamp, s->streams[stream_index]->time_base, st->time_base);
2308 mov_seek_stream(st, timestamp, flags); 2308 mov_seek_stream(s, st, timestamp, flags);
2309 } 2309 }
2310 return 0; 2310 return 0;
2311 } 2311 }
2312 2312
2313 static int mov_read_close(AVFormatContext *s) 2313 static int mov_read_close(AVFormatContext *s)