xine-lib: xine-lib-1.2.12/src/demuxers/asfheader.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
asfheader.c File Reference
`#include <string.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <xine/xineutils.h>`
`#include "bswap.h"`
`#include "asfheader.h"`

## Data Structures
struct | asf_reader_t
struct | asf_header_internal_t

## Macros
#define | LOG_MODULE "asfheader"
#define | LOG_VERBOSE
#define | iconv_open(TO, FROM) 0
#define | iconv(CD, INBUF, INLEFT, OUTBUF, OUTLEFT) iconv_internal(INBUF, INLEFT, OUTBUF, OUTLEFT)
#define | iconv_close(CD)
#define | ICONV_CONST const

## Typedefs
typedef int | iconv_t

## Functions
static size_t | iconv_internal (const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
static void | asf_reader_init (asf_reader_t *reader, const uint8_t *buffer, int size)
static const uint8_t * | asf_reader_get_block (asf_reader_t *reader, uint32_t n)
static uint8_t * | asf_reader_get_bytes (asf_reader_t *reader, uint32_t size)
static char * | asf_reader_get_string (asf_reader_t *reader, size_t size, iconv_t cd)
static int | asf_reader_skip (asf_reader_t *reader, uint32_t size)
static const uint8_t * | asf_reader_get_buffer (asf_reader_t *reader)
static int | asf_reader_eos (asf_reader_t *reader)
static size_t | asf_reader_get_size (asf_reader_t *reader)
static int | asf_header_get_stream_id (asf_header_t *header_pub, uint16_t stream_number)
static int | asf_header_parse_file_properties (asf_header_t *header, const uint8_t *buffer, int buffer_len)
static void | asf_header_delete_stream_properties (asf_stream_t *asf_stream)
static int | asf_header_parse_stream_properties (asf_header_t *header, const uint8_t *buffer, int buffer_len)
static void | asf_header_delete_stream_extended_properties (asf_stream_extension_t *asf_stream_extension)
static int | asf_header_parse_stream_extended_properties (asf_header_t *header, const uint8_t *buffer, int buffer_len)
static int | asf_header_parse_stream_bitrate_properties (asf_header_t *header_pub, const uint8_t *buffer, int buffer_len)
static int | asf_header_parse_metadata (asf_header_t *header_pub, const uint8_t *buffer, int buffer_len)
static int | asf_header_parse_header_extension (asf_header_t *header, const uint8_t *buffer, int buffer_len)
static int | asf_header_parse_content_description (asf_header_t *header_pub, const uint8_t *buffer, int buffer_len)
asf_header_t * | asf_header_new (uint8_t *buffer, int buffer_len)
static void | asf_header_delete_file_properties (asf_file_t *asf_file)
static void | asf_header_delete_content (asf_content_t *asf_content)
void | asf_header_delete (asf_header_t *header_pub)
static int | asf_header_choose_stream (asf_header_internal_t *header, int stream_type, uint32_t bandwidth)
void | asf_header_choose_streams (asf_header_t *header_pub, uint32_t bandwidth, int *video_id, int *audio_id)
void | asf_header_disable_streams (asf_header_t *header_pub, int video_id, int audio_id)
asf_guid_t | asf_guid_2_num (const uint8_t *guid)
void | asf_guid_2_str (uint8_t *str, const uint8_t *guid)
const char * | asf_guid_name (asf_guid_t num)

## Variables
static const asf_guid_t | sorted_nums []
static const uint8_t | sorted_guids []
static const char | tab_hex [16] = "0123456789abcdef"
static const char * | guid_names []

## Macro Definition Documentation

## ◆ iconv

#define iconv | ( |  | CD,
|  |  | INBUF,
|  |  | INLEFT,
|  |  | OUTBUF,
|  |  | OUTLEFT
| ) |  | iconv_internal(INBUF, INLEFT, OUTBUF, OUTLEFT)

## ◆ iconv_close

#define iconv_close | ( |  | CD | ) |

## ◆ ICONV_CONST

#define ICONV_CONST const

## ◆ iconv_open

#define iconv_open | ( |  | TO,
|  |  | FROM
| ) |  | 0

## ◆ LOG_MODULE

