blob: 57201e847d6d7ba55c10fd7f1d76995ea9c5a11f (
plain)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Title.cs" company="HandBrake Project (http://handbrake.fr)">
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
// An object that represents a single Title of a DVD
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrake.Interop.SourceData
{
using System;
using System.Collections.Generic;
using HandBrake.Interop.Model;
/// <summary>
/// An object that represents a single Title of a DVD
/// </summary>
public class Title
{
/// <summary>
/// The audio tracks.
/// </summary>
private readonly List<AudioTrack> audioTracks;
/// <summary>
/// The chapters.
/// </summary>
private readonly List<Chapter> chapters;
/// <summary>
/// The subtitles.
/// </summary>
private readonly List<Subtitle> subtitles;
/// <summary>
/// Initializes a new instance of the Title class.
/// </summary>
public Title()
{
this.audioTracks = new List<AudioTrack>();
this.chapters = new List<Chapter>();
this.subtitles = new List<Subtitle>();
}
/// <summary>
/// Gets or sets the input type of this title.
/// </summary>
public InputType InputType { get; set; }
/// <summary>
/// Gets a collection of chapters in this Title
/// </summary>
public List<Chapter> Chapters
{
get { return this.chapters; }
}
/// <summary>
/// Gets a collection of audio tracks associated with this Title
/// </summary>
public List<AudioTrack> AudioTracks
{
get { return this.audioTracks; }
}
/// <summary>
/// Gets a collection of subtitles associated with this Title
/// </summary>
public List<Subtitle> Subtitles
{
get { return this.subtitles; }
}
/// <summary>
/// Gets or sets the track number of this Title (1-based).
/// </summary>
public int TitleNumber { get; set; }
/// <summary>
/// Gets or sets the playlist number this title came from.
/// </summary>
public int Playlist { get; set; }
/// <summary>
/// Gets or sets the length in time of this Title
/// </summary>
public TimeSpan Duration { get; set; }
/// <summary>
/// Gets or sets the resolution (width/height) of this Title
/// </summary>
public Size Resolution { get; set; }
/// <summary>
/// Gets or sets the aspect ratio of this Title
/// </summary>
public double AspectRatio { get; set; }
/// <summary>
/// Gets or sets the number of angles on the title.
/// </summary>
public int AngleCount { get; set; }
/// <summary>
/// Gets or sets the pixel aspect ratio.
/// </summary>
public Size ParVal { get; set; }
/// <summary>
/// Gets or sets the automatically detected crop region for this Title.
/// </summary>
public Cropping AutoCropDimensions { get; set; }
/// <summary>
/// Gets or sets the name of the video codec for this title.
/// </summary>
public string VideoCodecName { get; set; }
/// <summary>
/// Gets or sets the video frame rate for this title.
/// </summary>
public double Framerate { get; set; }
/// <summary>
/// Gets or sets the video frame rate numerator.
/// </summary>
public int FramerateNumerator { get; set; }
/// <summary>
/// Gets or sets the video frame rate denominator.
/// </summary>
public int FramerateDenominator { get; set; }
/// <summary>
/// Gets the total number of frames in this title.
/// </summary>
public int Frames
{
get
{
return (int)Math.Ceiling(this.Duration.TotalSeconds * this.Framerate);
}
}
/// <summary>
/// Override of the ToString method to provide an easy way to use this object in the UI
/// </summary>
/// <returns>A string representing this track in the format: {title #}[ {playlist source}] (00:00:00)</returns>
public override string ToString()
{
string playlistPortion = string.Empty;
if (this.InputType == InputType.Bluray)
{
playlistPortion = string.Format(" {0:d5}.MPLS", this.Playlist);
}
return string.Format(
"{0}{1} ({2:00}:{3:00}:{4:00})",
this.TitleNumber,
playlistPortion,
this.Duration.Hours,
this.Duration.Minutes,
this.Duration.Seconds);
}
/// <summary>
/// Gets the display string for this title.
/// </summary>
public string Display
{
get
{
return this.ToString();
}
}
}
}
|