00001 /* 00002 * Copyright (c) 2000, 2001 Fabrice Bellard 00003 * 00004 * This file is part of FFmpeg. 00005 * 00006 * FFmpeg is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * FFmpeg is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with FFmpeg; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef AVFORMAT_ASF_H 00022 #define AVFORMAT_ASF_H 00023 00024 #include <stdint.h> 00025 #include "avformat.h" 00026 #include "metadata.h" 00027 #include "riff.h" 00028 00029 #define PACKET_SIZE 3200 00030 00031 typedef struct { 00032 int num; 00033 unsigned char seq; 00034 /* use for reading */ 00035 AVPacket pkt; 00036 int frag_offset; 00037 int timestamp; 00038 int64_t duration; 00039 00040 int ds_span; /* descrambling */ 00041 int ds_packet_size; 00042 int ds_chunk_size; 00043 00044 int64_t packet_pos; 00045 00046 uint16_t stream_language_index; 00047 00048 } ASFStream; 00049 00050 typedef struct { 00051 ff_asf_guid guid; 00052 uint64_t file_size; 00054 uint64_t create_time; 00056 uint64_t play_time; 00058 uint64_t send_time; 00060 uint32_t preroll; 00062 uint32_t ignore; 00063 uint32_t flags; 00066 uint32_t min_pktsize; 00068 uint32_t max_pktsize; 00070 uint32_t max_bitrate; 00073 } ASFMainHeader; 00074 00075 00076 typedef struct { 00077 uint32_t packet_number; 00078 uint16_t packet_count; 00079 } ASFIndex; 00080 00081 extern const ff_asf_guid ff_asf_header; 00082 extern const ff_asf_guid ff_asf_file_header; 00083 extern const ff_asf_guid ff_asf_stream_header; 00084 extern const ff_asf_guid ff_asf_ext_stream_header; 00085 extern const ff_asf_guid ff_asf_audio_stream; 00086 extern const ff_asf_guid ff_asf_audio_conceal_none; 00087 extern const ff_asf_guid ff_asf_audio_conceal_spread; 00088 extern const ff_asf_guid ff_asf_video_stream; 00089 extern const ff_asf_guid ff_asf_jfif_media; 00090 extern const ff_asf_guid ff_asf_video_conceal_none; 00091 extern const ff_asf_guid ff_asf_command_stream; 00092 extern const ff_asf_guid ff_asf_comment_header; 00093 extern const ff_asf_guid ff_asf_codec_comment_header; 00094 extern const ff_asf_guid ff_asf_codec_comment1_header; 00095 extern const ff_asf_guid ff_asf_data_header; 00096 extern const ff_asf_guid ff_asf_head1_guid; 00097 extern const ff_asf_guid ff_asf_head2_guid; 00098 extern const ff_asf_guid ff_asf_extended_content_header; 00099 extern const ff_asf_guid ff_asf_simple_index_header; 00100 extern const ff_asf_guid ff_asf_ext_stream_embed_stream_header; 00101 extern const ff_asf_guid ff_asf_ext_stream_audio_stream; 00102 extern const ff_asf_guid ff_asf_metadata_header; 00103 extern const ff_asf_guid ff_asf_marker_header; 00104 extern const ff_asf_guid ff_asf_my_guid; 00105 extern const ff_asf_guid ff_asf_language_guid; 00106 extern const ff_asf_guid ff_asf_content_encryption; 00107 extern const ff_asf_guid ff_asf_ext_content_encryption; 00108 extern const ff_asf_guid ff_asf_digital_signature; 00109 00110 extern const AVMetadataConv ff_asf_metadata_conv[]; 00111 00112 #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 0000 00113 00114 00115 // ASF data packet structure 00116 // ========================= 00117 // 00118 // 00119 // ----------------------------------- 00120 // | Error Correction Data | Optional 00121 // ----------------------------------- 00122 // | Payload Parsing Information (PPI) | 00123 // ----------------------------------- 00124 // | Payload Data | 00125 // ----------------------------------- 00126 // | Padding Data | 00127 // ----------------------------------- 00128 00129 00130 // PPI_FLAG - Payload parsing information flags 00131 #define ASF_PPI_FLAG_MULTIPLE_PAYLOADS_PRESENT 1 00132 00133 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_BYTE 0x02 //0000 0010 00134 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_WORD 0x04 //0000 0100 00135 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_DWORD 0x06 //0000 0110 00136 #define ASF_PPI_MASK_SEQUENCE_FIELD_SIZE 0x06 //0000 0110 00137 00138 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE 0x08 //0000 1000 00139 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD 0x10 //0001 0000 00140 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_DWORD 0x18 //0001 1000 00141 #define ASF_PPI_MASK_PADDING_LENGTH_FIELD_SIZE 0x18 //0001 1000 00142 00143 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_BYTE 0x20 //0010 0000 00144 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_WORD 0x40 //0100 0000 00145 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_DWORD 0x60 //0110 0000 00146 #define ASF_PPI_MASK_PACKET_LENGTH_FIELD_SIZE 0x60 //0110 0000 00147 00148 // PL_FLAG - Payload flags 00149 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE 0x01 //0000 0001 00150 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_WORD 0x02 //0000 0010 00151 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_DWORD 0x03 //0000 0011 00152 #define ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE 0x03 //0000 0011 00153 00154 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_BYTE 0x04 //0000 0100 00155 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_WORD 0x08 //0000 1000 00156 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD 0x0c //0000 1100 00157 #define ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE 0x0c //0000 1100 00158 00159 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE 0x10 //0001 0000 00160 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_WORD 0x20 //0010 0000 00161 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_DWORD 0x30 //0011 0000 00162 #define ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE 0x30 //0011 0000 00163 00164 #define ASF_PL_FLAG_STREAM_NUMBER_LENGTH_FIELD_IS_BYTE 0x40 //0100 0000 00165 #define ASF_PL_MASK_STREAM_NUMBER_LENGTH_FIELD_SIZE 0xc0 //1100 0000 00166 00167 #define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_BYTE 0x40 //0100 0000 00168 #define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD 0x80 //1000 0000 00169 #define ASF_PL_MASK_PAYLOAD_LENGTH_FIELD_SIZE 0xc0 //1100 0000 00170 00171 #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000 00172 00173 extern AVInputFormat ff_asf_demuxer; 00174 00175 #endif /* AVFORMAT_ASF_H */