xine-lib: xine-lib-1.2.13/src/combined/ffmpeg/demux_avformat.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Functions
demux_avformat.c File Reference
`#include <stdlib.h>`
`#include <string.h>`
`#include <pthread.h>`
`#include <errno.h>`
`#include <libavutil/avutil.h>`
`#include <libavcodec/avcodec.h>`
`#include <libavformat/avformat.h>`
`#include <libavformat/avio.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/input_plugin.h>`
`#include <xine/demux.h>`
`#include "ffmpeg_decoder.h"`
`#include "ffmpeg_compat.h"`

## Data Structures
struct | avformat_input_plugin_t
struct | avformat_demux_plugin_t

## Macros
#define | LOG_MODULE "libavformat"
#define | LOG_VERBOSE
#define | CODEC_ID(st) ((st)->codec->codec_id)
#define | WRAP_THRESHOLD 360000

## Functions
static off_t | input_avformat_read (input_plugin_t *this_gen, void *buf_gen, off_t len)
static buf_element_t * | input_avformat_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo)
static off_t | input_avformat_get_length (input_plugin_t *this_gen)
static uint32_t | input_avformat_get_capabilities (input_plugin_t *this_gen)
static uint32_t | input_avformat_get_blocksize (input_plugin_t *this_gen)
static off_t | input_avformat_get_current_pos (input_plugin_t *this_gen)
static off_t | input_avformat_seek (input_plugin_t *this_gen, off_t offset, int origin)
static const char * | input_avformat_get_mrl (input_plugin_t *this_gen)
static int | input_avformat_get_optional_data (input_plugin_t *this_gen, void *data, int data_type)
static int | input_avformat_open (input_plugin_t *this_gen)
static void | input_avformat_dispose (input_plugin_t *this_gen)
static input_plugin_t * | input_avformat_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *mrl)
void * | init_avformat_input_plugin (xine_t *xine, const void *data)
static void | check_newpts (avformat_demux_plugin_t *this, int64_t pts)
static uint32_t | video_codec_lookup (avformat_demux_plugin_t *this, unsigned id)
static uint32_t | audio_codec_lookup (avformat_demux_plugin_t *this, unsigned id)
static AVProgram * | _find_program_from_stream (AVFormatContext *ic, AVProgram *last, int s)
static int | find_avformat_streams (avformat_demux_plugin_t *this)
static void | send_headers_audio (avformat_demux_plugin_t *this)
static void | send_headers_video (avformat_demux_plugin_t *this)
static int | send_avpacket (avformat_demux_plugin_t *this)
static int | demux_avformat_get_status (demux_plugin_t *this_gen)
static int | demux_avformat_get_stream_length (demux_plugin_t *this_gen)
static uint32_t | demux_avformat_get_capabilities (demux_plugin_t *this_gen)
static int | demux_avformat_get_optional_data (demux_plugin_t *this_gen, void *data, int data_type)
static int | demux_avformat_send_chunk (demux_plugin_t *this_gen)
static void | demux_avformat_send_headers (demux_plugin_t *this_gen)
static int | avformat_seek (avformat_demux_plugin_t *this, off_t start_pos, int start_time)
static int | demux_avformat_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
static void | demux_avformat_dispose (demux_plugin_t *this_gen)
static int | pb_input_read_packet (void *opaque, uint8_t *buf, int buf_size)
static int64_t | pb_input_seek (void *opaque, int64_t offset, int whence)
static AVIOContext * | get_io_context (xine_stream_t *stream, input_plugin_t *input)
static AVFormatContext * | get_format_context (xine_stream_t *stream, input_plugin_t *input)
static demux_plugin_t * | open_demux_avformat_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input)
void * | init_avformat_demux_plugin (xine_t *xine, const void *data)

## Macro Definition Documentation

## ◆ CODEC_ID

#define CODEC_ID | ( |  | st | ) | ((st)->codec->codec_id)

Referenced by find_avformat_streams().

## ◆ LOG_MODULE

