Loading...
Searching...
No Matches
fftools_sync_queue.c File Reference

Go to the source code of this file.

## Data Structures

struct | SyncQueueStream
struct | SyncQueue

## Typedefs

typedef struct SyncQueueStream | SyncQueueStream

## Functions

static void | frame_move (const SyncQueue *sq, SyncQueueFrame dst, SyncQueueFrame src)
static int64_t | frame_ts (const SyncQueue *sq, SyncQueueFrame frame)
static int | frame_null (const SyncQueue *sq, SyncQueueFrame frame)
static void | finish_stream (SyncQueue *sq, unsigned int stream_idx)
static void | queue_head_update (SyncQueue *sq)
static void | stream_update_ts (SyncQueue *sq, unsigned int stream_idx, int64_t ts)
static int | overflow_heartbeat (SyncQueue *sq, int stream_idx)
int | sq_send (SyncQueue *sq, unsigned int stream_idx, SyncQueueFrame frame)
static int | receive_for_stream (SyncQueue *sq, unsigned int stream_idx, SyncQueueFrame frame)
static int | receive_internal (SyncQueue *sq, int stream_idx, SyncQueueFrame frame)
int | sq_receive (SyncQueue *sq, int stream_idx, SyncQueueFrame frame)
int | sq_add_stream (SyncQueue *sq, int limiting)
void | sq_set_tb (SyncQueue *sq, unsigned int stream_idx, AVRational tb)
void | sq_limit_frames (SyncQueue *sq, unsigned int stream_idx, uint64_t frames)
SyncQueue * | sq_alloc (enum SyncQueueType type, int64_t buf_size_us)
void | sq_free (SyncQueue **psq)

## Typedef Documentation

## SyncQueueStream

typedef struct SyncQueueStream SyncQueueStream

## Function Documentation

## finish_stream()

static void finish_stream | ( | SyncQueue * | sq,
|  | unsigned int | stream_idx
| ) |  |

static

Definition at line 101 of file fftools_sync_queue.c.

## frame_move()

static void frame_move | ( | const SyncQueue * | sq,
|  | SyncQueueFrame | dst,
|  | SyncQueueFrame | src
| ) |  |

static

Definition at line 80 of file fftools_sync_queue.c.

## frame_null()

static int frame_null | ( | const SyncQueue * | sq,
|  | SyncQueueFrame | frame
| ) |  |

static

Definition at line 96 of file fftools_sync_queue.c.

## frame_ts()

static int64_t frame_ts | ( | const SyncQueue * | sq,
|  | SyncQueueFrame | frame
| ) |  |

static

Definition at line 89 of file fftools_sync_queue.c.

## overflow_heartbeat()

static int overflow_heartbeat | ( | SyncQueue * | sq,
|  | int | stream_idx
| ) |  |

static

Definition at line 190 of file fftools_sync_queue.c.

## queue_head_update()

static void queue_head_update | ( | SyncQueue * | sq | ) |

static

Definition at line 135 of file fftools_sync_queue.c.

## receive_for_stream()

static int receive_for_stream | ( | SyncQueue * | sq,
|  | unsigned int | stream_idx,
|  | SyncQueueFrame | frame
| ) |  |

static

Definition at line 291 of file fftools_sync_queue.c.

## receive_internal()

static int receive_internal | ( | SyncQueue * | sq,
|  | int | stream_idx,
|  | SyncQueueFrame | frame
| ) |  |

static

Definition at line 329 of file fftools_sync_queue.c.

## sq_add_stream()

int sq_add_stream | ( | SyncQueue * | sq,
|  | 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 365 of file fftools_sync_queue.c.

## sq_alloc()

SyncQueue * sq_alloc | ( | enum SyncQueueType | type,
|  | int64_t | buf_size_us
| ) |  |

Allocate a sync queue of the given type.

Parameters

  buf_size_us | maximum duration that will be buffered in microseconds

Definition at line 419 of file fftools_sync_queue.c.

## sq_free()

void sq_free | ( | SyncQueue ** | psq | ) |

Definition at line 442 of file fftools_sync_queue.c.

## sq_limit_frames()

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.

Definition at line 407 of file fftools_sync_queue.c.

## sq_receive()

int sq_receive | ( | SyncQueue * | sq,
|  | 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 353 of file fftools_sync_queue.c.

## sq_send()

int sq_send | ( | SyncQueue * | sq,
|  | 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 248 of file fftools_sync_queue.c.

## sq_set_tb()

void sq_set_tb | ( | SyncQueue * | sq,
|  | unsigned int | stream_idx,
|  | AVRational | tb
| ) |  |

Set the timebase for the stream with index stream_idx. Should be called before sending any frames for this stream.

Definition at line 392 of file fftools_sync_queue.c.

## stream_update_ts()

static void stream_update_ts | ( | SyncQueue * | sq,
|  | unsigned int | stream_idx,
|  | int64_t | ts
| ) |  |

static

Definition at line 161 of file fftools_sync_queue.c.