/*===========================================================================
                    IMPORTANT NOTICE

            Not to be distributed in source format.

FILE:  bridle_MediaCMX.h

SERVICES:  Bridle'd IMedia interfaces via CMX. 

GENERAL DESCRIPTION:
   Contains inlined code that does swi-ing into OEM layer.	

        Copyright © 2003 QUALCOMM Incorporated.
               All Rights Reserved.
            QUALCOMM Proprietary/GTDR
===========================================================================*/

#ifndef BRIDLE_MEDIACMX_H
#define BRIDLE_MEDIACMX_H

#include "cmx.h"
#include "msm/bridle_Media.h"

/*===============================================================================

      BRIDLE SETUP

===============================================================================*/
// Unique ID for the functions invoked in OEM layer
enum {
   OEMMM_DEFINE_BRIDLE_ENUM(MediaCMX)
};

extern uint32 BRIDLE_SUBSYS_NO(MediaCMX);
extern AEEInstanceList  gMediaCMXInstanceList;

/*===============================================================================

      CALLBACK FUNCTIONS.
      Called in CMX context.

===============================================================================*/
extern void CMediaMMLayer_PlayCB(cmx_status_type status, const void * pClientData, cmx_af_server_data_type * psd);
extern void CMediaMMLayer_RingerCB(cmx_status_type status, const void * pClientData);
extern void CMediaMMLayer_StatusCB(cmx_status_type status, const void * pClientData);
extern void CMediaMMLayer_TimeCB(cmx_status_type status, const void * pClientData, uint32 dwTimeMS);
#if defined(FEATURE_QCP) || defined(FEATURE_PCM_REC)
extern void CMediaMMLayer_RecordCB(cmx_status_type status, const void * pClientData);
#endif // FEATURE_QCP || FEATURE_PCM_REC

#if defined(FEATURE_MIDI_OUT)
extern void CMIDIOut_MIDIDeviceCB(cmx_status_type status, const void * pClientData);
extern void CMediaMMLayer_MIDIOutMsgCB(cmx_status_type status, const void * pClientData);

#if defined(FEATURE_MIDI_OUT_QCP)
extern void CMediaMMLayer_MIDIOutQCPStatusCB(cmx_status_type status, const void * pClientData);
extern void CMediaMMLayer_MIDIOutQCPPlayCB(cmx_status_type status, const void * midi_out_qcp_id, const void * pClientData);
#endif // defined(FEATURE_MIDI_OUT_QCP)
#endif // FEATURE_MIDI_OUT
void CMediaMMLayer_CMXDataRequestCB(uint32 position, uint32 max_len, cmx_client_req_cb_func_ptr_type data_req_cb, 
                                           const void *server_client_data, const void *client_data);

/*===============================================================================

      PACKBRIDLE INLINE FUNCTIONS

===============================================================================*/
OEMMM_DEFINE_PACKBRIDLE_API(MediaCMX)

/*===============================================================================

   ParmIDs for OEMMedia_SetParm() and OEMMedia_GetParm().

===============================================================================*/
typedef struct CMXInfo
{
   int16             nType;   // OEMCMX_TYPE_XXX
   cmx_handle_type * ph;      // Set for Start()/TotalTime command
   uint32            dwCB;
   uint32            dwUserData;
} CMXInfo;

typedef struct CMXDataRequest
{
   uint32   dwPos;
   uint32   dwMaxLen;
   cmx_client_req_cb_func_ptr_type pfnDataReq;
   void *   pServerUserData;
} CMXDataRequest;

#define OEMCMX_ID_TYPE              1  // p1 = CMXInfo *, p2/p3 = see comments in OEMCMX_TYPE_XXX
#define OEMCMX_ID_STATUS_CB         2  // p1 = CMXInfo *
#define OEMCMX_ID_TOTALTIME         3  // p1 = CMXInfo *
#define OEMCMX_ID_VOLUME            4  // p1 = Volume
#define OEMCMX_ID_PAN               5  // p1 = Pan
#define OEMCMX_ID_TEMPO             6  // p1 = Tempo
#define OEMCMX_ID_TUNE              7  // p1 = Tune
#define OEMCMX_ID_MIDI_DEVICE       8  // p1 = TRUE/FALSE => Open/Close, p2 = ADECType, p3 = CMXInfo *
#define OEMCMX_ID_CHANNEL           9  // p1 = Channel #
#define OEMCMX_ID_DATA_RESPONSE    10 // p1 = CMXDataRequest *, p2 = uint8 * (pBuf), p3 = sizeof buffer in p2
#define OEMCMX_ID_SEQUENCE         11 // p1 = Sequence, p2 = cmx_audfmt_seq_param_type *
#define OEMCMX_ID_LINK             12 // p1 = link => forward or reverse link for PCM recording operations

#define OEMCMX_TYPE_AUDFMT_PLAY        1  // p2 = CMX_AUDFMT_START_XXX
#define OEMCMX_TYPE_AUDFMT_RINGER      2  // p2 = CMX_AUDFMT_START_XXX, p3 = Pause time
#define OEMCMX_TYPE_QCP_RECORD         3  // p2 = cmx_qcp_rec_para_type *, p3 = TRUE/FALSE => ReverseLink(Local)/ForwardLink
#define OEMCMX_TYPE_MIDI_OUT_MSG       4  //
#define OEMCMX_TYPE_MIDI_OUT_QCP       5  // 
#define OEMCMX_TYPE_AUDFMT_PLAY_CODEC  6  // p2 = cmx_codec_spec_type *
#define OEMCMX_TYPE_AUDFMT_PLAY_MULTI  7  // p2 = cmx_audfmt_multi_param_type *
#define OEMCMX_TYPE_PCM_RECORD         8  // p2 = cmx_pcm_rec_para_type *

#endif // BRIDLE_MEDIACMX_H
