xref: /third_party/libsnd/src/mpeg.h (revision b815c7f3)
1/*
2** Copyright (C) 2019 Erik de Castro Lopo <erikd@mega-nerd.com>
3** Copyright (C) 2019 Arthur Taylor <art@ified.ca>
4**
5** This program is free software ; you can redistribute it and/or modify
6** it under the terms of the GNU Lesser General Public License as published by
7** the Free Software Foundation ; either version 2.1 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY ; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13** GNU Lesser General Public License for more details.
14**
15** You should have received a copy of the GNU Lesser General Public License
16** along with this program ; if not, write to the Free Software
17** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/
19
20#ifndef SNDFILE_MPEG_H
21#define SNDFILE_MPEG_H
22
23#include	"common.h"
24
25int mpeg_decoder_init (SF_PRIVATE *psf) ;
26
27/*
28** Get the file bitrate mode, returning one of the SF_BITRATE_MODE_ enum
29** values. Purely informative, 'Frankenstein' files and VBR files without an
30** Xing/LAME/Info header may not be detected properly.
31*/
32int mpeg_decoder_get_bitrate_mode (SF_PRIVATE *psf) ;
33
34
35/*
36** Initialize an encoder instance for writing. If parameter info_tag is
37** SF_TRUE, a Xing/LAME/Info header is written at the beginning of the file,
38** (unless the file cannot seek.)
39*/
40int mpeg_l3_encoder_init (SF_PRIVATE *psf, int info_tag) ;
41
42
43/*
44** Write an ID3v2 header from the sndfile string metadata. Must be called
45** before any audio data is written. Writing an ID3v2 header will also cause
46** a ID3v1 trailer to be written on close automatically.
47*/
48int mpeg_l3_encoder_write_id3tag (SF_PRIVATE *psf) ;
49
50/*
51** Set the encoder quality setting. Argument to compression should be identical
52** to that for SFC_SET_COMPRESSION_LEVEL; It should be in the range [0-1],
53** with 0 being highest quality, least compression, and 1 being the opposite.
54** Returns SF_TRUE on success, SF_FALSE otherwise.
55*/
56int mpeg_l3_encoder_set_quality (SF_PRIVATE *psf, double compression) ;
57
58/*
59** Set the encoder bitrate mode. Can only be called before any data has been
60** written. Argument mode should be one of the SF_BITRATE_MODE_ enum values.
61** Returns SF_TRUE on success, SF_FALSE otherwise. The SF_BITRATE_MODE_FILE
62** enum value should not be passed here but rather intercepted at the container
63** level and translated according to the container.
64*/
65int mpeg_l3_encoder_set_bitrate_mode (SF_PRIVATE *psf, int mode) ;
66
67/*
68** Get the encoder bitrate mode in use. Returns a SF_BITRATE_MODE_ enum value.
69** Will not return SF_BITRATE_MODE_FILE.
70*/
71int mpeg_l3_encoder_get_bitrate_mode (SF_PRIVATE *psf) ;
72
73
74#endif /* SNDFILE_MPEG_H */
75