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

xine-lib 1.2.12

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

## Data Structures
struct | pnm_s

## Macros
#define | LOG_MODULE "pnm"
#define | LOG_VERBOSE
#define | BUF_SIZE 4096
#define | HEADER_SIZE 4096
#define | PREAMBLE_SIZE 8
#define | CHECKSUM_SIZE 3
#define | RM_HEADER_SIZE 0x12
#define | PNM_DATA_HEADER_SIZE 18
#define | PNA_CLIENT_CAPS 0x03
#define | PNA_CLIENT_CHALLANGE 0x04
#define | PNA_BANDWIDTH 0x05
#define | PNA_GUID 0x13
#define | PNA_TIMESTAMP 0x17
#define | PNA_TWENTYFOUR 0x18
#define | PNA_CLIENT_STRING 0x63
#define | PNA_PATH_REQUEST 0x52
#define | PNM_HEADER_SIZE 11
#define | PNM_CLIENT_CAPS_SIZE 126
#define | PNM_TWENTYFOUR_SIZE 16

## Functions
static unsigned int | pnm_get_chunk (pnm_t *p, unsigned int max, unsigned int *chunk_type, char *data, int *need_response)
static int | pnm_write_chunk (uint16_t chunk_id, uint16_t length, const char *chunk, char *data)
static int | pnm_send_request (pnm_t *p, uint32_t bandwidth)
static int | pnm_send_response (pnm_t *p, const char *response)
static int | pnm_get_headers (pnm_t *p, int *need_response)
static int | pnm_calc_stream (pnm_t *p)
static int | pnm_get_stream_chunk (pnm_t *p)
pnm_t * | pnm_connect (xine_stream_t *stream, const char *mrl)
int | pnm_read (pnm_t *this, char *data, int len)
int | pnm_peek_header (pnm_t *this, char *data, int maxsize)
void | pnm_close (pnm_t *p)

## Variables
static const unsigned char | rm_header []
static const unsigned char | pnm_data_header []
static const char | pnm_challenge [] = "0990f6b4508b51e801bd6da011ad7b56"
static const char | pnm_timestamp [] = "[15/06/1999:22:22:49 00:00]"
static const char | pnm_guid [] = "3eac2411-83d5-11d2-f3ea-d7c3a51aa8b0"
static const char | pnm_response [] = "97715a899cbe41cee00dd434851535bf"
static const char | client_string [] = "WinNT_9.0_6.0.6.45_plus32_MP60_en-US_686l"
static const unsigned char | pnm_header []
static const unsigned char | pnm_client_caps []
static const uint32_t | pnm_default_bandwidth =10485800
static const uint32_t | pnm_available_bandwidths []
static const unsigned char | pnm_twentyfour []
static const int | after_chunks_length =6
static const unsigned char | after_chunks []

## Macro Definition Documentation

## ◆ BUF_SIZE

#define BUF_SIZE 4096

## ◆ CHECKSUM_SIZE

#define CHECKSUM_SIZE 3

## ◆ HEADER_SIZE

#define HEADER_SIZE 4096

## ◆ LOG_MODULE

#define LOG_MODULE "pnm"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ PNA_BANDWIDTH

#define PNA_BANDWIDTH 0x05

## ◆ PNA_CLIENT_CAPS

#define PNA_CLIENT_CAPS 0x03

## ◆ PNA_CLIENT_CHALLANGE

#define PNA_CLIENT_CHALLANGE 0x04

## ◆ PNA_CLIENT_STRING

#define PNA_CLIENT_STRING 0x63

## ◆ PNA_GUID

#define PNA_GUID 0x13

## ◆ PNA_PATH_REQUEST

#define PNA_PATH_REQUEST 0x52

## ◆ PNA_TIMESTAMP

#define PNA_TIMESTAMP 0x17

## ◆ PNA_TWENTYFOUR

#define PNA_TWENTYFOUR 0x18

## ◆ PNM_CLIENT_CAPS_SIZE

#define PNM_CLIENT_CAPS_SIZE 126

## ◆ PNM_DATA_HEADER_SIZE

#define PNM_DATA_HEADER_SIZE 18

## ◆ PNM_HEADER_SIZE

#define PNM_HEADER_SIZE 11

## ◆ PNM_TWENTYFOUR_SIZE

#define PNM_TWENTYFOUR_SIZE 16

## ◆ PREAMBLE_SIZE

#define PREAMBLE_SIZE 8

## ◆ RM_HEADER_SIZE

#define RM_HEADER_SIZE 0x12

