1 /* libasf - An Advanced Systems Format media file parser
2 * Copyright (C) 2006-2010 Juho Vähä-Herttua
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 GetGUID(const void *pointer
, asf_guid_t
*guid
)
31 const uint8_t *data
= pointer
;
32 guid
->v1
= GetDWLE(data
);
33 guid
->v2
= GetWLE(data
+ 4);
34 guid
->v3
= GetWLE(data
+ 6);
35 memcpy(guid
->v4
, data
+ 8, 8);
38 #define GETLEN2b(bits) (((bits) == 0x03) ? 4 : bits)
39 #define GETVALUE2b(bits, data) \
40 (((bits) != 0x03) ? ((bits) != 0x02) ? ((bits) != 0x01) ? \
41 0 : *((uint8_t *)data) : GetWLE(data) : GetDWLE(data))
45 /* DO NOT MODIFY THE FIRST 3 VARIABLES, BECAUSE THEY ARE
46 * ALSO DEFINED IN asf.h HEADER AND WILL BREAK THINGS */
47 #define ASF_OBJECT_COMMON \
54 struct asfint_object_s *next;
56 struct asfint_object_s
{
59 typedef struct asfint_object_s asfint_object_t
;
61 struct asf_object_headerext_s
{
65 struct asfint_object_s
*first
;
66 struct asfint_object_s
*last
;
68 typedef struct asf_object_headerext_s asf_object_headerext_t
;
70 struct asf_object_header_s
{
73 uint8_t reserved1
; /* 0x01, but could be safely ignored */
74 uint8_t reserved2
; /* 0x02, if not must failed to source the contain */
75 asf_object_headerext_t
*ext
; /* this is here just for convenience */
76 struct asfint_object_s
*first
;
77 struct asfint_object_s
*last
;
79 typedef struct asf_object_header_s asf_object_header_t
;
81 struct asf_object_data_s
{
84 uint64_t total_data_packets
;
86 uint64_t packets_position
;
88 typedef struct asf_object_data_s asf_object_data_t
;
90 struct asf_index_entry_s
{
91 uint32_t packet_index
;
92 uint16_t packet_count
;
94 typedef struct asf_index_entry_s asf_index_entry_t
;
96 struct asf_object_index_s
{
99 uint64_t entry_time_interval
;
100 uint32_t max_packet_count
;
101 uint32_t entry_count
;
102 asf_index_entry_t
*entries
;
104 typedef struct asf_object_index_s asf_object_index_t
;
106 #define ASF_FLAG_BROADCAST 1
107 #define ASF_FLAG_SEEKABLE 2
109 #define ASF_MAX_STREAMS 128
112 const char *filename
;
113 asf_iostream_t iostream
;
118 /* Top level objects */
119 struct asf_object_header_s
*header
;
120 struct asf_object_data_s
*data
;
121 struct asf_object_index_s
*index
;
123 /* position (in bytes) of data and index objects */
124 uint64_t data_position
;
125 uint64_t index_position
;
129 uint64_t creation_date
;
130 uint64_t data_packets_count
;
131 uint64_t play_duration
;
132 uint64_t send_duration
;
135 uint32_t packet_size
;
136 uint32_t max_bitrate
;
138 asf_stream_t streams
[ASF_MAX_STREAMS
];