
#ifndef __STREAM_MGR_MSG_H__
#define __STREAM_MGR_MSG_H__

#include "ssi.h"
#include "table_structs.h"
#include "rtsppub.h"
#include "ss_global.h"


typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.

	S8	DevID[RTSP_MAX_DEVID_SIZE];  // Client request info.
	RtspScaleMode_e Scale;											 // scale of the stream, speed, FF or RR;
	RtspPlayMode_e PlayMode;										 //play mode , live or normal
	RtspLocation_e LocationFlag;								  //flag to indicate to play a single file or play from the time point 
	S8	FilePath[VS_FILE_PATH_LEN]; 	  // play this file
	S32 FileOffset; 						//offset of the file, unit 1s, -1 indicate currentTime
	WS_timeval TimePos; 								 // play from this timestamp, maybe need a time structure.
	RtspMediaType_e MediaType;  
	
	U32 firstSend; 

	RtspStreamProto_e  StreamProto;
	U32 StreamIP;		 // Streaming Server address for recv stream
	U16 StreamPort; 	 // Streaming Server RTP/UDP port for stream transport.

}Play_t;

typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.
	RtspErrorCode_e CmdAck;

	VIDEO_PARAM  VideoParam;							 //video decoder parameter
	AUDIO_PARAM  AudioParam;							 // audio decoder param
	RtspMediaType_e  MediaType;

	S8	FilePath[VS_FILE_PATH_LEN];
	WS_timeval FileStartTime;
	S32  FileLen;
	U32 FileOffset; //
	U32  TimeStamp;

}PlayAck_t;

typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.	

}Pause_t;

typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.
	RtspErrorCode_e CmdAck;

}PauseAck_t;

typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.		

	S8	FilePath[VS_FILE_PATH_LEN];
	WS_timeval FileStartTime;
	S32  FileLen;
	U32  TimeStamp;

	VIDEO_PARAM  VideoParam;							 //video decoder parameter
	AUDIO_PARAM  AudioParam;							 // audio decoder param
	RtspMediaType_e  MediaType;
	
}SetParam_t;

typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.
	RtspErrorCode_e CmdAck;

}SetParamAck_t;


typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.			

}Teardown_t;

typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.
	RtspErrorCode_e CmdAck;	
}TeardownAck_t;


typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.	

}PlayNext_t;

typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.
	RtspErrorCode_e CmdAck;

	S8	FilePath[VS_FILE_PATH_LEN];
	WS_timeval FileStartTime;
	S32  FileLen;
	U32  TimeStamp;

	VIDEO_PARAM  VideoParam;							 //video decoder parameter
	AUDIO_PARAM  AudioParam;							 // audio decoder param		
	RtspMediaType_e  MediaType;

}PlayNextAck_t;


typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.	

}PlayQuery_t;

typedef struct
{
	U32 CmdSeq;	
	U32 SessionID;	   // session ID from Server to Client.
	RtspErrorCode_e CmdAck;	

	RtspStreamState_e streamState;	//流状态

}PlayQueryAck_t;



typedef struct
{
	union
	{
		Play_t play; //RTSP_MSG_DVR_PLAY
		PlayAck_t playAck; //RTSP_MSG_DVR_PLAY_ACK

		Pause_t pause; //RTSP_MSG_PAUSE
		PauseAck_t pauseAck; //RTSP_MSG_PAUSE_ACK

		Teardown_t teardown; //RTSP_MSG_TEARDOWN
		TeardownAck_t  teardownAck; //RTSP_MSG_TEARDOWN_ACK

		SetParam_t   setParam; //RTSP_MSG_SETPARAMETER
		SetParamAck_t setParamAck; //RTSP_MSG_SETPARAMETER_ACK

		PlayNext_t  playNext; //RTSP_MSG_PLAYNEXTFILE
		PlayNextAck_t playNextAck; //RTSP_MSG_PLAYNEXTFILE_ACK

		PlayQuery_t  playQuery; //RTSP_MSG_PLAYQUERY
		PlayQueryAck_t playQueryAck; //RTSP_MSG_PLAYQUERY_ACK
		
	}u;
	
}StreamMgrMsgBody_t;


typedef struct
{
	U32 cmdType;   //see RTSP_MSG_* 
	U32 DevIP;				//由ADAPTER 设置,用于建立VMX转发表
	S8  DevID[RTSP_MAX_DEVID_SIZE]; 
}StreamMgrMsgHead_t;


typedef struct
{
	StreamMgrMsgHead_t head;
	StreamMgrMsgBody_t body;
}StreamMgrMsg_t;


#endif