#define LOG_MODULE "asfheader"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## Typedef Documentation

## ◆ iconv_t

typedef int iconv_t

## Function Documentation

## ◆ asf_guid_2_num()

asf_guid_t asf_guid_2_num | ( | const uint8_t * | guid | ) |

References sorted_guids, and sorted_nums.

Referenced by asf_header_new(), asf_header_parse_header_extension(), asf_header_parse_stream_extended_properties(), asf_header_parse_stream_properties(), get_guid_id(), and open_plugin().

## ◆ asf_guid_2_str()

void asf_guid_2_str | ( | uint8_t * | str,
|  | const uint8_t * | guid
| ) |  |

References tab_hex.

Referenced by asf_read_header(), and get_guid_id().

## ◆ asf_guid_name()

const char * asf_guid_name | ( | asf_guid_t | num | ) |

References GUID_END, GUID_ERROR, and guid_names.

Referenced by asf_header_parse_stream_properties().

## ◆ asf_header_choose_stream()

static int asf_header_choose_stream | ( | asf_header_internal_t * | header,
|  | int | stream_type,
|  | uint32_t | bandwidth
| ) |  |
| static

References asf_header_s::bitrates, asf_header_internal_t::pub, asf_header_s::stream_count, asf_stream_s::stream_type, and asf_header_s::streams.

Referenced by asf_header_choose_streams().

## ◆ asf_header_choose_streams()

void asf_header_choose_streams | ( | asf_header_t * | header_pub,
|  | uint32_t | bandwidth,
|  | int * | video_id,
|  | int * | audio_id
| ) |  |

References asf_header_choose_stream(), asf_header_s::bitrates, GUID_ASF_AUDIO_MEDIA, GUID_ASF_VIDEO_MEDIA, lprintf, asf_header_internal_t::pub, asf_header_s::stream_count, asf_stream_s::stream_number, and asf_header_s::streams.

Referenced by demux_asf_send_headers_common(), mms_choose_best_streams(), and mmsh_connect_int().

## ◆ asf_header_delete()

void asf_header_delete | ( | asf_header_t * | header_pub | ) |

References asf_header_delete_content(), asf_header_delete_file_properties(), asf_header_delete_stream_extended_properties(), asf_header_delete_stream_properties(), ASF_MAX_NUM_STREAMS, asf_header_s::content, asf_header_s::file, asf_header_internal_t::pub, asf_header_s::stream_extensions, and asf_header_s::streams.

Referenced by asf_header_new(), asf_read_header(), demux_asf_dispose(), interp_asf_header(), interp_header(), mms_close(), and mmsh_close().

## ◆ asf_header_delete_content()

static void asf_header_delete_content | ( | asf_content_t * | asf_content | ) |
| static

References asf_content_s::author, asf_content_s::copyright, asf_content_s::description, asf_content_s::rating, and asf_content_s::title.

Referenced by asf_header_delete().

## ◆ asf_header_delete_file_properties()

static void asf_header_delete_file_properties | ( | asf_file_t * | asf_file | ) |
| static

Referenced by asf_header_delete().

## ◆ asf_header_delete_stream_extended_properties()

static void asf_header_delete_stream_extended_properties | ( | asf_stream_extension_t * | asf_stream_extension | ) |
| static

References asf_stream_extension_s::stream_name_count, and asf_stream_extension_s::stream_names.

Referenced by asf_header_delete(), and asf_header_parse_stream_extended_properties().

## ◆ asf_header_delete_stream_properties()

static void asf_header_delete_stream_properties | ( | asf_stream_t * | asf_stream | ) |
| static

References asf_stream_s::error_correction_data, and asf_stream_s::private_data.

Referenced by asf_header_delete(), and asf_header_parse_stream_properties().

## ◆ asf_header_disable_streams()

void asf_header_disable_streams | ( | asf_header_t * | header_pub,
|  | int | video_id,
|  | int | audio_id
| ) |  |

References asf_header_internal_t::bitrate_offsets, GUID_ASF_AUDIO_MEDIA, GUID_ASF_VIDEO_MEDIA, lprintf, asf_header_internal_t::pub, asf_header_internal_t::raw_data, asf_header_s::stream_count, asf_stream_s::stream_number, asf_stream_s::stream_type, and asf_header_s::streams.

