#include <stdint.h>
#include <sndio.h>
-#include "libavformat/avformat.h"
+#include "libavutil/internal.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
+
+#include "libavformat/avformat.h"
+#include "libavformat/internal.h"
-#include "sndio_common.h"
+#include "libavdevice/sndio.h"
-static av_cold int audio_read_header(AVFormatContext *s1,
- AVFormatParameters *ap)
+static av_cold int audio_read_header(AVFormatContext *s1)
{
SndioData *s = s1->priv_data;
AVStream *st;
int ret;
-#if FF_API_FORMAT_PARAMETERS
- if (ap->sample_rate > 0)
- s->sample_rate = ap->sample_rate;
- if (ap->channels > 0)
- s->channels = ap->channels;
-#endif
-
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st)
return AVERROR(ENOMEM);
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 */
return 0;
}
}
static const AVOption options[] = {
- { "sample_rate", "", offsetof(SndioData, sample_rate), FF_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
- { "channels", "", offsetof(SndioData, channels), FF_OPT_TYPE_INT, {.dbl = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "sample_rate", "", offsetof(SndioData, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "channels", "", offsetof(SndioData, channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};