1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 1999-2001 VideoLAN
5 * $Id: vlc_es.h,v 1.2 2003/11/21 15:32:08 fenrir 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 *****************************************************************************/
28 * Description of a audio frame
32 vlc_fourcc_t i_format;
36 /* Describes the channels configuration of the samples (ie. number of
37 * channels which are available in the buffer, and positions). */
38 uint32_t i_physical_channels;
40 /* Describes from which original channels, before downmixing, the
41 * buffer is derived. */
42 uint32_t i_original_channels;
44 /* Optional - for A/52, SPDIF and DTS types : */
45 /* Bytes used by one compressed frame, depends on bitrate. */
46 unsigned int i_bytes_per_frame;
48 /* Number of sampleframes contained in one compressed frame. */
49 unsigned int i_frame_length;
50 /* Please note that it may be completely arbitrary - buffers are not
51 * obliged to contain a integral number of so-called "frames". It's
52 * just here for the division :
53 * buffer_size = i_nb_samples * i_bytes_per_frame / i_frame_length
56 /* FIXME ? (used by the codecs) */
63 * Description of a video frame
67 vlc_fourcc_t i_chroma; /**< picture chroma */
68 unsigned int i_aspect; /**< aspect ratio */
70 unsigned int i_width; /**< picture width */
71 unsigned int i_height; /**< picture height */
72 unsigned int i_x_offset; /**< start offset of visible area */
73 unsigned int i_y_offset; /**< start offset of visible area */
74 unsigned int i_visible_width; /**< width of visible area */
75 unsigned int i_visible_height; /**< height of visible area */
77 unsigned int i_bits_per_pixel; /**< number of bits per pixel */
79 unsigned int i_frame_rate; /**< frame rate numerator */
80 unsigned int i_frame_rate_base; /**< frame rate denominator */
100 int i_group; /* -1 : standalone
101 >= 0 then a "group" (program) is created
103 int i_priority; /* -2 : mean not selectable by the users
104 -1 : mean not selected by default even
108 char *psz_description;
110 audio_format_t audio;
111 video_format_t video;
121 static inline void es_format_Init( es_format_t *fmt,
122 int i_cat, vlc_fourcc_t i_codec )
125 fmt->i_codec = i_codec;
128 fmt->psz_language = NULL;
129 fmt->psz_description = NULL;
131 memset( &fmt->audio, 0, sizeof(audio_format_t) );
132 memset( &fmt->video, 0, sizeof(video_format_t) );
133 memset( &fmt->subs, 0, sizeof(subs_format_t) );
140 static inline void es_format_Copy( es_format_t *dst, es_format_t *src )
142 memcpy( dst, src, sizeof( es_format_t ) );
143 if( src->i_extra > 0 )
145 dst->p_extra = malloc( src->i_extra );
146 memcpy( dst->p_extra, src->p_extra,