00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _VLC_ES_H
00025 #define _VLC_ES_H 1
00026
00037 struct video_palette_t
00038 {
00039 int i_entries;
00040 uint8_t palette[256][4];
00041 };
00042
00046 struct audio_format_t
00047 {
00048 vlc_fourcc_t i_format;
00049 unsigned int i_rate;
00051
00052
00053 uint32_t i_physical_channels;
00054
00055
00056
00057 uint32_t i_original_channels;
00058
00059
00060
00061 unsigned int i_bytes_per_frame;
00062
00063
00064 unsigned int i_frame_length;
00065
00066
00067
00068
00069
00070
00071
00072 int i_channels;
00073 int i_blockalign;
00074 int i_bitspersample;
00075 };
00076
00077 #ifdef WORDS_BIGENDIAN
00078 # define AUDIO_FMT_S16_NE VLC_FOURCC('s','1','6','b')
00079 # define AUDIO_FMT_U16_NE VLC_FOURCC('u','1','6','b')
00080 #else
00081 # define AUDIO_FMT_S16_NE VLC_FOURCC('s','1','6','l')
00082 # define AUDIO_FMT_U16_NE VLC_FOURCC('u','1','6','l')
00083 #endif
00084
00088 struct video_format_t
00089 {
00090 vlc_fourcc_t i_chroma;
00091 unsigned int i_aspect;
00093 unsigned int i_width;
00094 unsigned int i_height;
00095 unsigned int i_x_offset;
00096 unsigned int i_y_offset;
00097 unsigned int i_visible_width;
00098 unsigned int i_visible_height;
00100 unsigned int i_bits_per_pixel;
00102 unsigned int i_sar_num;
00103 unsigned int i_sar_den;
00104
00105 unsigned int i_frame_rate;
00106 unsigned int i_frame_rate_base;
00108 int i_rmask, i_gmask, i_bmask;
00109 video_palette_t *p_palette;
00110 };
00111
00115 struct subs_format_t
00116 {
00117
00118
00119 char *psz_encoding;
00120
00121
00122 int i_x_origin;
00123 int i_y_origin;
00125 struct
00126 {
00127
00128 uint32_t palette[16+1];
00129
00130
00131 int i_original_frame_width;
00132
00133 int i_original_frame_height;
00134 } spu;
00135
00136 struct
00137 {
00138 int i_id;
00139 } dvb;
00140 };
00141
00145 struct es_format_t
00146 {
00147 int i_cat;
00148 vlc_fourcc_t i_codec;
00149
00150 int i_id;
00151
00152 int i_group;
00153
00154
00155 int i_priority;
00156
00157
00158
00159 char *psz_language;
00160 char *psz_description;
00161
00162 audio_format_t audio;
00163 video_format_t video;
00164 subs_format_t subs;
00165
00166 unsigned int i_bitrate;
00167
00168 vlc_bool_t b_packetized;
00169
00170 int i_extra;
00171 void *p_extra;
00172
00173 };
00174
00175
00176 #define UNKNOWN_ES 0x00
00177 #define VIDEO_ES 0x01
00178 #define AUDIO_ES 0x02
00179 #define SPU_ES 0x03
00180 #define NAV_ES 0x04
00181
00182 static inline void es_format_Init( es_format_t *fmt,
00183 int i_cat, vlc_fourcc_t i_codec )
00184 {
00185 fmt->i_cat = i_cat;
00186 fmt->i_codec = i_codec;
00187 fmt->i_id = -1;
00188 fmt->i_group = 0;
00189 fmt->i_priority = 0;
00190 fmt->psz_language = NULL;
00191 fmt->psz_description = NULL;
00192
00193 memset( &fmt->audio, 0, sizeof(audio_format_t) );
00194 memset( &fmt->video, 0, sizeof(video_format_t) );
00195 memset( &fmt->subs, 0, sizeof(subs_format_t) );
00196
00197 fmt->b_packetized = VLC_TRUE;
00198 fmt->i_bitrate = 0;
00199 fmt->i_extra = 0;
00200 fmt->p_extra = NULL;
00201 }
00202
00203 static inline void es_format_Copy( es_format_t *dst, es_format_t *src )
00204 {
00205 memcpy( dst, src, sizeof( es_format_t ) );
00206 if( src->psz_language )
00207 dst->psz_language = strdup( src->psz_language );
00208 if( src->psz_description )
00209 dst->psz_description = strdup( src->psz_description );
00210 if( src->i_extra > 0 )
00211 {
00212 dst->i_extra = src->i_extra;
00213 dst->p_extra = malloc( src->i_extra );
00214 memcpy( dst->p_extra, src->p_extra, src->i_extra );
00215 }
00216 else
00217 {
00218 dst->i_extra = 0;
00219 dst->p_extra = NULL;
00220 }
00221
00222 if( src->subs.psz_encoding )
00223 dst->subs.psz_encoding = strdup( src->subs.psz_encoding );
00224
00225 if( src->video.p_palette )
00226 {
00227 dst->video.p_palette =
00228 (video_palette_t*)malloc( sizeof( video_palette_t ) );
00229 memcpy( dst->video.p_palette, src->video.p_palette,
00230 sizeof( video_palette_t ) );
00231 }
00232 }
00233
00234 static inline void es_format_Clean( es_format_t *fmt )
00235 {
00236 if( fmt->psz_language ) free( fmt->psz_language );
00237 fmt->psz_language = NULL;
00238
00239 if( fmt->psz_description ) free( fmt->psz_description );
00240 fmt->psz_description = NULL;
00241
00242 if( fmt->i_extra > 0 ) free( fmt->p_extra );
00243 fmt->i_extra = 0; fmt->p_extra = NULL;
00244
00245 if( fmt->video.p_palette ) free( fmt->video.p_palette );
00246 fmt->video.p_palette = NULL;
00247
00248 if( fmt->subs.psz_encoding ) free( fmt->subs.psz_encoding );
00249 fmt->subs.psz_encoding = NULL;
00250 }
00251
00252 #endif