## Function Documentation

## ◆ pnm_calc_stream()

static int pnm_calc_stream | ( | pnm_t * | p | ) |
| static

References lprintf, pnm_s::seq_current, pnm_s::seq_num, pnm_s::stream, pnm_s::ts_current, pnm_s::ts_last, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by pnm_get_stream_chunk().

## ◆ pnm_close()

void pnm_close | ( | pnm_t * | p | ) |

References _x_io_tcp_close(), pnm_s::host, pnm_s::path, pnm_s::s, pnm_s::stream, and pnm_s::url.

Referenced by pnm_connect(), and pnm_plugin_dispose().

## ◆ pnm_connect()

pnm_t * pnm_connect | ( | xine_stream_t * | stream,
|  | const char * | mrl
| ) |  |

References _, _x_io_tcp_connect(), pnm_s::buffer, pnm_s::header, pnm_s::header_len, pnm_s::host, lprintf, NULL, pnm_s::packet, pnm_s::path, pnm_available_bandwidths, pnm_close(), pnm_get_headers(), pnm_response, pnm_send_request(), pnm_send_response(), pnm_s::port, pnm_s::recv, pnm_s::recv_read, pnm_s::recv_size, pnm_s::s, pnm_s::stream, pnm_s::ts_last, pnm_s::url, xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by pnm_plugin_open().

## ◆ pnm_get_chunk()

static unsigned int pnm_get_chunk | ( | pnm_t * | p,
|  | unsigned int | max,
|  | unsigned int * | chunk_type,
|  | char * | data,
|  | int * | need_response
| ) |  |
| static

