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

xine-lib 1.2.12

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

## Data Structures
struct | mmsh_s

## Macros
#define | LOG_MODULE "mmsh"
#define | LOG_VERBOSE
#define | USERAGENT "User-Agent: NSPlayer/4.1.0.3856\r\n"
#define | CLIENTGUID "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}\r\n"
#define | MMSH_PORT 80
#define | MMSH_UNKNOWN 0
#define | MMSH_SEEKABLE 1
#define | MMSH_LIVE 2
#define | CHUNK_HEADER_LENGTH 4
#define | EXT_HEADER_LENGTH 8
#define | CHUNK_TYPE_RESET 0x4324
#define | CHUNK_TYPE_DATA 0x4424
#define | CHUNK_TYPE_END 0x4524
#define | CHUNK_TYPE_ASF_HEADER 0x4824
#define | CHUNK_SIZE 65536 /* max chunk size */
#define | ASF_HEADER_SIZE 8192 /* max header size */
#define | SCRATCH_SIZE 1024
#define | mmsh_FirstRequest
#define | mmsh_SeekableRequest
#define | mmsh_LiveRequest

## Functions
static int | send_command (mmsh_t *this, char *cmd)
static int | get_answer (mmsh_t *this)
static int | get_chunk_header (mmsh_t *this)
static int | get_header (mmsh_t *this)
static int | interp_header (mmsh_t *this)
static int | mmsh_valid_proto (const char *proto)
static void | report_progress (xine_stream_t *stream, int p)
static int | mmsh_tcp_connect (mmsh_t *this)
static int | mmsh_connect_int (mmsh_t *this, int bandwidth)
static int | mmsh_connect_int2 (mmsh_t *this, int bandwidth)
mmsh_t * | mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth)
static int | get_media_packet (mmsh_t *this)
size_t | mmsh_peek_header (mmsh_t *this, char *data, size_t maxsize)
int | mmsh_read (mmsh_t *this, char *data, int len)
void | mmsh_close (mmsh_t *this)
uint32_t | mmsh_get_length (mmsh_t *this)
off_t | mmsh_get_current_pos (mmsh_t *this)
void | mmsh_set_start_time (mmsh_t *this, int time_offset)

## Variables
static const char | mmsh_proto_s [][8] = { "mms", "mmsh", "" }

## Macro Definition Documentation

## ◆ ASF_HEADER_SIZE

#define ASF_HEADER_SIZE 8192 /* max header size */

## ◆ CHUNK_HEADER_LENGTH

#define CHUNK_HEADER_LENGTH 4

## ◆ CHUNK_SIZE

#define CHUNK_SIZE 65536 /* max chunk size */

## ◆ CHUNK_TYPE_ASF_HEADER

#define CHUNK_TYPE_ASF_HEADER 0x4824

## ◆ CHUNK_TYPE_DATA

#define CHUNK_TYPE_DATA 0x4424

## ◆ CHUNK_TYPE_END

#define CHUNK_TYPE_END 0x4524

## ◆ CHUNK_TYPE_RESET

#define CHUNK_TYPE_RESET 0x4324

## ◆ CLIENTGUID

#define CLIENTGUID "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}\r\n"

## ◆ EXT_HEADER_LENGTH

#define EXT_HEADER_LENGTH 8

## ◆ LOG_MODULE

#define LOG_MODULE "mmsh"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ mmsh_FirstRequest

#define mmsh_FirstRequest

Value:
"GET %s HTTP/1.0\r\n" \
"Accept: */*\r\n" \
USERAGENT \
"Host: %s:%d\r\n" \
"Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=%u,max-duration=0\r\n" \
CLIENTGUID \
"Connection: Close\r\n\r\n"
CLIENTGUID
#define CLIENTGUID
Definition: mmsh.c:55
USERAGENT
#define USERAGENT
Definition: mmsh.c:54

## ◆ MMSH_LIVE

#define MMSH_LIVE 2

## ◆ mmsh_LiveRequest

#define mmsh_LiveRequest

Value:
"GET %s HTTP/1.0\r\n" \
"Accept: */*\r\n" \
USERAGENT \
"Host: %s:%d\r\n" \
"Pragma: no-cache,rate=1.000000,request-context=%u\r\n" \
"Pragma: xPlayStrm=1\r\n" \
CLIENTGUID \
"Pragma: stream-switch-count=%d\r\n" \
"Pragma: stream-switch-entry=%s\r\n" \
"Connection: Close\r\n\r\n"

## ◆ MMSH_PORT

#define MMSH_PORT 80

## ◆ MMSH_SEEKABLE

#define MMSH_SEEKABLE 1

## ◆ mmsh_SeekableRequest

#define mmsh_SeekableRequest

Value:
"GET %s HTTP/1.0\r\n" \
"Accept: */*\r\n" \
USERAGENT \
"Host: %s:%d\r\n" \
"Pragma: no-cache,rate=1.000000,stream-time=%u,stream-offset=%u:%u,request-context=%u,max-duration=%u\r\n" \
CLIENTGUID \
"Pragma: xPlayStrm=1\r\n" \
"Pragma: stream-switch-count=%d\r\n" \
"Pragma: stream-switch-entry=%s\r\n" /* ffff:1:0 ffff:2:0 */ \
"Connection: Close\r\n\r\n"

## ◆ MMSH_UNKNOWN

#define MMSH_UNKNOWN 0

## ◆ SCRATCH_SIZE

#define SCRATCH_SIZE 1024

## ◆ USERAGENT

