ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
ffmpeg_decoder_t Struct Reference

FFmpeg decoder state for video and audio decoding. More...

Data Fields

AVFormatContext * format_ctx
 FFmpeg format/container context.
 
AVCodecContext * video_codec_ctx
 Video codec context.
 
int video_stream_idx
 Video stream index (-1 if none)
 
struct SwsContext * sws_ctx
 Software scaler for format conversion.
 
AVCodecContext * audio_codec_ctx
 Audio codec context.
 
int audio_stream_idx
 Audio stream index (-1 if none)
 
struct SwrContext * swr_ctx
 Software resampler for format conversion.
 
AVFrame * frame
 Reusable frame for decoding.
 
AVPacket * packet
 Reusable packet for reading.
 
image_t * current_image
 Working buffer for decoding.
 
float * audio_buffer
 Buffer for partial audio frames.
 
size_t audio_buffer_size
 Total size of audio buffer.
 
size_t audio_buffer_offset
 Current offset in audio buffer.
 
asciichat_thread_t prefetch_thread
 Prefetch thread handle.
 
image_t * prefetch_image_a
 First prefetch buffer.
 
image_t * prefetch_image_b
 Second prefetch buffer.
 
image_t * current_prefetch_image
 Currently available prefetched frame.
 
bool prefetch_frame_ready
 Whether current_prefetch_image has valid data.
 
bool prefetch_thread_running
 Whether prefetch thread is active.
 
bool prefetch_should_stop
 Signal to stop prefetch thread.
 
bool seeking_in_progress
 Signal to pause prefetch thread during seek.
 
cond_t prefetch_cond
 Condition variable for pausing during seek.
 
mutex_t prefetch_mutex
 Protect prefetch state and FFmpeg decoder access.
 
image_t * current_read_buffer
 Buffer main thread is currently reading/rendering.
 
bool buffer_a_in_use
 Whether prefetch_image_a is being read by main thread.
 
bool buffer_b_in_use
 Whether prefetch_image_b is being read by main thread.
 
bool eof_reached
 Whether end of file was reached.
 
bool is_stdin
 Whether reading from stdin.
 
AVIOContext * avio_ctx
 Custom I/O context for stdin.
 
unsigned char * avio_buffer
 Buffer for custom I/O.
 
double last_video_pts
 Last video presentation timestamp.
 
double last_audio_pts
 Last audio presentation timestamp.
 
uint64_t audio_samples_read
 Total audio samples decoded and output.
 
int audio_sample_rate
 Audio sample rate (Hz)
 

Detailed Description

FFmpeg decoder state for video and audio decoding.

Handles video/audio decoding from files, stdin, and URLs using FFmpeg. Supports double-buffered prefetching for smooth playback.

Definition at line 66 of file ffmpeg_decoder.c.

Field Documentation

◆ audio_buffer

float* ffmpeg_decoder_t::audio_buffer

◆ audio_buffer_offset

size_t ffmpeg_decoder_t::audio_buffer_offset

Current offset in audio buffer.

Definition at line 90 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_read_audio_samples(), ffmpeg_decoder_rewind(), and ffmpeg_decoder_seek_to_timestamp().

◆ audio_buffer_size

size_t ffmpeg_decoder_t::audio_buffer_size

Total size of audio buffer.

Definition at line 89 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_create_stdin(), and ffmpeg_decoder_seek_to_timestamp().

◆ audio_codec_ctx

AVCodecContext* ffmpeg_decoder_t::audio_codec_ctx

◆ audio_sample_rate

int ffmpeg_decoder_t::audio_sample_rate

Audio sample rate (Hz)

Definition at line 123 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_get_position(), and ffmpeg_decoder_seek_to_timestamp().

◆ audio_samples_read

uint64_t ffmpeg_decoder_t::audio_samples_read

Total audio samples decoded and output.

Definition at line 122 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_get_position(), ffmpeg_decoder_read_audio_samples(), ffmpeg_decoder_rewind(), and ffmpeg_decoder_seek_to_timestamp().

◆ audio_stream_idx

int ffmpeg_decoder_t::audio_stream_idx

Audio stream index (-1 if none)

Definition at line 77 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_create_stdin(), ffmpeg_decoder_has_audio(), and ffmpeg_decoder_read_audio_samples().

◆ avio_buffer

unsigned char* ffmpeg_decoder_t::avio_buffer

Buffer for custom I/O.

Definition at line 115 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create_stdin().

◆ avio_ctx

AVIOContext* ffmpeg_decoder_t::avio_ctx

Custom I/O context for stdin.

Definition at line 114 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create_stdin(), and ffmpeg_decoder_destroy().

◆ buffer_a_in_use

bool ffmpeg_decoder_t::buffer_a_in_use

