2
* params.hpp: User specifiable parameters for various types of stream
4
* The Check<stream>Params pseudo-constructors are constructed so that
5
* they will only construct legal combinations of parameters.
7
* Copyright (C) 2002 Andrew Stevens <andrew.stevens@philips.com>
9
* This program is free software; you can redistribute it and/or
10
* modify it under the terms of version 2 of the GNU General Public License
11
* as published by the Free Software Foundation.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
#include "stream_params.hpp"
29
#include "format_codes.h"
31
LpcmParams *LpcmParams::Default(unsigned int mux_format)
33
return new LpcmParams(48000,2,16);
36
LpcmParams::LpcmParams( unsigned int samples,
39
samples_per_sec( samples ),
45
LpcmParams *LpcmParams::Checked(unsigned int samples,
49
if( samples != 48000 && samples != 96000 )
51
if( chans < 1 || chans > 7 )
53
if( bits != 16 && bits != 20 && bits != 24 )
56
return new LpcmParams(samples,chans,bits);
59
bool VideoParams::Force( unsigned int mux_format )
63
// Handle formats that force the buffer size parameter to a
64
// standard-conforming value
68
case MPEG_FORMAT_SVCD :
71
case MPEG_FORMAT_VCD :
74
case MPEG_FORMAT_DVD :
75
case MPEG_FORMAT_DVD_NAV :
81
decode_buffer_size = bufsiz;
85
VideoParams *VideoParams::Checked( unsigned int bufsiz)
87
if( bufsiz < 20 && bufsiz >= 4096 ) // In KB here...
89
return new VideoParams(bufsiz);
92
VideoParams::VideoParams( unsigned int bufsiz ) :
93
decode_buffer_size(bufsiz)
97
VideoParams *VideoParams::Default(unsigned int mux_format)
102
case MPEG_FORMAT_MPEG2 :
103
case MPEG_FORMAT_SVCD :
104
case MPEG_FORMAT_SVCD_NSR :
105
case MPEG_FORMAT_SVCD_STILL :
108
case MPEG_FORMAT_DVD :
109
case MPEG_FORMAT_DVD_NAV :
115
return new VideoParams(bufsiz);
121
* c-file-style: "stroustrup"
123
* indent-tabs-mode: nil