mirror of
https://github.com/nyanmisaka/mpp.git
synced 2026-01-24 01:31:37 +01:00
feat[kmpp_frame]: Add self_meta in kmpp_frame
Change-Id: Ieddb482e06c5230e04d6b05dec5bf48c307c411e Signed-off-by: Yanjun Liao <yanjun.liao@rock-chips.com>
This commit is contained in:
parent
f47eae175c
commit
40d1857674
3 changed files with 47 additions and 1 deletions
|
|
@ -28,7 +28,6 @@
|
|||
ENTRY(prefix, u32, rk_u32, fmt, FLAG_NONE, fmt) \
|
||||
ENTRY(prefix, u32, rk_u32, buf_size, FLAG_NONE, buf_size) \
|
||||
ENTRY(prefix, u32, rk_u32, is_gray, FLAG_NONE, is_gray) \
|
||||
STRCT(prefix, shm, KmppShmPtr, meta, FLAG_NONE, meta) \
|
||||
STRCT(prefix, shm, KmppShmPtr, buffer, FLAG_NONE, buffer) \
|
||||
STRCT(prefix, st, MppFrameRational, sar, FLAG_NONE, sar)
|
||||
|
||||
|
|
@ -41,6 +40,8 @@ extern "C" {
|
|||
#define KMPP_OBJ_ENTRY_TABLE KMPP_FRAME_ENTRY_TABLE
|
||||
#include "kmpp_obj_func.h"
|
||||
|
||||
rk_s32 kmpp_frame_get_meta(KmppFrame frame, KmppMeta *meta);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ typedef struct KmppFrameImpl_t {
|
|||
rk_u32 is_gray;
|
||||
|
||||
KmppShmPtr meta;
|
||||
KmppMeta self_meta;
|
||||
} KmppFrameImpl;
|
||||
|
||||
#endif /* __KMPP_FRAME_IMPL_H__ */
|
||||
|
|
|
|||
|
|
@ -6,10 +6,54 @@
|
|||
#define MODULE_TAG "kmpp_frame"
|
||||
|
||||
#include "kmpp_frame_impl.h"
|
||||
#include "kmpp_obj_impl.h"
|
||||
|
||||
static rk_s32 kmpp_frame_impl_deinit(void *entry, KmppObj obj, const char *caller)
|
||||
{
|
||||
KmppFrameImpl *impl = (KmppFrameImpl *)entry;
|
||||
|
||||
if (impl->self_meta) {
|
||||
kmpp_obj_put_impl(impl->self_meta, caller);
|
||||
impl->self_meta = NULL;
|
||||
} else {
|
||||
mpp_logw_f("self_meta is NULL, obj %p at %s\n", obj, caller);
|
||||
}
|
||||
|
||||
return rk_ok;
|
||||
}
|
||||
|
||||
rk_s32 kmpp_frame_get_meta(KmppFrame frame, KmppMeta *meta)
|
||||
{
|
||||
KmppFrameImpl *impl = (KmppFrameImpl *)kmpp_obj_to_entry(frame);
|
||||
KmppShmPtr sptr;
|
||||
rk_s32 ret;
|
||||
|
||||
if (!impl || !meta) {
|
||||
mpp_loge_f("invalid impl %p or meta %p\n", impl, meta);
|
||||
return rk_nok;
|
||||
}
|
||||
|
||||
if (impl->self_meta) {
|
||||
*meta = impl->self_meta;
|
||||
return rk_ok;
|
||||
}
|
||||
|
||||
kmpp_obj_get_shm(frame, "meta", &sptr);
|
||||
ret = kmpp_obj_get_by_sptr_f(&impl->self_meta, &sptr);
|
||||
if (ret) {
|
||||
*meta = NULL;
|
||||
mpp_loge_f("self_meta get obj by sptr failed, ret %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*meta = impl->self_meta;
|
||||
return rk_ok;
|
||||
}
|
||||
|
||||
#define KMPP_OBJ_NAME kmpp_frame
|
||||
#define KMPP_OBJ_INTF_TYPE KmppFrame
|
||||
#define KMPP_OBJ_IMPL_TYPE KmppFrameImpl
|
||||
#define KMPP_OBJ_FUNC_DEINIT kmpp_frame_impl_deinit
|
||||
#define KMPP_OBJ_SGLN_ID MPP_SGLN_KMPP_FRAME
|
||||
#define KMPP_OBJ_ENTRY_TABLE KMPP_FRAME_ENTRY_TABLE
|
||||
#include "kmpp_obj_helper.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue