mtc_media.h 6.68 KB
/************************************************************************

        Copyright (c) 2005-2011 by Juphoon System Software, Inc.
                       All rights reserved.

     This software is confidential and proprietary to Juphoon System,
     Inc. No part of this software may be reproduced, stored, transmitted,
     disclosed or used in any form or by any means other than as expressly
     provided by the written license agreement between Juphoon and its
     licensee.

     THIS SOFTWARE IS PROVIDED BY JUPHOON "AS IS" AND ANY EXPRESS OR 
     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     ARE DISCLAIMED. IN NO EVENT SHALL JUPHOON BE LIABLE FOR ANY DIRECT, 
     INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
     STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
     IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     POSSIBILITY OF SUCH DAMAGE. 

                    Juphoon System Software, Inc.
                    Email: support@juphoon.com
                    Web: http://www.juphoon.com

************************************************************************/
/*************************************************
  File name     : mtc_media.h
  Module        : multimedia talk client
  Author        : tanek.ye
  Created on    : 2011-05-06
  Description   :
    Marcos and structure definitions required by the mtc media.

  Modify History:
  1. Date:        Author:         Modification:
*************************************************/
#ifndef _MTC_MEDIA_H__
#define _MTC_MEDIA_H__

/**
 * @file mtc_media.h
 * @brief MTC Media Interface Functions
 */
/** @brief Type of MTC media file type. */
typedef enum EN_MTC_MFILE_TYPE
{
    EN_MTC_MFILE_UNKNOW,              /**< @brief Unknow file type. */
    EN_MTC_MFILE_PCM,                 /**< @brief PCM file. */
    EN_MTC_MFILE_WAV,                 /**< @brief WAV file. */
    EN_MTC_MFILE_WAV_PCM,             /**< @brief WAV file with codec of PCM. */
    EN_MTC_MFILE_WAV_PCMU,            /**< @brief WAV file with codec of PCMU. */
    EN_MTC_MFILE_WAV_PCMA,            /**< @brief WAV file with codec of PCMA. */
    EN_MTC_MFILE_ILBC,                /**< @brief WAV file with codec of iLBC. */
    EN_MTC_MFILE_AMR,                 /**< @brief WAV file with codec of AMR. */
    EN_MTC_MFILE_AVI,                 /**< @brief AVI file. */
    EN_MTC_MFILE_AVI_VP8,             /**< @brief AVI file with codec of VP8. */
    EN_MTC_MFILE_AVI_I420,            /**< @brief AVI file with codec of I420. */
    EN_MTC_MFILE_AVI_H264,            /**< @brief AVI file with codec of H264. */
    EN_MTC_MFILE_MP4_H264,            /**< @brief MP4 file with codec of H264 and AAC */
} EN_MTC_MFILE_TYPE;

/** @brief Type of MTC adaptive negotiation bitrate mode type. */
typedef enum EN_MTC_AN_MODE
{
    EN_MTC_AN_UNKNOW,                /**< @brief Invalid mode type. */
    EN_MTC_AN_LOW,                   /**< @brief Low bitrate mode. */ 
    EN_MTC_AN_MID,                   /**< @brief Middle bitrate mode. */ 
    EN_MTC_AN_HIGH,                  /**< @brief High bitrate mode. */ 
} EN_MTC_AN_MODE;

/** @brief Display mode */
typedef enum EN_MTC_DISPLAY_MODE
{
    EN_MTC_DISPLAY_FULL_CONTENT,     /**< @brief Scale size to fit display
                                          area with ratio unchanged. */
    EN_MTC_DISPLAY_FULL_SCREEN       /**< @brief Scale size to fullfill display
                                          area with ratio unchanged. */
} EN_MTC_DISPLAY_MODE;


/** @brief Rectangle */
typedef struct tagMTC_RECT
{
    int iX;                          /**< @brief Specifies the x-coordinate of
                                        the upper-left corner of a rectangle. */
    int iY;                          /**< @brief Specifies the y-coordinate of 
                                        the upper-left corner of a rectangle. */
    int iWidth;                      /**< @brief Specifies the width of a rectangle. */
    int iHeight;                     /**< @brief Specifies the height of a rectangle. */
} ST_MTC_RECT;

/** @brief MTC video record option */
typedef enum EN_MTC_VIDEO_RECORD_OPTION
{
    /** @brief Do not record audio. */
    EN_MTC_VIDEO_RECORD_WITHOUT_AUDIO,
    /** @brief Record audio which matchs video. */ 
    EN_MTC_VIDEO_RECORD_MATCH_VIDEO,
    /** @brief Record microphone. */
    EN_MTC_VIDEO_RECORD_MICROPHONE,
    /** @brief Record speaker. */
    EN_MTC_VIDEO_RECORD_SPEAKER,
    /** @brief Record both microphone and speaker. */
    EN_MTC_VIDEO_RECORD_BOTH,
} EN_MTC_VIDEO_RECORD_OPTION;

#ifdef __cplusplus
extern "C" {
#endif
/**
 * @brief Convert wav file to amr file.
 *
 * @param [in] pcInFile Input wav file name.
 * @param [in] pcOutFile Output amr file name.
 *
 * @retval ZOK on successfully.
 * @retval ZFAILED on failed.
 *
 * @see
 */
MTCFUNC ZINT Mtc_MediaFileWavToAmr(ZCHAR *pcInFile, ZCHAR *pcOutFile);

/**
 * @brief Convert amr file to wav file.
 *
 * @param [in] pcInFile Input amr file name.
 * @param [in] pcOutFile Output wav file name.
 *
 * @retval ZOK on successfully.
 * @retval ZFAILED on failed.
 *
 * @see
 */
MTCFUNC ZINT Mtc_MediaFileAmrToWav(ZCHAR *pcInFile, ZCHAR *pcOutFile);

/**
 * @brief Start record capture to file.
 *
 * @param [in] pcFileName The output file path.
 * @param [in] pcCameraId The camera ID.
 * @param [in] iWidth Video width in pixels.
 * @param [in] iHeight Video height in pixels.
 * @param [in] pData  Pointer to the buffer of image RGBA8 data for blend, maybe ZNULL.
 * @param [in] iDataSize The buffer size in bytes, must be iWidth * iHeight * 4.
 * @param [in] iOption @ref EN_MTC_VIDEO_RECORD_OPTION.
 *
 * @retval ZOK on successfully.
 * @retval ZFAILED on failed.
 *
 * @see Mtc_MediaFileRecSetCamera, Mtc_MediaFileStopRecord
 */
MTCFUNC ZINT Mtc_MediaFileRecordVideo(ZCONST ZCHAR *pcFileName,
    ZCONST ZCHAR *pcCameraId, ZUINT iWidth, ZUINT iHeight,
    ZVOID *pData, ZUINT iDataSize, ZUINT iOption);

/**
 * @brief Set record camera id.
 *
 * @param [in] pcCameraId camera id.
 *
 * @see Mtc_MediaFileStopRecord
 */
MTCFUNC ZVOID Mtc_MediaFileSetCamera(ZCONST ZCHAR *pcCameraId);

/**
 * @brief Stop record file
 */
MTCFUNC ZVOID Mtc_MediaFileStopRecord(ZFUNC_VOID);

/**
 * @brief Recovery MP4 file in specific directory.
 *
 * @param [in] pcDir The file directory.
 *
 * @retval ZOK on successfully.
 * @retval ZFAILED on failed.
 */
MTCFUNC ZINT Mtc_MediaFileRecovery(ZCONST ZCHAR *pcDir);

#ifdef __cplusplus
}
#endif

#endif