⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hxrtsp2.h

📁 著名的 helix realplayer 基于手机 symbian 系统的 播放器全套源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* ***** BEGIN LICENSE BLOCK ***** 
 * Version: RCSL 1.0/RPSL 1.0 
 *  
 * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
 *      
 * The contents of this file, and the files included with this file, are 
 * subject to the current version of the RealNetworks Public Source License 
 * Version 1.0 (the "RPSL") available at 
 * http://www.helixcommunity.org/content/rpsl unless you have licensed 
 * the file under the RealNetworks Community Source License Version 1.0 
 * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
 * in which case the RCSL will apply. You may also obtain the license terms 
 * directly from RealNetworks.  You may not use this file except in 
 * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
 * applicable to this file, the RCSL.  Please see the applicable RPSL or 
 * RCSL for the rights, obligations and limitations governing use of the 
 * contents of the file.  
 *  
 * This file is part of the Helix DNA Technology. RealNetworks is the 
 * developer of the Original Code and owns the copyrights in the portions 
 * it created. 
 *  
 * This file, and the files included with this file, is distributed and made 
 * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
 * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
 * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
 * 
 * Technology Compatibility Kit Test Suite(s) Location: 
 *    http://www.helixcommunity.org/content/tck 
 * 
 * Contributor(s): 
 *  
 * ***** END LICENSE BLOCK ***** */ 

#ifndef _HXRTSP2_H_
#define _HXRTSP2_H_

#include "hxcom.h"
#include "hxtypes.h"

class RTSPTransport;

typedef _INTERFACE	IHXTCPSocket		IHXTCPSocket;
typedef _INTERFACE	IHXBuffer		IHXBuffer;
typedef _INTERFACE	IHXList		IHXList;
typedef _INTERFACE	IHXListIterator	IHXListIterator;
typedef _INTERFACE	IHXMIMEParameter	IHXMIMEParameter;
typedef _INTERFACE	IHXMIMEField		IHXMIMEField;
typedef _INTERFACE	IHXMIMEHeader		IHXMIMEHeader;
typedef _INTERFACE	IHXRTSPMessage		IHXRTSPMessage;
typedef _INTERFACE	IHXRTSPRequestMessage	IHXRTSPRequestMessage;
typedef _INTERFACE	IHXRTSPResponseMessage	IHXRTSPResponseMessage;
typedef _INTERFACE	IHXRTSPInterleavedPacket IHXRTSPInterleavedPacket;
typedef _INTERFACE	IHXRTSPConsumer	 IHXRTSPConsumer;
typedef _INTERFACE	IHXRTSPProtocolResponse IHXRTSPProtocolResponse;
typedef _INTERFACE	IHXRTSPProtocol	IHXRTSPProtocol;

/*
 * RTSP message limits:
 *
 *   Max pending bytes: 64k
 *     This is the upper bound on any portion of an RTSP message (command,
 *     header, packet, entity).
 *
 *   Max header size: 64k
 *   Max headers: 100
 *     I thought about restricting header length to something smallor than
 *     the default 64k but that isn't really practical.  Some headers such
 *     as RTP-Info contain urls and so we must allow headers to be as long
 *     as the command line.
 *
 *   Max entity size: 64k
 *     Entities are only used in our system for SDP.  A typical SDP block is
 *     around 4k, so this should leave plenty of room.
 */
#define RTSP_MAX_PENDING_BYTES  (64*1024)
#define RTSP_MAX_COMMAND_SIZE   (64*1024)
#define RTSP_MAX_HEADER_SIZE    (64*1024)
#define RTSP_MAX_HEADER_COUNT   100
#define RTSP_MAX_ENTITY_SIZE    (64*1024)
// No packet limit needed, 64k is physical maximum

enum RTSPMethod
{
      RTSP_UNKNOWN
    , RTSP_ANNOUNCE
    , RTSP_DESCRIBE
    , RTSP_GET_PARAM
    , RTSP_OPTIONS
    , RTSP_PAUSE
    , RTSP_PLAY
    , RTSP_RECORD
    , RTSP_REDIRECT
    , RTSP_SETUP
    , RTSP_SET_PARAM
    , RTSP_TEARDOWN
    , RTSP_EXTENSION
    , RTSP_RESP
};

