diff options
Diffstat (limited to 'xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.cpp')
| -rw-r--r-- | xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.cpp | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.cpp new file mode 100644 index 0000000..2f833c5 --- /dev/null +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.cpp | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2013 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * 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 General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include "DVDDemux.h" | ||
| 22 | #include "DVDCodecs/DVDCodecs.h" | ||
| 23 | |||
| 24 | void CDemuxStreamTeletext::GetStreamInfo(std::string& strInfo) | ||
| 25 | { | ||
| 26 | strInfo = "Teletext Data Stream"; | ||
| 27 | } | ||
| 28 | |||
| 29 | void CDemuxStreamAudio::GetStreamType(std::string& strInfo) | ||
| 30 | { | ||
| 31 | char sInfo[64]; | ||
| 32 | |||
| 33 | if (codec == AV_CODEC_ID_AC3) strcpy(sInfo, "AC3 "); | ||
| 34 | else if (codec == AV_CODEC_ID_DTS) | ||
| 35 | { | ||
| 36 | #ifdef FF_PROFILE_DTS_HD_MA | ||
| 37 | if (profile == FF_PROFILE_DTS_HD_MA) | ||
| 38 | strcpy(sInfo, "DTS-HD MA "); | ||
| 39 | else if (profile == FF_PROFILE_DTS_HD_HRA) | ||
| 40 | strcpy(sInfo, "DTS-HD HRA "); | ||
| 41 | else | ||
| 42 | #endif | ||
| 43 | strcpy(sInfo, "DTS "); | ||
| 44 | } | ||
| 45 | else if (codec == AV_CODEC_ID_MP2) strcpy(sInfo, "MP2 "); | ||
| 46 | else if (codec == AV_CODEC_ID_TRUEHD) strcpy(sInfo, "Dolby TrueHD "); | ||
| 47 | else strcpy(sInfo, ""); | ||
| 48 | |||
| 49 | if (iChannels == 1) strcat(sInfo, "Mono"); | ||
| 50 | else if (iChannels == 2) strcat(sInfo, "Stereo"); | ||
| 51 | else if (iChannels == 6) strcat(sInfo, "5.1"); | ||
| 52 | else if (iChannels == 8) strcat(sInfo, "7.1"); | ||
| 53 | else if (iChannels != 0) | ||
| 54 | { | ||
| 55 | char temp[32]; | ||
| 56 | sprintf(temp, " %d%s", iChannels, "-chs"); | ||
| 57 | strcat(sInfo, temp); | ||
| 58 | } | ||
| 59 | strInfo = sInfo; | ||
| 60 | } | ||
| 61 | |||
| 62 | int CDVDDemux::GetNrOfAudioStreams() | ||
| 63 | { | ||
| 64 | int iCounter = 0; | ||
| 65 | |||
| 66 | for (int i = 0; i < GetNrOfStreams(); i++) | ||
| 67 | { | ||
| 68 | CDemuxStream* pStream = GetStream(i); | ||
| 69 | if (pStream->type == STREAM_AUDIO) iCounter++; | ||
| 70 | } | ||
| 71 | |||
| 72 | return iCounter; | ||
| 73 | } | ||
| 74 | |||
| 75 | int CDVDDemux::GetNrOfVideoStreams() | ||
| 76 | { | ||
| 77 | int iCounter = 0; | ||
| 78 | |||
| 79 | for (int i = 0; i < GetNrOfStreams(); i++) | ||
| 80 | { | ||
| 81 | CDemuxStream* pStream = GetStream(i); | ||
| 82 | if (pStream->type == STREAM_VIDEO) iCounter++; | ||
| 83 | } | ||
| 84 | |||
| 85 | return iCounter; | ||
| 86 | } | ||
| 87 | |||
| 88 | int CDVDDemux::GetNrOfSubtitleStreams() | ||
| 89 | { | ||
| 90 | int iCounter = 0; | ||
| 91 | |||
| 92 | for (int i = 0; i < GetNrOfStreams(); i++) | ||
| 93 | { | ||
| 94 | CDemuxStream* pStream = GetStream(i); | ||
| 95 | if (pStream->type == STREAM_SUBTITLE) iCounter++; | ||
| 96 | } | ||
| 97 | |||
| 98 | return iCounter; | ||
| 99 | } | ||
| 100 | |||
| 101 | int CDVDDemux::GetNrOfTeletextStreams() | ||
| 102 | { | ||
| 103 | int iCounter = 0; | ||
| 104 | |||
| 105 | for (int i = 0; i < GetNrOfStreams(); i++) | ||
| 106 | { | ||
| 107 | CDemuxStream* pStream = GetStream(i); | ||
| 108 | if (pStream->type == STREAM_TELETEXT) iCounter++; | ||
| 109 | } | ||
| 110 | |||
| 111 | return iCounter; | ||
| 112 | } | ||
| 113 | |||
| 114 | CDemuxStreamAudio* CDVDDemux::GetStreamFromAudioId(int iAudioIndex) | ||
| 115 | { | ||
| 116 | int counter = -1; | ||
| 117 | for (int i = 0; i < GetNrOfStreams(); i++) | ||
| 118 | { | ||
| 119 | CDemuxStream* pStream = GetStream(i); | ||
| 120 | |||
| 121 | if (pStream->type == STREAM_AUDIO) counter++; | ||
| 122 | if (iAudioIndex == counter) | ||
| 123 | return (CDemuxStreamAudio*)pStream; | ||
| 124 | } | ||
| 125 | return NULL; | ||
| 126 | } | ||
| 127 | |||
| 128 | CDemuxStreamVideo* CDVDDemux::GetStreamFromVideoId(int iVideoIndex) | ||
| 129 | { | ||
| 130 | int counter = -1; | ||
| 131 | for (int i = 0; i < GetNrOfStreams(); i++) | ||
| 132 | { | ||
| 133 | CDemuxStream* pStream = GetStream(i); | ||
| 134 | |||
| 135 | if (pStream->type == STREAM_VIDEO) counter++; | ||
| 136 | if (iVideoIndex == counter) | ||
| 137 | return (CDemuxStreamVideo*)pStream; | ||
| 138 | } | ||
| 139 | return NULL; | ||
| 140 | } | ||
| 141 | |||
| 142 | CDemuxStreamSubtitle* CDVDDemux::GetStreamFromSubtitleId(int iSubtitleIndex) | ||
| 143 | { | ||
| 144 | int counter = -1; | ||
| 145 | for (int i = 0; i < GetNrOfStreams(); i++) | ||
| 146 | { | ||
| 147 | CDemuxStream* pStream = GetStream(i); | ||
| 148 | |||
| 149 | if (pStream->type == STREAM_SUBTITLE) counter++; | ||
| 150 | if (iSubtitleIndex == counter) | ||
| 151 | return (CDemuxStreamSubtitle*)pStream; | ||
| 152 | } | ||
| 153 | return NULL; | ||
| 154 | } | ||
| 155 | |||
| 156 | CDemuxStreamTeletext* CDVDDemux::GetStreamFromTeletextId(int iTeletextIndex) | ||
| 157 | { | ||
| 158 | int counter = -1; | ||
| 159 | for (int i = 0; i < GetNrOfStreams(); i++) | ||
| 160 | { | ||
| 161 | CDemuxStream* pStream = GetStream(i); | ||
| 162 | |||
| 163 | if (pStream->type == STREAM_TELETEXT) counter++; | ||
| 164 | if (iTeletextIndex == counter) | ||
| 165 | return (CDemuxStreamTeletext*)pStream; | ||
| 166 | } | ||
| 167 | return NULL; | ||
| 168 | } | ||
| 169 | |||
| 170 | void CDemuxStream::GetStreamName( std::string& strInfo ) | ||
| 171 | { | ||
| 172 | strInfo = ""; | ||
| 173 | } | ||
| 174 | |||
| 175 | AVDiscard CDemuxStream::GetDiscard() | ||
| 176 | { | ||
| 177 | return AVDISCARD_NONE; | ||
| 178 | } | ||
| 179 | |||
| 180 | void CDemuxStream::SetDiscard(AVDiscard discard) | ||
| 181 | { | ||
| 182 | return; | ||
| 183 | } | ||
| 184 | |||
