42#define FIFO_PACKETS_NUM 16
68 jack_nframes_t latency, cycle_delay;
77 cycle_delay = jack_frames_since_cycle_start(self->
client);
94 pkt_data = (
float *)
pkt.data;
99 jack_latency_range_t
range;
100 jack_port_get_latency_range(self->
ports[
i], JackCaptureLatency, &
range);
101 latency +=
range.max;
152 jack_status_t status;
156 self->
client = jack_client_open(context->
url, JackNullOption, &status);
173 snprintf(str,
sizeof(str),
"input_%d",
i + 1);
175 JACK_DEFAULT_AUDIO_TYPE,
180 jack_client_close(self->
client);
193 jack_client_close(self->
client);
202 jack_client_close(self->
client);
206 jack_client_close(self->
client);
227 jack_deactivate(self->
client);
228 jack_client_close(self->
client);
268 struct timespec timeout = {0, 0};
276 if (!jack_activate(self->
client)) {
279 "JACK client registered and activated (rate=%dHz, buffer_size=%d frames)\n",
290 if (errno == ETIMEDOUT) {
292 "Input error: timed out when waiting for JACK process callback output\n");
330#define OFFSET(x) offsetof(JackData, x)
337 .class_name =
"JACK indev",
const FFInputFormat ff_jack_demuxer
static av_cold int audio_read_header(AVFormatContext *s1)
static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
Main libavdevice API header.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define i(width, name, range_min, range_max)
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
size_t av_fifo_can_write(const AVFifo *f)
size_t av_fifo_can_read(const AVFifo *f)
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
#define FIFO_PACKETS_NUM
Size of the internal FIFO buffers as a number of audio packets.
static int audio_read_close(AVFormatContext *context)
static void free_pkt_fifo(AVFifo **fifop)
static int audio_read_header(AVFormatContext *context)
static int start_jack(AVFormatContext *context)
static const AVClass jack_indev_class
static void stop_jack(JackData *self)
static int process_callback(jack_nframes_t nframes, void *arg)
static int audio_read_packet(AVFormatContext *context, AVPacket *pkt)
static int xrun_callback(void *arg)
static void shutdown_callback(void *arg)
static int supply_new_packets(JackData *self, AVFormatContext *context)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
Memory handling functions.
#define sem_timedwait(psem, val)
#define sem_destroy(psem)
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
AVChannelLayout ch_layout
The channel layout and number of channels.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
char * url
input or output URL.
void * priv_data
Format private data.
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
jack_nframes_t buffer_size
jack_nframes_t sample_rate
Opaque type representing a time filter state.
#define av_malloc_array(a, b)
int64_t av_gettime(void)
Get the current time in microseconds.
double ff_timefilter_update(TimeFilter *self, double system_time, double period)
Update the filter.
void ff_timefilter_destroy(TimeFilter *self)
Free all resources associated with the filter.
void ff_timefilter_reset(TimeFilter *self)
Reset the filter.
TimeFilter * ff_timefilter_new(double time_base, double period, double bandwidth)
Create a new Delay Locked Loop time filter.