]> git.sesse.net Git - vlc/blob - include/codecs.h
* Strings review in include/
[vlc] / include / codecs.h
1 /*****************************************************************************
2  * codecs.h: codec related structures needed by the demuxers and decoders
3  *****************************************************************************
4  * Copyright (C) 1999-2001 VideoLAN
5  * $Id: codecs.h,v 1.10 2004/01/25 18:17:08 zorglub Exp $
6  *
7  * Author: Gildas Bazin <gbazin@netcourrier.com>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 #ifndef _VLC_CODECS_H
25 #define _VLC_CODECS_H 1
26
27 /* Structures exported to the demuxers and decoders */
28
29 #ifndef _WAVEFORMATEX_
30 #define _WAVEFORMATEX_
31 typedef struct
32 #ifdef HAVE_ATTRIBUTE_PACKED
33     __attribute__((__packed__))
34 #endif
35 _WAVEFORMATEX {
36     uint16_t   wFormatTag;
37     uint16_t   nChannels;
38     uint32_t   nSamplesPerSec;
39     uint32_t   nAvgBytesPerSec;
40     uint16_t   nBlockAlign;
41     uint16_t   wBitsPerSample;
42     uint16_t   cbSize;
43 } WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
44 #endif /* _WAVEFORMATEX_ */
45
46 #if !defined(_BITMAPINFOHEADER_) && !defined(WIN32)
47 #define _BITMAPINFOHEADER_
48 typedef struct
49 #ifdef HAVE_ATTRIBUTE_PACKED
50     __attribute__((__packed__))
51 #endif
52 {
53     uint32_t   biSize;
54     uint32_t   biWidth;
55     uint32_t   biHeight;
56     uint16_t   biPlanes;
57     uint16_t   biBitCount;
58     uint32_t   biCompression;
59     uint32_t   biSizeImage;
60     uint32_t   biXPelsPerMeter;
61     uint32_t   biYPelsPerMeter;
62     uint32_t   biClrUsed;
63     uint32_t   biClrImportant;
64 } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
65 typedef struct {
66     BITMAPINFOHEADER bmiHeader;
67     int        bmiColors[1];
68 } BITMAPINFO, *LPBITMAPINFO;
69 #endif
70
71 /* dvb_spuinfo_t exports the id of the selected track to the decoder */
72 typedef struct
73 {
74     unsigned int i_id;
75 } dvb_spuinfo_t;
76
77 /* WAVE form wFormatTag IDs */
78
79 #define WAVE_FORMAT_UNKNOWN             0x0000 /* Microsoft Corporation */
80 #define WAVE_FORMAT_PCM                 0x0001 /* Microsoft Corporation */
81 #define WAVE_FORMAT_ADPCM               0x0002 /* Microsoft Corporation */
82 #define WAVE_FORMAT_IEEE_FLOAT          0x0003 /* Microsoft Corporation */
83 #define WAVE_FORMAT_ALAW                0x0006 /* Microsoft Corporation */
84 #define WAVE_FORMAT_MULAW               0x0007 /* Microsoft Corporation */
85 #define WAVE_FORMAT_DTS                 0x0008 /* Microsoft Corporation */
86 #define WAVE_FORMAT_IMA_ADPCM           0x0011 /* Intel Corporation */
87 #define WAVE_FORMAT_GSM610              0x0031 /* Microsoft Corporation */
88 #define WAVE_FORMAT_MSNAUDIO            0x0032 /* Microsoft Corporation */
89 #define WAVE_FORMAT_MPEG                0x0050 /* Microsoft Corporation */
90 #define WAVE_FORMAT_MPEGLAYER3          0x0055 /* ISO/MPEG Layer3 Format Tag */
91 #define WAVE_FORMAT_DOLBY_AC3_SPDIF     0x0092 /* Sonic Foundry */
92
93 #define WAVE_FORMAT_A52                 0x2000
94 #define WAVE_FORMAT_WMA1                0x0160
95 #define WAVE_FORMAT_WMA2                0x0161
96 #define WAVE_FORMAT_WMA3                0x0162
97
98 /* Need to check these */
99 #define WAVE_FORMAT_DK3                 0x0061
100 #define WAVE_FORMAT_DK4                 0x0062
101
102 #if !defined(WAVE_FORMAT_EXTENSIBLE)
103 #define  WAVE_FORMAT_EXTENSIBLE         0xFFFE /* Microsoft */
104 #endif
105
106 static struct
107 {
108     uint16_t     i_tag;
109     vlc_fourcc_t i_fourcc;
110     char         *psz_name;
111 }
112 wave_format_tag_to_fourcc[] =
113 {
114     { WAVE_FORMAT_PCM,      VLC_FOURCC( 'a', 'r', 'a', 'w' ), "Raw audio" },
115     { WAVE_FORMAT_ADPCM,    VLC_FOURCC( 'm', 's', 0x00,0x02), "Adpcm" },
116     { WAVE_FORMAT_ALAW,     VLC_FOURCC( 'a', 'l', 'a', 'w' ), "A-Law" },
117     { WAVE_FORMAT_MULAW,    VLC_FOURCC( 'm', 'l', 'a', 'w' ), "Mu-Law" },
118     { WAVE_FORMAT_IMA_ADPCM,VLC_FOURCC( 'm', 's', 0x00,0x11), "Ima-Adpcm" },
119     { WAVE_FORMAT_MPEGLAYER3,VLC_FOURCC('m', 'p', 'g', 'a' ), "Mpeg Audio" },
120     { WAVE_FORMAT_MPEG,     VLC_FOURCC( 'm', 'p', 'g', 'a' ), "Mpeg Audio" },
121     { WAVE_FORMAT_A52,      VLC_FOURCC( 'a', '5', '2', ' ' ), "A/52" },
122     { WAVE_FORMAT_WMA1,     VLC_FOURCC( 'w', 'm', 'a', '1' ), "Window Media Audio 1" },
123     { WAVE_FORMAT_WMA2,     VLC_FOURCC( 'w', 'm', 'a', '2' ), "Window Media Audio 2" },
124     { WAVE_FORMAT_WMA3,     VLC_FOURCC( 'w', 'm', 'a', '3' ), "Window Media Audio 3" },
125     { WAVE_FORMAT_DK3,      VLC_FOURCC( 'm', 's', 0x00,0x61), "Duck DK3" },
126     { WAVE_FORMAT_DK4,      VLC_FOURCC( 'm', 's', 0x00,0x62), "Duck DK4" },
127     { WAVE_FORMAT_UNKNOWN,  VLC_FOURCC( 'u', 'n', 'd', 'f' ), "Unknown" }
128 };
129
130 static inline void wf_tag_to_fourcc( uint16_t i_tag,
131                                      vlc_fourcc_t *fcc, char **ppsz_name )
132 {
133     int i;
134     for( i = 0; wave_format_tag_to_fourcc[i].i_tag != 0; i++ )
135     {
136         if( wave_format_tag_to_fourcc[i].i_tag == i_tag )
137         {
138             break;
139         }
140     }
141     if( fcc )
142     {
143         *fcc = wave_format_tag_to_fourcc[i].i_fourcc;
144     }
145     if( ppsz_name )
146     {
147         *ppsz_name = wave_format_tag_to_fourcc[i].psz_name;
148     }
149 }
150
151 /**
152  * Structure to hold information concerning subtitles.
153  * Used between demuxers and decoders of subtitles.
154  */
155 typedef struct es_sys_t
156 {
157     char        *psz_header; /* for 'ssa ' and 'subt' */
158
159     /* for spudec */
160     unsigned int        i_orig_height;
161     unsigned int        i_orig_width;
162     unsigned int        i_origin_x;
163     unsigned int        i_origin_y;
164     unsigned int        i_scale_h;
165     unsigned int        i_scale_v;
166     unsigned int        i_alpha;
167     vlc_bool_t          b_smooth;
168     mtime_t             i_fade_in;
169     mtime_t             i_fade_out;
170     unsigned int        i_align;
171     mtime_t             i_time_offset;
172     vlc_bool_t          b_forced_subs;
173     unsigned int        palette[16];
174     unsigned int        colors[4];
175 } subtitle_data_t;
176
177 #endif /* "codecs.h" */
178