[mpp_buffer]: add mpp_buffer_get_size interface

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@849 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2016-05-31 07:44:01 +00:00
parent 23067f3253
commit cb1f526351
2 changed files with 14 additions and 2 deletions

View File

@@ -211,6 +211,7 @@ MPP_RET mpp_buffer_read(MppBuffer buffer, size_t offset, void *data, size_t size
MPP_RET mpp_buffer_write(MppBuffer buffer, size_t offset, void *data, size_t size); MPP_RET mpp_buffer_write(MppBuffer buffer, size_t offset, void *data, size_t size);
void *mpp_buffer_get_ptr(MppBuffer buffer); void *mpp_buffer_get_ptr(MppBuffer buffer);
int mpp_buffer_get_fd(MppBuffer buffer); int mpp_buffer_get_fd(MppBuffer buffer);
size_t mpp_buffer_get_size(MppBuffer buffer);
MPP_RET mpp_buffer_group_get(const char *tag, const char *caller, MppBufferMode mode, MppBufferGroup *group, MppBufferType type); MPP_RET mpp_buffer_group_get(const char *tag, const char *caller, MppBufferMode mode, MppBufferGroup *group, MppBufferType type);
MPP_RET mpp_buffer_group_put(MppBufferGroup group); MPP_RET mpp_buffer_group_put(MppBufferGroup group);

View File

@@ -132,7 +132,7 @@ MPP_RET mpp_buffer_write(MppBuffer buffer, size_t offset, void *data, size_t siz
void *mpp_buffer_get_ptr(MppBuffer buffer) void *mpp_buffer_get_ptr(MppBuffer buffer)
{ {
if (NULL == buffer) { if (NULL == buffer) {
mpp_err_f("invalid input: buffer %p\n", buffer); mpp_err_f("invalid NULL input\n");
return NULL; return NULL;
} }
@@ -145,7 +145,7 @@ void *mpp_buffer_get_ptr(MppBuffer buffer)
int mpp_buffer_get_fd(MppBuffer buffer) int mpp_buffer_get_fd(MppBuffer buffer)
{ {
if (NULL == buffer) { if (NULL == buffer) {
mpp_err_f("invalid input: buffer %p\n", buffer); mpp_err_f("invalid NULL input\n");
return -1; return -1;
} }
@@ -159,6 +159,17 @@ int mpp_buffer_get_fd(MppBuffer buffer)
return fd; return fd;
} }
size_t mpp_buffer_get_size(MppBuffer buffer)
{
if (NULL == buffer) {
mpp_err_f("invalid NULL input\n");
return -1;
}
MppBufferImpl *p = (MppBufferImpl*)buffer;
return p->info.size;
}
MPP_RET mpp_buffer_info_get(MppBuffer buffer, MppBufferInfo *info) MPP_RET mpp_buffer_info_get(MppBuffer buffer, MppBufferInfo *info)
{ {
if (NULL == buffer || NULL == info) { if (NULL == buffer || NULL == info) {