56 #define LOWEST_AL_FORMAT FFMIN(FFMIN(AL_FORMAT_MONO8,AL_FORMAT_MONO16),FFMIN(AL_FORMAT_STEREO8,AL_FORMAT_STEREO16))
81 static inline int al_get_error(ALCdevice *device,
const char** error_msg_ret)
83 ALCenum error = alcGetError(device);
85 *error_msg_ret = (
const char*) alcGetString(device, error);
89 case ALC_INVALID_DEVICE:
92 case ALC_INVALID_CONTEXT:
93 case ALC_INVALID_ENUM:
94 case ALC_INVALID_VALUE:
97 case ALC_OUT_OF_MEMORY:
112 if (!(devices = alcGetString(
NULL, ALC_CAPTURE_DEVICE_SPECIFIER)))
115 av_log(log_ctx,
AV_LOG_INFO,
"List of OpenAL capture devices on this system:\n");
117 for (; *devices !=
'\0'; devices += strlen(devices) + 1)
124 static const ALCenum sample_formats[2][2] = {
125 { AL_FORMAT_MONO8, AL_FORMAT_STEREO8 },
126 { AL_FORMAT_MONO16, AL_FORMAT_STEREO16 }
129 const char *error_msg;
170 alcCaptureStart(ad->
device);
177 alcCaptureCloseDevice(ad->
device);
187 const char *error_msg;
192 alcGetIntegerv(ad->
device, ALC_CAPTURE_SAMPLES, (ALCsizei)
sizeof(ALCint), &nb_samples);
207 alcCaptureSamples(ad->
device, pkt->
data, nb_samples);
225 alcCaptureStop(ad->
device);
226 alcCaptureCloseDevice(ad->
device);
231 #define OFFSET(x) offsetof(al_data, x)
254 .priv_data_size =
sizeof(
al_data),
#define LIBAVUTIL_VERSION_INT
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
static const al_format_info * get_al_format_info(ALCenum al_fmt)
Get information about an AL_FORMAT value.
static void print_al_capture_devices(void *log_ctx)
Print out a list of OpenAL capture devices on this system.
int av_usleep(unsigned usec)
Sleep for a period of time.
This struct describes the properties of an encoded stream.
ALCdevice * device
OpenAL capture device context.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int sample_rate
The sample rate (in Hz) of the captured audio.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int flags
Flags modifying the (de)muxer behaviour.
Main libavdevice API header.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
ALCenum sample_format
The OpenAL sample format of the captured audio.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int read_header(AVFormatContext *ctx)
enum AVMediaType codec_type
General type of the encoded data.
char filename[1024]
input or output filename
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
int channels
The number of channels in the captured audio.
int64_t av_gettime(void)
Get the current time in microseconds.
#define AV_LOG_INFO
Standard information.
static const AVOption options[]
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Describe the class of an AVClass context structure.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
ALCint sample_step
The number of bytes between two consecutive samples of the same channel/component.
int sample_size
The sample size (in bits) of the captured audio.
int sample_rate
Audio only.
AVInputFormat ff_openal_demuxer
static int al_get_error(ALCdevice *device, const char **error_msg_ret)
Get the OpenAL error code, translated into an av/errno error code.
int list_devices
If true, print a list of capture devices on this system and exit.
void * priv_data
Format private data.
AVCodecParameters * codecpar
static int read_close(AVFormatContext *ctx)
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...