1 /*****************************************************************************
2 * vlc_es.h: Elementary stream formats descriptions
3 *****************************************************************************
4 * Copyright (C) 1999-2001 VideoLAN
5 * $Id: vlc_es.h,v 1.7 2004/01/25 21:39:37 gbazin Exp $
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
29 * This file defines the elementary streams format types
37 struct video_palette_t
39 int i_dummy; /**< to keep the compatibility with ffmpeg's palette */
41 uint32_t palette[256]; /**< 4-byte ARGB palette entries, stored in native
46 * audio format description
50 vlc_fourcc_t i_format; /**< audio format fourcc */
51 unsigned int i_rate; /**< audio sample-rate */
53 /* Describes the channels configuration of the samples (ie. number of
54 * channels which are available in the buffer, and positions). */
55 uint32_t i_physical_channels;
57 /* Describes from which original channels, before downmixing, the
58 * buffer is derived. */
59 uint32_t i_original_channels;
61 /* Optional - for A/52, SPDIF and DTS types : */
62 /* Bytes used by one compressed frame, depends on bitrate. */
63 unsigned int i_bytes_per_frame;
65 /* Number of sampleframes contained in one compressed frame. */
66 unsigned int i_frame_length;
67 /* Please note that it may be completely arbitrary - buffers are not
68 * obliged to contain a integral number of so-called "frames". It's
69 * just here for the division :
70 * buffer_size = i_nb_samples * i_bytes_per_frame / i_frame_length
73 /* FIXME ? (used by the codecs) */
80 * video format description
84 vlc_fourcc_t i_chroma; /**< picture chroma */
85 unsigned int i_aspect; /**< aspect ratio */
87 unsigned int i_width; /**< picture width */
88 unsigned int i_height; /**< picture height */
89 unsigned int i_x_offset; /**< start offset of visible area */
90 unsigned int i_y_offset; /**< start offset of visible area */
91 unsigned int i_visible_width; /**< width of visible area */
92 unsigned int i_visible_height; /**< height of visible area */
94 unsigned int i_bits_per_pixel; /**< number of bits per pixel */
96 unsigned int i_frame_rate; /**< frame rate numerator */
97 unsigned int i_frame_rate_base; /**< frame rate denominator */
99 video_palette_t *p_palette; /**< video palette from demuxer */
103 * subtitles format description
112 uint32_t palette[16+1];
127 vlc_fourcc_t i_codec;
129 int i_id; /* -1: let the core mark the right id
131 int i_group; /* -1 : standalone
132 >= 0 then a "group" (program) is created
134 int i_priority; /* -2 : mean not selectable by the users
135 -1 : mean not selected by default even
139 char *psz_description;
141 audio_format_t audio;
142 video_format_t video;
153 #define UNKNOWN_ES 0x00
154 #define VIDEO_ES 0x01
155 #define AUDIO_ES 0x02
159 static inline void es_format_Init( es_format_t *fmt,
160 int i_cat, vlc_fourcc_t i_codec )
163 fmt->i_codec = i_codec;
167 fmt->psz_language = NULL;
168 fmt->psz_description = NULL;
170 memset( &fmt->audio, 0, sizeof(audio_format_t) );
171 memset( &fmt->video, 0, sizeof(video_format_t) );
172 memset( &fmt->subs, 0, sizeof(subs_format_t) );
179 static inline void es_format_Copy( es_format_t *dst, es_format_t *src )
181 memcpy( dst, src, sizeof( es_format_t ) );
182 if( src->i_extra > 0 )
184 dst->p_extra = malloc( src->i_extra );
185 memcpy( dst->p_extra, src->p_extra,