/***************************************************
CopyRight: 天视通电子科技有限公司
Version : 0.0.1
Filename : rtspmsg.h
Description :  准RTSP消息定义

Creation : ken  26/03/2010
Modification :

****************************************************/

#ifndef RTSPMSG_H
#define RTSPMSG_H

#include "ss_global.h"
#include "rtsppub.h"


typedef struct
{
	U32 CmdSeq;							// RTSP CSeq.
	U32 SessionID;						 // session ID from Server to Client.
	
	S8 UserID[RTSP_MAX_USERID_SIZE]; 
	S8	DevID[RTSP_MAX_DEVID_SIZE];	
}RtspSetup_t;

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

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

}RtspSetupAck_t;

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; 
	
}RtspPlay_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; 
//	U32 nFrameIndex;//为0表示无效
}RtspPlayAck_t;

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

}RtspPause_t;

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

}RtspPauseAck_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;
	
}RtspSetParam_t;

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

}RtspSetParamAck_t;


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

}RtspTeardown_t;

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


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; 

}RtspDvrPlay_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;

}RtspDvrPlayAck_t;


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

}RtspPlayNext_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;
	
}RtspPlayNextAck_t;


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

}RtspOpenHole_t;

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

}RtspOpenHoleAck_t;


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

}RtspPlayQuery_t;

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

	RtspStreamState_e streamState;	//流状态

}RtspPlayQueryAck_t;


typedef struct
{
	union
	{
		RtspSetup_t setup;
		RtspSetupAck_t setupAck;
		
		RtspPlay_t   play;
		RtspPlayAck_t  playAck;

		RtspPause_t  pause;
		RtspPauseAck_t pauseAck;

		RtspSetParam_t  setParam;
		RtspSetParamAck_t setParamAck;

		RtspTeardown_t  teardown;
		RtspTeardownAck_t teardownAck;

		RtspDvrPlay_t  dvrPlay;
		RtspDvrPlayAck_t dvrPlayAck;

		RtspPlayNext_t  playNext;
		RtspPlayNextAck_t  playNextAck;

		RtspOpenHole_t   openHole;
		RtspOpenHoleAck_t  openHoleAck;

		RtspPlayQuery_t  playQuery;
		RtspPlayQueryAck_t playQueryAck;
		
	}u;
}RtspMsgBody_t;


typedef struct 
{
	MSMsgHead_t   head;
	RtspMsgBody_t body;
}RtspMsg_t;


#endif

