AVFrame: add side data.

This commit is contained in:
Anton Khirnov
2012-12-25 22:11:36 +01:00
parent 7ecc2d403c
commit 77b2cd7b41
2 changed files with 110 additions and 0 deletions

View File

@@ -26,9 +26,23 @@
#include "avutil.h"
#include "buffer.h"
#include "dict.h"
#include "rational.h"
#include "samplefmt.h"
enum AVFrameSideDataType {
/**
* The data is the AVPanScan struct defined in libavcodec.
*/
AV_FRAME_DATA_PANSCAN,
};
typedef struct AVFrameSideData {
enum AVFrameSideDataType type;
uint8_t *data;
int size;
AVDictionary *metadata;
} AVFrameSideData;
/**
* This structure describes decoded (raw) audio or video data.
@@ -306,6 +320,9 @@ typedef struct AVFrame {
* Number of elements in extended_buf.
*/
int nb_extended_buf;
AVFrameSideData **side_data;
int nb_side_data;
} AVFrame;
/**
@@ -413,6 +430,7 @@ int av_frame_make_writable(AVFrame *frame);
* Metadata for the purpose of this function are those fields that do not affect
* the data layout in the buffers. E.g. pts, sample rate (for audio) or sample
* aspect ratio (for video), but not width/height or channel layout.
* Side data is also copied.
*/
int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
@@ -426,4 +444,24 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
*/
AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
/**
* Add a new side data to a frame.
*
* @param frame a frame to which the side data should be added
* @param type type of the added side data
* @param size size of the side data
*
* @return newly added side data on success, NULL on error
*/
AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
enum AVFrameSideDataType type,
int size);
/**
* @return a pointer to the side data of a given type on success, NULL if there
* is no side data with such type in this frame.
*/
AVFrameSideData *av_frame_get_side_data(AVFrame *frame,
enum AVFrameSideDataType type);
#endif /* AVUTIL_FRAME_H */