FFmpeg
Data Structures | Macros | Enumerations | Functions
sync_queue.h File Reference
#include <stdint.h>
#include "libavcodec/packet.h"
#include "libavutil/frame.h"

Go to the source code of this file.

Data Structures

union   SyncQueueFrame
 

Macros

#define  SQFRAME(frame)   ((SyncQueueFrame){ .f = (frame) })
 
#define  SQPKT(pkt)   ((SyncQueueFrame){ .p = (pkt) })
 

Enumerations

 

Functions

SyncQueuesq_alloc (enum SyncQueueType type, int64_t buf_size_us, void *logctx)
  Allocate a sync queue of the given type. More...
 
void  sq_free (SyncQueue **sq)
 
int  sq_add_stream (SyncQueue *sq, int limiting)
  Add a new stream to the sync queue. More...
 
void  sq_limit_frames (SyncQueue *sq, unsigned int stream_idx, uint64_t max_frames)
  Limit the number of output frames for stream with index stream_idx to max_frames. More...
 
void  sq_frame_samples (SyncQueue *sq, unsigned int stream_idx, int frame_samples)
  Set a constant output audio frame size, in samples. More...
 
int  sq_send (SyncQueue *sq, unsigned int stream_idx, SyncQueueFrame frame)
  Submit a frame for the stream with index stream_idx. More...
 
int  sq_receive (SyncQueue *sq, int stream_idx, SyncQueueFrame frame)
  Read a frame from the queue. More...
 

Macro Definition Documentation

SQFRAME

#define SQFRAME (   frame )    ((SyncQueueFrame){ .f = (frame) })

Definition at line 38 of file sync_queue.h.

SQPKT

#define SQPKT (   pkt )    ((SyncQueueFrame){ .p = (pkt) })

Definition at line 39 of file sync_queue.h.

Enumeration Type Documentation

SyncQueueType

Enumerator
SYNC_QUEUE_PACKETS 
SYNC_QUEUE_FRAMES 

Definition at line 28 of file sync_queue.h.

Function Documentation

sq_alloc()

SyncQueue* sq_alloc ( enum SyncQueueType  type,
int64_t  buf_size_us,
void *  logctx 
)

Allocate a sync queue of the given type.

Parameters
buf_size_us maximum duration that will be buffered in microseconds

Definition at line 675 of file sync_queue.c.

Referenced by sch_add_sq_enc(), and setup_sync_queues().

sq_free()

void sq_free ( SyncQueue **  sq )

Definition at line 699 of file sync_queue.c.

Referenced by of_free(), and sch_free().

sq_add_stream()

int sq_add_stream ( SyncQueuesq,
int  limiting 
)

Add a new stream to the sync queue.

Parameters
limiting whether the stream is limiting, i.e. no other stream can be longer than this one
Returns
  • a non-negative stream index on success
  • a negative error code on error

Definition at line 620 of file sync_queue.c.

Referenced by sch_sq_add_enc(), and setup_sync_queues().

sq_limit_frames()

void sq_limit_frames ( SyncQueuesq,
unsigned int  stream_idx,
uint64_t  max_frames 
)

Limit the number of output frames for stream with index stream_idx to max_frames.

Definition at line 649 of file sync_queue.c.

Referenced by sch_sq_add_enc(), and setup_sync_queues().

sq_frame_samples()

void sq_frame_samples ( SyncQueuesq,
unsigned int  stream_idx,
int  frame_samples 
)

Set a constant output audio frame size, in samples.

Can only be used with SYNC_QUEUE_FRAMES queues and audio streams.

All output frames will have exactly frame_samples audio samples, except possibly for the last one, which may have fewer.

Definition at line 661 of file sync_queue.c.

Referenced by enc_open().

sq_send()

int sq_send ( SyncQueuesq,
unsigned int  stream_idx,
SyncQueueFrame  frame 
)

Submit a frame for the stream with index stream_idx.

On success, the sync queue takes ownership of the frame and will reset the contents of the supplied frame. On failure, the frame remains owned by the caller.

Sending a frame with NULL contents marks the stream as finished.

Returns
  • 0 on success
  • AVERROR_EOF when no more frames should be submitted for this stream
  • another a negative error code on failure

Definition at line 343 of file sync_queue.c.

Referenced by send_to_enc_sq(), and sync_queue_process().

sq_receive()

int sq_receive ( SyncQueuesq,
int  stream_idx,
SyncQueueFrame  frame 
)

Read a frame from the queue.

Parameters
stream_idx index of the stream to read a frame for. May be -1, then try to read a frame from any stream that is ready for output.
frame output frame will be written here on success. The frame is owned by the caller.
Returns
  • a non-negative index of the stream to which the returned frame belongs
  • AVERROR(EAGAIN) when more frames need to be submitted to the queue
  • AVERROR_EOF when no more frames will be available for this stream (for any stream if stream_idx is -1)
  • another negative error code on failure

Definition at line 608 of file sync_queue.c.

Referenced by send_to_enc_sq(), and sync_queue_process().


Generated on Fri Aug 22 2025 13:59:48 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /