MediaTranscodingTable.hh 2.7 KB

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