xine-lib: xine-lib-1.2.12/src/input/librtsp/rtsp.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Functions | Variables
rtsp.c File Reference
`#include <stdio.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <sys/types.h>`
`#include "rtsp.h"`
`#include <xine/io_helper.h>`
`#include <xine/xineutils.h>`

## Data Structures
struct | rtsp_s

## Macros
#define | LOG_MODULE "rtsp"
#define | LOG_VERBOSE
#define | BUF_SIZE 4096
#define | HEADER_SIZE 1024
#define | MAX_FIELDS 256
#define | RTSP_CONNECTED 1
#define | RTSP_INIT 2
#define | RTSP_READY 4
#define | RTSP_PLAYING 8
#define | RTSP_RECORDING 16
#define | RTSP_OPTIONS 0x001
#define | RTSP_DESCRIBE 0x002
#define | RTSP_ANNOUNCE 0x004
#define | RTSP_SETUP 0x008
#define | RTSP_GET_PARAMETER 0x010
#define | RTSP_SET_PARAMETER 0x020
#define | RTSP_TEARDOWN 0x040
#define | RTSP_PLAY 0x080
#define | RTSP_RECORD 0x100

## Functions
static char * | rtsp_get (rtsp_t *s)
static int | rtsp_put (rtsp_t *s, const char *string)
static int | rtsp_get_code (rtsp_t *s, const char *string)
static void | rtsp_send_request (rtsp_t *s, const char *type, const char *what)
static void | rtsp_schedule_standard (rtsp_t *s)
static int | rtsp_get_answers (rtsp_t *s)
int | rtsp_send_ok (rtsp_t *s)
int | rtsp_request_options (rtsp_t *s, const char *what)
int | rtsp_request_describe (rtsp_t *s, const char *what)
int | rtsp_request_setup (rtsp_t *s, const char *what)
int | rtsp_request_setparameter (rtsp_t *s, const char *what)
int | rtsp_request_play (rtsp_t *s, const char *what)
int | rtsp_read_data (rtsp_t *s, void *buffer_gen, unsigned int size)
static void | rtsp_basicauth (const char *user, const char *password, char **dest)
rtsp_t * | rtsp_connect (xine_stream_t *stream, const char *mrl, const char *user_agent)
void | rtsp_close (rtsp_t *s)
const char * | rtsp_search_answers (rtsp_t *s, const char *tag)
char * | rtsp_get_mrl (rtsp_t *s)
void | rtsp_schedule_field (rtsp_t *s, const char *string)
void | rtsp_unschedule_all (rtsp_t *s)
void | rtsp_free_answers (rtsp_t *s)

## Variables
static const char | rtsp_protocol_version [] ="RTSP/1.0"

## Macro Definition Documentation

## ◆ BUF_SIZE

#define BUF_SIZE 4096

## ◆ HEADER_SIZE

#define HEADER_SIZE 1024

## ◆ LOG_MODULE

#define LOG_MODULE "rtsp"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MAX_FIELDS

#define MAX_FIELDS 256

## ◆ RTSP_ANNOUNCE

#define RTSP_ANNOUNCE 0x004

## ◆ RTSP_CONNECTED

#define RTSP_CONNECTED 1

## ◆ RTSP_DESCRIBE

#define RTSP_DESCRIBE 0x002

## ◆ RTSP_GET_PARAMETER

#define RTSP_GET_PARAMETER 0x010

## ◆ RTSP_INIT

#define RTSP_INIT 2

## ◆ RTSP_OPTIONS

#define RTSP_OPTIONS 0x001

## ◆ RTSP_PLAY

#define RTSP_PLAY 0x080

## ◆ RTSP_PLAYING

#define RTSP_PLAYING 8

## ◆ RTSP_READY

#define RTSP_READY 4

## ◆ RTSP_RECORD

#define RTSP_RECORD 0x100

## ◆ RTSP_RECORDING

#define RTSP_RECORDING 16

