/src/poppler/poppler/Sound.h
Line | Count | Source |
1 | | /* Sound.h - an object that holds the sound structure |
2 | | * Copyright (C) 2006-2007, Pino Toscano <pino@kde.org> |
3 | | * Copyright (C) 2017-2021, 2024, 2025, Albert Astals Cid <aacid@kde.org> |
4 | | * Copyright (C) 2020, Oliver Sander <oliver.sander@tu-dresden.de> |
5 | | * |
6 | | * This program is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU General Public License as published by |
8 | | * the Free Software Foundation; either version 2, or (at your option) |
9 | | * any later version. |
10 | | * |
11 | | * This program is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU General Public License |
17 | | * along with this program; if not, write to the Free Software |
18 | | * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. |
19 | | */ |
20 | | |
21 | | #ifndef Sound_H |
22 | | #define Sound_H |
23 | | |
24 | | #include <memory> |
25 | | |
26 | | #include "poppler_private_export.h" |
27 | | |
28 | | #include "Object.h" |
29 | | |
30 | | //------------------------------------------------------------------------ |
31 | | |
32 | | enum SoundKind |
33 | | { |
34 | | soundEmbedded, // embedded sound |
35 | | soundExternal // external sound |
36 | | }; |
37 | | |
38 | | enum SoundEncoding |
39 | | { |
40 | | soundRaw, // raw encoding |
41 | | soundSigned, // twos-complement values |
42 | | soundMuLaw, // mu-law-encoded samples |
43 | | soundALaw // A-law-encoded samples |
44 | | }; |
45 | | |
46 | | class POPPLER_PRIVATE_EXPORT Sound |
47 | | { |
48 | | public: |
49 | | // Try to parse the Object obj |
50 | | static std::unique_ptr<Sound> parseSound(const Object &obj); |
51 | | |
52 | | // Destructor |
53 | | ~Sound(); |
54 | | |
55 | | Sound(const Sound &) = delete; |
56 | | Sound &operator=(const Sound &) = delete; |
57 | | |
58 | 0 | const Object &getObject() const { return streamObj; } |
59 | | Stream *getStream(); |
60 | | |
61 | 0 | SoundKind getSoundKind() const { return kind; } |
62 | 0 | const std::string &getFileName() const { return fileName; } |
63 | 0 | double getSamplingRate() const { return samplingRate; } |
64 | 0 | int getChannels() const { return channels; } |
65 | 0 | int getBitsPerSample() const { return bitsPerSample; } |
66 | 0 | SoundEncoding getEncoding() const { return encoding; } |
67 | | |
68 | | Sound *copy() const; |
69 | | |
70 | | private: |
71 | | // Create a sound. The Object obj is ensured to be a Stream with a Dict |
72 | | explicit Sound(const Object &obj, bool readAttrs = true); |
73 | | |
74 | | Object streamObj; |
75 | | SoundKind kind; |
76 | | std::string fileName; |
77 | | double samplingRate; |
78 | | int channels; |
79 | | int bitsPerSample; |
80 | | SoundEncoding encoding; |
81 | | }; |
82 | | |
83 | | #endif |