Mercurial > libavformat.hg
comparison asf.h @ 373:e47d9c8e2054 libavformat
asf patch by (Konstantin Andreyev <kandreyev at bcsii dot com>)
1. Corrected packet sent time. (Packet sent time => previous packet sent
time)
2. Corrected payload playing time. (Payload playing time => packet sent
time)
3. Used different format for packets with one payload and multi payloads.
author | michael |
---|---|
date | Fri, 05 Mar 2004 22:10:50 +0000 |
parents | 2e12cd1b68ed |
children | 55081ada3aad |
comparison
equal
deleted
inserted
replaced
372:2e12cd1b68ed | 373:e47d9c8e2054 |
---|---|
14 * You should have received a copy of the GNU Lesser General Public | 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 | 15 * License along with this library; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 */ | 17 */ |
18 #define PACKET_SIZE 3200 | 18 #define PACKET_SIZE 3200 |
19 #define PACKET_HEADER_SIZE 12 | |
20 #define FRAME_HEADER_SIZE 17 | |
21 | 19 |
22 typedef struct { | 20 typedef struct { |
23 int num; | 21 int num; |
24 int seq; | 22 unsigned char seq; |
25 /* use for reading */ | 23 /* use for reading */ |
26 AVPacket pkt; | 24 AVPacket pkt; |
27 int frag_offset; | 25 int frag_offset; |
28 int timestamp; | 26 int timestamp; |
29 int64_t duration; | 27 int64_t duration; |
72 // individual media streams | 70 // individual media streams |
73 } ASFMainHeader; | 71 } ASFMainHeader; |
74 | 72 |
75 | 73 |
76 typedef struct { | 74 typedef struct { |
77 int seqno; | 75 uint32_t seqno; |
78 int packet_size; | 76 unsigned int packet_size; |
79 int is_streamed; | 77 int is_streamed; |
80 int asfid2avid[128]; /* conversion table from asf ID 2 AVStream ID */ | 78 int asfid2avid[128]; /* conversion table from asf ID 2 AVStream ID */ |
81 ASFStream streams[128]; /* it's max number and it's not that big */ | 79 ASFStream streams[128]; /* it's max number and it's not that big */ |
82 /* non streamed additonnal info */ | 80 /* non streamed additonnal info */ |
83 int64_t nb_packets; | 81 int64_t nb_packets; |
84 int64_t duration; /* in 100ns units */ | 82 int64_t duration; /* in 100ns units */ |
85 /* packet filling */ | 83 /* packet filling */ |
84 unsigned char multi_payloads_present; | |
86 int packet_size_left; | 85 int packet_size_left; |
86 int prev_packet_sent_time; | |
87 int packet_timestamp_start; | 87 int packet_timestamp_start; |
88 int packet_timestamp_end; | 88 int packet_timestamp_end; |
89 unsigned int packet_nb_payloads; | |
89 int packet_nb_frames; | 90 int packet_nb_frames; |
90 uint8_t packet_buf[PACKET_SIZE]; | 91 uint8_t packet_buf[PACKET_SIZE]; |
91 ByteIOContext pb; | 92 ByteIOContext pb; |
92 /* only for reading */ | 93 /* only for reading */ |
93 uint64_t data_offset; /* begining of the first data packet */ | 94 uint64_t data_offset; /* begining of the first data packet */ |
177 /* I am not a number !!! This GUID is the one found on the PC used to | 178 /* I am not a number !!! This GUID is the one found on the PC used to |
178 generate the stream */ | 179 generate the stream */ |
179 static const GUID my_guid = { | 180 static const GUID my_guid = { |
180 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, | 181 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, |
181 }; | 182 }; |
183 | |
184 #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 0000 | |
185 | |
186 | |
187 // ASF data packet structure | |
188 // ========================= | |
189 // | |
190 // | |
191 // ----------------------------------- | |
192 // | Error Correction Data | Optional | |
193 // ----------------------------------- | |
194 // | Payload Parsing Information (PPI) | | |
195 // ----------------------------------- | |
196 // | Payload Data | | |
197 // ----------------------------------- | |
198 // | Padding Data | | |
199 // ----------------------------------- | |
200 | |
201 | |
202 // PPI_FLAG - Payload parsing information flags | |
203 #define ASF_PPI_FLAG_MULTIPLE_PAYLOADS_PRESENT 1 | |
204 | |
205 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_BYTE 0x02 //0000 0010 | |
206 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_WORD 0x04 //0000 0100 | |
207 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_DWORD 0x06 //0000 0110 | |
208 #define ASF_PPI_MASK_SEQUENCE_FIELD_SIZE 0x06 //0000 0110 | |
209 | |
210 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE 0x08 //0000 1000 | |
211 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD 0x10 //0001 0000 | |
212 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_DWORD 0x18 //0001 1000 | |
213 #define ASF_PPI_MASK_PADDING_LENGTH_FIELD_SIZE 0x18 //0001 1000 | |
214 | |
215 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_BYTE 0x20 //0010 0000 | |
216 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_WORD 0x40 //0100 0000 | |
217 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_DWORD 0x60 //0110 0000 | |
218 #define ASF_PPI_MASK_PACKET_LENGTH_FIELD_SIZE 0x60 //0110 0000 | |
219 | |
220 // PL_FLAG - Payload flags | |
221 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE 0x01 //0000 0001 | |
222 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_WORD 0x02 //0000 0010 | |
223 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_DWORD 0x03 //0000 0011 | |
224 #define ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE 0x03 //0000 0011 | |
225 | |
226 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_BYTE 0x04 //0000 0100 | |
227 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_WORD 0x08 //0000 1000 | |
228 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD 0x0c //0000 1100 | |
229 #define ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE 0x0c //0000 1100 | |
230 | |
231 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE 0x10 //0001 0000 | |
232 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_WORD 0x20 //0010 0000 | |
233 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_DWORD 0x30 //0011 0000 | |
234 #define ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE 0x30 //0011 0000 | |
235 | |
236 #define ASF_PL_FLAG_STREAM_NUMBER_LENGTH_FIELD_IS_BYTE 0x40 //0100 0000 | |
237 #define ASF_PL_MASK_STREAM_NUMBER_LENGTH_FIELD_SIZE 0xc0 //1100 0000 | |
238 | |
239 #define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_BYTE 0x40 //0100 0000 | |
240 #define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD 0x80 //1000 0000 | |
241 #define ASF_PL_MASK_PAYLOAD_LENGTH_FIELD_SIZE 0xc0 //1100 0000 | |
242 | |
243 #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000 |