Lines Matching defs:pkt
120 AVPacket pkt;
171 static int64_t next_duration(AVFormatContext *avf, AVPacket *pkt, int64_t *last_dts)
173 AVStream *st = avf->streams[pkt->stream_index];
174 int64_t dts = av_rescale_q(pkt->dts, st->time_base, AV_TIME_BASE_Q);
180 static int fifo_thread_write_packet(FifoThreadContext *ctx, AVPacket *pkt)
189 if (fifo->timeshift && pkt->dts != AV_NOPTS_VALUE)
190 atomic_fetch_sub_explicit(&fifo->queue_duration, next_duration(avf, pkt, &ctx->last_received_dts), memory_order_relaxed);
193 if (pkt->flags & AV_PKT_FLAG_KEY) {
198 av_packet_unref(pkt);
203 orig_pts = pkt->pts;
204 orig_dts = pkt->dts;
205 orig_duration = pkt->duration;
206 s_idx = pkt->stream_index;
209 av_packet_rescale_ts(pkt, src_tb, dst_tb);
211 ret = av_write_frame(avf2, pkt);
213 av_packet_unref(pkt);
216 pkt->pts = orig_pts;
217 pkt->dts = orig_dts;
218 pkt->duration = orig_duration;
257 return fifo_thread_write_packet(ctx, &msg->pkt);
290 av_packet_unref(&fifo_msg->pkt);
293 static int fifo_thread_process_recovery_failure(FifoThreadContext *ctx, AVPacket *pkt,
304 if (pkt->pts == AV_NOPTS_VALUE)
307 ctx->last_recovery_ts = pkt->pts;
329 AVPacket *pkt = &msg->pkt;
349 AVRational tb = avf->streams[pkt->stream_index]->time_base;
350 time_since_recovery = av_rescale_q(pkt->pts - ctx->last_recovery_ts,
380 return fifo_thread_process_recovery_failure(ctx, pkt, ret);
415 av_packet_unref(&msg->pkt);
574 static int fifo_write_packet(AVFormatContext *avf, AVPacket *pkt)
577 FifoMessage msg = {.type = pkt ? FIFO_WRITE_PACKET : FIFO_FLUSH_OUTPUT};
580 if (pkt) {
581 ret = av_packet_ref(&msg.pkt,pkt);
608 if (fifo->timeshift && pkt && pkt->dts != AV_NOPTS_VALUE)
609 atomic_fetch_add_explicit(&fifo->queue_duration, next_duration(avf, pkt, &fifo->last_sent_dts), memory_order_relaxed);
613 if (pkt)
614 av_packet_unref(&msg.pkt);