[ITC][mediacodec][Non-ACR][DPTTIZEN-2590, Change file reading logic according to...
authorShashank Shekhar Shukla <shekhar1.s@samsung.com>
Thu, 15 Dec 2016 05:58:33 +0000 (11:28 +0530)
committerShashank Shekhar Shukla <shekhar1.s@samsung.com>
Thu, 15 Dec 2016 11:21:14 +0000 (03:21 -0800)
Change-Id: I76cb1bc31040546ea5ffbb36171d4891c8904a08
Signed-off-by: Shashank Shekhar Shukla <shekhar1.s@samsung.com>
src/itc/mediacodec/ITs-mediacodec-common.c
src/itc/mediacodec/ITs-mediacodec-common.h
src/itc/mediacodec/ITs-mediacodec.c

index 569aa7d..152536b 100755 (executable)
@@ -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);
 }
index 8a5ceee..1508405 100755 (executable)
@@ -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
index d397325..9dbbe07 100755 (executable)
@@ -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));