[mpp_frame]: Add MppMeta to MppFrame

MppFrame will NOT create meta data by default. Then user and mpp can
attach or remove flexible parameter without adding or remove
interface which will break binary compatibility.

Change-Id: Ia3c0d15d6daa210deab7a7d5dffcb54303fbb73e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen 2019-06-14 10:47:17 +08:00
parent cd9a1cca3f
commit 0ee116f416
3 changed files with 30 additions and 3 deletions

View file

@ -18,6 +18,7 @@
#define __MPP_FRAME_H__
#include "mpp_buffer.h"
#include "mpp_meta.h"
/*
* bit definition for mode flag in MppFrame
@ -245,6 +246,11 @@ void mpp_frame_set_info_change(MppFrame frame, RK_U32 info_change);
MppBuffer mpp_frame_get_buffer(const MppFrame frame);
void mpp_frame_set_buffer(MppFrame frame, MppBuffer buffer);
/*
* meta data parameter
*/
MppMeta mpp_frame_get_meta(const MppFrame frame);
/*
* color related parameter
*/

View file

@ -87,6 +87,7 @@ struct MppFrameImpl_t {
MppFrameChromaLocation chroma_location;
MppFrameFormat fmt;
/*
* buffer information
* NOTE: buf_size only access internally
@ -94,6 +95,11 @@ struct MppFrameImpl_t {
MppBuffer buffer;
size_t buf_size;
/*
* meta data information
*/
MppMeta meta;
/*
* pointer for multiple frame output at one time
*/

View file

@ -65,9 +65,12 @@ MPP_RET mpp_frame_deinit(MppFrame *frame)
return MPP_ERR_NULL_PTR;
}
MppBuffer buffer = mpp_frame_get_buffer(*frame);
if (buffer)
mpp_buffer_put(buffer);
MppFrameImpl *p = (MppFrameImpl *)*frame;
if (p->buffer)
mpp_buffer_put(p->buffer);
if (p->meta)
mpp_meta_put(p->meta);
mpp_free(*frame);
*frame = NULL;
@ -119,6 +122,18 @@ void mpp_frame_set_buffer(MppFrame frame, MppBuffer buffer)
}
}
MppMeta mpp_frame_get_meta(MppFrame frame)
{
if (check_is_mpp_frame(frame))
return NULL;
MppFrameImpl *p = (MppFrameImpl *)frame;
if (NULL == p->meta)
mpp_meta_get(&p->meta);
return p->meta;
}
MPP_RET mpp_frame_copy(MppFrame dst, MppFrame src)
{
if (NULL == dst || check_is_mpp_frame(src)) {