3 * Copyright (C) 2005-2008 Team XBMC
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)
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.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 * http://www.gnu.org/copyleft/gpl.html
28 class CStreamDetail
: public ISerializable
37 CStreamDetail(StreamType type
) : m_eType(type
) {};
38 virtual void Serialize(CArchive
& ar
);
39 virtual bool IsWorseThan(CStreamDetail
*that
) { return true; };
41 const StreamType m_eType
;
44 CStreamDetails
*m_pParent
;
45 friend class CStreamDetails
;
48 class CStreamDetailVideo
: public CStreamDetail
52 virtual void Serialize(CArchive
& ar
);
53 virtual bool IsWorseThan(CStreamDetail
*that
);
59 CStdString m_strCodec
;
62 class CStreamDetailAudio
: public CStreamDetail
66 virtual void Serialize(CArchive
& ar
);
67 virtual bool IsWorseThan(CStreamDetail
*that
);
70 CStdString m_strCodec
;
71 CStdString m_strLanguage
;
73 int GetCodecPriority() const;
76 class CStreamDetailSubtitle
: public CStreamDetail
79 CStreamDetailSubtitle();
80 virtual void Serialize(CArchive
& ar
);
81 virtual bool IsWorseThan(CStreamDetail
*that
);
83 CStdString m_strLanguage
;
86 class CStreamDetails
: public ISerializable
89 CStreamDetails() { Reset(); };
90 CStreamDetails(const CStreamDetails
&that
);
91 ~CStreamDetails() { Reset(); };
92 CStreamDetails
& operator=(const CStreamDetails
&that
);
94 static CStdString
VideoDimsToResolutionDescription(int iWidth
, int iHeight
);
95 static CStdString
VideoAspectToAspectDescription(float fAspect
);
97 bool HasItems(void) const { return m_vecItems
.size() > 0; };
98 int GetStreamCount(CStreamDetail::StreamType type
) const;
99 int GetVideoStreamCount(void) const;
100 int GetAudioStreamCount(void) const;
101 int GetSubtitleStreamCount(void) const;
102 const CStreamDetail
* GetNthStream(CStreamDetail::StreamType type
, int idx
) const;
104 CStdString
GetVideoCodec(int idx
= 0) const;
105 float GetVideoAspect(int idx
= 0) const;
106 int GetVideoWidth(int idx
= 0) const;
107 int GetVideoHeight(int idx
= 0) const;
108 int GetVideoDuration(int idx
= 0) const;
110 CStdString
GetAudioCodec(int idx
= 0) const;
111 CStdString
GetAudioLanguage(int idx
= 0) const;
112 int GetAudioChannels(int idx
= 0) const;
114 CStdString
GetSubtitleLanguage(int idx
= 0) const;
116 void AddStream(CStreamDetail
*item
);
118 void DetermineBestStreams(void);
120 virtual void Serialize(CArchive
& ar
);
122 // Language to use for "best" subtitle stream
123 CStdString m_strLanguage
;
126 CStreamDetail
*NewStream(CStreamDetail::StreamType type
);
127 std::vector
<CStreamDetail
*> m_vecItems
;
128 CStreamDetailVideo
*m_pBestVideo
;
129 CStreamDetailAudio
*m_pBestAudio
;
130 CStreamDetailSubtitle
*m_pBestSubtitle
;
133 class IStreamDetailsObserver
136 virtual ~IStreamDetailsObserver() {}
137 virtual void OnStreamDetails(const CStreamDetails
&details
, const CStdString
&strFileName
, long lFileId
) = 0;