| 578 | } |
| 579 | |
| 580 | static int ism_write_packet(AVFormatContext *s, AVPacket *pkt) |
| 581 | { |
| 582 | SmoothStreamingContext *c = s->priv_data; |
| 583 | AVStream *st = s->streams[pkt->stream_index]; |
| 584 | FFStream *const sti = ffstream(st); |
| 585 | OutputStream *os = &c->streams[pkt->stream_index]; |
| 586 | int64_t end_dts = (c->nb_fragments + 1) * (int64_t) c->min_frag_duration; |
| 587 | int ret; |
| 588 | |
| 589 | if (sti->first_dts == AV_NOPTS_VALUE) |
| 590 | sti->first_dts = pkt->dts; |
| 591 | |
| 592 | if ((!c->has_video || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && |
| 593 | av_compare_ts(pkt->dts - sti->first_dts, st->time_base, |
| 594 | end_dts, AV_TIME_BASE_Q) >= 0 && |
| 595 | pkt->flags & AV_PKT_FLAG_KEY && os->packets_written) { |
| 596 | |
| 597 | if ((ret = ism_flush(s, 0)) < 0) |
| 598 | return ret; |
| 599 | c->nb_fragments++; |
| 600 | } |
| 601 | |
| 602 | os->packets_written++; |
| 603 | return ff_write_chained(os->ctx, 0, pkt, s, 0); |
| 604 | } |
| 605 | |
| 606 | static int ism_write_trailer(AVFormatContext *s) |
| 607 | { |
nothing calls this directly
no test coverage detected