#define RTSP_VERB_NONE       0
#define RTSP_VERB_ANNOUNCE   1
#define RTSP_VERB_DESCRIBE   2
#define RTSP_VERB_GETPARAM   3
#define RTSP_VERB_OPTIONS    4
#define RTSP_VERB_PAUSE      5
#define RTSP_VERB_PLAY       6
#define RTSP_VERB_RECORD     7
#define RTSP_VERB_REDIRECT   8
#define RTSP_VERB_SETUP      9
#define RTSP_VERB_SETPARAM  10
#define RTSP_VERB_TEARDOWN  11
#define RTSP_VERB_EXTENSION 12

#define RTSP_RES_AGAIN   1
#define RTSP_RES_DONE    2
#define RTSP_RES_PARTIAL 3
#define RTSP_RES_INVALID 4

#define RS_READY    1
#define RS_HDR      2
#define RS_DATA     3
#define RS_FIN      4

/*
 * Simple MIME headers:
 *   "CSeq: 5"
 *   "Content-Type: application/sdp"
 *
 * Non-simple MIME headers:
 *   "Foo:"
 *   "Transport: rdt;cp=6970;mode=play,rtp;cp=6970;mode=play"
 *
 *   In the last example, the fields are "rdt;client_port=6970;mode=play"
 *   and "rtp;client_port=6970;mode=play".  Each field is composed of a
 *   list of parameters.  Each parameter is an attr/value pair.  The value
 *   for any parameter may be NULL (non-existent).  Example:
 *
 *   attr  value
 *   ----  -----
 *   rdt   NULL
 *   cp    6970
 *   mode  play
 */

// IHXMIMEParameter: 8ae57afa-902c-4327-8c00-315785cdc243
DEFINE_GUID(IID_IHXMIMEParameter, 0x8ae57afa, 0x902c, 0x4327,
            0x8c, 0x00, 0x31, 0x57, 0x85, 0xcd, 0xc2, 0x43);

#undef  INTERFACE
#define INTERFACE   IHXMIMEParameter

DECLARE_INTERFACE_(IHXMIMEParameter, IUnknown)
{
    // IUnknown
    STDMETHOD(QueryInterface)       (THIS_ REFIID riid, void** ppvObj) PURE;
    STDMETHOD_(ULONG32,AddRef)      (THIS) PURE;
    STDMETHOD_(ULONG32,Release)     (THIS) PURE;

    // IHXMIMEParameter
    STDMETHOD_(UINT32,GetSize)      (THIS) PURE;
    STDMETHOD_(UINT32,Write)        (THIS_ BYTE* pbuf) PURE;
    STDMETHOD(Get)                  (THIS_ REF(IHXBuffer*) pbufAttr,
                                           REF(IHXBuffer*) pbufVal) PURE;
    STDMETHOD(Set)                  (THIS_ IHXBuffer* pbufAttr,
                                           IHXBuffer* pbufVal) PURE;
};

/*
 * A MIME field consists of zero or more parameters.  A parameter consists
 * of exactly one attr/value pair.  The value may be NULL (not present) as
 * in "rdt" above.  The parameters may be iterated with the GetFirstParam/
 * GetNextParam methods.
 *
 * Lazy parsing is used for incoming fields.  The first call to
 * GetFirstParam parses the parameters (but does no copying).  All calls to
 * parameter-related methods for incoming fields will fail until
 * GetFirstParam is called.
 *
 * A parameter may be added using InsertParam or AppendParam.  The
 * InsertParam method takes three arguments.  The first is a position
 * marker.  The second and third are the new parameter, which will be
 * inserted after the marker.  If the marker is NULL, it denotes the head of
 * the list.  The "current" parameter is reset to the first parameter.  This
 * method is O(1) if the marker is NULL and O(n) if not.  The AppendParam
 * method appends the new parameter at the tail of the list.  The "current"
 * parameter remains the same.  This method is O(1).
 *
 * A parameter may be removed using RemoveParam or RemoveCurrentParam.  The
 * RemoveParam method takes a pointer to the parameter attribute to be
 * removed.  This method is O(n).  The RemoveCurrentParam method removes the
 * parameter that was last returned in GetFirstParam/GetNextParam.  The new
 * "current" parameter is the next parameter, if any.  This method is O(1).
 *
 * A parameter's value may be changed using SetValue or SetCurrentValue. 
 * The SetValue method takes a pointer to the parameter attribute to be
 * changed.  This method is O(n).  The SetCurrentValue method changes the
 * parameter that was last returned in GetFirstParam/GetNextParam.  This
 * method is O(1).
 */
