ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
ffmpeg_decoder.h
Go to the documentation of this file.
1#pragma once
2
40
42#include <stdbool.h>
43#include <stddef.h>
44#include "../common.h"
46
47/* ============================================================================
48 * FFmpeg Decoder Handle
49 * ============================================================================ */
50
60
61/* ============================================================================
62 * Decoder Lifecycle
63 * ============================================================================ */
64
86
111
131
152
163
182void ffmpeg_decoder_set_exit_callback(ffmpeg_decoder_t *decoder, bool (*should_exit_callback)(void *), void *user_data);
183
195
196/* ============================================================================
197 * Video Operations
198 * ============================================================================ */
199
234
243
254
265
266/* ============================================================================
267 * Audio Operations
268 * ============================================================================ */
269
298size_t ffmpeg_decoder_read_audio_samples(ffmpeg_decoder_t *decoder, float *buffer, size_t num_samples);
299
308
309/* ============================================================================
310 * Playback Control
311 * ============================================================================ */
312
331
353
362
373
384
386
387ffmpeg_decoder_t *ffmpeg_decoder_create_interruptible(const char *path, bool (*cancel)(void *), void *data);
388ffmpeg_decoder_t *ffmpeg_decoder_create_with_request_options(const char *path, bool (*cancel)(void *), void *data,
389 const char *headers, const char *cookies,
390 const char *proxy);
Synchronized per-thread pending error stacks and value snapshots. SET_ERRNO pushes,...
⚙️ Common definitions, error codes, macros, and types shared throughout the application
ffmpeg_decoder_t * ffmpeg_decoder_create_interruptible(const char *path, bool(*cancel)(void *), void *data)
ffmpeg_decoder_t * ffmpeg_decoder_create_with_request_options(const char *path, bool(*cancel)(void *), void *data, const char *headers, const char *cookies, const char *proxy)
unsigned int height
Definition fft.c:23
unsigned int width
Definition fft.c:23
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
bool ffmpeg_decoder_at_end(ffmpeg_decoder_t *decoder)
Check if decoder reached end of stream.
double ffmpeg_decoder_get_position(ffmpeg_decoder_t *decoder)
Get current playback position in seconds.
void ffmpeg_decoder_stop_prefetch(ffmpeg_decoder_t *decoder)
Stop background frame prefetching thread.
image_t * ffmpeg_decoder_read_video_frame(ffmpeg_decoder_t *decoder)
bool ffmpeg_decoder_has_video(ffmpeg_decoder_t *decoder)
Check if decoder has video stream.
double ffmpeg_decoder_get_video_fps(ffmpeg_decoder_t *decoder)
Get video frame rate.
asciichat_error_t ffmpeg_decoder_rewind(ffmpeg_decoder_t *decoder)
Seek to beginning of media.
asciichat_error_t ffmpeg_decoder_get_video_dimensions(ffmpeg_decoder_t *decoder, int *width, int *height)
Get video dimensions.
ffmpeg_frame_status_t
Decode next video frame.
bool ffmpeg_decoder_has_audio(ffmpeg_decoder_t *decoder)
Check if decoder has audio stream.
bool ffmpeg_decoder_is_prefetch_running(ffmpeg_decoder_t *decoder)
Check if background frame prefetching thread is running.
asciichat_error_t ffmpeg_decoder_start_prefetch(ffmpeg_decoder_t *decoder)
Start background frame prefetching thread.
asciichat_error_t ffmpeg_decoder_seek_to_timestamp(ffmpeg_decoder_t *decoder, double timestamp_sec)
Seek to specific timestamp in media.
void ffmpeg_decoder_set_exit_callback(ffmpeg_decoder_t *decoder, bool(*should_exit_callback)(void *), void *user_data)
Set exit signal callback for graceful shutdown during I/O.
void ffmpeg_decoder_destroy(ffmpeg_decoder_t *decoder)
Destroy FFmpeg decoder and free resources.
ffmpeg_decoder_t * ffmpeg_decoder_create(const char *path)
Create FFmpeg decoder from file path.
size_t ffmpeg_decoder_read_audio_samples(ffmpeg_decoder_t *decoder, float *buffer, size_t num_samples)
Decode audio samples.
ffmpeg_frame_status_t ffmpeg_decoder_poll_video(ffmpeg_decoder_t *decoder, image_t **frame, asciichat_error_context_t *failure)
ffmpeg_decoder_t * ffmpeg_decoder_create_stdin(void)
Create FFmpeg decoder from stdin.
double ffmpeg_decoder_get_duration(ffmpeg_decoder_t *decoder)
Get media duration in seconds.
@ FFMPEG_FRAME_READY
@ FFMPEG_FRAME_WAITING
@ FFMPEG_FRAME_FAILED
@ FFMPEG_FRAME_EOF
FFmpeg decoder state for video and audio decoding.
atomic_ptr_t should_exit_callback
Callback to check if app should exit.
AVFrame * frame
Reusable frame for decoding.
SIMD-friendly storage for one RGB pixel. r, g, and b hold the color channels and padding keeps the la...