mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 17:16:50 +08:00
[mpp]: change packet/frame deinit function and always return ok for function get_frame/get_packet
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@160 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -137,7 +137,7 @@ extern "C" {
|
||||
* MppFrame interface
|
||||
*/
|
||||
MPP_RET mpp_frame_init(MppFrame *frame);
|
||||
MPP_RET mpp_frame_deinit(MppFrame frame);
|
||||
MPP_RET mpp_frame_deinit(MppFrame *frame);
|
||||
MppFrame mpp_frame_get_next(MppFrame frame);
|
||||
|
||||
/*
|
||||
|
@@ -33,7 +33,7 @@ extern "C" {
|
||||
*/
|
||||
MPP_RET mpp_packet_new(MppPacket *packet);
|
||||
MPP_RET mpp_packet_init(MppPacket *packet, void *data, size_t size);
|
||||
MPP_RET mpp_packet_deinit(MppPacket packet);
|
||||
MPP_RET mpp_packet_deinit(MppPacket *packet);
|
||||
|
||||
|
||||
void mpp_packet_set_data(MppPacket packet, void *data);
|
||||
|
10
mpp/mpp.cpp
10
mpp/mpp.cpp
@@ -137,11 +137,10 @@ MPP_RET Mpp::put_packet(MppPacket packet)
|
||||
|
||||
MPP_RET Mpp::get_frame(MppFrame *frame)
|
||||
{
|
||||
MPP_RET ret = MPP_NOK;
|
||||
if (frames->list_size()) {
|
||||
ret = (MPP_RET)frames->del_at_tail(frame, sizeof(frame));
|
||||
frames->del_at_tail(frame, sizeof(frame));
|
||||
}
|
||||
return ret;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET Mpp::put_frame(MppFrame frame)
|
||||
@@ -152,10 +151,9 @@ MPP_RET Mpp::put_frame(MppFrame frame)
|
||||
|
||||
MPP_RET Mpp::get_packet(MppPacket *packet)
|
||||
{
|
||||
MPP_RET ret = MPP_NOK;
|
||||
if (packets->list_size()) {
|
||||
ret = (MPP_RET)packets->del_at_tail(packet, sizeof(packet));
|
||||
packets->del_at_tail(packet, sizeof(packet));
|
||||
}
|
||||
return ret;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
|
@@ -52,15 +52,15 @@ MPP_RET mpp_frame_init(MppFrame *frame)
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_frame_deinit(MppFrame frame)
|
||||
MPP_RET mpp_frame_deinit(MppFrame *frame)
|
||||
{
|
||||
if (NULL == frame) {
|
||||
if (NULL == frame || NULL == *frame) {
|
||||
mpp_err("mpp_frame_deinit invalid NULL pointer input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
mpp_free(frame);
|
||||
|
||||
mpp_free(*frame);
|
||||
*frame = NULL;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
|
@@ -51,14 +51,15 @@ MPP_RET mpp_packet_init(MppPacket *packet, void *data, size_t size)
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_packet_deinit(MppPacket packet)
|
||||
MPP_RET mpp_packet_deinit(MppPacket *packet)
|
||||
{
|
||||
if (NULL == packet) {
|
||||
if (NULL == packet || NULL == packet) {
|
||||
mpp_err("mpp_packet_deinit found NULL input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
mpp_free((MppPacketImpl *)packet);
|
||||
mpp_free(*packet);
|
||||
*packet = NULL;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
|
@@ -96,13 +96,12 @@ int main()
|
||||
|
||||
// TODO: diaplay function called here
|
||||
|
||||
mpp_frame_deinit(dec_out);
|
||||
mpp_frame_deinit(&dec_out);
|
||||
dec_out = next;
|
||||
} while (dec_out);
|
||||
}
|
||||
|
||||
mpp_packet_deinit(dec_in);
|
||||
dec_in = NULL;
|
||||
mpp_packet_deinit(&dec_in);
|
||||
}
|
||||
|
||||
// interface with input and output separated
|
||||
@@ -116,8 +115,7 @@ int main()
|
||||
goto MPP_TEST_FAILED;
|
||||
}
|
||||
|
||||
mpp_packet_deinit(dec_in);
|
||||
dec_in = NULL;
|
||||
mpp_packet_deinit(&dec_in);
|
||||
}
|
||||
|
||||
for (i = 0; i < MPI_DEC_LOOP_COUNT; i++) {
|
||||
@@ -133,7 +131,7 @@ int main()
|
||||
|
||||
// TODO: diaplay function called here
|
||||
|
||||
mpp_frame_deinit(dec_out);
|
||||
mpp_frame_deinit(&dec_out);
|
||||
dec_out = next;
|
||||
} while (dec_out);
|
||||
}
|
||||
@@ -183,13 +181,10 @@ int main()
|
||||
goto MPP_TEST_FAILED;
|
||||
}
|
||||
|
||||
if (enc_out) {
|
||||
mpp_packet_deinit(enc_out);
|
||||
enc_out = NULL;
|
||||
}
|
||||
if (enc_out)
|
||||
mpp_packet_deinit(&enc_out);
|
||||
|
||||
mpp_frame_deinit(enc_in);
|
||||
enc_in = NULL;
|
||||
mpp_frame_deinit(&enc_in);
|
||||
}
|
||||
|
||||
// interface with input and output separated
|
||||
@@ -203,8 +198,7 @@ int main()
|
||||
goto MPP_TEST_FAILED;
|
||||
}
|
||||
|
||||
mpp_frame_deinit(enc_in);
|
||||
enc_in = NULL;
|
||||
mpp_frame_deinit(&enc_in);
|
||||
}
|
||||
|
||||
for (i = 0; i < MPI_ENC_LOOP_COUNT; i++) {
|
||||
@@ -214,10 +208,7 @@ int main()
|
||||
}
|
||||
|
||||
if (enc_out) {
|
||||
if (enc_out) {
|
||||
mpp_packet_deinit(enc_out);
|
||||
enc_out = NULL;
|
||||
}
|
||||
mpp_packet_deinit(&enc_out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,15 +219,11 @@ int main()
|
||||
goto MPP_TEST_FAILED;
|
||||
}
|
||||
|
||||
if (dec_in) {
|
||||
mpp_packet_deinit(dec_in);
|
||||
dec_in = NULL;
|
||||
}
|
||||
if (dec_in)
|
||||
mpp_packet_deinit(&dec_in);
|
||||
|
||||
if (enc_in) {
|
||||
mpp_frame_deinit(enc_in);
|
||||
enc_in = NULL;
|
||||
}
|
||||
if (enc_in)
|
||||
mpp_frame_deinit(&enc_in);
|
||||
|
||||
mpp_deinit(ctx);
|
||||
free(buf);
|
||||
@@ -246,15 +233,11 @@ int main()
|
||||
return 0;
|
||||
|
||||
MPP_TEST_FAILED:
|
||||
if (dec_in) {
|
||||
mpp_packet_deinit(dec_in);
|
||||
dec_in = NULL;
|
||||
}
|
||||
if (dec_in)
|
||||
mpp_packet_deinit(&dec_in);
|
||||
|
||||
if (enc_in) {
|
||||
mpp_frame_deinit(enc_in);
|
||||
enc_in = NULL;
|
||||
}
|
||||
if (enc_in)
|
||||
mpp_frame_deinit(&enc_in);
|
||||
|
||||
if (ctx)
|
||||
mpp_deinit(ctx);
|
||||
|
@@ -48,7 +48,7 @@ int main()
|
||||
mpp_err("mpp_packet_test mpp_packet_set_eos failed\n");
|
||||
goto MPP_PACKET_failed;
|
||||
}
|
||||
mpp_packet_deinit(packet);
|
||||
mpp_packet_deinit(&packet);
|
||||
|
||||
free(data);
|
||||
mpp_log("mpp_packet_test success\n");
|
||||
@@ -56,7 +56,7 @@ int main()
|
||||
|
||||
MPP_PACKET_failed:
|
||||
if (packet)
|
||||
mpp_packet_deinit(packet);
|
||||
mpp_packet_deinit(&packet);
|
||||
|
||||
if (data)
|
||||
free(data);
|
||||
|
Reference in New Issue
Block a user