]> git.sesse.net Git - ffmpeg/blobdiff - libavdevice/alsa-audio-dec.c
RELEASE: We're now at 0.9.0.git
[ffmpeg] / libavdevice / alsa-audio-dec.c
index 11c6e92928619348ad360a8ade61c9c013a47009..bb9d233a4e95625bc8c5b1b827cf0b63cb844d60 100644 (file)
@@ -46,6 +46,7 @@
  */
 
 #include <alsa/asoundlib.h>
+#include "libavformat/internal.h"
 #include "libavutil/opt.h"
 #include "libavutil/mathematics.h"
 
@@ -61,7 +62,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
     enum CodecID codec_id;
     double o;
 
-    st = av_new_stream(s1, 0);
+    st = avformat_new_stream(s1, NULL);
     if (!st) {
         av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");
 
@@ -80,7 +81,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
     st->codec->codec_id    = codec_id;
     st->codec->sample_rate = s->sample_rate;
     st->codec->channels    = s->channels;
-    av_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
+    avpriv_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
     o = 2 * M_PI * s->period_size / s->sample_rate * 1.5; // bandwidth: 1.5Hz
     s->timefilter = ff_timefilter_new(1000000.0 / s->sample_rate,
                                       sqrt(2 * o), o * o);
@@ -132,8 +133,8 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
 }
 
 static const AVOption options[] = {
-    { "sample_rate", "", offsetof(AlsaData, sample_rate), FF_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
-    { "channels",    "", offsetof(AlsaData, channels),    FF_OPT_TYPE_INT, {.dbl = 2},     1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+    { "sample_rate", "", offsetof(AlsaData, sample_rate), AV_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+    { "channels",    "", offsetof(AlsaData, channels),    AV_OPT_TYPE_INT, {.dbl = 2},     1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
     { NULL },
 };
 
@@ -145,13 +146,12 @@ static const AVClass alsa_demuxer_class = {
 };
 
 AVInputFormat ff_alsa_demuxer = {
-    "alsa",
-    NULL_IF_CONFIG_SMALL("ALSA audio input"),
-    sizeof(AlsaData),
-    NULL,
-    audio_read_header,
-    audio_read_packet,
-    ff_alsa_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &alsa_demuxer_class,
+    .name           = "alsa",
+    .long_name      = NULL_IF_CONFIG_SMALL("ALSA audio input"),
+    .priv_data_size = sizeof(AlsaData),
+    .read_header    = audio_read_header,
+    .read_packet    = audio_read_packet,
+    .read_close     = ff_alsa_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &alsa_demuxer_class,
 };