MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ism_write_packet

Function ism_write_packet

libavformat/smoothstreamingenc.c:580–604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580static 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
606static int ism_write_trailer(AVFormatContext *s)
607{

Callers

nothing calls this directly

Calls 4

ffstreamFunction · 0.85
av_compare_tsFunction · 0.85
ism_flushFunction · 0.85
ff_write_chainedFunction · 0.85

Tested by

no test coverage detected