1 | /********** |
2 | This library is free software; you can redistribute it and/or modify it under |
3 | the terms of the GNU Lesser General Public License as published by the |
4 | Free Software Foundation; either version 3 of the License, or (at your |
5 | option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) |
6 | |
7 | This library is distributed in the hope that it will be useful, but WITHOUT |
8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
10 | more details. |
11 | |
12 | You should have received a copy of the GNU Lesser General Public License |
13 | along with this library; if not, write to the Free Software Foundation, Inc., |
14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
15 | **********/ |
16 | // "liveMedia" |
17 | // Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved. |
18 | // A class that implements a database that can be accessed to create |
19 | // "FramedFilter" (subclass) objects that transcode one codec into another. |
20 | // The implementation of this class just returns NULL for each codec lookup; |
21 | // To actually implement transcoding, you would subclass it. |
22 | // C++ header |
23 | |
24 | #ifndef _MEDIA_TRANSCODING_TABLE_HH |
25 | #define _MEDIA_TRANSCODING_TABLE_HH |
26 | |
27 | #ifndef _FRAMED_FILTER_HH |
28 | #include "FramedFilter.hh" |
29 | #endif |
30 | #ifndef _MEDIA_SESSION_HH |
31 | #include "MediaSession.hh" |
32 | #endif |
33 | |
34 | class MediaTranscodingTable: public Medium { |
35 | public: |
36 | virtual FramedFilter* |
37 | lookupTranscoder(MediaSubsession& /*inputCodecDescription*/, // in |
38 | char*& outputCodecName/* out; must be delete[]d later */) { |
39 | // Default implementation: Return NULL (indicating: no transcoding). |
40 | // You would reimplement this virtual function in a subclass to return a new 'transcoding' |
41 | // "FramedFilter" (subclass) object for each ("mediumName","codecName") that you wish to |
42 | // transcode (or return NULL for no transcoding). |
43 | // (Note that "inputCodecDescription" must have a non-NULL "readSource()"; this is used |
44 | // as the input to the new "FramedFilter" (subclass) object.) |
45 | outputCodecName = NULL; |
46 | return NULL; |
47 | } |
48 | |
49 | virtual Boolean weWillTranscode(char const* /*mediumName*/, char const* /*codecName*/) { |
50 | // Default implementation: Return False. |
51 | // You would reimplement this in a subclass - returning True for each |
52 | // <mediumName>/<codecName> for which you'll do transcoding. |
53 | // Note: Unlike "lookupTranscoder()", this function does not actually create any 'transcoding' |
54 | // filter objects. (It may be called before "MediaSubsession::initiate()".) |
55 | return False; |
56 | } |
57 | |
58 | protected: // we are to be subclassed only |
59 | MediaTranscodingTable(UsageEnvironment& env) |
60 | : Medium(env) { |
61 | } |
62 | virtual ~MediaTranscodingTable() { |
63 | } |
64 | }; |
65 | |
66 | #endif |
67 | |