[FFmpeg-devel] [RFC 2/3] daala_parser: add a Daala parser
Rostislav Pehlivanov
atomnuker at gmail.com
Mon Dec 28 17:58:49 CET 2015
Not much to say about this other than "it works".
Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
---
configure | 1 +
libavcodec/Makefile | 1 +
libavcodec/allcodecs.c | 1 +
libavcodec/daala_parser.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 53 insertions(+)
create mode 100644 libavcodec/daala_parser.c
diff --git a/configure b/configure
index a510e8f..e84da27 100755
--- a/configure
+++ b/configure
@@ -2275,6 +2275,7 @@ comfortnoise_encoder_select="lpc"
cook_decoder_select="audiodsp mdct sinewin"
cscd_decoder_select="lzo"
cscd_decoder_suggest="zlib"
+daala_decoder_select="daala_parser"
dca_decoder_select="fmtconvert mdct"
dds_decoder_select="texturedsp"
dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 85d2e00..b642d2f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -864,6 +864,7 @@ OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca.o
+OBJS-$(CONFIG_DAALA_PARSER) += daala_parser.o
OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o
OBJS-$(CONFIG_DPX_PARSER) += dpx_parser.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 43d99b3..804c076 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -619,6 +619,7 @@ void avcodec_register_all(void)
REGISTER_PARSER(CAVSVIDEO, cavsvideo);
REGISTER_PARSER(COOK, cook);
REGISTER_PARSER(DCA, dca);
+ REGISTER_PARSER(DAALA, daala);
REGISTER_PARSER(DIRAC, dirac);
REGISTER_PARSER(DNXHD, dnxhd);
REGISTER_PARSER(DPX, dpx);
diff --git a/libavcodec/daala_parser.c b/libavcodec/daala_parser.c
new file mode 100644
index 0000000..5e49061
--- /dev/null
+++ b/libavcodec/daala_parser.c
@@ -0,0 +1,50 @@
+/*
+ * Daala video decoder
+ *
+ * Copyright (C) 2015 Rostislav Pehlivanov <atomnuker at gmail.com>
+ *
+ * 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 "parser.h"
+#include "daala_entropy.h"
+
+static int parse(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size)
+{
+ DaalaEntropy e;
+ DaalaBitstreamHeader h;
+
+ daalaent_decode_init(&e, buf, buf_size);
+ daalaent_decode_frame_header(&e, &h, 0);
+
+ s->key_frame = h.key_frame;
+ s->pict_type = h.key_frame ? AV_PICTURE_TYPE_I : !h.bipred ?
+ AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B;
+
+ *poutbuf = buf;
+ *poutbuf_size = buf_size;
+
+ return buf_size;
+}
+
+AVCodecParser ff_daala_parser = {
+ .codec_ids = { AV_CODEC_ID_DAALA },
+ .parser_parse = parse,
+};
--
2.6.4
More information about the ffmpeg-devel
mailing list