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 int palette_changed; 00049 uint32_t palette[256]; 00050 } ASFStream; 00051 00052 typedef struct { 00053 ff_asf_guid guid; 00054 uint64_t file_size; 00056 uint64_t create_time; 00058 uint64_t play_time; 00060 uint64_t send_time; 00062 uint32_t preroll; 00064 uint32_t ignore; 00065 uint32_t flags; 00068 uint32_t min_pktsize; 00070 uint32_t max_pktsize; 00072 uint32_t max_bitrate; 00075 } ASFMainHeader; 00076 00077 00078 typedef struct { 00079 uint32_t packet_number; 00080 uint16_t packet_count; 00081 } ASFIndex; 00082 00083 extern const ff_asf_guid ff_asf_header; 00084 extern const ff_asf_guid ff_asf_file_header; 00085 extern const ff_asf_guid ff_asf_stream_header; 00086 extern const ff_asf_guid ff_asf_ext_stream_header; 00087 extern const ff_asf_guid ff_asf_audio_stream; 00088 extern const ff_asf_guid ff_asf_audio_conceal_none; 00089 extern const ff_asf_guid ff_asf_audio_conceal_spread; 00090 extern const ff_asf_guid ff_asf_video_stream; 00091 extern const ff_asf_guid ff_asf_jfif_media; 00092 extern const ff_asf_guid ff_asf_video_conceal_none; 00093 extern const ff_asf_guid ff_asf_command_stream; 00094 extern const ff_asf_guid ff_asf_comment_header; 00095 extern const ff_asf_guid ff_asf_codec_comment_header; 00096 extern const ff_asf_guid ff_asf_codec_comment1_header; 00097 extern const ff_asf_guid ff_asf_data_header; 00098 extern const ff_asf_guid ff_asf_head1_guid; 00099 extern const ff_asf_guid ff_asf_head2_guid; 00100 extern const ff_asf_guid ff_asf_extended_content_header; 00101 extern const ff_asf_guid ff_asf_simple_index_header; 00102 extern const ff_asf_guid ff_asf_ext_stream_embed_stream_header; 00103 extern const ff_asf_guid ff_asf_ext_stream_audio_stream; 00104 extern const ff_asf_guid ff_asf_metadata_header; 00105 extern const ff_asf_guid ff_asf_marker_header; 00106 extern const ff_asf_guid ff_asf_my_guid; 00107 extern const ff_asf_guid ff_asf_language_guid; 00108 extern const ff_asf_guid ff_asf_content_encryption; 00109 extern const ff_asf_guid ff_asf_ext_content_encryption; 00110 extern const ff_asf_guid ff_asf_digital_signature; 00111 00112 extern const AVMetadataConv ff_asf_metadata_conv[]; 00113 00114 #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 0000 00115 00116 00117 // ASF data packet structure 00118 // ========================= 00119 // 00120 // 00121 // ----------------------------------- 00122 // | Error Correction Data | Optional 00123 // ----------------------------------- 00124 // | Payload Parsing Information (PPI) | 00125 // ----------------------------------- 00126 // | Payload Data | 00127 // ----------------------------------- 00128 // | Padding Data | 00129 // ----------------------------------- 00130 00131 00132 // PPI_FLAG - Payload parsing information flags 00133 #define ASF_PPI_FLAG_MULTIPLE_PAYLOADS_PRESENT 1 00134 00135 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_BYTE 0x02 //0000 0010 00136 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_WORD 0x04 //0000 0100 00137 #define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_DWORD 0x06 //0000 0110 00138 #define ASF_PPI_MASK_SEQUENCE_FIELD_SIZE 0x06 //0000 0110 00139 00140 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE 0x08 //0000 1000 00141 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD 0x10 //0001 0000 00142 #define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_DWORD 0x18 //0001 1000 00143 #define ASF_PPI_MASK_PADDING_LENGTH_FIELD_SIZE 0x18 //0001 1000 00144 00145 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_BYTE 0x20 //0010 0000 00146 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_WORD 0x40 //0100 0000 00147 #define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_DWORD 0x60 //0110 0000 00148 #define ASF_PPI_MASK_PACKET_LENGTH_FIELD_SIZE 0x60 //0110 0000 00149 00150 // PL_FLAG - Payload flags 00151 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE 0x01 //0000 0001 00152 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_WORD 0x02 //0000 0010 00153 #define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_DWORD 0x03 //0000 0011 00154 #define ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE 0x03 //0000 0011 00155 00156 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_BYTE 0x04 //0000 0100 00157 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_WORD 0x08 //0000 1000 00158 #define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD 0x0c //0000 1100 00159 #define ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE 0x0c //0000 1100 00160 00161 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE 0x10 //0001 0000 00162 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_WORD 0x20 //0010 0000 00163 #define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_DWORD 0x30 //0011 0000 00164 #define ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE 0x30 //0011 0000 00165 00166 #define ASF_PL_FLAG_STREAM_NUMBER_LENGTH_FIELD_IS_BYTE 0x40 //0100 0000 00167 #define ASF_PL_MASK_STREAM_NUMBER_LENGTH_FIELD_SIZE 0xc0 //1100 0000 00168 00169 #define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_BYTE 0x40 //0100 0000 00170 #define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD 0x80 //1000 0000 00171 #define ASF_PL_MASK_PAYLOAD_LENGTH_FIELD_SIZE 0xc0 //1100 0000 00172 00173 #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000 00174 00175 extern AVInputFormat ff_asf_demuxer; 00176 00177 void ff_put_guid(AVIOContext *s, const ff_asf_guid *g); 00178 00179 #endif /* AVFORMAT_ASF_H */