mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-09 02:50:06 +08:00
[mpp_packet]: Fix reset function
1. Reset function will not reset buffer pointer and buffer size. 2. Make mpp_packet_reset into a C function. Change-Id: I1d9041e9732f249ef4a7753a4aac5c0795c34b17 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -51,6 +51,9 @@ typedef struct MppPacketImpl_t {
|
||||
MppMeta meta;
|
||||
} MppPacketImpl;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* mpp_packet_reset is only used internelly and should NOT be used outside
|
||||
*/
|
||||
@@ -59,4 +62,8 @@ MPP_RET mpp_packet_reset(MppPacketImpl *packet);
|
||||
/* pointer check function */
|
||||
MPP_RET check_is_mpp_packet(void *ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__MPP_PACKET_IMPL_H__*/
|
||||
|
@@ -255,7 +255,14 @@ MPP_RET mpp_packet_reset(MppPacketImpl *packet)
|
||||
if (check_is_mpp_packet(packet))
|
||||
return MPP_ERR_UNKNOW;
|
||||
|
||||
void *data = packet->data;
|
||||
size_t size = packet->size;
|
||||
|
||||
memset(packet, 0, sizeof(*packet));
|
||||
|
||||
packet->data = data;
|
||||
packet->pos = data;
|
||||
packet->size = size;
|
||||
setup_mpp_packet_name(packet);
|
||||
return MPP_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user