## ◆ RTSP_SET_PARAMETER

#define RTSP_SET_PARAMETER 0x020

## ◆ RTSP_SETUP

#define RTSP_SETUP 0x008

## ◆ RTSP_TEARDOWN

#define RTSP_TEARDOWN 0x040

## Function Documentation

## ◆ rtsp_basicauth()

static void rtsp_basicauth | ( | const char * | user,
|  | const char * | password,
|  | char ** | dest
| ) |  |
| static

References xine_base64_encode().

Referenced by rtsp_connect().

## ◆ rtsp_close()

void rtsp_close | ( | rtsp_t * | s | ) |

References _x_io_tcp_close(), rtsp_s::auth, rtsp_s::host, rtsp_s::mrl, rtsp_s::path, rtsp_free_answers(), rtsp_unschedule_all(), rtsp_s::s, rtsp_s::session, rtsp_s::stream, and rtsp_s::user_agent.

Referenced by rtsp_connect(), rtsp_session_end(), and rtsp_session_start().

## ◆ rtsp_connect()

rtsp_t * rtsp_connect | ( | xine_stream_t * | stream,
|  | const char * | mrl,
|  | const char * | user_agent
| ) |  |

References _, _x_asprintf(), _x_io_tcp_connect(), rtsp_s::answers, rtsp_s::auth, rtsp_s::cseq, rtsp_s::host, lprintf, MAX_FIELDS, rtsp_s::mrl, NULL, rtsp_s::path, rtsp_s::port, rtsp_basicauth(), rtsp_close(), rtsp_request_options(), rtsp_schedule_field(), rtsp_s::s, rtsp_s::scheduled, rtsp_s::server, rtsp_s::server_caps, rtsp_s::session, rtsp_s::stream, rtsp_s::user_agent, xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by rtsp_session_start().

## ◆ rtsp_free_answers()

void rtsp_free_answers | ( | rtsp_t * | s | ) |

References rtsp_s::answers, and NULL.

Referenced by rtsp_close(), and rtsp_get_answers().

## ◆ rtsp_get()

static char * rtsp_get | ( | rtsp_t * | s | ) |
| static

References _x_io_tcp_read_line(), BUF_SIZE, lprintf, NULL, rtsp_s::s, rtsp_s::stream, and string.

Referenced by rtsp_get_answers(), and rtsp_read_data().

## ◆ rtsp_get_answers()

static int rtsp_get_answers | ( | rtsp_t * | s | ) |
| static

References rtsp_s::answers, code, rtsp_s::cseq, lprintf, MAX_FIELDS, NULL, rtsp_free_answers(), rtsp_get(), rtsp_get_code(), rtsp_schedule_standard(), rtsp_s::server, rtsp_s::session, rtsp_s::stream, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by rtsp_request_describe(), rtsp_request_options(), rtsp_request_play(), rtsp_request_setparameter(), and rtsp_request_setup().

## ◆ rtsp_get_code()

static int rtsp_get_code | ( | rtsp_t * | s,
|  | const char * | string
| ) |  |
| static

References _x_message(), code, rtsp_s::mrl, NULL, rtsp_protocol_version, RTSP_STATUS_SET_PARAMETER, rtsp_s::stream, xine_stream_s::xine, XINE_MSG_AUTHENTICATION_NEEDED, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by rtsp_get_answers().

## ◆ rtsp_get_mrl()

char * rtsp_get_mrl | ( | rtsp_t * | s | ) |

References rtsp_s::mrl.

Referenced by real_setup_and_get_header().

## ◆ rtsp_put()

static int rtsp_put | ( | rtsp_t * | s,
|  | const char * | string
| ) |  |
| static

References _x_io_tcp_write(), lprintf, rtsp_s::s, and rtsp_s::stream.

Referenced by rtsp_read_data(), rtsp_send_ok(), and rtsp_send_request().

## ◆ rtsp_read_data()

int rtsp_read_data | ( | rtsp_t * | s,
|  | void * | buffer_gen,
|  | unsigned int | size
| ) |  |

References _x_asprintf(), _x_io_tcp_read(), lprintf, rtsp_get(), rtsp_put(), rtsp_s::s, and rtsp_s::stream.

Referenced by real_get_rdt_chunk(), and real_setup_and_get_header().

## ◆ rtsp_request_describe()

int rtsp_request_describe | ( | rtsp_t * | s,
|  | const char * | what
| ) |  |

References _x_asprintf(), rtsp_s::host, rtsp_s::path, rtsp_s::port, rtsp_get_answers(), and rtsp_send_request().

Referenced by real_setup_and_get_header().

## ◆ rtsp_request_options()

int rtsp_request_options | ( | rtsp_t * | s,
|  | const char * | what
| ) |  |

References _x_asprintf(), rtsp_s::host, rtsp_s::port, rtsp_get_answers(), and rtsp_send_request().

Referenced by rtsp_connect().

## ◆ rtsp_request_play()

int rtsp_request_play | ( | rtsp_t * | s,
|  | const char * | what
| ) |  |

References _x_asprintf(), rtsp_s::host, rtsp_s::path, rtsp_s::port, rtsp_get_answers(), and rtsp_send_request().

Referenced by rtsp_session_play().

## ◆ rtsp_request_setparameter()

int rtsp_request_setparameter | ( | rtsp_t * | s,
|  | const char * | what
| ) |  |

References _x_asprintf(), rtsp_s::host, rtsp_s::path, rtsp_s::port, rtsp_get_answers(), and rtsp_send_request().

Referenced by real_setup_and_get_header().

## ◆ rtsp_request_setup()

int rtsp_request_setup | ( | rtsp_t * | s,
|  | const char * | what
| ) |  |

References rtsp_get_answers(), and rtsp_send_request().

Referenced by real_setup_and_get_header().

## ◆ rtsp_schedule_field()

void rtsp_schedule_field | ( | rtsp_t * | s,
|  | const char * | string
| ) |  |

References rtsp_s::scheduled.

Referenced by real_setup_and_get_header(), rtsp_connect(), rtsp_schedule_standard(), and rtsp_session_play().

## ◆ rtsp_schedule_standard()

static void rtsp_schedule_standard | ( | rtsp_t * | s | ) |
| static

References _x_asprintf(), rtsp_s::cseq, rtsp_schedule_field(), and rtsp_s::session.

Referenced by rtsp_get_answers().

## ◆ rtsp_search_answers()

const char * rtsp_search_answers | ( | rtsp_t * | s,
|  | const char * | tag
| ) |  |

References rtsp_s::answers, and NULL.

Referenced by real_setup_and_get_header(), and rtsp_session_start().

## ◆ rtsp_send_ok()

int rtsp_send_ok | ( | rtsp_t * | s | ) |

References rtsp_s::cseq, and rtsp_put().

Referenced by real_setup_and_get_header().

## ◆ rtsp_send_request()

static void rtsp_send_request | ( | rtsp_t * | s,
|  | const char * | type,
|  | const char * | what
| ) |  |
| static

References _x_asprintf(), rtsp_s::auth, rtsp_protocol_version, rtsp_put(), rtsp_unschedule_all(), rtsp_s::scheduled, and type.

Referenced by rtsp_request_describe(), rtsp_request_options(), rtsp_request_play(), rtsp_request_setparameter(), and rtsp_request_setup().

## ◆ rtsp_unschedule_all()

void rtsp_unschedule_all | ( | rtsp_t * | s | ) |

References NULL, and rtsp_s::scheduled.

Referenced by rtsp_close(), and rtsp_send_request().

## Variable Documentation

## ◆ rtsp_protocol_version

const char rtsp_protocol_version[] ="RTSP/1.0"
| static

Referenced by rtsp_get_code(), and rtsp_send_request().