References _X_BE_16, _X_BE_32, _x_io_tcp_read(), CHECKSUM_SIZE, CONT_TAG, DATA_TAG, MDPR_TAG, PNA_TAG, PREAMBLE_SIZE, PROP_TAG, RMF_TAG, pnm_s::s, pnm_s::stream, xine_stream_s::xine, xine_hexdump(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by pnm_get_headers().

## ◆ pnm_get_headers()

static int pnm_get_headers | ( | pnm_t * | p,
|  | int * | need_response
| ) |  |
| static

References _x_io_tcp_read(), be2me_32, pnm_s::buffer, DATA_TAG, pnm_s::header, pnm_s::header_len, HEADER_SIZE, NULL, PNA_TAG, pnm_data_header, PNM_DATA_HEADER_SIZE, pnm_get_chunk(), PREAMBLE_SIZE, PROP_TAG, rm_header, RM_HEADER_SIZE, RMF_TAG, pnm_s::s, pnm_s::stream, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by pnm_connect().

## ◆ pnm_get_stream_chunk()

static int pnm_get_stream_chunk | ( | pnm_t * | p | ) |
| static

References _, _X_BE_16, _X_BE_32, _x_io_tcp_read(), _x_io_tcp_write(), be2me_16, BUF_SIZE, pnm_s::buffer, lprintf, pnm_s::packet, pnm_calc_stream(), pnm_s::recv, pnm_s::recv_size, pnm_s::s, pnm_s::seq_current, pnm_s::stream, pnm_s::ts_current, pnm_s::ts_last, xine_stream_s::xine, xine_hexdump(), XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by pnm_read().

## ◆ pnm_peek_header()

int pnm_peek_header | ( | pnm_t * | this,
|  | char * | data,
|  | int | maxsize
| ) |  |

Referenced by pnm_plugin_get_optional_data().

## ◆ pnm_read()

int pnm_read | ( | pnm_t * | this,
|  | char * | data,
|  | int | len
| ) |  |

References lprintf, and pnm_get_stream_chunk().

Referenced by pnm_plugin_read().

## ◆ pnm_send_request()

static int pnm_send_request | ( | pnm_t * | p,
|  | uint32_t | bandwidth
| ) |  |
| static

References _x_io_tcp_write(), after_chunks, after_chunks_length, be2me_16, pnm_s::buffer, client_string, NULL, pnm_s::path, PNA_BANDWIDTH, PNA_CLIENT_CAPS, PNA_CLIENT_CHALLANGE, PNA_CLIENT_STRING, PNA_GUID, PNA_PATH_REQUEST, PNA_TIMESTAMP, PNA_TWENTYFOUR, pnm_challenge, pnm_client_caps, PNM_CLIENT_CAPS_SIZE, pnm_default_bandwidth, pnm_guid, pnm_header, PNM_HEADER_SIZE, pnm_timestamp, pnm_twentyfour, PNM_TWENTYFOUR_SIZE, pnm_write_chunk(), pnm_s::s, and pnm_s::stream.

Referenced by pnm_connect().

## ◆ pnm_send_response()

static int pnm_send_response | ( | pnm_t * | p,
|  | const char * | response
| ) |  |
| static

@TODO should check that sze is always < 256

References _x_io_tcp_write(), pnm_s::buffer, pnm_s::s, and pnm_s::stream.

Referenced by pnm_connect().

## ◆ pnm_write_chunk()

static int pnm_write_chunk | ( | uint16_t | chunk_id,
|  | uint16_t | length,
|  | const char * | chunk,
|  | char * | data
| ) |  |
| static

References be2me_16.

Referenced by pnm_send_request().

## Variable Documentation

## ◆ after_chunks

const unsigned char after_chunks[]
| static

Initial value:
={
0x00, 0x00,
0x50, 0x84,
0x1f, 0x3a
}

Referenced by pnm_send_request().

## ◆ after_chunks_length

const int after_chunks_length =6
| static

Referenced by pnm_send_request().

## ◆ client_string

const char client_string[] = "WinNT_9.0_6.0.6.45_plus32_MP60_en-US_686l"
| static

Referenced by pnm_send_request().

## ◆ pnm_available_bandwidths

const uint32_t pnm_available_bandwidths[]
| static

Initial value:
={14400,19200,28800,33600,34430,57600,
115200,262200,393216,524300,1544000,10485800}

Referenced by pnm_connect().

## ◆ pnm_challenge

const char pnm_challenge[] = "0990f6b4508b51e801bd6da011ad7b56"
| static

Referenced by pnm_send_request().

## ◆ pnm_client_caps

const unsigned char pnm_client_caps[]
| static

Initial value:
= {
0x07, 0x8a, 'p','n','r','v',
0, 0x90, 'p','n','r','v',
0, 0x64, 'd','n','e','t',
0, 0x46, 'p','n','r','v',
0, 0x32, 'd','n','e','t',
0, 0x2b, 'p','n','r','v',
0, 0x28, 'd','n','e','t',
0, 0x24, 'p','n','r','v',
0, 0x19, 'd','n','e','t',
0, 0x18, 'p','n','r','v',
0, 0x14, 's','i','p','r',
0, 0x14, 'd','n','e','t',
0, 0x24, '2','8','_','8',
0, 0x12, 'p','n','r','v',
0, 0x0f, 'd','n','e','t',
0, 0x0a, 's','i','p','r',
0, 0x0a, 'd','n','e','t',
0, 0x08, 's','i','p','r',
0, 0x06, 's','i','p','r',
0, 0x12, 'l','p','c','J',
0, 0x07, '0','5','_','6' }

Referenced by pnm_send_request().

## ◆ pnm_data_header

const unsigned char pnm_data_header[]
| static

Initial value:
={
'D','A','T','A',
0,0,0,0,
0,0,
0,0,0,0,
0,0,0,0}

Referenced by pnm_get_headers().

## ◆ pnm_default_bandwidth

const uint32_t pnm_default_bandwidth =10485800
| static

Referenced by pnm_send_request().

## ◆ pnm_guid

const char pnm_guid[] = "3eac2411-83d5-11d2-f3ea-d7c3a51aa8b0"
| static

Referenced by pnm_send_request().

## ◆ pnm_header

const unsigned char pnm_header[]
| static

Initial value:
= {
'P','N','A',
0x00, 0x0a,
0x00, 0x14,
0x00, 0x02,
0x00, 0x01 }

Referenced by pnm_send_request().

## ◆ pnm_response

const char pnm_response[] = "97715a899cbe41cee00dd434851535bf"
| static

Referenced by pnm_connect().

## ◆ pnm_timestamp

const char pnm_timestamp[] = "[15/06/1999:22:22:49 00:00]"
| static

Referenced by pnm_send_request().

## ◆ pnm_twentyfour

const unsigned char pnm_twentyfour[]
| static

Initial value:
={
0xd5, 0x42, 0xa3, 0x1b, 0xef, 0x1f, 0x70, 0x24,
0x85, 0x29, 0xb3, 0x8d, 0xba, 0x11, 0xf3, 0xd6 }

Referenced by pnm_send_request().

## ◆ rm_header

const unsigned char rm_header[]
| static

Initial value:
={
0x2e, 0x52, 0x4d, 0x46,
0x00, 0x00, 0x00, 0x12,
0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06
}

Referenced by pnm_get_headers().