annotate libmpdemux/asfguid.h @ 31603:2b455d7357cc

Check packet size before memmove to avoid crashes e.g. if we recognized the wrong type and subtracted more header bytes than there are overall bytes.
author reimar
date Sat, 10 Jul 2010 16:43:00 +0000
parents bce9cacbdeb7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26325
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
1 /*
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
2 * Copyright (C) 2001 Reimar Döffinger
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
3 *
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
4 * This file is part of MPlayer.
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
5 *
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
9 * (at your option) any later version.
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
10 *
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
14 * GNU General Public License for more details.
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
15 *
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License along
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
19 */
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
20
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
21 #ifndef MPLAYER_ASFGUID_H
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
22 #define MPLAYER_ASFGUID_H
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
23
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
24 #include <inttypes.h>
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
25 #include "libavutil/common.h"
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
26 #include "mpbswap.h"
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
27
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
28
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
29 #define ASF_LOAD_GUID_PREFIX(guid) AV_RL32(guid)
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
30
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
31 #define ASF_GUID_PREFIX_audio_stream 0xF8699E40
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
32 #define ASF_GUID_PREFIX_video_stream 0xBC19EFC0
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
33 #define ASF_GUID_PREFIX_audio_conceal_none 0x49f1a440
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
34 #define ASF_GUID_PREFIX_audio_conceal_interleave 0xbfc3cd50
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
35 #define ASF_GUID_PREFIX_header 0x75B22630
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
36 #define ASF_GUID_PREFIX_data_chunk 0x75b22636
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
37 #define ASF_GUID_PREFIX_index_chunk 0x33000890
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
38 #define ASF_GUID_PREFIX_stream_header 0xB7DC0791
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
39 #define ASF_GUID_PREFIX_header_2_0 0xD6E229D1
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
40 #define ASF_GUID_PREFIX_file_header 0x8CABDCA1
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
41 #define ASF_GUID_PREFIX_content_desc 0x75b22633
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
42 #define ASF_GUID_PREFIX_stream_group 0x7bf875ce
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
43 #define ASF_GUID_PREFIX_ext_audio_stream 0x31178C9D
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
44 #define ASF_GUID_PREFIX_ext_stream_embed_stream_header 0x3AFB65E2
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
45 #define ASF_GUID_PREFIX_dvr_ms_timing_rep_data 0xFD3CC02A
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
46 #define ASF_GUID_PREFIX_dvr_ms_vid_frame_rep_data 0xDD6432CC
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
47
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
48 /*
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
49 const char asf_audio_stream_guid[16] = {0x40, 0x9e, 0x69, 0xf8,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
50 0x4d, 0x5b, 0xcf, 0x11, 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
51 const char asf_video_stream_guid[16] = {0xc0, 0xef, 0x19, 0xbc,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
52 0x4d, 0x5b, 0xcf, 0x11, 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
53 */
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
54 static const char asf_stream_header_guid[16] = {0x91, 0x07, 0xdc, 0xb7,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
55 0xb7, 0xa9, 0xcf, 0x11, 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
56 static const char asf_file_header_guid[16] = {0xa1, 0xdc, 0xab, 0x8c,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
57 0x47, 0xa9, 0xcf, 0x11, 0x8e, 0xe4, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
58 static const char asf_content_desc_guid[16] = {0x33, 0x26, 0xb2, 0x75,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
59 0x8e, 0x66, 0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
60 static const char asf_stream_group_guid[16] = {0xce, 0x75, 0xf8, 0x7b,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
61 0x8d, 0x46, 0xd1, 0x11, 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
62 static const char asf_data_chunk_guid[16] = {0x36, 0x26, 0xb2, 0x75,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
63 0x8e, 0x66, 0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
64 static const char asf_ext_stream_embed_stream_header[16] = {0xe2, 0x65, 0xfb, 0x3a,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
65 0xef, 0x47, 0xf2, 0x40, 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
66 static const char asf_ext_stream_audio[16] = {0x9d, 0x8c, 0x17, 0x31,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
67 0xe1, 0x03, 0x28, 0x45, 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
68 static const char asf_ext_stream_header[16] = {0xCB, 0xA5, 0xE6, 0x14,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
69 0x72, 0xC6, 0x32, 0x43, 0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
70 static const char asf_metadata_header[16] = {0xea, 0xcb, 0xf8, 0xc5,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
71 0xaf, 0x5b, 0x77, 0x48, 0x84, 0x67, 0xaa, 0x8c, 0x44, 0xfa, 0x4c, 0xca};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
72 static const char asf_content_encryption[16] = {0xfb, 0xb3, 0x11, 0x22,
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
73 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e};
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28290
diff changeset
74 static const char asf_dvr_ms_timing_rep_data[16] = {0x2a, 0xc0, 0x3c,0xfd,
26325
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
75 0xdb, 0x06, 0xfa, 0x4c, 0x80, 0x1c, 0x72, 0x12, 0xd3, 0x87, 0x45, 0xe4};
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28290
diff changeset
76 static const char asf_dvr_ms_vid_frame_rep_data[16] = {0xcc, 0x32, 0x64, 0xdd,
26325
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
77 0x29, 0xe2, 0xdb, 0x40, 0x80, 0xf6, 0xd2, 0x63, 0x28, 0xd2, 0x76, 0x1f};
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
78
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
79 static int find_asf_guid(char *buf, const char *guid, int cur_pos, int buf_len)
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
80 {
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
81 int i;
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
82 for (i = cur_pos; i < buf_len - 19; i++) {
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
83 if (memcmp(&buf[i], guid, 16) == 0)
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
84 return i + 16 + 8; // point after guid + length
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
85 }
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
86 return -1;
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
87 }
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
88
890180cde40f Make stream independent of libmpdemux, the asf demuxer and streaming
albeu
parents:
diff changeset
89 #endif /* MPLAYER_ASFGUID_H */