// IHXMIMEField: 0946eed6-0501-4fc3-94bb-3023a0e523c7
DEFINE_GUID(IID_IHXMIMEField, 0x946eed6, 0x0501, 0x4fc3,
            0x94, 0xbb, 0x30, 0x23, 0xa0, 0xe5, 0x23, 0xc7);

#undef  INTERFACE
#define INTERFACE   IHXMIMEField

DECLARE_INTERFACE_(IHXMIMEField, IUnknown)
{
    // IUnknown
    STDMETHOD(QueryInterface)       (THIS_ REFIID riid, void** ppvObj) PURE;
    STDMETHOD_(ULONG32,AddRef)      (THIS) PURE;
    STDMETHOD_(ULONG32,Release)     (THIS) PURE;

    // IHXMIMEField
    STDMETHOD_(UINT32,GetSize)      (THIS) PURE;
    STDMETHOD_(UINT32,Write)        (THIS_ BYTE* pbuf) PURE;
    STDMETHOD(GetFirstParam)        (THIS_
    				    REF(IHXMIMEParameter*) pParam) PURE;
    STDMETHOD(GetParamList)         (THIS_ REF(IHXList*) plistParam) PURE;
    STDMETHOD(GetParamListConst)    (THIS_ REF(IHXList*) plistParam) PURE;
};

/*
 * A MIME header is a "key: val" pair, eg. "CSeq: 5".  The value consists of
 * zero or more fields. For simple cases, the value is exactly one field
 * with exactly one token and may be retrieved as a specified type with the
 * GetValueAs methods.  For non-simple cases, the value is a list of fields
 * which may be iterated with the GetFirstField/GetNextField methods.
 *
 * Lazy parsing is used for incoming headers.  The first call to
 * GetFirstField parses the fields (but does no copying).  All calls to
 * field-related methods for incoming headers will fail until GetFirstField
 * is called.
 *
 * A field may be added using InsertField or AppendField.  The InsertField
 * method takes two arguments.  The first is a position marker.  The second
 * is the new field, which will be inserted after the marker.  If the marker
 * is NULL, it denotes the head of the list.  The "current" field is reset
 * to the first field.  This method is O(1) if the marker is NULL and O(n)
 * if not.  The AppendField method appends the new field at the tail of the
 * list.  The "current" field remains the same.  This method is O(1).
 *
 * A field may be removed using RemoveField or RemoveCurrentField.  The
 * RemoveField method takes a pointer to the field to be removed.  This
 * method is O(n).  The RemoveCurrentField method removes the field that was
 * last returned in GetFirstField/GetNextField.  The new "current" field is
 * the next field, if any.  This method is O(1).
 */
// IHXMIMEHeader: 97e681a3-bd71-4b81-8fa0-81199e799ae7
DEFINE_GUID(IID_IHXMIMEHeader, 0x97e681a3, 0xbd71, 0x4b81,
            0x8f, 0xa0, 0x81, 0x19, 0x9e, 0x79, 0x9a, 0xe7);

#undef  INTERFACE
#define INTERFACE   IHXMIMEHeader

DECLARE_INTERFACE_(IHXMIMEHeader, IUnknown)
{
    // IUnknown
    STDMETHOD(QueryInterface)       (THIS_ REFIID riid, void** ppvObj) PURE;
    STDMETHOD_(ULONG32,AddRef)      (THIS) PURE;
    STDMETHOD_(ULONG32,Release)     (THIS) PURE;

    // IHXMIMEHeader
    STDMETHOD_(void,ReplaceDelimiters)(THIS_ 
    				    BOOL bReplaceDelimiters,
				    int nReplacementDelimiter) PURE;
    STDMETHOD_(UINT32,GetSize)      (THIS) PURE;
    STDMETHOD_(UINT32,Write)        (THIS_ BYTE* pbuf) PURE;
    STDMETHOD(GetKey)               (THIS_ REF(IHXBuffer*)pbufKey) PURE;
    STDMETHOD(SetKey)               (THIS_ IHXBuffer* pbufKey) PURE;
    STDMETHOD(GetFirstField)        (THIS_ REF(IHXMIMEField*) pField) PURE;
    STDMETHOD(GetFieldList)         (THIS_ REF(IHXList*) plistFields) PURE;
    STDMETHOD(GetFieldListConst)    (THIS_ REF(IHXList*) plistFields) PURE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -