mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-07 10:00:55 +08:00
[mpp]: add basic mpp thread codec flow
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@158 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -172,9 +172,55 @@ int main()
|
||||
goto MPP_TEST_FAILED;
|
||||
}
|
||||
|
||||
mpi->encode(ctx, enc_in, &enc_out);
|
||||
mpi->encode_put_frame(ctx, enc_in);
|
||||
mpi->encode_get_packet(ctx, &dec_out);
|
||||
|
||||
|
||||
// interface with both input and output
|
||||
for (i = 0; i < MPI_ENC_LOOP_COUNT; i++) {
|
||||
mpp_frame_init(&enc_in);
|
||||
|
||||
mpi->encode(ctx, enc_in, &enc_out);
|
||||
if (MPP_OK != ret) {
|
||||
goto MPP_TEST_FAILED;
|
||||
}
|
||||
|
||||
if (enc_out) {
|
||||
mpp_packet_deinit(enc_out);
|
||||
enc_out = NULL;
|
||||
}
|
||||
|
||||
mpp_frame_deinit(enc_in);
|
||||
enc_in = NULL;
|
||||
}
|
||||
|
||||
// interface with input and output separated
|
||||
for (i = 0; i < MPI_ENC_LOOP_COUNT; i++) {
|
||||
mpp_frame_init(&enc_in);
|
||||
|
||||
// TODO: read stream data to buf
|
||||
|
||||
mpi->encode_put_frame(ctx, enc_in);
|
||||
if (MPP_OK != ret) {
|
||||
goto MPP_TEST_FAILED;
|
||||
}
|
||||
|
||||
mpp_frame_deinit(enc_in);
|
||||
enc_in = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < MPI_ENC_LOOP_COUNT; i++) {
|
||||
mpi->encode_get_packet(ctx, &enc_out);
|
||||
if (MPP_OK != ret) {
|
||||
goto MPP_TEST_FAILED;
|
||||
}
|
||||
|
||||
if (enc_out) {
|
||||
if (enc_out) {
|
||||
mpp_packet_deinit(enc_out);
|
||||
enc_out = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ret = mpi->flush(ctx);
|
||||
if (MPP_OK != ret) {
|
||||
@@ -187,6 +233,11 @@ int main()
|
||||
dec_in = NULL;
|
||||
}
|
||||
|
||||
if (enc_in) {
|
||||
mpp_frame_deinit(enc_in);
|
||||
enc_in = NULL;
|
||||
}
|
||||
|
||||
mpp_deinit(ctx);
|
||||
free(buf);
|
||||
|
||||
@@ -200,6 +251,11 @@ MPP_TEST_FAILED:
|
||||
dec_in = NULL;
|
||||
}
|
||||
|
||||
if (enc_in) {
|
||||
mpp_frame_deinit(enc_in);
|
||||
enc_in = NULL;
|
||||
}
|
||||
|
||||
if (ctx)
|
||||
mpp_deinit(ctx);
|
||||
if (buf)
|
||||
|
Reference in New Issue
Block a user