diff mbox

[FFmpeg-devel,v7,2/4] libavutil: add ancillary data

Message ID 1527257791-26839-2-git-send-email-patrick.keroulas@savoirfairelinux.com
State New
Headers show

Commit Message

Patrick Keroulas May 25, 2018, 2:16 p.m. UTC
Ancillary data can carry various side data that can't be transmitted in
bitstreams. For now, this struct includes interlaced field flags and
the must be attached to an AVPacket as side data.

Signed-off-by: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
---
 libavutil/Makefile         |  2 ++
 libavutil/ancillary_data.c | 27 +++++++++++++++++++++++
 libavutil/ancillary_data.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++
 libavutil/version.h        |  4 ++--
 4 files changed, 86 insertions(+), 2 deletions(-)
 create mode 100644 libavutil/ancillary_data.c
 create mode 100644 libavutil/ancillary_data.h
diff mbox

Patch

diff --git a/libavutil/Makefile b/libavutil/Makefile
index d0632f1..7349b4f 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -4,6 +4,7 @@  DESC = FFmpeg utility library
 HEADERS = adler32.h                                                     \
           aes.h                                                         \
           aes_ctr.h                                                     \
+          ancillary_data.h                                              \
           attributes.h                                                  \
           audio_fifo.h                                                  \
           avassert.h                                                    \
@@ -92,6 +93,7 @@  BUILT_HEADERS = avconfig.h                                              \
 OBJS = adler32.o                                                        \
        aes.o                                                            \
        aes_ctr.o                                                        \
+       ancillary_data.o                                                 \
        audio_fifo.o                                                     \
        avstring.o                                                       \
        base64.o                                                         \
diff --git a/libavutil/ancillary_data.c b/libavutil/ancillary_data.c
new file mode 100644
index 0000000..26686b8
--- /dev/null
+++ b/libavutil/ancillary_data.c
@@ -0,0 +1,27 @@ 
+/**
+ * Copyright (c) 2018 Patrick Keroulas <patrick.keroulas@savoirfairelinux.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 "ancillary_data.h"
+#include "mem.h"
+
+AVAncillaryData *av_ancillary_data_alloc(void)
+{
+    return av_mallocz(sizeof(AVAncillaryData));
+}
diff --git a/libavutil/ancillary_data.h b/libavutil/ancillary_data.h
new file mode 100644
index 0000000..860bc92
--- /dev/null
+++ b/libavutil/ancillary_data.h
@@ -0,0 +1,55 @@ 
+/**
+ * Copyright (c) 2018 Patrick Keroulas <patrick.keroulas@savoirfairelinux.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
+ */
+
+#ifndef AVUTIL_ANCILLARY_DATA_H
+#define AVUTIL_ANCILLARY_DATA_H
+
+#include <stdint.h>
+
+enum AVAncillaryDataFields {
+    AV_ANCILLARY_DATA_FIELD_TOP_FIELD    = 0x01,
+    AV_ANCILLARY_DATA_FIELD_BOTTOM_FIELD = 0x02,
+};
+
+/**
+ * Ancillary data carries various side data that can't be transmitted in
+ * AV bit streams for codecs like bitpacked or v210.
+ *
+ * To be used as payload of a AVPacketSideData.
+ *
+ */
+typedef struct AVAncillaryData {
+    /**
+     * Flags to determine if the AVPacket holds a top/bottom field in
+     * case of interlaced format.
+     */
+    uint8_t field;
+} AVAncillaryData;
+
+/**
+ * Allocate an AVAncillaryData structure and set its fields to
+ * default values. The resulting struct can be freed using av_freep().
+ *
+ * @return An AVAncillaryData filled with default values or NULL
+ *         on failure.
+ */
+AVAncillaryData *av_ancillary_data_alloc(void);
+
+#endif /* AVUTIL_ANCILLARY_DATA_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 44bdebd..84409b1 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@ 
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  18
-#define LIBAVUTIL_VERSION_MICRO 102
+#define LIBAVUTIL_VERSION_MINOR  19
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \