/
DVBAudioStream.cs
129 lines (112 loc) · 3.85 KB
/
DVBAudioStream.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#region Copyright (C) 2005-2011 Team MediaPortal
// Copyright (C) 2005-2011 Team MediaPortal
// http://www.team-mediaportal.com
//
// MediaPortal 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 of the License, or
// (at your option) any later version.
//
// MediaPortal 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 MediaPortal. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;
using TvLibrary.Interfaces;
namespace TvLibrary.Implementations.DVB
{
/// <summary>
/// class which holds the audio stream details for a DVB channel
/// </summary>
[Serializable]
public class DVBAudioStream : IAudioStream
{
#region variables
private string _language;
private AudioStreamType _streamType;
private UInt16 _pid;
#endregion
#region ctor
/// <summary>
/// Initializes a new instance of the <see cref="DVBAudioStream"/> class.
/// </summary>
public DVBAudioStream()
{
_language = "";
_streamType = AudioStreamType.Mpeg2;
_pid = 0;
}
#endregion
#region properties
/// <summary>
/// gets/sets Audio language
/// </summary>
public string Language
{
get { return _language; }
set { _language = value; }
}
/// <summary>
/// gets/sets the audio stream type
/// </summary>
public AudioStreamType StreamType
{
get { return _streamType; }
set { _streamType = value; }
}
/// <summary>
/// gets/sets the audio pid for this stream
/// </summary>
public UInt16 Pid
{
get { return _pid; }
set { _pid = value; }
}
#endregion
/// <summary>
/// Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
/// </summary>
/// <param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>.</param>
/// <returns>
/// true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
/// </returns>
public override bool Equals(object obj)
{
DVBAudioStream stream = obj as DVBAudioStream;
if (stream == null)
{
return false;
}
if (_language == stream.Language && _streamType == stream.StreamType && _pid == stream.Pid)
{
return true;
}
return false;
}
/// <summary>
/// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
/// </summary>
/// <returns>
/// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
/// </returns>
public override string ToString()
{
return String.Format("pid:{0:X} language:{1} type:{2}",
Pid, Language, StreamType);
}
/// <summary>
/// Serves as a hash function for a particular type. <see cref="M:System.Object.GetHashCode"></see> is suitable for use in hashing algorithms and data structures like a hash table.
/// </summary>
/// <returns>
/// A hash code for the current <see cref="T:System.Object"></see>.
/// </returns>
public override int GetHashCode()
{
return base.GetHashCode() ^ _language.GetHashCode() ^ _streamType.GetHashCode() ^ _pid.GetHashCode();
}
}
}