rtsp_session.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 134 行

H
134
字号
/*******************************************************************
 * 
 *  Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: 
 *
 *  Author: Eric Knudstrup
 *  Created: Fri Apr 29 11:13:56 2005
 *
 *******************************************************************/

#ifndef RTSP_SESSION_H
#define RTSP_SESSION_H

/**
 * @file rtsp_session.h
 * Application level interface to the RTSP client.  This code will perform
 * all setup required to connect and begin streaming of a resource via RTP
 * including MPEG Audio, Transport Streams, and audio ES + video ES.
 */

/** @addtogroup rtsp_client */

/*@{*/
/** RTSP session state according to 
 * <A HREF="http://www.ietf.org/rfc/rfc2326.txt">RFC2326</A>  S. A.1,
 * slightly modified */
typedef enum {
    RTSP_STATE_ALLOC,      /**< Session allocated */
    RTSP_STATE_DESCRIBE,   /**< Waiting for SDP file */
    RTSP_STATE_SETUP,      /**< Performing SETUP command(s)*/
    RTSP_STATE_READY,      /**< SETUP confirmed, ready to play */
    RTSP_STATE_PLAYING,    /**< PLAY command succeeded, playing */
    RTSP_STATE_TEARDOWN,   /**< TEARDOWN succeeded. */ 
} RTSPSessState_t;

typedef enum {
    RTSP_SESSION_OK,        /**< Last command succeeded. */
    RTSP_SESSION_NOMEM,     /**< Out of memory */
    RTSP_SESSION_PROTO_ERR, /**< Remote end doesn't speak the protocol the same way we do. */
    RTSP_SESSION_SDP_ERR,   /**< Failed to parse the session description */
    RTSP_SESSION_PT_ERR,    /**< Don't understand the RTP payload type */
    RTSP_SESSION_ECONN,     /**< Connection error */
    RTSP_SESSION_ESETUP,    /**< A stream setup error occured */
    RTSP_SESSION_EAUTH      /**< Authorization failure. */
} RTSPSessionStatus_t;

/**
 * RTSP Session descriptor.  Includes state for RTP streams managed by it.
 */
typedef struct _rtsp_session_s RTSPSession_t;

/** 
 * User callback type for command completion results.  Context is the same
 * as the user_context passed to rtsp_session_create().
 */
typedef void (*RTSPSessionCb_t) (RTSPSession_t *session, void *context);

/*;emacs generated header for file rtsp_session.c. Global function declarations only. */
/**
 * Retrieve the RTSP \a session status.
 */
extern RTSPSessState_t
rtsp_session_get_state(RTSPSession_t *session);

/**
 * Retrieve the RTSP \a session state.
 */
extern RTSPSessionStatus_t
rtsp_session_get_status(RTSPSession_t *session);

/**
 * Tell the server to stop playing with this session and
 * free all context related to it.
 */
extern RTSPCmdResult_t
rtsp_session_teardown(RTSPSession_t *session);

/**
 * Stop playback for this session. Only valid in the PLAYING
 * state.
 */
extern RTSPCmdResult_t
rtsp_session_pause(RTSPSession_t *session);

/**
 * Start playback or modify scale for this session.
 * Only valid in READY or PLAYING state.
 */
extern RTSPCmdResult_t
rtsp_session_play(RTSPSession_t *session, int scale);

/**
 * Destroy all context associated with the session. Playback
 * will stop if started.
 */
extern void
rtsp_session_destroy(RTSPSession_t *session);

/**
 * If the session description wasn't passed into the create function then this
 * will retrieve the SDP (Session Description) and set up the RTSP control and
 * RTP data connections. If this operation succeeds, the completion
 * callback will be called notifying the application that the
 * session is ready to begin playing the stream.
 *
 * @param session The session to initiate.
 *
 * @returns RTSP_CMD_SENT on success. May return RTSP_CMD_ERR_ARG
 * if the session has already been started.
 */
extern RTSPCmdResult_t
rtsp_session_start(RTSPSession_t *session);

/**
 * Allocate a new RTSP session.
 *
 * @param[out] new_session Allocated session.
 * @param[in] uri Parsed Uniform Resource Identifier of the stream.
 * @param[in] sdp_text If this is not NULL, it will be used instead
 * of the RTSP DESCRIBE method.
 * @param[in] session_cb Callback to notify user of state changes.
 * @param[in] user_context Data to be passed to callback.
 */
extern err_t
rtsp_session_create(RTSPSession_t **new_session, URI_t *uri, char *sdp_text,
 RTSPSessionCb_t session_cb, void *user_context);


/*;end emacs generated header for file rtsp_session.c. Global function declarations only. */

#endif
/*@}*/

⌨️ 快捷键说明

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