This repository has been archived by the owner on Apr 15, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #254 from Jalle19/unify-codec-descriptors
Unify codec descriptor usage
- Loading branch information
Showing
3 changed files
with
67 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2005-2013 Team XBMC | ||
* http://xbmc.org | ||
* | ||
* This Program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This Program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with XBMC; see the file COPYING. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
#ifndef XBMC_CODEC_DESCRIPTOR_HPP | ||
#define XBMC_CODEC_DESCRIPTOR_HPP | ||
|
||
#include "libXBMC_codec.h" | ||
|
||
/** | ||
* Adapter which converts codec names used by tvheadend and VDR into their | ||
* FFmpeg equivalents. | ||
*/ | ||
class CodecDescriptor | ||
{ | ||
public: | ||
CodecDescriptor(void) | ||
{ | ||
m_codec.codec_id = XBMC_INVALID_CODEC_ID; | ||
m_codec.codec_type = XBMC_CODEC_TYPE_UNKNOWN; | ||
} | ||
|
||
CodecDescriptor(xbmc_codec_t codec, const char* name) : | ||
m_codec(codec), | ||
m_strName(name) {} | ||
virtual ~CodecDescriptor(void) {} | ||
|
||
const std::string& Name(void) const { return m_strName; } | ||
xbmc_codec_t Codec(void) const { return m_codec; } | ||
|
||
static CodecDescriptor GetCodecByName(const char* strCodecName) | ||
{ | ||
CodecDescriptor retVal; | ||
// some of Tvheadend's and VDR's codec names don't match ffmpeg's, so translate them to something ffmpeg understands | ||
if (!strcmp(strCodecName, "MPEG2AUDIO")) | ||
retVal = CodecDescriptor(CODEC->GetCodecByName("MP2"), strCodecName); | ||
else if (!strcmp(strCodecName, "MPEGTS")) | ||
retVal = CodecDescriptor(CODEC->GetCodecByName("MPEG2VIDEO"), strCodecName); | ||
else | ||
retVal = CodecDescriptor(CODEC->GetCodecByName(strCodecName), strCodecName); | ||
|
||
return retVal; | ||
} | ||
|
||
private: | ||
xbmc_codec_t m_codec; | ||
std::string m_strName; | ||
}; | ||
|
||
#endif /* XBMC_CODEC_DESCRIPTOR_HPP */ |