--- doc/APIchanges | 4 ++++ libavutil/Makefile | 1 + libavutil/frame.h | 5 +++++ libavutil/pixmodel.c | 38 ++++++++++++++++++++++++++++++++++++++ libavutil/pixmodel.h | 17 +++++++++++++++++ libavutil/version.h | 2 +- 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 libavutil/pixmodel.c
diff --git a/doc/APIchanges b/doc/APIchanges index 0fce83f..1d8dbbc 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,10 @@ libavutil: 2013-12-xx API changes, most recent first: +2014-xx-xx - xxxxxxx - lavu 53.08.0 - frame.h + Add AV_FRAME_DATA_COLOR value to the AVFrameSideDataType enum and pixmodel.h + API, that unquely convey colors representation for the frame pixel format. + 2014-xx-xx - xxxxxxx - lavu 53.07.0 - pixmodel.h Move all color-related enums (AVColorPrimaries, AVColorSpace, AVColorRange, and AVChromaLocation) inside lavu, and introduce a new type containing them. diff --git a/libavutil/Makefile b/libavutil/Makefile index be42520..fed1d41 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -91,6 +91,7 @@ OBJS = adler32.o \ opt.o \ parseutils.o \ pixdesc.o \ + pixmodel.o \ random_seed.o \ rational.o \ rc4.o \ diff --git a/libavutil/frame.h b/libavutil/frame.h index 6b168e2..560767d 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -69,6 +69,11 @@ enum AVFrameSideDataType { * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. */ AV_FRAME_DATA_DOWNMIX_INFO, + /** + * Interpretation of the current frame pixel format. + * The data is the AVPixFmtModel struct defined in libavutil/pixmodel.h. + */ + AV_FRAME_DATA_COLOR, }; typedef struct AVFrameSideData { diff --git a/libavutil/pixmodel.c b/libavutil/pixmodel.c new file mode 100644 index 0000000..d9b6c0c --- /dev/null +++ b/libavutil/pixmodel.c @@ -0,0 +1,38 @@ +/* + * This file is part of Libav. + * + * Libav 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. + * + * Libav 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <stdint.h> + +#include "mem.h" +#include "pixmodel.h" + +AVPixFmtModel *av_pixfmtmodel_alloc(void) +{ + return av_mallocz(sizeof(AVPixFmtModel)); +} + +AVPixFmtModel *av_pixfmtmodel_create_side_data(AVFrame *frame) +{ + AVFrameSideData *side_data = av_frame_new_side_data(frame, + AV_FRAME_DATA_COLOR, + sizeof(AVPixFmtModel)); + if (!side_data) + return NULL; + + return (AVPixFmtModel *)side_data->data; +} diff --git a/libavutil/pixmodel.h b/libavutil/pixmodel.h index be9202c..7e1426a 100644 --- a/libavutil/pixmodel.h +++ b/libavutil/pixmodel.h @@ -126,4 +126,21 @@ typedef struct AVPixFmtModel { enum AVChromaLocation chroma_location; } AVPixFmtModel; +/** + * Allocate an AVPixFmtModel structure and set its fields to default values. + * The resulting struct can be freed using av_freep(). + * + * @return An AVPixFmtModel filled with default values or NULL on failure. + */ +AVPixFmtModel *av_pixfmtmodel_alloc(void); + +/** + * Allocate a complete AVFrameSideData and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVPixFmtModel structure to be filled by caller. + */ +AVPixFmtModel *av_pixfmtmodel_create_side_data(AVFrame *frame); + #endif /* AVUTIL_PIXMODEL_H */ diff --git a/libavutil/version.h b/libavutil/version.h index d680979..7f439d7 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -54,7 +54,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 53 -#define LIBAVUTIL_VERSION_MINOR 7 +#define LIBAVUTIL_VERSION_MINOR 8 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 1.8.3.4 (Apple Git-47) _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel