summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog2
-rw-r--r--MAINTAINERS1
-rw-r--r--doc/general_contents.texi1
-rw-r--r--libavformat/Makefile2
-rw-r--r--libavformat/allformats.c2
-rw-r--r--libavformat/dfpwmdec.c82
-rw-r--r--libavformat/rawenc.c13
-rw-r--r--libavformat/version.h4
8 files changed, 104 insertions, 3 deletions
diff --git a/Changelog b/Changelog
index f3249fe594..ac614f8f05 100644
--- a/Changelog
+++ b/Changelog
@@ -5,7 +5,7 @@ version 5.1:
- dialogue enhance audio filter
- dropped obsolete XvMC hwaccel
- pcm-bluray encoder
-- DFPWM audio encoder/decoder
+- DFPWM audio encoder/decoder and raw muxer/demuxer
version 5.0:
diff --git a/MAINTAINERS b/MAINTAINERS
index 57b6f33d16..931cf4bd2c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -416,6 +416,7 @@ Muxers/Demuxers:
dashdec.c Steven Liu
dashenc.c Karthick Jeyapal
daud.c Reimar Doeffinger
+ dfpwmdec.c Jack Bruienne
dss.c Oleksij Rempel
dtsdec.c foo86
dtshddec.c Paul B Mahol
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index 14aeaeda80..fcd9da1b34 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -578,6 +578,7 @@ library:
@item raw aptX @tab X @tab X
@item raw aptX HD @tab X @tab X
@item raw Chinese AVS video @tab X @tab X
+@item raw DFPWM @tab X @tab X
@item raw Dirac @tab X @tab X
@item raw DNxHD @tab X @tab X
@item raw DTS @tab X @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 16d019df4e..322c8e7896 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -166,6 +166,8 @@ OBJS-$(CONFIG_DAUD_MUXER) += daudenc.o
OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
OBJS-$(CONFIG_DERF_DEMUXER) += derf.o pcm.o
OBJS-$(CONFIG_DFA_DEMUXER) += dfa.o
+OBJS-$(CONFIG_DFPWM_DEMUXER) += dfpwmdec.o pcm.o
+OBJS-$(CONFIG_DFPWM_MUXER) += rawenc.o
OBJS-$(CONFIG_DHAV_DEMUXER) += dhav.o
OBJS-$(CONFIG_DIRAC_DEMUXER) += diracdec.o rawdec.o
OBJS-$(CONFIG_DIRAC_MUXER) += rawenc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index d066a7745b..587ad59b3c 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -124,6 +124,8 @@ extern const AVOutputFormat ff_daud_muxer;
extern const AVInputFormat ff_dcstr_demuxer;
extern const AVInputFormat ff_derf_demuxer;
extern const AVInputFormat ff_dfa_demuxer;
+extern const AVInputFormat ff_dfpwm_demuxer;
+extern const AVOutputFormat ff_dfpwm_muxer;
extern const AVInputFormat ff_dhav_demuxer;
extern const AVInputFormat ff_dirac_demuxer;
extern const AVOutputFormat ff_dirac_muxer;
diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c
new file mode 100644
index 0000000000..25fc5cb30d
--- /dev/null
+++ b/libavformat/dfpwmdec.c
@@ -0,0 +1,82 @@
+/*
+ * RAW PCM demuxers
+ * Copyright (c) 2002 Fabrice Bellard
+ * Copyright (c) 2022 Jack Bruienne
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "avformat.h"
+#include "internal.h"
+#include "pcm.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
+#include "libavutil/avassert.h"
+
+typedef struct DFPWMAudioDemuxerContext {
+ AVClass *class;
+ int sample_rate;
+ int channels;
+} DFPWMAudioDemuxerContext;
+
+static int dfpwm_read_header(AVFormatContext *s)
+{
+ DFPWMAudioDemuxerContext *s1 = s->priv_data;
+ AVCodecParameters *par;
+ AVStream *st;
+
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+ par = st->codecpar;
+
+ par->codec_type = AVMEDIA_TYPE_AUDIO;
+ par->codec_id = s->iformat->raw_codec_id;
+ par->sample_rate = s1->sample_rate;
+ par->channels = s1->channels;
+ par->bits_per_coded_sample = 1;
+ par->block_align = 1;
+
+ avpriv_set_pts_info(st, 64, 1, par->sample_rate);
+ return 0;
+}
+
+static const AVOption dfpwm_options[] = {
+ { "sample_rate", "", offsetof(DFPWMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "channels", "", offsetof(DFPWMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { NULL },
+};
+static const AVClass dfpwm_demuxer_class = {
+ .class_name = "dfpwm demuxer",
+ .item_name = av_default_item_name,
+ .option = dfpwm_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+const AVInputFormat ff_dfpwm_demuxer = {
+ .name = "dfpwm",
+ .long_name = NULL_IF_CONFIG_SMALL("raw DFPWM1a"),
+ .priv_data_size = sizeof(DFPWMAudioDemuxerContext),
+ .read_header = dfpwm_read_header,
+ .read_packet = ff_pcm_read_packet,
+ .read_seek = ff_pcm_read_seek,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "dfpwm",
+ .raw_codec_id = AV_CODEC_ID_DFPWM,
+ .priv_class = &dfpwm_demuxer_class,
+};
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 4bbae7717b..f8c267c4c9 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -192,6 +192,19 @@ const AVOutputFormat ff_data_muxer = {
};
#endif
+#if CONFIG_DFPWM_MUXER
+const AVOutputFormat ff_dfpwm_muxer = {
+ .name = "dfpwm",
+ .long_name = NULL_IF_CONFIG_SMALL("raw DFPWM1a"),
+ .extensions = "dfpwm",
+ .audio_codec = AV_CODEC_ID_DFPWM,
+ .video_codec = AV_CODEC_ID_NONE,
+ .init = force_one_stream,
+ .write_packet = ff_raw_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
#if CONFIG_DIRAC_MUXER
const AVOutputFormat ff_dirac_muxer = {
.name = "dirac",
diff --git a/libavformat/version.h b/libavformat/version.h
index 05688e33ad..0f89af47e6 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,8 +32,8 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 59
-#define LIBAVFORMAT_VERSION_MINOR 17
-#define LIBAVFORMAT_VERSION_MICRO 103
+#define LIBAVFORMAT_VERSION_MINOR 18
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \