mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[mpp]: add set_next to MppFrame, enable multiply frame output at one time
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@236 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
13
mpp/mpp.cpp
13
mpp/mpp.cpp
@@ -167,11 +167,22 @@ MPP_RET Mpp::put_packet(MppPacket packet)
|
|||||||
MPP_RET Mpp::get_frame(MppFrame *frame)
|
MPP_RET Mpp::get_frame(MppFrame *frame)
|
||||||
{
|
{
|
||||||
Mutex::Autolock autoLock(mFrames->mutex());
|
Mutex::Autolock autoLock(mFrames->mutex());
|
||||||
|
MppFrame first = NULL;
|
||||||
if (mFrames->list_size()) {
|
if (mFrames->list_size()) {
|
||||||
mFrames->del_at_tail(frame, sizeof(frame));
|
mFrames->del_at_tail(&first, sizeof(frame));
|
||||||
mFrameGetCount++;
|
mFrameGetCount++;
|
||||||
|
|
||||||
|
MppFrame prev = first;
|
||||||
|
MppFrame next = NULL;
|
||||||
|
while (mFrames->list_size()) {
|
||||||
|
mFrames->del_at_tail(&next, sizeof(frame));
|
||||||
|
mFrameGetCount++;
|
||||||
|
mpp_frame_set_next(prev, next);
|
||||||
|
prev = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mThreadHal->signal();
|
mThreadHal->signal();
|
||||||
|
*frame = first;
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,13 +37,13 @@ MPP_FRAME_ACCESSORS(MppBuffer, buffer)
|
|||||||
MPP_RET mpp_frame_init(MppFrame *frame)
|
MPP_RET mpp_frame_init(MppFrame *frame)
|
||||||
{
|
{
|
||||||
if (NULL == frame) {
|
if (NULL == frame) {
|
||||||
mpp_err("mpp_frame_init invalid NULL pointer input\n");
|
mpp_err_f("invalid NULL pointer input\n");
|
||||||
return MPP_ERR_NULL_PTR;
|
return MPP_ERR_NULL_PTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
MppFrameImpl *p = mpp_calloc(MppFrameImpl, 1);
|
MppFrameImpl *p = mpp_calloc(MppFrameImpl, 1);
|
||||||
if (NULL == p) {
|
if (NULL == p) {
|
||||||
mpp_err("mpp_frame_init malloc failed\n");
|
mpp_err_f("malloc failed\n");
|
||||||
return MPP_ERR_NULL_PTR;
|
return MPP_ERR_NULL_PTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ MPP_RET mpp_frame_init(MppFrame *frame)
|
|||||||
MPP_RET mpp_frame_deinit(MppFrame *frame)
|
MPP_RET mpp_frame_deinit(MppFrame *frame)
|
||||||
{
|
{
|
||||||
if (NULL == frame || NULL == *frame) {
|
if (NULL == frame || NULL == *frame) {
|
||||||
mpp_err("mpp_frame_deinit invalid NULL pointer input\n");
|
mpp_err_f("invalid NULL pointer input\n");
|
||||||
return MPP_ERR_NULL_PTR;
|
return MPP_ERR_NULL_PTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ MPP_RET mpp_frame_deinit(MppFrame *frame)
|
|||||||
MppFrame mpp_frame_get_next(MppFrame frame)
|
MppFrame mpp_frame_get_next(MppFrame frame)
|
||||||
{
|
{
|
||||||
if (NULL == frame) {
|
if (NULL == frame) {
|
||||||
mpp_err("mpp_frame_get_next invalid NULL pointer input\n");
|
mpp_err_f("invalid NULL pointer input\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,3 +78,15 @@ MppFrame mpp_frame_get_next(MppFrame frame)
|
|||||||
return (MppFrame)p->next;
|
return (MppFrame)p->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MPP_RET mpp_frame_set_next(MppFrame frame, MppFrame next)
|
||||||
|
{
|
||||||
|
if (NULL == frame) {
|
||||||
|
mpp_err_f("invalid NULL pointer input\n");
|
||||||
|
return MPP_ERR_NULL_PTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
MppFrameImpl *p = (MppFrameImpl *)frame;
|
||||||
|
p->next = (MppFrameImpl *)next;
|
||||||
|
return MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -82,6 +82,6 @@ struct MppFrameImpl_t {
|
|||||||
type mpp_frame_get_##field(const MppFrame s) { return ((MppFrameImpl*)s)->field; } \
|
type mpp_frame_get_##field(const MppFrame s) { return ((MppFrameImpl*)s)->field; } \
|
||||||
void mpp_frame_set_##field(MppFrame s, type v) { ((MppFrameImpl*)s)->field = v; }
|
void mpp_frame_set_##field(MppFrame s, type v) { ((MppFrameImpl*)s)->field = v; }
|
||||||
|
|
||||||
|
MPP_RET mpp_frame_set_next(MppFrame frame, MppFrame next);
|
||||||
|
|
||||||
#endif /*__MPP_FRAME_IMPL_H__*/
|
#endif /*__MPP_FRAME_IMPL_H__*/
|
||||||
|
@@ -133,8 +133,8 @@ int main()
|
|||||||
|
|
||||||
mpp_frame_deinit(&dec_out);
|
mpp_frame_deinit(&dec_out);
|
||||||
dec_out = next;
|
dec_out = next;
|
||||||
} while (dec_out);
|
|
||||||
i++;
|
i++;
|
||||||
|
} while (dec_out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user