Referenced by mmsh_connect_int(), and mmsh_connect_int2().

## ◆ asf_header_get_stream_id()

static int asf_header_get_stream_id | ( | asf_header_t * | header_pub,
|  | uint16_t | stream_number
| ) |  |
| static

References ASF_MAX_NUM_STREAMS, lprintf, asf_header_internal_t::number_count, and asf_header_internal_t::numbers.

Referenced by asf_header_parse_metadata(), asf_header_parse_stream_bitrate_properties(), asf_header_parse_stream_extended_properties(), and asf_header_parse_stream_properties().

## ◆ asf_header_new()

asf_header_t * asf_header_new | ( | uint8_t * | buffer,
|  | int | buffer_len
| ) |  |

References _X_LE_32, _X_LE_64, asf_guid_2_num(), asf_header_delete(), asf_header_parse_content_description(), asf_header_parse_file_properties(), asf_header_parse_header_extension(), asf_header_parse_stream_bitrate_properties(), asf_header_parse_stream_properties(), ASF_MAX_NUM_STREAMS, asf_reader_eos(), asf_reader_get_block(), asf_reader_get_buffer(), asf_reader_init(), asf_reader_skip(), asf_header_s::aspect_ratios, asf_header_internal_t::bitrate_offsets, asf_header_s::bitrates, asf_header_s::content, asf_header_s::file, GUID_ASF_BITRATE_MUTUAL_EXCLUSION, GUID_ASF_CODEC_LIST, GUID_ASF_CONTENT_DESCRIPTION, GUID_ASF_ERROR_CORRECTION, GUID_ASF_EXTENDED_CONTENT_DESCRIPTION, GUID_ASF_EXTENDED_CONTENT_ENCRYPTION, GUID_ASF_FILE_PROPERTIES, GUID_ASF_HEADER_EXTENSION, GUID_ASF_MARKER, GUID_ASF_PADDING, GUID_ASF_SCRIPT_COMMAND, GUID_ASF_STREAM_BITRATE_PROPERTIES, GUID_ASF_STREAM_PROPERTIES, lprintf, NULL, asf_header_internal_t::number_count, asf_header_internal_t::numbers, asf_header_internal_t::pub, asf_header_internal_t::raw_data, asf_header_s::stream_count, asf_header_s::stream_extensions, asf_header_s::streams, asf_header_s::x, and asf_header_s::y.

Referenced by asf_read_header(), interp_asf_header(), and interp_header().

## ◆ asf_header_parse_content_description()

static int asf_header_parse_content_description | ( | asf_header_t * | header_pub,
|  | const uint8_t * | buffer,
|  | int | buffer_len
| ) |  |
| static

References _X_LE_16, asf_reader_get_block(), asf_reader_get_string(), asf_reader_init(), asf_content_s::author, asf_header_s::content, asf_content_s::copyright, asf_content_s::description, iconv_close, iconv_open, lprintf, asf_header_internal_t::pub, asf_content_s::rating, and asf_content_s::title.

Referenced by asf_header_new().

## ◆ asf_header_parse_file_properties()

static int asf_header_parse_file_properties | ( | asf_header_t * | header,
|  | const uint8_t * | buffer,
|  | int | buffer_len
| ) |  |
| static

References _X_LE_16, _X_LE_32, _X_LE_64, asf_reader_get_block(), asf_reader_init(), asf_file_s::broadcast_flag, asf_file_s::data_packet_count, asf_header_s::file, asf_file_s::file_id, asf_file_s::file_size, lprintf, asf_file_s::max_bitrate, asf_file_s::packet_size, asf_file_s::play_duration, asf_file_s::preroll, asf_file_s::seekable_flag, and asf_file_s::send_duration.

Referenced by asf_header_new().

## ◆ asf_header_parse_header_extension()

static int asf_header_parse_header_extension | ( | asf_header_t * | header,
|  | const uint8_t * | buffer,
|  | int | buffer_len
| ) |  |
| static

