From: Shashank Shekhar Shukla Date: Thu, 15 Dec 2016 05:58:33 +0000 (+0530) Subject: [ITC][mediacodec][Non-ACR][DPTTIZEN-2590, Change file reading logic according to... X-Git-Tag: Public_Final_RC8~21^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dff57e20ad01554bb08547713aefea5b730aa888;p=test%2Ftct%2Fnative%2Fapi.git [ITC][mediacodec][Non-ACR][DPTTIZEN-2590, Change file reading logic according to developer request] Change-Id: I76cb1bc31040546ea5ffbb36171d4891c8904a08 Signed-off-by: Shashank Shekhar Shukla --- diff --git a/src/itc/mediacodec/ITs-mediacodec-common.c b/src/itc/mediacodec/ITs-mediacodec-common.c index 569aa7d29..152536b31 100755 --- a/src/itc/mediacodec/ITs-mediacodec-common.c +++ b/src/itc/mediacodec/ITs-mediacodec-common.c @@ -64,7 +64,7 @@ char* MediaCodecGetError(int nRet) * @return NA */ -unsigned int GetDataFromFile() +unsigned int GetDataFromFile(unsigned char *pcm) { int read_size = 1024*2*2; unsigned char szBuffer[1000000]; @@ -95,6 +95,7 @@ unsigned int GetDataFromFile() fclose(pFile); return 0; } + memcpy(pcm, szBuffer, read_size); fclose(pFile); return(read_size); } diff --git a/src/itc/mediacodec/ITs-mediacodec-common.h b/src/itc/mediacodec/ITs-mediacodec-common.h index 8a5ceee35..15084059d 100755 --- a/src/itc/mediacodec/ITs-mediacodec-common.h +++ b/src/itc/mediacodec/ITs-mediacodec-common.h @@ -71,7 +71,7 @@ static GMainLoop *g_pMainLoop; } char* MediaCodecGetError(int nRet); -unsigned int GetDataFromFile(); +unsigned int GetDataFromFile(unsigned char *DataPointer); gboolean MediaCodecTimeoutFunction(gpointer data); /** @} */ //end of itc-mediacodec diff --git a/src/itc/mediacodec/ITs-mediacodec.c b/src/itc/mediacodec/ITs-mediacodec.c index d397325d7..9dbbe07d8 100755 --- a/src/itc/mediacodec/ITs-mediacodec.c +++ b/src/itc/mediacodec/ITs-mediacodec.c @@ -696,7 +696,7 @@ int ITc_mediacodec_process_input_p(void) void *szData = NULL; media_packet_get_buffer_data_ptr(hInputBuff, &szData); - unsigned int unSize = GetDataFromFile(); + unsigned int unSize = GetDataFromFile(szData); media_packet_set_buffer_size(hInputBuff, unSize); //Target API @@ -767,7 +767,7 @@ int ITc_mediacodec_get_output_p(void) media_packet_create_alloc(hFormat, NULL, NULL, &hInputBuffNew); void *szData = NULL; media_packet_get_buffer_data_ptr(hInputBuffNew, &szData); - unsigned int unSize = GetDataFromFile(); + unsigned int unSize = GetDataFromFile(szData); media_packet_set_buffer_size(hInputBuffNew, unSize); nRet = mediacodec_process_input(g_mediacodec, hInputBuffNew, 0); PRINT_RESULT_CLEANUP(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_process_input", MediaCodecGetError(nRet), mediacodec_unprepare(g_mediacodec);mediacodec_unset_output_buffer_available_cb(g_mediacodec)); @@ -913,7 +913,7 @@ int ITc_mediacodec_set_unset_input_buffer_used_cb_p(void) media_packet_create_alloc(hFormat, NULL, NULL, &hInputBuffNew); void *szData = NULL; media_packet_get_buffer_data_ptr(hInputBuffNew, &szData); - unsigned int unSize = GetDataFromFile(); + unsigned int unSize = GetDataFromFile(szData); media_packet_set_buffer_size(hInputBuffNew, unSize); nRet = mediacodec_process_input(g_mediacodec, hInputBuffNew, 0); PRINT_RESULT_CLEANUP(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_process_input", MediaCodecGetError(nRet), mediacodec_unprepare(g_mediacodec);mediacodec_unset_input_buffer_used_cb(g_mediacodec)); @@ -1000,7 +1000,7 @@ int ITc_mediacodec_set_unset_output_buffer_available_cb_p(void) media_packet_create_alloc(hFormat, NULL, NULL, &hInputBuffNew); void *szData = NULL; media_packet_get_buffer_data_ptr(hInputBuffNew, &szData); - unsigned int unSize = GetDataFromFile(); + unsigned int unSize = GetDataFromFile(szData); media_packet_set_buffer_size(hInputBuffNew, unSize); nRet = mediacodec_process_input(g_mediacodec, hInputBuffNew, 0); PRINT_RESULT_CLEANUP(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_process_input", MediaCodecGetError(nRet), mediacodec_unprepare(g_mediacodec);mediacodec_unset_output_buffer_available_cb(g_mediacodec)); @@ -1215,7 +1215,7 @@ int ITc_mediacodec_set_unset_buffer_status_cb_p(void) media_packet_create_alloc(hFormat, NULL, NULL, &hInputBuffNew); void *szData = NULL; media_packet_get_buffer_data_ptr(hInputBuffNew, &szData); - unsigned int unSize = GetDataFromFile(); + unsigned int unSize = GetDataFromFile(szData); media_packet_set_buffer_size(hInputBuffNew, unSize); nRet = mediacodec_process_input(g_mediacodec, hInputBuffNew, 0); PRINT_RESULT_CLEANUP(MEDIACODEC_ERROR_NONE, nRet, "mediacodec_process_input", MediaCodecGetError(nRet), mediacodec_unset_buffer_status_cb(g_mediacodec));