- if (pkt && s->streams[pkt->stream_index]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
- pkt->duration = 2; // enforce 2 fields
- return ff_audio_rechunk_interleave(s, out, pkt, flush,
- ff_interleave_packet_per_dts, gxf_compare_field_nb);
+ int ret;
+ if (pkt) {
+ AVStream *st = s->streams[pkt->stream_index];
+ GXFStreamContext *sc = st->priv_data;
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
+ pkt->pts = pkt->dts = sc->pkt_cnt * 2; // enforce 2 fields
+ else
+ pkt->pts = pkt->dts = sc->pkt_cnt * GXF_SAMPLES_PER_FRAME;
+ sc->pkt_cnt++;
+ if ((ret = ff_interleave_add_packet(s, pkt, gxf_compare_field_nb)) < 0)
+ return ret;
+ }
+ return ff_interleave_packet_per_dts(s, out, NULL, flush);