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

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
mms.c File Reference
`#include <stdio.h>`
`#include <string.h>`
`#include <sys/types.h>`
`#include <stdlib.h>`
`#include <time.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include "bswap.h"`
`#include "http_helper.h"`
`#include "mms.h"`
`#include "../demuxers/asfheader.h"`

## Data Structures
struct | mms_buffer_s
struct | mms_packet_header_s
struct | mms_s

## Macros
#define | ICONV_CONST const
#define | LOG_MODULE "mms"
#define | LOG_VERBOSE
#define | MMST_PORT 1755
#define | BUF_SIZE 102400
#define | CMD_HEADER_LEN 40
#define | CMD_PREFIX_LEN 8
#define | CMD_BODY_LEN 1024
#define | ASF_HEADER_LEN 8192
#define | MMS_PACKET_ERR 0
#define | MMS_PACKET_COMMAND 1
#define | MMS_PACKET_ASF_HEADER 2
#define | MMS_PACKET_ASF_PACKET 3
#define | ASF_HEADER_PACKET_ID_TYPE 2
#define | ASF_MEDIA_PACKET_ID_TYPE 4
#define | D2Q(d)
#define | print_command(data, len)

## Typedefs
typedef struct mms_buffer_s | mms_buffer_t
typedef struct mms_packet_header_s | mms_packet_header_t

## Functions
static void | mms_buffer_init (mms_buffer_t *mms_buffer, char *buffer)
static void | mms_buffer_put_8 (mms_buffer_t *mms_buffer, uint8_t value)
static void | mms_buffer_put_32 (mms_buffer_t *mms_buffer, uint32_t value)
static void | mms_buffer_put_64 (mms_buffer_t *mms_buffer, uint64_t value)
static int | send_command (mms_t *this, int command, uint32_t prefix1, uint32_t prefix2, int length)
static void | string_utf16 (int unused, char *dest, const char *src, int len)
static int | get_packet_header (mms_t *this, mms_packet_header_t *header)
static int | get_packet_command (mms_t *this, uint32_t packet_len)
static int | get_answer (mms_t *this)
static int | get_asf_header (mms_t *this)
static int | interp_asf_header (mms_t *this)
static int | mmst_valid_proto (const char *proto)
static void | report_progress (xine_stream_t *stream, int p)
static int | mms_tcp_connect (mms_t *this)
static void | mms_gen_guid (char guid[])
static int | mms_choose_best_streams (mms_t *this)
mms_t * | mms_connect (xine_stream_t *stream, const char *url, int bandwidth)
static int | get_media_packet (mms_t *this)
size_t | mms_peek_header (mms_t *this, char *data, size_t maxsize)
int | mms_read (mms_t *this, char *data, int len)
void | mms_close (mms_t *this)
uint32_t | mms_get_length (mms_t *this)
off_t | mms_get_current_pos (mms_t *this)
void | mms_set_start_time (mms_t *this, int time_offset)

## Variables
static const char | mmst_proto_s [][8] = { "mms", "mmst", "" }

## Macro Definition Documentation

## ◆ ASF_HEADER_LEN

#define ASF_HEADER_LEN 8192

## ◆ ASF_HEADER_PACKET_ID_TYPE

#define ASF_HEADER_PACKET_ID_TYPE 2

## ◆ ASF_MEDIA_PACKET_ID_TYPE

#define ASF_MEDIA_PACKET_ID_TYPE 4

## ◆ BUF_SIZE

#define BUF_SIZE 102400

## ◆ CMD_BODY_LEN

#define CMD_BODY_LEN 1024

## ◆ CMD_HEADER_LEN

#define CMD_HEADER_LEN 40

## ◆ CMD_PREFIX_LEN

#define CMD_PREFIX_LEN 8

## ◆ D2Q

#define D2Q | ( |  | d | ) |

Value:
({\
union { double db; long long qw; } _tmp;\
_tmp.db = d;\
_tmp.qw;\
})\

## ◆ ICONV_CONST

#define ICONV_CONST const

## ◆ LOG_MODULE

#define LOG_MODULE "mms"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MMS_PACKET_ASF_HEADER

#define MMS_PACKET_ASF_HEADER 2

## ◆ MMS_PACKET_ASF_PACKET

#define MMS_PACKET_ASF_PACKET 3

## ◆ MMS_PACKET_COMMAND

#define MMS_PACKET_COMMAND 1

## ◆ MMS_PACKET_ERR

#define MMS_PACKET_ERR 0

## ◆ MMST_PORT

#define MMST_PORT 1755

## ◆ print_command

#define print_command | ( |  | data,
|  |  | len
| ) |  |

## Typedef Documentation

## ◆ mms_buffer_t

typedef struct mms_buffer_s mms_buffer_t

## ◆ mms_packet_header_t

typedef struct mms_packet_header_s mms_packet_header_t

## Function Documentation

## ◆ get_answer()

static int get_answer | ( | mms_t * | this | ) |
| static

References get_answer(), get_packet_command(), get_packet_header(), MMS_PACKET_ASF_HEADER, MMS_PACKET_ASF_PACKET, MMS_PACKET_COMMAND, MMS_PACKET_ERR, mms_packet_header_s::packet_len, send_command(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by get_answer(), get_asf_header(), mms_choose_best_streams(), and mms_connect().

## ◆ get_asf_header()

static int get_asf_header | ( | mms_t * | this | ) |
| static

References _x_io_tcp_read(), ASF_HEADER_LEN, mms_packet_header_s::flags, get_answer(), get_packet_command(), get_packet_header(), lprintf, MMS_PACKET_ASF_HEADER, MMS_PACKET_ASF_PACKET, MMS_PACKET_COMMAND, MMS_PACKET_ERR, mms_packet_header_s::packet_len, send_command(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by get_media_packet(), and mms_connect().

## ◆ get_media_packet()

static int get_media_packet | ( | mms_t * | this | ) |
| static

References _x_io_tcp_read(), _X_LE_32, ASF_MEDIA_PACKET_ID_TYPE, CMD_HEADER_LEN, get_asf_header(), get_packet_command(), get_packet_header(), interp_asf_header(), lprintf, mms_buffer_init(), mms_buffer_put_32(), mms_buffer_put_8(), mms_choose_best_streams(), MMS_PACKET_ASF_HEADER, MMS_PACKET_ASF_PACKET, MMS_PACKET_COMMAND, MMS_PACKET_ERR, mms_packet_header_s::packet_len, mms_packet_header_s::packet_seq, mms_buffer_s::pos, send_command(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by mms_read().

## ◆ get_packet_command()

static int get_packet_command | ( | mms_t * | this,
|  | uint32_t | packet_len
| ) |  |
| static

References _x_io_tcp_read(), _X_LE_32, lprintf, and print_command.

Referenced by get_answer(), get_asf_header(), and get_media_packet().

## ◆ get_packet_header()

static int get_packet_header | ( | mms_t * | this,
|  | mms_packet_header_t * | header
| ) |  |
| static

References _x_io_tcp_read(), _X_LE_16, _X_LE_32, ASF_HEADER_PACKET_ID_TYPE, BUF_SIZE, mms_packet_header_s::flags, lprintf, MMS_PACKET_ASF_HEADER, MMS_PACKET_ASF_PACKET, MMS_PACKET_COMMAND, MMS_PACKET_ERR, mms_packet_header_s::packet_id_type, mms_packet_header_s::packet_len, and mms_packet_header_s::packet_seq.

Referenced by get_answer(), get_asf_header(), and get_media_packet().

## ◆ interp_asf_header()

static int interp_asf_header | ( | mms_t * | this | ) |
| static

References asf_header_delete(), and asf_header_new().

Referenced by get_media_packet(), and mms_connect().

## ◆ mms_buffer_init()

static void mms_buffer_init | ( | mms_buffer_t * | mms_buffer,
|  | char * | buffer
| ) |  |
| static

References mms_buffer_s::buffer, and mms_buffer_s::pos.

Referenced by get_media_packet(), mms_connect(), mms_read(), and send_command().

## ◆ mms_buffer_put_32()

static void mms_buffer_put_32 | ( | mms_buffer_t * | mms_buffer,
|  | uint32_t | value
| ) |  |
| static

References mms_buffer_s::buffer, and mms_buffer_s::pos.

Referenced by get_media_packet(), mms_connect(), mms_read(), and send_command().

## ◆ mms_buffer_put_64()

static void mms_buffer_put_64 | ( | mms_buffer_t * | mms_buffer,
|  | uint64_t | value
| ) |  |
| static

References mms_buffer_s::buffer, and mms_buffer_s::pos.

Referenced by mms_read().

## ◆ mms_buffer_put_8()

static void mms_buffer_put_8 | ( | mms_buffer_t * | mms_buffer,
|  | uint8_t | value
| ) |  |
| static

References mms_buffer_s::buffer, and mms_buffer_s::pos.

Referenced by get_media_packet(), mms_connect(), and mms_read().

## ◆ mms_choose_best_streams()

static int mms_choose_best_streams | ( | mms_t * | this | ) |
| static

References asf_header_choose_streams(), get_answer(), lprintf, send_command(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by get_media_packet(), and mms_connect().

## ◆ mms_close()

void mms_close | ( | mms_t * | this | ) |

References _x_io_tcp_close(), _x_url_cleanup(), and asf_header_delete().

Referenced by mms_plugin_dispose().

## ◆ mms_connect()

mms_t * mms_connect | ( | xine_stream_t * | stream,
|  | const char * | url,
|  | int | bandwidth
| ) |  |

References _x_io_tcp_close(), _x_mrl_unescape(), _x_url_cleanup(), _x_url_parse2(), ASF_HEADER_PACKET_ID_TYPE, ASF_MEDIA_PACKET_ID_TYPE, CMD_HEADER_LEN, CMD_PREFIX_LEN, get_answer(), get_asf_header(), ICONV_CONST, interp_asf_header(), lprintf, mms_buffer_init(), mms_buffer_put_32(), mms_buffer_put_8(), mms_choose_best_streams(), mms_gen_guid(), mms_tcp_connect(), mmst_valid_proto(), NULL, mms_buffer_s::pos, report_progress(), send_command(), string_utf16(), xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by mms_plugin_open().

## ◆ mms_gen_guid()

static void mms_gen_guid | ( | char | guid[] | ) |
| static

References NULL.

Referenced by mms_connect().

## ◆ mms_get_current_pos()

off_t mms_get_current_pos | ( | mms_t * | this | ) |

Referenced by mms_plugin_get_current_pos(), mms_plugin_seek(), and mms_plugin_seek_time().

## ◆ mms_get_length()

uint32_t mms_get_length | ( | mms_t * | this | ) |

Referenced by mms_plugin_get_length().

## ◆ mms_peek_header()

size_t mms_peek_header | ( | mms_t * | this,
|  | char * | data,
|  | size_t | maxsize
| ) |  |

Referenced by mms_plugin_get_optional_data().

## ◆ mms_read()

int mms_read | ( | mms_t * | this,
|  | char * | data,
|  | int | len
| ) |  |

References ASF_MEDIA_PACKET_ID_TYPE, D2Q, get_media_packet(), mms_buffer_init(), mms_buffer_put_32(), mms_buffer_put_64(), mms_buffer_put_8(), mms_buffer_s::pos, send_command(), xine_fast_memcpy, XINE_VERBOSITY_LOG, and xprintf.

Referenced by mms_plugin_read().

## ◆ mms_set_start_time()

void mms_set_start_time | ( | mms_t * | this,
|  | int | time_offset
| ) |  |

Referenced by mms_plugin_seek_time().

## ◆ mms_tcp_connect()

static int mms_tcp_connect | ( | mms_t * | this | ) |
| static

References _x_io_select(), _x_io_tcp_connect(), lprintf, MMST_PORT, report_progress(), XINE_VERBOSITY_LOG, XIO_READY, XIO_TIMEOUT, XIO_WRITE_READY, and xprintf.

Referenced by mms_connect().

## ◆ mmst_valid_proto()

static int mmst_valid_proto | ( | const char * | proto | ) |
| static

References lprintf, and mmst_proto_s.

Referenced by mms_connect().

## ◆ report_progress()

static void report_progress | ( | xine_stream_t * | stream,
|  | int | p
| ) |  |
| static

References _, xine_progress_data_t::description, xine_progress_data_t::percent, XINE_EVENT_PROGRESS, and xine_event_send().

Referenced by mms_connect(), and mms_tcp_connect().

## ◆ send_command()

static int send_command | ( | mms_t * | this,
|  | int | command,
|  | uint32_t | prefix1,
|  | uint32_t | prefix2,
|  | int | length
| ) |  |
| static

References _x_io_tcp_write(), CMD_HEADER_LEN, CMD_PREFIX_LEN, mms_buffer_init(), mms_buffer_put_32(), and print_command.

Referenced by get_answer(), get_asf_header(), get_media_packet(), mms_choose_best_streams(), mms_connect(), and mms_read().

## ◆ string_utf16()

static void string_utf16 | ( | int | unused,
|  | char * | dest,
|  | const char * | src,
|  | int | len
| ) |  |
| static

Referenced by mms_connect().

## Variable Documentation

## ◆ mmst_proto_s

const char mmst_proto_s[][8] = { "mms", "mmst", "" }
| static

Referenced by mmst_valid_proto().