48#include <libavcodec/avcodec.h>
49#include <libavformat/avformat.h>
50#include <libavutil/channel_layout.h>
51#include <libavutil/opt.h>
52#include <libavutil/timestamp.h>
53#include <libswresample/swresample.h>
105int ff_open_file(JNIEnv *, AVFormatContext **, AVStream **, AVCodecContext **,
106 int *,
const char *,
int);
void ff_audioio_free(FFAudioIO *aio)
Free all resources held by aio and then itself.
int ff_big_endian(enum AVCodecID codec_id)
Indicates whether the given id belongs to a big endian codec.
void logWarning(FFAudioIO *aio, int err, const char *message)
Log a warning.
void throwFileNotFoundExceptionIfError(JNIEnv *env, int err, const char *message)
Throws a FileNotFoundException.
int ff_open_file(JNIEnv *env, AVFormatContext **format_context, AVStream **openedStream, AVCodecContext **context, int *stream_index, const char *url, int io_buffer_size)
Opens the input file/url, allocates a AVFormatContext for it and opens the audio stream with an appro...
int ff_open_format_context(JNIEnv *env, AVFormatContext **format_context, const char *url, int io_buffer_size)
Opens the input file/url and allocates a AVFormatContext for it, but does not open the audio stream w...
AVCodec * ff_find_encoder(enum AVSampleFormat sampleFormat, int bits, int big_endian, int signedSamples)
Finds an AVCodec encoder for the given sample format, bits per sample, byte order and signed/unsigned...
int ff_fill_buffer(FFAudioIO *aio)
Reads frames via av_read_frame, decodes them, and writes the result to the Java-side nativeBuffer.
void throwUnsupportedAudioFileExceptionIfError(JNIEnv *env, int err, const char *message)
Throws an UnsupportedAudioFileException.
int ff_init_audioio(JNIEnv *env, FFAudioIO *aio)
Initialize our main context FFAudioIO, so that SwrContext, decode buffers and the encoder are set to ...
int ff_init_encoder(JNIEnv *env, FFAudioIO *aio, AVCodec *encoder)
Allocates and initializes the encoder context and frame in FFAudioIO.
void throwIOExceptionIfError(JNIEnv *env, int err, const char *message)
Throws an IOException.
const uint32_t CODEC_TAG_DRMS
int ff_open_stream(JNIEnv *env, AVStream *stream, AVCodecContext **context)
Opens the given stream, i.e.
void throwIndexOutOfBoundsExceptionIfError(JNIEnv *env, int err, int index)
Throws an IndexOutOfBoundsException.
void logFine(FFAudioIO *aio, int err, const char *message)
Log a debug message.
Central context representing the native peer to the Java FFNativePeerInputStream object.
uint64_t timestamp
Current timestamp (in samples, not seconds).
AVFormatContext * format_context
Current AVFormatContext.
int stream_index
Index of the audio stream we are using.
AVStream * stream
Audio stream we are interested in.
JNIEnv * env
JNI environment.
AVPacket * encode_packet
AVPacket for encoding.
uint64_t decoded_samples
Running count of decoded samples.
AVFrame * decode_frame
AVFrame for decoding.
AVFrame * encode_frame
AVFrame for encoding.
AVPacket * decode_packet
AVPacket for decoding.
jint java_buffer_capacity
Current capacity of the Java nativeBuffer.
AVCodecContext * decode_context
Codec context for decoding.
uint8_t ** audio_data
Audio data (accommodates multiple planes).
SwrContext * swr_context
Resampling context.
jobject java_instance
Calling Java instance.
uint64_t resampled_samples
Count of resampled samples.
AVCodecContext * encode_context
Codec context for encoding.