#define LOG_MODULE "libavformat"

Referenced by audio_codec_lookup(), find_avformat_streams(), get_format_context(), get_io_context(), input_avformat_get_instance(), open_demux_avformat_plugin(), send_avpacket(), send_headers_audio(), send_headers_video(), and video_codec_lookup().

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ WRAP_THRESHOLD

#define WRAP_THRESHOLD 360000

Referenced by check_newpts(), and check_newpts().

## Function Documentation

## ◆ _find_program_from_stream()

static AVProgram * _find_program_from_stream | ( | AVFormatContext * | ic,
|  | AVProgram * | last,
|  | int | s )
| static

References NULL.

Referenced by find_avformat_streams().

## ◆ audio_codec_lookup()

static uint32_t audio_codec_lookup | ( | avformat_demux_plugin_t * | this,
|  | unsigned | id )
| static

References BUF_AUDIO_A52, BUF_AUDIO_LPCM_BE, BUF_AUDIO_LPCM_LE, BUF_AUDIO_MPEG, ff_audio_lookup, ff_audio_lookup_entries, LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by find_avformat_streams().

## ◆ avformat_seek()

static int avformat_seek | ( | avformat_demux_plugin_t * | this,
|  | off_t | start_pos,
|  | int | start_time )
| static

Referenced by demux_avformat_seek().

## ◆ check_newpts()

static void check_newpts | ( | avformat_demux_plugin_t * | this,
|  | int64_t | pts )
| static

References _x_demux_control_newpts(), and WRAP_THRESHOLD.

Referenced by send_avpacket().

## ◆ demux_avformat_dispose()

static void demux_avformat_dispose | ( | demux_plugin_t * | this_gen | ) |
| static

References _x_freep().

Referenced by open_demux_avformat_plugin().

## ◆ demux_avformat_get_capabilities()

static uint32_t demux_avformat_get_capabilities | ( | demux_plugin_t * | this_gen | ) |
| static

References DEMUX_CAP_AUDIOLANG.

Referenced by open_demux_avformat_plugin().

## ◆ demux_avformat_get_optional_data()

static int demux_avformat_get_optional_data | ( | demux_plugin_t * | this_gen,
|  | void * | data,
|  | int | data_type )
| static

References DEMUX_OPTIONAL_DATA_AUDIOLANG, DEMUX_OPTIONAL_SUCCESS, DEMUX_OPTIONAL_UNSUPPORTED, INPUT_CAP_AUDIOLANG, and NULL.

Referenced by open_demux_avformat_plugin().

## ◆ demux_avformat_get_status()

static int demux_avformat_get_status | ( | demux_plugin_t * | this_gen | ) |
| static

Referenced by open_demux_avformat_plugin().

## ◆ demux_avformat_get_stream_length()

static int demux_avformat_get_stream_length | ( | demux_plugin_t * | this_gen | ) |
| static

Referenced by open_demux_avformat_plugin().

## ◆ demux_avformat_seek()

static int demux_avformat_seek | ( | demux_plugin_t * | this_gen,
|  | off_t | start_pos,
|  | int | start_time,
|  | int | playing )
| static

References _x_demux_flush_engine(), avformat_seek(), and BUF_FLAG_SEEK.

Referenced by open_demux_avformat_plugin().

## ◆ demux_avformat_send_chunk()

static int demux_avformat_send_chunk | ( | demux_plugin_t * | this_gen | ) |
| static

References DEMUX_FINISHED, DEMUX_OK, and send_avpacket().

Referenced by open_demux_avformat_plugin().

## ◆ demux_avformat_send_headers()

static void demux_avformat_send_headers | ( | demux_plugin_t * | this_gen | ) |
| static

References _x_demux_control_start(), _x_stream_info_set(), DEMUX_OK, send_headers_audio(), send_headers_video(), XINE_STREAM_INFO_HAS_AUDIO, and XINE_STREAM_INFO_HAS_VIDEO.

Referenced by open_demux_avformat_plugin().

## ◆ find_avformat_streams()

