| 2209 | } |
| 2210 | |
| 2211 | static int dash_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 2212 | { |
| 2213 | DASHContext *c = s->priv_data; |
| 2214 | int ret = 0, i; |
| 2215 | int64_t mints = 0; |
| 2216 | struct representation *cur = NULL; |
| 2217 | struct representation *rep = NULL; |
| 2218 | |
| 2219 | recheck_discard_flags(s, c->videos, c->n_videos); |
| 2220 | recheck_discard_flags(s, c->audios, c->n_audios); |
| 2221 | recheck_discard_flags(s, c->subtitles, c->n_subtitles); |
| 2222 | |
| 2223 | for (i = 0; i < c->n_videos; i++) { |
| 2224 | rep = c->videos[i]; |
| 2225 | if (!rep->ctx) |
| 2226 | continue; |
| 2227 | if (!cur || rep->cur_timestamp < mints) { |
| 2228 | cur = rep; |
| 2229 | mints = rep->cur_timestamp; |
| 2230 | } |
| 2231 | } |
| 2232 | for (i = 0; i < c->n_audios; i++) { |
| 2233 | rep = c->audios[i]; |
| 2234 | if (!rep->ctx) |
| 2235 | continue; |
| 2236 | if (!cur || rep->cur_timestamp < mints) { |
| 2237 | cur = rep; |
| 2238 | mints = rep->cur_timestamp; |
| 2239 | } |
| 2240 | } |
| 2241 | |
| 2242 | for (i = 0; i < c->n_subtitles; i++) { |
| 2243 | rep = c->subtitles[i]; |
| 2244 | if (!rep->ctx) |
| 2245 | continue; |
| 2246 | if (!cur || rep->cur_timestamp < mints) { |
| 2247 | cur = rep; |
| 2248 | mints = rep->cur_timestamp; |
| 2249 | } |
| 2250 | } |
| 2251 | |
| 2252 | if (!cur) { |
| 2253 | return AVERROR_INVALIDDATA; |
| 2254 | } |
| 2255 | while (!ff_check_interrupt(c->interrupt_callback) && !ret) { |
| 2256 | ret = av_read_frame(cur->ctx, pkt); |
| 2257 | if (ret >= 0) { |
| 2258 | /* If we got a packet, return it */ |
| 2259 | cur->cur_timestamp = av_rescale(pkt->pts, (int64_t)cur->ctx->streams[0]->time_base.num * 90000, cur->ctx->streams[0]->time_base.den); |
| 2260 | pkt->stream_index = cur->stream_index; |
| 2261 | return 0; |
| 2262 | } |
| 2263 | if (cur->is_restart_needed) { |
| 2264 | cur->cur_seg_offset = 0; |
| 2265 | cur->init_sec_buf_read_offset = 0; |
| 2266 | cur->is_restart_needed = 0; |
| 2267 | ff_format_io_close(cur->parent, &cur->input); |
| 2268 | ret = reopen_demux_for_component(s, cur); |
nothing calls this directly
no test coverage detected