2
2
3
3
namespace TagLib . Id3v2
4
4
{
5
+ /// <summary>
6
+ /// This class extends <see cref="Frame" />, implementing support for
7
+ /// ID3v2 Event Time Codes (ETCO) Frames.
8
+ /// </summary>
9
+ /// <remarks>
10
+ /// Event time codes Frames should contain a list of events occurring
11
+ /// throughout the track such as the start of the main part and the end of it.
12
+ /// To see all available event types see <see cref="EventType"/>.
13
+ /// </remarks>
14
+ /// <example>
15
+ /// <para>Reading the Event Time Codes from a tag.</para>
16
+ /// <code lang="C#">
17
+ /// using TagLib;
18
+ /// using TagLib.Id3v2;
19
+ ///
20
+ /// public static class LookupUtil
21
+ /// {
22
+ /// public static ByteVector GetTrackEvents(string filename)
23
+ /// {
24
+ /// File file = File.Create (filename, ReadStyle.None);
25
+ /// Id3v2.Tag tag = file.GetTag (TagTypes.Id3v2, false) as Id3v2.Tag;
26
+ /// if (tag == null)
27
+ /// return new ByteVector ();
28
+ ///
29
+ /// EventTimeCodesFrame frame = EventTimeCodesFrame.Get (tag, false);
30
+ /// if (frame == null)
31
+ /// return new ByteVector ();
32
+ ///
33
+ /// return frame.Data;
34
+ /// }
35
+ /// }
36
+ /// </code>
37
+ /// <code lang="C++">
38
+ /// #using <System.dll>
39
+ /// #using <taglib-sharp.dll>
40
+ ///
41
+ /// using System;
42
+ /// using TagLib;
43
+ /// using TagLib::Id3v2;
44
+ ///
45
+ /// public ref class LookupUtil abstract sealed
46
+ /// {
47
+ /// public:
48
+ /// static ByteVector^ GetTrackEvents (String^ filename)
49
+ /// {
50
+ /// File^ file = File::Create (filename, ReadStyle::None);
51
+ /// Id3v2::Tag^ tag = dynamic_cast<Id3v2::Tag^> (file.GetTag (TagTypes::Id3v2, false));
52
+ /// if (tag == null)
53
+ /// return gcnew ByteVector;
54
+ ///
55
+ /// EventTimeCodesFrame^ frame = EventTimeCodesFrame::Get (tag, false);
56
+ /// if (frame == null)
57
+ /// return gcnew ByteVector;
58
+ ///
59
+ /// return frame->Data;
60
+ /// }
61
+ /// }
62
+ /// </code>
63
+ /// <code lang="VB">
64
+ /// Imports TagLib
65
+ /// Imports TagLib.Id3v2
66
+ ///
67
+ /// Public Shared Class LookupUtil
68
+ /// Public Shared Sub GetTrackEvents (filename As String) As TagLib.ByteVector
69
+ /// Dim file As File = File.Create (filename, ReadStyle.None)
70
+ /// Dim tag As Id3v2.Tag = file.GetTag (TagTypes.Id3v2, False)
71
+ /// If tag Is Nothing Return New ByteVector ()
72
+ ///
73
+ /// Dim frame As EventTimeCodesFrame = EventTimeCodesFrame.Get (tag, False)
74
+ /// If frame Is Nothing Return New ByteVector ()
75
+ ///
76
+ /// Return frame.Data
77
+ /// End Sub
78
+ /// End Class
79
+ /// </code>
80
+ /// <code lang="Boo">
81
+ /// import TagLib
82
+ /// import TagLib.Id3v2
83
+ ///
84
+ /// public static class LookupUtil:
85
+ /// static def GetTrackEvents (filename as string) as TagLib.ByteVector:
86
+ /// file as File = File.Create (filename, ReadStyle.None)
87
+ /// tag as Id3v2.Tag = file.GetTag (TagTypes.Id3v2, false)
88
+ /// if tag == null:
89
+ /// return ByteVector ()
90
+ ///
91
+ /// frame as EventTimeCodesFrame = EventTimeCodesFrame.Get (tag, false)
92
+ /// if frame == null:
93
+ /// return ByteVector ()
94
+ ///
95
+ /// return frame.Data
96
+ /// </code>
97
+ /// </example>
5
98
public class EventTimeCodesFrame : Frame
6
99
{
7
100
#region Private Properties
@@ -14,28 +107,90 @@ public class EventTimeCodesFrame : Frame
14
107
15
108
#region Constructors
16
109
110
+ /// <summary>
111
+ /// Constructs and initializes a new instance of <see
112
+ /// cref="EventTimeCodesFrame" /> with empty
113
+ /// identifier data.
114
+ /// </summary>
115
+ /// <remarks>
116
+ /// When a frame is created, it is not automatically added to
117
+ /// the tag. Consider using <see cref="Get" /> for more
118
+ /// integrated frame creation.
119
+ /// </remarks>
17
120
public EventTimeCodesFrame ( ) : base ( FrameType . ETCO , 4 )
18
121
{
19
122
Flags = FrameFlags . FileAlterPreservation ;
20
123
}
21
124
125
+ /// <summary>
126
+ /// Constructs and initializes a new instance of <see
127
+ /// cref="EventTimeCodesFrame" /> by reading its raw data
128
+ /// in a specified ID3v2 version.
129
+ /// </summary>
130
+ /// <param name="timestampFormat">
131
+ /// A <see cref="TimestampFormat" /> Specifies the time unit to use in this frame.
132
+ /// </param>
22
133
public EventTimeCodesFrame ( TimestampFormat timestampFormat ) : base ( FrameType . ETCO , 4 )
23
134
{
24
135
this . timestampFormat = timestampFormat ;
25
136
Flags = FrameFlags . FileAlterPreservation ;
26
137
}
27
138
139
+ /// <summary>
140
+ /// Constructs and initializes a new instance of <see
141
+ /// cref="EventTimeCodesFrame" /> by reading its raw data
142
+ /// in a specified ID3v2 version.
143
+ /// </summary>
144
+ /// <param name="data">
145
+ /// A <see cref="ByteVector" /> object starting with the raw
146
+ /// representation of the new frame.
147
+ /// </param>
148
+ /// <param name="version">
149
+ /// A <see cref="byte" /> indicating the ID3v2 version the
150
+ /// raw frame is encoded in.
151
+ /// </param>
28
152
public EventTimeCodesFrame ( ByteVector data ,
29
153
byte version ) : base ( data , version )
30
154
{
31
155
SetData ( data , 0 , version , true ) ;
32
156
}
33
157
158
+
159
+ /// <summary>
160
+ /// Constructs and initializes a new instance of <see
161
+ /// cref="EventTimeCodesFrame" /> by reading its raw data
162
+ /// in a specified ID3v2 version.
163
+ /// </summary>
164
+ /// <param name="frameHeader">
165
+ /// A <see cref="FrameHeader" /> containing the header of the frame
166
+ /// </param>
34
167
public EventTimeCodesFrame ( FrameHeader frameHeader ) : base ( frameHeader )
35
168
{
36
169
37
170
}
38
171
172
+
173
+ /// <summary>
174
+ /// Constructs and initializes a new instance of <see
175
+ /// cref="EventTimeCodesFrame" /> by reading its raw data
176
+ /// in a specified ID3v2 version.
177
+ /// </summary>
178
+ /// <param name="data">
179
+ /// A <see cref="ByteVector" /> object containing the raw
180
+ /// representation of the new frame.
181
+ /// </param>
182
+ /// <param name="offset">
183
+ /// A <see cref="int" /> indicating at what offset in
184
+ /// <paramref name="data" /> the frame actually begins.
185
+ /// </param>
186
+ /// <param name="header">
187
+ /// A <see cref="FrameHeader" /> containing the header of the
188
+ /// frame found at <paramref name="offset" /> in the data.
189
+ /// </param>
190
+ /// <param name="version">
191
+ /// A <see cref="byte" /> indicating the ID3v2 version the
192
+ /// raw frame is encoded in.
193
+ /// </param>
39
194
public EventTimeCodesFrame ( ByteVector data ,
40
195
int offset ,
41
196
FrameHeader header ,
@@ -48,12 +203,25 @@ public EventTimeCodesFrame(ByteVector data,
48
203
49
204
#region Public Properties
50
205
206
+ /// <summary>
207
+ /// Gets or sets the timestamp format for this frame instance.
208
+ /// </summary>
209
+ /// <value>
210
+ /// A <see cref="TimestampFormat"/> that will be used in this frame instance.
211
+ /// </value>
51
212
public TimestampFormat TimestampFormat
52
213
{
53
214
get { return timestampFormat ; }
54
215
set { timestampFormat = value ; }
55
216
}
56
217
218
+ /// <summary>
219
+ /// Gets or sets the events this frame contains.
220
+ /// Each <see cref="EventTimeCode"/> represents a single event at a certain point in time.
221
+ /// </summary>
222
+ /// <value>
223
+ /// A <see cref="List{EventTimeCode}"/> that are stored in this frame instance.
224
+ /// </value>
57
225
public List < EventTimeCode > Events
58
226
{
59
227
get { return events ; }
@@ -104,6 +272,18 @@ public static EventTimeCodesFrame Get(Tag tag, bool create)
104
272
105
273
#region Protected Methods
106
274
275
+ /// <summary>
276
+ /// Populates the values in the current instance by parsing
277
+ /// its field data in a specified version.
278
+ /// </summary>
279
+ /// <param name="data">
280
+ /// A <see cref="ByteVector" /> object containing the
281
+ /// extracted field data.
282
+ /// </param>
283
+ /// <param name="version">
284
+ /// A <see cref="byte" /> indicating the ID3v2 version the
285
+ /// field data is encoded in.
286
+ /// </param>
107
287
protected override void ParseFields ( ByteVector data , byte version )
108
288
{
109
289
events = new List < EventTimeCode > ( ) ;
@@ -128,6 +308,18 @@ protected override void ParseFields(ByteVector data, byte version)
128
308
}
129
309
}
130
310
311
+ /// <summary>
312
+ /// Renders the values in the current instance into field
313
+ /// data for a specified version.
314
+ /// </summary>
315
+ /// <param name="version">
316
+ /// A <see cref="byte" /> indicating the ID3v2 version the
317
+ /// field data is to be encoded in.
318
+ /// </param>
319
+ /// <returns>
320
+ /// A <see cref="ByteVector" /> object containing the
321
+ /// rendered field data.
322
+ /// </returns>
131
323
protected override ByteVector RenderFields ( byte version )
132
324
{
133
325
var data = new List < byte > ( ) ;
0 commit comments