media_format_h g_hfmt;
static bool g_bMediaTools = false;
+media_format_channel_position_e g_eSetPosition[] = {
+ MEDIA_FORMAT_CHANNEL_POSITION_FRONT_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_FRONT_RIGHT,
+ MEDIA_FORMAT_CHANNEL_POSITION_FRONT_CENTER,
+ MEDIA_FORMAT_CHANNEL_POSITION_LFE1,
+ MEDIA_FORMAT_CHANNEL_POSITION_REAR_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_REAR_RIGHT,
+ MEDIA_FORMAT_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
+ MEDIA_FORMAT_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
+ MEDIA_FORMAT_CHANNEL_POSITION_REAR_CENTER,
+ MEDIA_FORMAT_CHANNEL_POSITION_LFE2,
+ MEDIA_FORMAT_CHANNEL_POSITION_SIDE_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_SIDE_RIGHT,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_FRONT_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_FRONT_RIGHT,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_FRONT_CENTER,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_CENTER,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_REAR_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_REAR_RIGHT,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_SIDE_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_SIDE_RIGHT,
+ MEDIA_FORMAT_CHANNEL_POSITION_TOP_REAR_CENTER,
+ MEDIA_FORMAT_CHANNEL_POSITION_BOTTOM_FRONT_CENTER,
+ MEDIA_FORMAT_CHANNEL_POSITION_BOTTOM_FRONT_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT,
+ MEDIA_FORMAT_CHANNEL_POSITION_WIDE_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_WIDE_RIGHT,
+ MEDIA_FORMAT_CHANNEL_POSITION_SURROUND_LEFT,
+ MEDIA_FORMAT_CHANNEL_POSITION_SURROUND_RIGHT
+};
+
+media_format_mimetype_e g_eFormateMime[] = {
+ MEDIA_FORMAT_PCM,
+ MEDIA_FORMAT_PCM_S16LE,
+ MEDIA_FORMAT_PCM_S24LE,
+ MEDIA_FORMAT_PCM_S32LE,
+ MEDIA_FORMAT_PCM_S16BE,
+ MEDIA_FORMAT_PCM_S24BE,
+ MEDIA_FORMAT_PCM_S32BE,
+ MEDIA_FORMAT_PCM_F32LE,
+ MEDIA_FORMAT_PCM_F32BE,
+ MEDIA_FORMAT_PCM_U16LE,
+ MEDIA_FORMAT_PCM_U24LE,
+ MEDIA_FORMAT_PCM_U32LE,
+ MEDIA_FORMAT_PCM_U16BE,
+ MEDIA_FORMAT_PCM_U24BE,
+ MEDIA_FORMAT_PCM_U32BE,
+ MEDIA_FORMAT_PCMA,
+ MEDIA_FORMAT_PCMU
+};
+
+int g_nBitDepth[] = {
+ 16,
+ 16,
+ 24,
+ 32,
+ 16,
+ 24,
+ 32,
+ 32,
+ 32,
+ 16,
+ 24,
+ 32,
+ 16,
+ 24,
+ 32,
+ 32,
+ 32
+};
+
void ITs_media_format_startup(void)
{
struct stat stBuff;
return 0;
}
+//& purpose: Converts the channels in the channel mask to a positions array \n
+//& and Converts the positions array to a bitmask
+//& type: auto
+/**
+* @testcase ITc_media_format_channel_positions_to_from_mask_p
+* @since_tizen 5.5
+* @author SRID(j.abhishek)
+* @reviewer SRID(manoj.g2)
+* @type auto
+* @description Converts the channels in the channel mask to a positions array \n
+* and Converts the positions array to a bitmask
+* @scenario Creates a media format, set audio channel \n
+* Convert channel position to mask and mask to position array
+* @apicovered media_format_channel_positions_to_mask & media_format_channel_positions_from_mask
+* @passcase When media_format_channel_positions_to_mask and media_format_channel_positions_from_mask is successful.
+* @failcase If target API media_format_channel_positions_to_mask or media_format_channel_positions_from_mask fails or any precondition API fails.
+* @precondition Creates a media format and set audio channel
+* @postcondition None
+*/
+int ITc_media_format_channel_positions_to_from_mask_p(void)
+{
+ START_TEST;
+
+ int nRet = MEDIA_FORMAT_ERROR_NONE;
+ uint64_t nsetChMask;
+ uint64_t ngetChMask;
+ int nAudioCh = 1;
+ int nChannels;
+ media_format_channel_position_e *eGetPositions;
+
+ nRet = media_format_set_audio_mime(g_hfmt, MEDIA_FORMAT_MP3);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_mime", MediaFormatGetError(nRet));
+
+ nRet = media_format_set_audio_channel(g_hfmt, nAudioCh);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_channel", MediaFormatGetError(nRet));
+
+ nRet = media_format_channel_positions_to_mask(g_hfmt, g_eSetPosition, &nsetChMask);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_channel_positions_to_mask", MediaFormatGetError(nRet));
+
+ nRet = media_format_get_audio_info(g_hfmt, NULL, &nChannels, NULL, NULL, NULL);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_get_audio_info", MediaFormatGetError(nRet));
+
+ eGetPositions = malloc(nChannels * sizeof(media_format_channel_position_e));
+
+ nRet = media_format_channel_positions_from_mask(g_hfmt, ngetChMask, &eGetPositions);
+ PRINT_RESULT_CLEANUP(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_channel_positions_from_mask", MediaFormatGetError(nRet), FREE_MEMORY(eGetPositions));
+
+ FREE_MEMORY(eGetPositions);
+
+ return 0;
+}
+
+//& purpose: Sets/Gets audio channel mask of media format
+//& type: auto
+/**
+* @testcase ITc_media_format_set_get_audio_channel_mask_p
+* @since_tizen 5.5
+* @author SRID(j.abhishek)
+* @reviewer SRID(manoj.g2)
+* @type auto
+* @description Sets/Gets audio channel mask of media format
+* @scenario Creates a media format\n
+* Sets/Gets audio channel mask of media format
+* @apicovered media_format_set_audio_channel_mask & media_format_get_audio_channel_mask
+* @passcase When media_format_set_audio_channel_mask and media_format_get_audio_channel_mask is successful.
+* @failcase If target API media_format_set_audio_channel_mask or media_format_get_audio_channel_mask fails or any precondition API fails.
+* @precondition Creates a media format and set audio channel
+* @postcondition None
+*/
+int ITc_media_format_set_get_audio_channel_mask_p(void)
+{
+ START_TEST;
+
+ int nRet = MEDIA_FORMAT_ERROR_NONE;
+ uint64_t nsetChMask;
+ uint64_t ngetChMask;
+
+ nRet = media_format_set_audio_mime(g_hfmt, MEDIA_FORMAT_MP3);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_mime", MediaFormatGetError(nRet));
+
+ nRet = media_format_set_audio_channel(g_hfmt, 1);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_channel", MediaFormatGetError(nRet));
+
+ nRet = media_format_channel_positions_to_mask(g_hfmt, g_eSetPosition, &nsetChMask);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_channel_positions_to_mask", MediaFormatGetError(nRet));
+
+ media_format_set_audio_channel_mask(g_hfmt, nsetChMask);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_channel_mask", MediaFormatGetError(nRet));
+
+ media_format_get_audio_channel_mask(g_hfmt, &ngetChMask);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_get_audio_channel_mask",MediaFormatGetError(nRet));
+
+ if (nsetChMask != ngetChMask)
+ {
+ FPRINTF("Line : %d] [Function: %s][%s]value mismatch\\n",__LINE__, __FUNCTION__,API_NAMESPACE);
+
+ return 1;
+ }
+ return 0;
+}
+
+//& purpose: Checks whether the given media format is little endian.
+//& type: auto
+/**
+* @testcase ITc_media_format_is_little_endian_p
+* @since_tizen 5.5
+* @author SRID(j.abhishek)
+* @reviewer SRID(manoj.g2)
+* @type auto
+* @description Checks whether the given media format is little endian.
+* @scenario Creates a media format\n
+* Checks whether the given media format is little endian.
+* @apicovered media_format_is_little_endian
+* @passcase When media_format_is_little_endian is successful.
+* @failcase If target API media_format_is_little_endian fails or any precondition API fails.
+* @precondition Creates a media format and set audio mime
+* @postcondition None
+*/
+int ITc_media_format_is_little_endian_p(void)
+{
+ START_TEST;
+ int nRet = MEDIA_FORMAT_ERROR_NONE;
+ bool bIsLittleEndian;
+
+ int nEnumSize = sizeof(g_eFormateMime) / sizeof(g_eFormateMime[0]);
+ int nEnumCounter;
+
+ for ( nEnumCounter=0; nEnumCounter<nEnumSize; nEnumCounter++)
+ {
+ nRet = media_format_set_audio_mime(g_hfmt, g_eFormateMime[nEnumCounter]); //MEDIA_FORMAT_PCM);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_mime", MediaFormatGetError(nRet));
+
+ nRet = media_format_is_little_endian(g_hfmt, &bIsLittleEndian);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_is_little_endian", MediaFormatGetError(nRet));
+
+ if(bIsLittleEndian)
+ {
+ FPRINTF("Line : %d] [Function: %s][%s] audio format is little endian\\n",__LINE__, __FUNCTION__,API_NAMESPACE);
+ }
+ else
+ {
+ FPRINTF("Line : %d] [Function: %s][%s] audio format is big endian\\n",__LINE__, __FUNCTION__,API_NAMESPACE);
+ }
+ }
+ return 0;
+}
+
+//& purpose: Gets the number of bits of information in digital audio using pulse-code modulation (PCM).
+//& type: auto
+/**
+* @testcase ITc_media_format_get_audio_bit_depth_p
+* @since_tizen 5.5
+* @author SRID(j.abhishek)
+* @reviewer SRID(manoj.g2)
+* @type auto
+* @description Gets the number of bits of information in digital audio using pulse-code modulation (PCM).
+* @scenario Creates a media format\n
+* Gets the number of bits of information in digital audio using pulse-code modulation (PCM).
+* @apicovered media_format_get_audio_bit_depth
+* @passcase When media_format_get_audio_bit_depth is successful.
+* @failcase If target API media_format_get_audio_bit_depth fails or any precondition API fails.
+* @precondition Creates a media format and set audio mime
+* @postcondition None
+*/
+int ITc_media_format_get_audio_bit_depth_p(void)
+{
+ START_TEST;
+ int nRet = MEDIA_FORMAT_ERROR_NONE;
+ int nBitDepth;
+
+ int nEnumSize = sizeof(g_eFormateMime) / sizeof(g_eFormateMime[0]);
+ int nEnumCounter;
+
+ for ( nEnumCounter=0; nEnumCounter<nEnumSize; nEnumCounter++)
+ {
+ nRet = media_format_set_audio_mime(g_hfmt, g_eFormateMime[nEnumCounter]);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_set_audio_mime", MediaFormatGetError(nRet));
+
+ nRet = media_format_get_audio_bit_depth(g_hfmt, &nBitDepth);
+ PRINT_RESULT(MEDIA_FORMAT_ERROR_NONE, nRet, "media_format_get_audio_bit_depth", MediaFormatGetError(nRet));
+ if (g_nBitDepth[nEnumCounter] != nBitDepth)
+ {
+ FPRINTF("Line : %d] [Function: %s][%s] Expected audio bit depth [%d] but retrieved audio bit depth [%d] \\n",__LINE__, __FUNCTION__,API_NAMESPACE, g_nBitDepth[nEnumCounter], nBitDepth);
+ return 1;
+ }
+ }
+ return 0;
+}
+
/** @} */
/** @} */