archived-mpp/mpp/mpp_frame.cpp
ChenHengming 3612ed5876 [mpp/osal]: add codec thread and hal thread
1. add MppThread / Mutex / Condition class
2. add internal flag to MppBuffer
3. change MppBufferService from structure to class
4. add mpp_buffer_put on mpp_frame_put
5. add coding type to Mpp initial function
6. mpp codec / hal thread basic flow done, but reset is not added

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@168 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-26 12:46:38 +00:00

81 lines
2.3 KiB
C++

/*
* Copyright 2010 Rockchip Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define MODULE_TAG "mpp_frame"
#include "mpp_log.h"
#include "mpp_mem.h"
#include "mpp_frame_impl.h"
MPP_FRAME_ACCESSORS(RK_U32, width)
MPP_FRAME_ACCESSORS(RK_U32, height)
MPP_FRAME_ACCESSORS(RK_U32, hor_stride)
MPP_FRAME_ACCESSORS(RK_U32, ver_stride)
MPP_FRAME_ACCESSORS(RK_U32, mode)
MPP_FRAME_ACCESSORS(RK_S64, pts)
MPP_FRAME_ACCESSORS(RK_S64, dts)
MPP_FRAME_ACCESSORS(MppFrameColorRange, color_range)
MPP_FRAME_ACCESSORS(MppFrameColorPrimaries, color_primaries)
MPP_FRAME_ACCESSORS(MppFrameColorTransferCharacteristic, color_trc)
MPP_FRAME_ACCESSORS(MppFrameColorSpace, colorspace)
MPP_FRAME_ACCESSORS(MppFrameChromaLocation, chroma_location)
MPP_FRAME_ACCESSORS(MppBuffer, buffer)
MPP_RET mpp_frame_init(MppFrame *frame)
{
if (NULL == frame) {
mpp_err("mpp_frame_init invalid NULL pointer input\n");
return MPP_ERR_NULL_PTR;
}
MppFrameImpl *p = mpp_calloc(MppFrameImpl, 1);
if (NULL == p) {
mpp_err("mpp_frame_init malloc failed\n");
return MPP_ERR_NULL_PTR;
}
*frame = p;
return MPP_OK;
}
MPP_RET mpp_frame_deinit(MppFrame *frame)
{
if (NULL == frame || NULL == *frame) {
mpp_err("mpp_frame_deinit invalid NULL pointer input\n");
return MPP_ERR_NULL_PTR;
}
MppBuffer buffer = mpp_frame_get_buffer(*frame);
if (buffer)
mpp_buffer_put(buffer);
mpp_free(*frame);
*frame = NULL;
return MPP_OK;
}
MppFrame mpp_frame_get_next(MppFrame frame)
{
if (NULL == frame) {
mpp_err("mpp_frame_get_next invalid NULL pointer input\n");
return NULL;
}
MppFrameImpl *p = (MppFrameImpl *)frame;
return (MppFrame)p->next;
}