#define USERAGENT "User-Agent: NSPlayer/4.1.0.3856\r\n"

## Function Documentation

## ◆ get_answer()

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

References _, _x_io_tcp_read(), lprintf, MMSH_LIVE, MMSH_SEEKABLE, MMSH_UNKNOWN, xine_log(), XINE_LOG_MSG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by mmsh_connect_int(), and mmsh_connect_int2().

## ◆ get_chunk_header()

static int get_chunk_header | ( | mmsh_t * | this | ) |
| static

References _x_io_tcp_read(), _X_LE_16, _X_LE_32, CHUNK_HEADER_LENGTH, CHUNK_TYPE_ASF_HEADER, CHUNK_TYPE_DATA, CHUNK_TYPE_END, CHUNK_TYPE_RESET, EXT_HEADER_LENGTH, lprintf, XINE_VERBOSITY_LOG, and xprintf.

Referenced by get_header(), and get_media_packet().

## ◆ get_header()

static int get_header | ( | mmsh_t * | this | ) |
| static

References _x_io_tcp_read(), ASF_HEADER_SIZE, CHUNK_TYPE_ASF_HEADER, CHUNK_TYPE_DATA, get_chunk_header(), lprintf, XINE_VERBOSITY_LOG, and xprintf.

Referenced by get_media_packet(), mmsh_connect_int(), and mmsh_connect_int2().

## ◆ get_media_packet()

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

References _x_io_tcp_close(), _x_io_tcp_read(), CHUNK_TYPE_DATA, CHUNK_TYPE_END, CHUNK_TYPE_RESET, get_chunk_header(), get_header(), interp_header(), lprintf, mmsh_connect_int(), mmsh_tcp_connect(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by mmsh_read().

## ◆ interp_header()

static int interp_header | ( | mmsh_t * | this | ) |
| static

References asf_header_delete(), asf_header_new(), and lprintf.

Referenced by get_media_packet(), mmsh_connect_int(), and mmsh_connect_int2().

## ◆ mmsh_close()

void mmsh_close | ( | mmsh_t * | this | ) |

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

Referenced by mms_plugin_dispose().

## ◆ mmsh_connect()

mmsh_t * mmsh_connect | ( | xine_stream_t * | stream,
|  | const char * | url,
|  | int | bandwidth
| ) |  |

References _, _x_io_tcp_close(), _x_url_cleanup(), _x_url_parse2(), lprintf, mmsh_connect_int(), mmsh_tcp_connect(), mmsh_valid_proto(), NULL, report_progress(), xine_stream_s::xine, xine_log(), and XINE_LOG_MSG.

Referenced by mms_plugin_open().

## ◆ mmsh_connect_int()

static int mmsh_connect_int | ( | mmsh_t * | this,
|  | int | bandwidth
| ) |  |
| static

References _x_io_tcp_close(), asf_header_choose_streams(), asf_header_disable_streams(), get_answer(), get_header(), interp_header(), lprintf, mmsh_FirstRequest, mmsh_tcp_connect(), report_progress(), SCRATCH_SIZE, and send_command().

Referenced by get_media_packet(), and mmsh_connect().

## ◆ mmsh_connect_int2()

static int mmsh_connect_int2 | ( | mmsh_t * | this,
|  | int | bandwidth
| ) |  |
| static

References asf_header_disable_streams(), ASF_MAX_NUM_STREAMS, get_answer(), get_header(), interp_header(), lprintf, MMSH_LIVE, mmsh_LiveRequest, MMSH_SEEKABLE, mmsh_SeekableRequest, SCRATCH_SIZE, send_command(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by mmsh_read().

## ◆ mmsh_get_current_pos()

off_t mmsh_get_current_pos | ( | mmsh_t * | this | ) |

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

## ◆ mmsh_get_length()

uint32_t mmsh_get_length | ( | mmsh_t * | this | ) |

Referenced by mms_plugin_get_length().

## ◆ mmsh_peek_header()

size_t mmsh_peek_header | ( | mmsh_t * | this,
|  | char * | data,
|  | size_t | maxsize
| ) |  |

References lprintf.

Referenced by mms_plugin_get_optional_data().

## ◆ mmsh_read()

int mmsh_read | ( | mmsh_t * | this,
|  | char * | data,
|  | int | len
| ) |  |

References get_media_packet(), lprintf, mmsh_connect_int2(), xine_fast_memcpy, XINE_VERBOSITY_LOG, and xprintf.

Referenced by mms_plugin_read().

## ◆ mmsh_set_start_time()

void mmsh_set_start_time | ( | mmsh_t * | this,
|  | int | time_offset
| ) |  |

Referenced by mms_plugin_seek_time().

## ◆ mmsh_tcp_connect()

static int mmsh_tcp_connect | ( | mmsh_t * | this | ) |
| static

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

Referenced by get_media_packet(), mmsh_connect(), and mmsh_connect_int().

## ◆ mmsh_valid_proto()

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

References lprintf, and mmsh_proto_s.

Referenced by mmsh_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 mmsh_connect(), mmsh_connect_int(), and mmsh_tcp_connect().

## ◆ send_command()

static int send_command | ( | mmsh_t * | this,
|  | char * | cmd
| ) |  |
| static

References _, _x_io_tcp_write(), lprintf, XINE_LOG_MSG, and xprintf.

Referenced by mmsh_connect_int(), and mmsh_connect_int2().

## Variable Documentation

## ◆ mmsh_proto_s

const char mmsh_proto_s[][8] = { "mms", "mmsh", "" }
| static

Referenced by mmsh_valid_proto().