static int find_avformat_streams | ( | avformat_demux_plugin_t * | this | ) |
| static

References _find_program_from_stream(), audio_codec_lookup(), CODEC_ID, LOG_MODULE, NULL, video_codec_lookup(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by open_demux_avformat_plugin().

## ◆ get_format_context()

static AVFormatContext * get_format_context | ( | xine_stream_t * | stream,
|  | input_plugin_t * | input )
| static

References DEMUX_AVFORMAT_ID, get_io_context(), input(), INPUT_OPTIONAL_DATA_fmt_ctx, INPUT_OPTIONAL_SUCCESS, LOG_MODULE, NULL, xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by open_demux_avformat_plugin().

## ◆ get_io_context()

static AVIOContext * get_io_context | ( | xine_stream_t * | stream,
|  | input_plugin_t * | input )
| static

References input(), INPUT_AVIO_ID, INPUT_CAP_SEEKABLE, INPUT_OPTIONAL_DATA_pb, INPUT_OPTIONAL_SUCCESS, LOG_MODULE, NULL, pb_input_read_packet(), pb_input_seek(), xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by get_format_context().

## ◆ init_avformat_demux_plugin()

void * init_avformat_demux_plugin | ( | xine_t * | xine,
|  | const void * | data )

References DEMUX_AVFORMAT_ID, demux_plugin_s::dispose, N_, NULL, open_demux_avformat_plugin(), and demux_class_s::open_plugin.

## ◆ init_avformat_input_plugin()

void * init_avformat_input_plugin | ( | xine_t * | xine,
|  | const void * | data )

References DEMUX_AVFORMAT_ID, input_plugin_s::dispose, input_class_s::get_instance, input_avformat_get_instance(), N_, and NULL.

## ◆ input_avformat_dispose()

static void input_avformat_dispose | ( | input_plugin_t * | this_gen | ) |
| static

References _x_freep().

Referenced by input_avformat_get_instance().

## ◆ input_avformat_get_blocksize()

static uint32_t input_avformat_get_blocksize | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by input_avformat_get_instance().

## ◆ input_avformat_get_capabilities()

static uint32_t input_avformat_get_capabilities | ( | input_plugin_t * | this_gen | ) |
| static

References INPUT_CAP_SEEKABLE.

Referenced by input_avformat_get_instance().

## ◆ input_avformat_get_current_pos()

static off_t input_avformat_get_current_pos | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by input_avformat_get_instance().

## ◆ input_avformat_get_instance()

static input_plugin_t * input_avformat_get_instance | ( | input_class_t * | cls_gen,
|  | xine_stream_t * | stream,
|  | const char * | mrl )
| static

References _x_freep(), _x_meta_info_set(), _x_mrl_remove_auth(), DEMUX_AVFORMAT_ID, init_once_routine(), input_avformat_dispose(), input_avformat_get_blocksize(), input_avformat_get_capabilities(), input_avformat_get_current_pos(), input_avformat_get_length(), input_avformat_get_mrl(), input_avformat_get_optional_data(), input_avformat_open(), input_avformat_read(), input_avformat_read_block(), input_avformat_seek(), LOG_MODULE, NULL, xine_stream_s::xine, XINE_META_INFO_TITLE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by init_avformat_input_plugin().

## ◆ input_avformat_get_length()

static off_t input_avformat_get_length | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by input_avformat_get_instance().

## ◆ input_avformat_get_mrl()

static const char * input_avformat_get_mrl | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by input_avformat_get_instance().

## ◆ input_avformat_get_optional_data()

static int input_avformat_get_optional_data | ( | input_plugin_t * | this_gen,
|  | void * | data,
|  | int | data_type )
| static

References DEMUX_AVFORMAT_ID, INPUT_OPTIONAL_DATA_DEMUXER, INPUT_OPTIONAL_DATA_fmt_ctx, INPUT_OPTIONAL_SUCCESS, INPUT_OPTIONAL_UNSUPPORTED, and NULL.

Referenced by input_avformat_get_instance().

## ◆ input_avformat_open()

static int input_avformat_open | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by input_avformat_get_instance().

## ◆ input_avformat_read()

static off_t input_avformat_read | ( | input_plugin_t * | this_gen,
|  | void * | buf_gen,
|  | off_t | len )
| static

Referenced by input_avformat_get_instance().

## ◆ input_avformat_read_block()

static buf_element_t * input_avformat_read_block | ( | input_plugin_t * | this_gen,
|  | fifo_buffer_t * | fifo,
|  | off_t | todo )
| static

References NULL.

Referenced by input_avformat_get_instance().

## ◆ input_avformat_seek()

static off_t input_avformat_seek | ( | input_plugin_t * | this_gen,
|  | off_t | offset,
|  | int | origin )
| static

Referenced by input_avformat_get_instance().

## ◆ open_demux_avformat_plugin()

static demux_plugin_t * open_demux_avformat_plugin | ( | demux_class_t * | class_gen,
|  | xine_stream_t * | stream,
|  | input_plugin_t * | input )
| static

References demux_avformat_dispose(), demux_avformat_get_capabilities(), demux_avformat_get_optional_data(), demux_avformat_get_status(), demux_avformat_get_stream_length(), demux_avformat_seek(), demux_avformat_send_chunk(), demux_avformat_send_headers(), DEMUX_FINISHED, find_avformat_streams(), get_format_context(), init_once_routine(), input(), LOG_MODULE, NULL, xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by init_avformat_demux_plugin().

## ◆ pb_input_read_packet()

static int pb_input_read_packet | ( | void * | opaque,
|  | uint8_t * | buf,
|  | int | buf_size )
| static

References input(), and input_plugin_s::read.

Referenced by get_io_context().

## ◆ pb_input_seek()

static int64_t pb_input_seek | ( | void * | opaque,
|  | int64_t | offset,
|  | int | whence )
| static

References input_plugin_s::get_length, and input().

Referenced by get_io_context().

## ◆ send_avpacket()

static int send_avpacket | ( | avformat_demux_plugin_t * | this | ) |
| static

References _x_demux_send_data(), check_newpts(), LOG_MODULE, NULL, fifo_buffer_s::size, XINE_VERBOSITY_LOG, and xprintf.

Referenced by demux_avformat_send_chunk().

## ◆ send_headers_audio()

static void send_headers_audio | ( | avformat_demux_plugin_t * | this | ) |
| static

References _x_stream_info_set(), BUF_FLAG_FRAME_END, BUF_FLAG_HEADER, BUF_FLAG_STDHEADER, xine_waveformatex::cbSize, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, LOG_MODULE, buf_element_s::max_size, xine_waveformatex::nAvgBytesPerSec, xine_waveformatex::nBlockAlign, buf_element_s::size, buf_element_s::type, XINE_STREAM_INFO_AUDIO_FOURCC, XINE_VERBOSITY_LOG, and xprintf.

Referenced by demux_avformat_send_headers().

## ◆ send_headers_video()

static void send_headers_video | ( | avformat_demux_plugin_t * | this | ) |
| static

References _x_stream_info_set(), xine_bmiheader::biBitCount, xine_bmiheader::biHeight, xine_bmiheader::biSize, xine_bmiheader::biWidth, BUF_FLAG_FRAME_END, BUF_FLAG_HEADER, BUF_FLAG_STDHEADER, buf_element_s::content, buf_element_s::decoder_flags, LOG_MODULE, buf_element_s::max_size, buf_element_s::size, buf_element_s::type, XINE_STREAM_INFO_VIDEO_FOURCC, XINE_VERBOSITY_LOG, and xprintf.

Referenced by demux_avformat_send_headers().

## ◆ video_codec_lookup()

static uint32_t video_codec_lookup | ( | avformat_demux_plugin_t * | this,
|  | unsigned | id )
| static

References ff_video_lookup, ff_video_lookup_entries, LOG_MODULE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by find_avformat_streams().