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

Function packet_queue_get

ffplay.c:364–397  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

362
363/* return < 0 if aborted, 0 if no packet and > 0 if packet. */
364static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block)
365{
366 AVPacketList *pkt1;
367 int ret;
368
369 SDL_LockMutex(q->mutex);
370
371 for(;;) {
372 if (q->abort_request) {
373 ret = -1;
374 break;
375 }
376
377 pkt1 = q->first_pkt;
378 if (pkt1) {
379 q->first_pkt = pkt1->next;
380 if (!q->first_pkt)
381 q->last_pkt = NULL;
382 q->nb_packets--;
383 q->size -= pkt1->pkt.size + sizeof(*pkt1);
384 *pkt = pkt1->pkt;
385 av_free(pkt1);
386 ret = 1;
387 break;
388 } else if (!block) {
389 ret = 0;
390 break;
391 } else {
392 SDL_CondWait(q->cond, q->mutex);
393 }
394 }
395 SDL_UnlockMutex(q->mutex);
396 return ret;
397}
398
399static inline void fill_rectangle(SDL_Surface *screen,
400 int x, int y, int w, int h, int color)

Callers 3

get_video_frameFunction · 0.85
subtitle_threadFunction · 0.85
audio_decode_frameFunction · 0.85

Calls 1

av_freeFunction · 0.85

Tested by

no test coverage detected