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

Function packet_queue_get

fftools/ffplay.c:534–566  ·  view source on GitHub ↗

return < 0 if aborted, 0 if no packet and > 0 if packet. */

Source from the content-addressed store, hash-verified

532
533/* return < 0 if aborted, 0 if no packet and > 0 if packet. */
534static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block, int *serial)
535{
536 MyAVPacketList pkt1;
537 int ret;
538
539 SDL_LockMutex(q->mutex);
540
541 for (;;) {
542 if (q->abort_request) {
543 ret = -1;
544 break;
545 }
546
547 if (av_fifo_read(q->pkt_list, &pkt1, 1) >= 0) {
548 q->nb_packets--;
549 q->size -= pkt1.pkt->size + sizeof(pkt1);
550 q->duration -= pkt1.pkt->duration;
551 av_packet_move_ref(pkt, pkt1.pkt);
552 if (serial)
553 *serial = pkt1.serial;
554 av_packet_free(&pkt1.pkt);
555 ret = 1;
556 break;
557 } else if (!block) {
558 ret = 0;
559 break;
560 } else {
561 SDL_CondWait(q->cond, q->mutex);
562 }
563 }
564 SDL_UnlockMutex(q->mutex);
565 return ret;
566}
567
568static int decoder_init(Decoder *d, AVCodecContext *avctx, PacketQueue *queue, SDL_cond *empty_queue_cond) {
569 memset(d, 0, sizeof(Decoder));

Callers 1

decoder_decode_frameFunction · 0.85

Calls 3

av_fifo_readFunction · 0.85
av_packet_move_refFunction · 0.85
av_packet_freeFunction · 0.85

Tested by

no test coverage detected