AVbin
Version 10
Cross-platform audio/video media decoding library with long-term ABI support.
|
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | _AVbinFileInfo |
struct | _AVbinStreamInfo |
struct | _AVbinStreamInfo8 |
struct | _AVbinPacket |
struct | _AVbinInfo |
struct | _AVbinOptions |
Macros | |
#define | AVBIN_H |
Typedefs | |
typedef enum _AVbinResult | AVbinResult |
typedef enum _AVbinStreamType | AVbinStreamType |
typedef enum _AVbinSampleFormat | AVbinSampleFormat |
typedef enum _AVbinLogLevel | AVbinLogLevel |
typedef struct _AVbinFile | AVbinFile |
typedef struct _AVbinStream | AVbinStream |
typedef int64_t | AVbinTimestamp |
typedef struct _AVbinFileInfo | AVbinFileInfo |
typedef struct _AVbinStreamInfo | AVbinStreamInfo |
typedef struct _AVbinStreamInfo8 | AVbinStreamInfo8 |
typedef struct _AVbinPacket | AVbinPacket |
typedef struct _AVbinInfo | AVbinInfo |
typedef struct _AVbinOptions | AVbinOptions |
typedef void(* | AVbinLogCallback )(const char *module, AVbinLogLevel level, const char *message) |
Enumerations | |
enum | _AVbinResult { AVBIN_RESULT_ERROR = -1, AVBIN_RESULT_OK = 0 } |
enum | _AVbinStreamType { AVBIN_STREAM_TYPE_UNKNOWN = 0, AVBIN_STREAM_TYPE_VIDEO = 1, AVBIN_STREAM_TYPE_AUDIO = 2 } |
enum | _AVbinSampleFormat { AVBIN_SAMPLE_FORMAT_U8 = 0, AVBIN_SAMPLE_FORMAT_S16 = 1, AVBIN_SAMPLE_FORMAT_S24 = 2, AVBIN_SAMPLE_FORMAT_S32 = 3, AVBIN_SAMPLE_FORMAT_FLOAT = 4 } |
enum | _AVbinLogLevel { AVBIN_LOG_QUIET = -8, AVBIN_LOG_PANIC = 0, AVBIN_LOG_FATAL = 8, AVBIN_LOG_ERROR = 16, AVBIN_LOG_WARNING = 24, AVBIN_LOG_INFO = 32, AVBIN_LOG_VERBOSE = 40, AVBIN_LOG_DEBUG = 48 } |
Functions | |
Information about AVbin | |
int32_t | avbin_get_version () |
AVbinInfo * | avbin_get_info () |
int32_t | avbin_get_ffmpeg_revision () __attribute__((deprecated)) |
size_t | avbin_get_audio_buffer_size () |
int32_t | avbin_have_feature (const char *feature) |
Global AVbin functions | |
AVbinResult | avbin_init () |
AVbinResult | avbin_init_options (AVbinOptions *options) |
AVbinResult | avbin_set_log_level (AVbinLogLevel level) |
AVbinResult | avbin_set_log_callback (AVbinLogCallback callback) |
File handling functions | |
AVbinFile * | avbin_open_filename (const char *filename) |
AVbinFile * | avbin_open_filename_with_format (const char *filename, char *format) |
void | avbin_close_file (AVbinFile *file) |
AVbinResult | avbin_seek_file (AVbinFile *file, AVbinTimestamp timestamp) |
AVbinResult | avbin_file_info (AVbinFile *file, AVbinFileInfo *info) |
Stream functions | |
AVbinResult | avbin_stream_info (AVbinFile *file, int32_t stream_index, AVbinStreamInfo *info) |
AVbinStream * | avbin_open_stream (AVbinFile *file, int32_t stream_index) |
void | avbin_close_stream (AVbinStream *stream) |
Reading and decoding functions | |
AVbinResult | avbin_read (AVbinFile *file, AVbinPacket *packet) |
int32_t | avbin_decode_audio (AVbinStream *stream, uint8_t *data_in, size_t size_in, uint8_t *data_out, int *size_out) |
int32_t | avbin_decode_video (AVbinStream *stream, uint8_t *data_in, size_t size_in, uint8_t *data_out) |
AVbin functions and structures.
Definition in file avbin.h.
#define AVBIN_H |
typedef struct _AVbinFile AVbinFile |
typedef struct _AVbinFileInfo AVbinFileInfo |
File details. The info struct is filled in by avbin_get_file_info.
typedef struct _AVbinInfo AVbinInfo |
Information about the AVbin library. See avbin_get_info()
typedef void(* AVbinLogCallback)(const char *module, AVbinLogLevel level, const char *message) |
typedef enum _AVbinLogLevel AVbinLogLevel |
Threshold of logging verbosity.
typedef struct _AVbinOptions AVbinOptions |
Initialization Options
typedef struct _AVbinPacket AVbinPacket |
A single packet of stream data.
The structure size must be initialised before passing to avbin_read. The data will point to a block of memory allocated by AVbin – you must not free it. The data will be valid until the next time you call avbin_read, or until the file is closed.
typedef enum _AVbinResult AVbinResult |
Error-checked function result.
typedef enum _AVbinSampleFormat AVbinSampleFormat |
The sample format for audio data.
typedef struct _AVbinStream AVbinStream |
typedef struct _AVbinStreamInfo AVbinStreamInfo |
Stream details.
A stream is a single audio track or video. Most audio files contain one audio stream. Most video files contain one audio stream and one video stream. More than one audio stream may indicate the presence of multiple languages which can be selected (however at this time AVbin does not provide language information).
typedef struct _AVbinStreamInfo8 AVbinStreamInfo8 |
Stream details, version 8.
A stream is a single audio track or video. Most audio files contain one audio stream. Most video files contain one audio stream and one video stream. More than one audio stream may indicate the presence of multiple languages which can be selected (however at this time AVbin does not provide language information).
typedef enum _AVbinStreamType AVbinStreamType |
Type of a stream; currently only video and audio streams are supported.
typedef int64_t AVbinTimestamp |
enum _AVbinLogLevel |
enum _AVbinResult |
enum _AVbinSampleFormat |
enum _AVbinStreamType |
void avbin_close_file | ( | AVbinFile * | file | ) |
void avbin_close_stream | ( | AVbinStream * | stream | ) |
int32_t avbin_decode_audio | ( | AVbinStream * | stream, |
uint8_t * | data_in, | ||
size_t | size_in, | ||
uint8_t * | data_out, | ||
int * | size_out | ||
) |
Decode some audio data.
You must ensure that data_out is at least as big as the minimum audio buffer size (see avbin_get_audio_buffer_size()).
[in] | stream | The stream to decode. |
[in] | data_in | Incoming data, as read from a packet |
[in] | size_in | Size of data_in, in bytes |
[out] | data_out | Decoded audio data buffer, provided by application |
[out] | size_out | Number of bytes of data_out used. |
-1 | if there was an error |
int32_t avbin_decode_video | ( | AVbinStream * | stream, |
uint8_t * | data_in, | ||
size_t | size_in, | ||
uint8_t * | data_out | ||
) |
Decode a video frame image.
The size of data_out must be large enough to hold the entire image. This is width * height * 3 (images are always in 8-bit RGB format).
[in] | stream | The stream to decode. |
[in] | data_in | Incoming data, as read from a packet |
[in] | size_in | Size of data_in, in bytes |
[out] | data_out | Decoded image data. |
-1 | if there was an error |
AVbinResult avbin_file_info | ( | AVbinFile * | file, |
AVbinFileInfo * | info | ||
) |
size_t avbin_get_audio_buffer_size | ( | ) |
int32_t avbin_get_ffmpeg_revision | ( | ) |
AVbinInfo* avbin_get_info | ( | ) |
int32_t avbin_get_version | ( | ) |
int32_t avbin_have_feature | ( | const char * | feature | ) |
Determine if AVbin includes a requested feature.
When future versions of AVbin include more functionality, that functionality can be tested for by calling this function. The following features can be tested for:
1 | The feature is present |
0 | The feature is not present |
AVbinResult avbin_init | ( | ) |
One of the avbin_init* functions must be called before opening a file to initialize AVbin. Check the return value for success before continuing. Initialize AVbin with basic features. Consider instead avbin_init_options()
AVbinResult avbin_init_options | ( | AVbinOptions * | options | ) |
AVbinFile* avbin_open_filename | ( | const char * | filename | ) |
AVbinFile* avbin_open_filename_with_format | ( | const char * | filename, |
char * | format | ||
) |
AVbinStream* avbin_open_stream | ( | AVbinFile * | file, |
int32_t | stream_index | ||
) |
AVbinResult avbin_read | ( | AVbinFile * | file, |
AVbinPacket * | packet | ||
) |
Read a packet from the file.
The packet struct must be allocated by the application and have its structure_size member filled in correctly. On return, the structure will be filled with a packet of data. The actual data pointer within the packet must not be freed, and is valid until the next call to avbin_read.
Applications should examine the packet's stream index to match it with an appropriate open stream handle, or discard it if none match. The packet data can then be passed to the relevant decode function.
AVbinResult avbin_seek_file | ( | AVbinFile * | file, |
AVbinTimestamp | timestamp | ||
) |
AVbinResult avbin_set_log_callback | ( | AVbinLogCallback | callback | ) |
AVbinResult avbin_set_log_level | ( | AVbinLogLevel | level | ) |
AVbinResult avbin_stream_info | ( | AVbinFile * | file, |
int32_t | stream_index, | ||
AVbinStreamInfo * | info | ||
) |
Get information about a stream within the file.
The info struct must be allocated by the application and have its structure_size member filled in correctly. On return, the structure will be filled with stream details.
Ensure that stream_index is less than n_streams given in the file info.
[in] | file | The file to examine |
[in] | stream_index | The number of the stream within the file |
[out] | info | Returned stream information |