References _X_LE_32, _X_LE_64, asf_guid_2_num(), asf_header_parse_metadata(), asf_header_parse_stream_extended_properties(), asf_reader_eos(), asf_reader_get_block(), asf_reader_get_buffer(), asf_reader_init(), asf_reader_skip(), GUID_ADVANCED_CONTENT_ENCRYPTION, GUID_ADVANCED_MUTUAL_EXCLUSION, GUID_ASF_PADDING, GUID_BANDWIDTH_SHARING, GUID_COMPATIBILITY, GUID_EXTENDED_STREAM_PROPERTIES, GUID_GROUP_MUTUAL_EXCLUSION, GUID_INDEX_PARAMETERS, GUID_LANGUAGE_LIST, GUID_MEDIA_OBJECT_INDEX_PARAMETERS, GUID_METADATA, GUID_METADATA_LIBRARY, GUID_STREAM_PRIORITIZATION, GUID_TIMECODE_INDEX_PARAMETERS, and lprintf.

Referenced by asf_header_new().

## ◆ asf_header_parse_metadata()

static int asf_header_parse_metadata | ( | asf_header_t * | header_pub,
|  | const uint8_t * | buffer,
|  | int | buffer_len
| ) |  |
| static

References _X_LE_16, _X_LE_32, asf_header_get_stream_id(), asf_reader_get_block(), asf_reader_init(), asf_reader_skip(), asf_header_s::aspect_ratios, asf_header_internal_t::pub, asf_header_s::x, and asf_header_s::y.

Referenced by asf_header_parse_header_extension().

## ◆ asf_header_parse_stream_bitrate_properties()

static int asf_header_parse_stream_bitrate_properties | ( | asf_header_t * | header_pub,
|  | const uint8_t * | buffer,
|  | int | buffer_len
| ) |  |
| static

References _X_LE_16, _X_LE_32, asf_header_get_stream_id(), asf_reader_get_block(), asf_reader_init(), asf_header_internal_t::bitrate_offsets, asf_header_s::bitrates, lprintf, asf_header_internal_t::pub, and asf_header_internal_t::raw_data.

Referenced by asf_header_new().

## ◆ asf_header_parse_stream_extended_properties()

static int asf_header_parse_stream_extended_properties | ( | asf_header_t * | header,
|  | const uint8_t * | buffer,
|  | int | buffer_len
| ) |  |
| static

References _X_LE_16, _X_LE_32, _X_LE_64, asf_stream_extension_s::alternate_buffer_size, asf_stream_extension_s::alternate_data_bitrate, asf_stream_extension_s::alternate_initial_buffer_fullness, asf_guid_2_num(), asf_header_delete_stream_extended_properties(), asf_header_get_stream_id(), asf_header_parse_stream_properties(), asf_reader_get_block(), asf_reader_get_buffer(), asf_reader_get_bytes(), asf_reader_get_size(), asf_reader_init(), asf_reader_skip(), asf_stream_extension_s::average_time_per_frame, asf_stream_extension_s::buffer_size, asf_stream_extension_s::data_bitrate, asf_stream_extension_s::end_time, GUID_ASF_STREAM_PROPERTIES, asf_stream_extension_s::initial_buffer_fullness, asf_stream_extension_s::language_id, lprintf, asf_stream_extension_s::max_object_size, name, asf_stream_extension_s::no_cleanpoints_flag, NULL, asf_stream_extension_s::payload_extension_system_count, asf_stream_extension_s::reliable_flag, asf_stream_extension_s::resend_live_cleanpoints_flag, asf_stream_extension_s::seekable_flag, asf_stream_extension_s::start_time, asf_header_s::stream_extensions, asf_stream_extension_s::stream_name_count, and asf_stream_extension_s::stream_names.

Referenced by asf_header_parse_header_extension().

## ◆ asf_header_parse_stream_properties()

static int asf_header_parse_stream_properties | ( | asf_header_t * | header,
|  | const uint8_t * | buffer,
|  | int | buffer_len
| ) |  |
| static

References _X_LE_16, _X_LE_32, _X_LE_64, asf_guid_2_num(), asf_guid_name(), asf_header_delete_stream_properties(), asf_header_get_stream_id(), asf_reader_get_block(), asf_reader_get_bytes(), asf_reader_init(), asf_stream_s::encrypted_flag, asf_stream_s::error_correction_data, asf_stream_s::error_correction_data_length, asf_stream_s::error_correction_type, lprintf, NULL, asf_stream_s::private_data, asf_stream_s::private_data_length, asf_header_s::stream_count, asf_stream_s::stream_number, asf_stream_s::stream_type, asf_header_s::streams, and asf_stream_s::time_offset.