Whether prefetch_image_a is being read by main thread.

Definition at line 106 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_read_video_frame(), and ffmpeg_decoder_seek_to_timestamp().

◆ buffer_b_in_use

bool ffmpeg_decoder_t::buffer_b_in_use

Whether prefetch_image_b is being read by main thread.

Definition at line 107 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_read_video_frame(), and ffmpeg_decoder_seek_to_timestamp().

◆ current_image

image_t* ffmpeg_decoder_t::current_image

Working buffer for decoding.

Definition at line 85 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_destroy(), and ffmpeg_decoder_read_video_frame().

◆ current_prefetch_image

image_t* ffmpeg_decoder_t::current_prefetch_image

Currently available prefetched frame.

Definition at line 96 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), and ffmpeg_decoder_read_video_frame().

◆ current_read_buffer

image_t* ffmpeg_decoder_t::current_read_buffer

Buffer main thread is currently reading/rendering.

Definition at line 105 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_read_video_frame(), and ffmpeg_decoder_seek_to_timestamp().

◆ eof_reached

bool ffmpeg_decoder_t::eof_reached

Whether end of file was reached.

Definition at line 110 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_at_end(), ffmpeg_decoder_read_audio_samples(), ffmpeg_decoder_rewind(), and ffmpeg_decoder_seek_to_timestamp().

◆ format_ctx

◆ frame

AVFrame* ffmpeg_decoder_t::frame

Reusable frame for decoding.

Definition at line 81 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_create_stdin(), ffmpeg_decoder_destroy(), and ffmpeg_decoder_read_audio_samples().

◆ is_stdin

bool ffmpeg_decoder_t::is_stdin

Whether reading from stdin.

Definition at line 111 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create_stdin(), ffmpeg_decoder_rewind(), and ffmpeg_decoder_seek_to_timestamp().

◆ last_audio_pts

double ffmpeg_decoder_t::last_audio_pts

◆ last_video_pts

double ffmpeg_decoder_t::last_video_pts

◆ packet

AVPacket* ffmpeg_decoder_t::packet

Reusable packet for reading.

Definition at line 82 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_create_stdin(), ffmpeg_decoder_destroy(), and ffmpeg_decoder_read_audio_samples().

◆ prefetch_cond

cond_t ffmpeg_decoder_t::prefetch_cond

Condition variable for pausing during seek.

Definition at line 101 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_destroy(), and ffmpeg_decoder_seek_to_timestamp().

◆ prefetch_frame_ready

bool ffmpeg_decoder_t::prefetch_frame_ready

Whether current_prefetch_image has valid data.

Definition at line 97 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_read_video_frame(), and ffmpeg_decoder_seek_to_timestamp().

◆ prefetch_image_a

image_t* ffmpeg_decoder_t::prefetch_image_a

◆ prefetch_image_b

image_t* ffmpeg_decoder_t::prefetch_image_b

◆ prefetch_mutex

mutex_t ffmpeg_decoder_t::prefetch_mutex

Protect prefetch state and FFmpeg decoder access.

Definition at line 102 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_destroy(), ffmpeg_decoder_read_video_frame(), and ffmpeg_decoder_seek_to_timestamp().

◆ prefetch_should_stop

bool ffmpeg_decoder_t::prefetch_should_stop

Signal to stop prefetch thread.

Definition at line 99 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_destroy(), ffmpeg_decoder_start_prefetch(), and ffmpeg_decoder_stop_prefetch().

◆ prefetch_thread

asciichat_thread_t ffmpeg_decoder_t::prefetch_thread

Prefetch thread handle.

Definition at line 93 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_destroy(), ffmpeg_decoder_start_prefetch(), and ffmpeg_decoder_stop_prefetch().

◆ prefetch_thread_running

bool ffmpeg_decoder_t::prefetch_thread_running

◆ seeking_in_progress

bool ffmpeg_decoder_t::seeking_in_progress

Signal to pause prefetch thread during seek.

Definition at line 100 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_seek_to_timestamp().

◆ swr_ctx

struct SwrContext* ffmpeg_decoder_t::swr_ctx

Software resampler for format conversion.

Definition at line 78 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_create_stdin(), ffmpeg_decoder_destroy(), and ffmpeg_decoder_read_audio_samples().

◆ sws_ctx

struct SwsContext* ffmpeg_decoder_t::sws_ctx

Software scaler for format conversion.

Definition at line 73 of file ffmpeg_decoder.c.

Referenced by ffmpeg_decoder_create(), ffmpeg_decoder_create_stdin(), and ffmpeg_decoder_destroy().

◆ video_codec_ctx

AVCodecContext* ffmpeg_decoder_t::video_codec_ctx

◆ video_stream_idx


The documentation for this struct was generated from the following file: