From 4230154782d7cc40a5d938ba3c5f318f928ba85f Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Fri, 18 Aug 2023 20:12:21 +0900 Subject: [PATCH] Improve GlobalVariable violation SAM Score: 3.71 -> 3.73 GV: 0.85 -> 1 [Version] 0.1.29 [Issue Type] SAM Change-Id: I5c520f94e0b9d7cbfc90d2b993e7a3af206cb089 --- packaging/capi-mediamuxer.spec | 2 +- test/mediamuxer_test.c | 37 +++++++++++++++++----------------- test/mediamuxer_test_with_mediacodec.c | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/packaging/capi-mediamuxer.spec b/packaging/capi-mediamuxer.spec index fd3e785..b122c34 100644 --- a/packaging/capi-mediamuxer.spec +++ b/packaging/capi-mediamuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediamuxer Summary: A Media Muxer library in Tizen Native API -Version: 0.1.28 +Version: 0.1.29 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/mediamuxer_test.c b/test/mediamuxer_test.c index af2dc8c..d420862 100644 --- a/test/mediamuxer_test.c +++ b/test/mediamuxer_test.c @@ -75,18 +75,12 @@ enum { }; mediamuxer_h myMuxer = 0; -media_format_h media_format = NULL; +static media_format_h media_format = NULL; media_format_h media_format_a = NULL; -media_format_h media_format_t = NULL; +static media_format_h media_format_t = NULL; media_format_h input_fmt = NULL; -int use_video = 1; /* 1 to test video with codec, 0 for audio */ -int use_encoder = 1; media_format_mimetype_e mimetype; -int width = DEFAULT_OUT_BUF_WIDTH; -int height = DEFAULT_OUT_BUF_HEIGHT; -float fps = 0; -int target_bits = 0; int samplerate = DEFAULT_SAMPPLERATE; int channel = DEFAULT_CHANNEL; @@ -95,17 +89,22 @@ int pcm_format = 0; unsigned char buf_adts[ADTS_HEADER_SIZE]; uint64_t pts = 0; #ifdef USE_MEDIA_CODEC +int use_video = 1; /* 1 to test video with codec, 0 for audio */ +int use_encoder = 1; +int width = DEFAULT_OUT_BUF_WIDTH; +int height = DEFAULT_OUT_BUF_HEIGHT; +float fps = 0; +int target_bits = 0; static int bitrate = DEFAULT_BITRATE; #endif -int iseos_codec = 0; -bool validate_with_codec = false; +static bool validate_with_codec = false; bool validate_multitrack = false; -bool validate_with_demux = false; -bool validate_with_pcm = false; +static bool validate_with_demux = false; +static bool validate_with_pcm = false; char media_file[MAX_INPUT_SIZE]; char data_sink[MAX_INPUT_SIZE]; -bool have_mp4 = false; +static bool have_mp4 = false; bool have_vid_track = false; bool have_aud_track = false; bool have_text_track = false; @@ -113,12 +112,14 @@ int track_index_vid = -1; int track_index_aud = -1; int track_index_aud2 = -1; int track_index_text = -1; -int g_menu_state = CURRENT_STATUS_MAINMENU; +static int g_menu_state = CURRENT_STATUS_MAINMENU; -int demuxer_index_vid = -1; -int demuxer_index_aud = -1; -bool is_video = false; -bool is_audio = false; +#ifdef USE_MEDIA_DEMUX +static int demuxer_index_vid = -1; +static int demuxer_index_aud = -1; +static bool is_video = false; +static bool is_audio = false; +#endif int demux_mp4(); int demux_audio(bool need_demux); diff --git a/test/mediamuxer_test_with_mediacodec.c b/test/mediamuxer_test_with_mediacodec.c index a7be998..b82739a 100644 --- a/test/mediamuxer_test_with_mediacodec.c +++ b/test/mediamuxer_test_with_mediacodec.c @@ -475,7 +475,7 @@ unsigned int __extract_input_aacenc(FILE *fd, unsigned char* rawdata) readsize = ((samplebyte * channel) * (bit / 8)); result = fread(buffer, 1, readsize, fd); if (result != readsize) - g_print("different size of read. result is %d\n", result); + g_print("different size of read. result is %zu\n", result); memcpy(rawdata, buffer, result); -- 2.7.4