Referenced by asf_header_new(), and asf_header_parse_stream_extended_properties().

## ◆ asf_reader_eos()

static int asf_reader_eos | ( | asf_reader_t * | reader | ) |
| static

References asf_reader_t::end, and asf_reader_t::p.

Referenced by asf_header_new(), and asf_header_parse_header_extension().

## ◆ asf_reader_get_block()

static const uint8_t * asf_reader_get_block | ( | asf_reader_t * | reader,
|  | uint32_t | n
| ) |  |
| static

References asf_reader_t::end, NULL, and asf_reader_t::p.

Referenced by asf_header_new(), asf_header_parse_content_description(), asf_header_parse_file_properties(), asf_header_parse_header_extension(), asf_header_parse_metadata(), asf_header_parse_stream_bitrate_properties(), asf_header_parse_stream_extended_properties(), and asf_header_parse_stream_properties().

## ◆ asf_reader_get_buffer()

static const uint8_t * asf_reader_get_buffer | ( | asf_reader_t * | reader | ) |
| static

References asf_reader_t::p.

Referenced by asf_header_new(), asf_header_parse_header_extension(), and asf_header_parse_stream_extended_properties().

## ◆ asf_reader_get_bytes()

static uint8_t * asf_reader_get_bytes | ( | asf_reader_t * | reader,
|  | uint32_t | size
| ) |  |
| static

References asf_reader_t::end, NULL, and asf_reader_t::p.

Referenced by asf_header_parse_stream_extended_properties(), and asf_header_parse_stream_properties().

## ◆ asf_reader_get_size()

static size_t asf_reader_get_size | ( | asf_reader_t * | reader | ) |
| static

References asf_reader_t::end, and asf_reader_t::p.

Referenced by asf_header_parse_stream_extended_properties().

## ◆ asf_reader_get_string()

static char * asf_reader_get_string | ( | asf_reader_t * | reader,
|  | size_t | size,
|  | iconv_t | cd
| ) |  |
| static

References asf_reader_t::end, iconv, ICONV_CONST, lprintf, NULL, and asf_reader_t::p.

Referenced by asf_header_parse_content_description().

## ◆ asf_reader_init()

static void asf_reader_init | ( | asf_reader_t * | reader,
|  | const uint8_t * | buffer,
|  | int | size
| ) |  |
| static

References asf_reader_t::buffer, asf_reader_t::end, and asf_reader_t::p.

Referenced by asf_header_new(), asf_header_parse_content_description(), asf_header_parse_file_properties(), asf_header_parse_header_extension(), asf_header_parse_metadata(), asf_header_parse_stream_bitrate_properties(), asf_header_parse_stream_extended_properties(), and asf_header_parse_stream_properties().

## ◆ asf_reader_skip()

static int asf_reader_skip | ( | asf_reader_t * | reader,
|  | uint32_t | size
| ) |  |
| static

References asf_reader_t::end, and asf_reader_t::p.

Referenced by asf_header_new(), asf_header_parse_header_extension(), asf_header_parse_metadata(), and asf_header_parse_stream_extended_properties().

## ◆ iconv_internal()

static size_t iconv_internal | ( | const char ** | inbuf,
|  | size_t * | inbytesleft,
|  | char ** | outbuf,
|  | size_t * | outbytesleft
| ) |  |
| static

References _X_LE_16, and z.

## Variable Documentation

## ◆ guid_names

const char* guid_names[]
| static

Referenced by asf_guid_name().

## ◆ sorted_guids

const uint8_t sorted_guids[]
| static

Referenced by asf_guid_2_num().

## ◆ sorted_nums

const asf_guid_t sorted_nums[]
| static

Referenced by asf_guid_2_num().

## ◆ tab_hex

const char tab_hex[16] = "0123456789abcdef"
| static

Referenced by _x_tag32_me2str(), asf_guid_2_str(), demux_ts_hexdump(), and demux_ts_parse_pes_header().