]> git.sesse.net Git - ffmpeg/blobdiff - libavdevice/jack_audio.c
rtmp: Store all the notify messages
[ffmpeg] / libavdevice / jack_audio.c
index e68559e4d3323c3f3bc68a33bd504e01d8f94fb4..280f24dc480dc9f1030a3441b80b584d899955c9 100644 (file)
@@ -27,6 +27,7 @@
 #include "libavutil/log.h"
 #include "libavutil/fifo.h"
 #include "libavutil/opt.h"
+#include "libavutil/time.h"
 #include "libavcodec/avcodec.h"
 #include "libavformat/avformat.h"
 #include "libavformat/internal.h"
@@ -91,7 +92,13 @@ static int process_callback(jack_nframes_t nframes, void *arg)
 
     /* Copy and interleave audio data from the JACK buffer into the packet */
     for (i = 0; i < self->nports; i++) {
+    #if HAVE_JACK_PORT_GET_LATENCY_RANGE
+        jack_latency_range_t range;
+        jack_port_get_latency_range(self->ports[i], JackCaptureLatency, &range);
+        latency += range.max;
+    #else
         latency += jack_port_get_total_latency(self->client, self->ports[i]);
+    #endif
         buffer = jack_port_get_buffer(self->ports[i], self->buffer_size);
         for (j = 0; j < self->buffer_size; j++)
             pkt_data[j * self->nports + i] = buffer[j];
@@ -221,7 +228,7 @@ static void stop_jack(JackData *self)
     ff_timefilter_destroy(self->timefilter);
 }
 
-static int audio_read_header(AVFormatContext *context, AVFormatParameters *params)
+static int audio_read_header(AVFormatContext *context)
 {
     JackData *self = context->priv_data;
     AVStream *stream;
@@ -238,9 +245,9 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param
 
     stream->codec->codec_type   = AVMEDIA_TYPE_AUDIO;
 #if HAVE_BIGENDIAN
-    stream->codec->codec_id     = CODEC_ID_PCM_F32BE;
+    stream->codec->codec_id     = AV_CODEC_ID_PCM_F32BE;
 #else
-    stream->codec->codec_id     = CODEC_ID_PCM_F32LE;
+    stream->codec->codec_id     = AV_CODEC_ID_PCM_F32LE;
 #endif
     stream->codec->sample_rate  = self->sample_rate;
     stream->codec->channels     = self->nports;
@@ -315,7 +322,7 @@ static int audio_read_close(AVFormatContext *context)
 
 #define OFFSET(x) offsetof(JackData, x)
 static const AVOption options[] = {
-    { "channels", "Number of audio channels.", OFFSET(nports), AV_OPT_TYPE_INT, { 2 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+    { "channels", "Number of audio channels.", OFFSET(nports), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
     { NULL },
 };