History

lavu: add AV_FRAME_DATA_DOWNMIX_INFO side data type.

Tim Walker committed 12 years ago

Commit c98f3161 parent 9c0e4b36 files · +164 −1Browse files

Unified · Split

6 files
  1. doc/APIchanges +4 −0
  2. libavutil/Makefile +2 −0
  3. libavutil/downmix_info.c +38 −0
  4. libavutil/downmix_info.h +114 −0
  5. libavutil/frame.h +5 −0
  6. libavutil/version.h +1 −1
doc/APIchanges+4−0
@@ -13,6 +13,10 @@ libavutil: 2013-12-xx · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2014-02-xx - xxxxxxx - lavu 53.3.0 - frame.h
17+ Add AV_FRAME_DATA_DOWNMIX_INFO value to the AVFrameSideDataType enum and
18+ downmix_info.h API, which identify downmix-related metadata.
19+
1620 2014-02-04 - d9ae103 - lavf 55.11.0 - avformat.h
1721 Add AVFormatContext.max_interleave_delta for controlling amount of buffering
1822 when interleaving.
libavutil/Makefile+2−0
@@ -16,6 +16,7 @@ HEADERS = adler32.h \ · 15 unmodified lines
1616 common.h \
1717 cpu.h \
1818 crc.h \
19+ downmix_info.h \
1920 error.h \
2021 eval.h \
2122 fifo.h \
@@ -67,6 +68,7 @@ OBJS = adler32.o \ · 45 unmodified lines
6768 cpu.o \
6869 crc.o \
6970 des.o \
71+ downmix_info.o \
7072 error.o \
7173 eval.o \
7274 fifo.o \
libavutil/downmix_info.c+38−0
@@ -0,0 +1,38 @@
1+/*
2+ * Copyright (c) 2014 Tim Walker <tdskywalker@gmail.com>
3+ *
4+ * This file is part of Libav.
5+ *
6+ * Libav is free software; you can redistribute it and/or
7+ * modify it under the terms of the GNU Lesser General Public
8+ * License as published by the Free Software Foundation; either
9+ * version 2.1 of the License, or (at your option) any later version.
10+ *
11+ * Libav is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+ * Lesser General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU Lesser General Public
17+ * License along with Libav; if not, write to the Free Software
18+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+ */
20+
21+#include "downmix_info.h"
22+#include "frame.h"
23+
24+AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame)
25+{
26+ AVFrameSideData *side_data;
27+
28+ side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_DOWNMIX_INFO);
29+
30+ if (!side_data)
31+ side_data = av_frame_new_side_data(frame, AV_FRAME_DATA_DOWNMIX_INFO,
32+ sizeof(AVDownmixInfo));
33+
34+ if (!side_data)
35+ return NULL;
36+
37+ return (AVDownmixInfo*)side_data->data;
38+}
libavutil/downmix_info.h+114−0
@@ -0,0 +1,114 @@
1+/*
2+ * Copyright (c) 2014 Tim Walker <tdskywalker@gmail.com>
3+ *
4+ * This file is part of Libav.
5+ *
6+ * Libav is free software; you can redistribute it and/or
7+ * modify it under the terms of the GNU Lesser General Public
8+ * License as published by the Free Software Foundation; either
9+ * version 2.1 of the License, or (at your option) any later version.
10+ *
11+ * Libav is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+ * Lesser General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU Lesser General Public
17+ * License along with Libav; if not, write to the Free Software
18+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+ */
20+
21+#ifndef AVUTIL_DOWNMIX_INFO_H
22+#define AVUTIL_DOWNMIX_INFO_H
23+
24+#include "frame.h"
25+
26+/**
27+ * @file
28+ * audio downmix medatata
29+ */
30+
31+/**
32+ * @addtogroup lavu_audio
33+ * @{
34+ */
35+
36+/**
37+ * @defgroup downmix_info Audio downmix metadata
38+ * @{
39+ */
40+
41+/**
42+ * Possible downmix types.
43+ */
44+enum AVDownmixType {
45+ AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */
46+ AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */
47+ AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */
48+ AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */
49+ AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */
50+};
51+
52+/**
53+ * This structure describes optional metadata relevant to a downmix procedure.
54+ *
55+ * All fields are set by the decoder to the value indicated in the audio
56+ * bitstream (if present), or to a "sane" default otherwise.
57+ */
58+typedef struct AVDownmixInfo {
59+ /**
60+ * Type of downmix preferred by the mastering engineer.
61+ */
62+ enum AVDownmixType preferred_downmix_type;
63+
64+ /**
65+ * Absolute scale factor representing the nominal level of the center
66+ * channel during a regular downmix.
67+ */
68+ double center_mix_level;
69+
70+ /**
71+ * Absolute scale factor representing the nominal level of the center
72+ * channel during an Lt/Rt compatible downmix.
73+ */
74+ double center_mix_level_ltrt;
75+
76+ /**
77+ * Absolute scale factor representing the nominal level of the surround
78+ * channels during a regular downmix.
79+ */
80+ double surround_mix_level;
81+
82+ /**
83+ * Absolute scale factor representing the nominal level of the surround
84+ * channels during an Lt/Rt compatible downmix.
85+ */
86+ double surround_mix_level_ltrt;
87+
88+ /**
89+ * Absolute scale factor representing the level at which the LFE data is
90+ * mixed into L/R channels during downmixing.
91+ */
92+ double lfe_mix_level;
93+} AVDownmixInfo;
94+
95+/**
96+ * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing.
97+ *
98+ * The side data is created and added to the frame if it's absent.
99+ *
100+ * @param frame the frame for which the side data is to be obtained.
101+ *
102+ * @return the AVDownmixInfo structure to be edited by the caller.
103+ */
104+AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame);
105+
106+/**
107+ * @}
108+ */
109+
110+/**
111+ * @}
112+ */
113+
114+#endif /* AVUTIL_DOWNMIX_INFO_H */
libavutil/frame.h+5−0
@@ -64,6 +64,11 @@ enum AVFrameSideDataType { · 63 unmodified lines
6464 * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
6565 */
6666 AV_FRAME_DATA_MATRIXENCODING,
67+ /**
68+ * Metadata relevant to a downmix procedure.
69+ * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
70+ */
71+ AV_FRAME_DATA_DOWNMIX_INFO,
6772 };
6873
6974 typedef struct AVFrameSideData {
libavutil/version.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 */
5555
5656 #define LIBAVUTIL_VERSION_MAJOR 53
57−#define LIBAVUTIL_VERSION_MINOR 2
57+#define LIBAVUTIL_VERSION_MINOR 3
5858 #define LIBAVUTIL_VERSION_MICRO 0
5959
6060 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t