Skip to content

Commit 574de31

Browse files
committed
[AVFoundation] Add xml docs for AVCaptureTimecode.
1 parent 9f27fba commit 574de31

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/AVFoundation/AVTypes.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,8 @@ public static AVCaptionSize Create (AVCaptionDimension width, AVCaptionDimension
882882
}
883883
#endif // __TVOS__
884884

885+
/// <summary>Represents a timecode structure adhering to SMPTE standards for precise time information and synchronization.</summary>
886+
/// <remarks>This structure corresponds to the SMPTE 12M-1 Linear Timecode (LTC) format.</remarks>
885887
[SupportedOSPlatform ("ios26.0")]
886888
[SupportedOSPlatform ("maccatalyst26.0")]
887889
[SupportedOSPlatform ("macos26.0")]
@@ -905,42 +907,65 @@ public struct AVCaptureTimecode
905907
CMTime frameDuration;
906908
nuint sourceType;
907909

910+
/// <summary>Gets or sets the hour component of the timecode.</summary>
911+
/// <value>The hour value of the current timecode.</value>
908912
public byte Hours {
909913
get => hours;
910914
set => hours = value;
911915
}
912916

917+
/// <summary>Gets or sets the minute component of the timecode.</summary>
918+
/// <value>The minute value of the current timecode.</value>
913919
public byte Minutes {
914920
get => minutes;
915921
set => minutes = value;
916922
}
917923

924+
/// <summary>Gets or sets the second component of the timecode.</summary>
925+
/// <value>The second value of the current timecode.</value>
918926
public byte Seconds {
919927
get => seconds;
920928
set => seconds = value;
921929
}
922930

931+
/// <summary>Gets or sets the frame component of the timecode.</summary>
932+
/// <value>The frame count within the current second.</value>
923933
public byte Frames {
924934
get => frames;
925935
set => frames = value;
926936
}
927937

938+
/// <summary>Gets or sets the SMPTE user bits field.</summary>
939+
/// <value>A field carrying additional metadata such as scene-take information, reel numbers, or dates.</value>
940+
/// <remarks>The exact usage of user bits is application-dependent and not strictly standardized by SMPTE.</remarks>
928941
public uint UserBits {
929942
get => userBits;
930943
set => userBits = value;
931944
}
932945

946+
/// <summary>Gets or sets the frame duration of the timecode.</summary>
947+
/// <value>The duration of each frame. If unknown, the value is <see cref="CMTime.Invalid" />.</value>
933948
public CMTime FrameDuration {
934949
get => frameDuration;
935950
set => frameDuration = value;
936951
}
937952

938953
#if !COREBUILD
954+
/// <summary>Gets or sets the source type of the timecode.</summary>
955+
/// <value>The type indicating the emitter, carriage, or transport mechanism of the timecode.</value>
939956
public AVCaptureTimecodeSourceType SourceType {
940957
get => (AVCaptureTimecodeSourceType) (long) sourceType;
941958
set => sourceType = (nuint) (long) value;
942959
}
943960

961+
/// <summary>Initializes a new instance of the AVCaptureTimecode structure.</summary>
962+
/// <param name="hours">The hour component of the timecode.</param>
963+
/// <param name="minutes">The minute component of the timecode.</param>
964+
/// <param name="seconds">The second component of the timecode.</param>
965+
/// <param name="frames">The frame component of the timecode.</param>
966+
/// <param name="userBits">The SMPTE user bits for additional metadata.</param>
967+
/// <param name="frameDuration">The duration of each frame.</param>
968+
/// <param name="sourceType">The source type of the timecode.</param>
944969
public AVCaptureTimecode (byte hours, byte minutes, byte seconds, byte frames, uint userBits, CMTime frameDuration, AVCaptureTimecodeSourceType sourceType)
945970
{
946971
Hours = hours;
@@ -956,6 +981,10 @@ public AVCaptureTimecode (byte hours, byte minutes, byte seconds, byte frames, u
956981
[DllImport (Constants.AVFoundationLibrary)]
957982
static extern IntPtr /* CMSampleBufferRef */ AVCaptureTimecodeCreateMetadataSampleBufferAssociatedWithPresentationTimeStamp (AVCaptureTimecode timecode, CMTime presentationTimeStamp);
958983

984+
/// <summary>Creates a sample buffer containing timecode metadata associated with a presentation timestamp.</summary>
985+
/// <param name="presentationTimeStamp">The presentation time stamp that determines when the metadata should be applied in the media timeline.</param>
986+
/// <returns>A sample buffer with encoded timecode metadata for video synchronization, or <see langword="null" /> if creation fails.</returns>
987+
/// <remarks>This method creates a <see cref="CMSampleBuffer" /> with metadata for integration with a video track at a specific moment in time.</remarks>
959988
public CMSampleBuffer? CreateMetadataSampleBufferAssociatedWithPresentationTimeStamp (CMTime presentationTimeStamp)
960989
{
961990
var ptr = AVCaptureTimecodeCreateMetadataSampleBufferAssociatedWithPresentationTimeStamp (this, presentationTimeStamp);
@@ -966,6 +995,10 @@ public AVCaptureTimecode (byte hours, byte minutes, byte seconds, byte frames, u
966995
[DllImport (Constants.AVFoundationLibrary)]
967996
static extern IntPtr /* CMSampleBufferRef */ AVCaptureTimecodeCreateMetadataSampleBufferForDuration (AVCaptureTimecode timecode, CMTime duration);
968997

998+
/// <summary>Creates a sample buffer containing timecode metadata for a specified duration.</summary>
999+
/// <param name="duration">The duration that the metadata sample buffer should represent.</param>
1000+
/// <returns>A sample buffer with encoded timecode metadata for the given duration, or <see langword="null" /> if creation fails.</returns>
1001+
/// <remarks>Use this method for scenarios where timecode metadata needs to span a custom interval rather than a single frame.</remarks>
9691002
public CMSampleBuffer? CreateMetadataSampleBufferForDuration (CMTime duration)
9701003
{
9711004
var ptr = AVCaptureTimecodeCreateMetadataSampleBufferForDuration (this, duration);
@@ -976,14 +1009,32 @@ public AVCaptureTimecode (byte hours, byte minutes, byte seconds, byte frames, u
9761009
[DllImport (Constants.AVFoundationLibrary)]
9771010
static extern AVCaptureTimecode AVCaptureTimecodeAdvancedByFrames (AVCaptureTimecode timecode, long framesToAdd);
9781011

1012+
/// <summary>Generates a new timecode by adding a specified number of frames to this timecode.</summary>
1013+
/// <param name="framesToAdd">The number of frames to add to the timecode.</param>
1014+
/// <returns>A new timecode with the updated time values after adding the specified frames.</returns>
1015+
/// <remarks>This method handles overflow for seconds, minutes, and hours appropriately.</remarks>
9791016
public AVCaptureTimecode AddFrames (long framesToAdd) => AVCaptureTimecodeAdvancedByFrames (this, framesToAdd);
9801017

1018+
/// <summary>Determines whether two timecode instances are equal.</summary>
1019+
/// <param name="left">The first timecode to compare.</param>
1020+
/// <param name="right">The second timecode to compare.</param>
1021+
/// <returns>True if the timecodes are equal; otherwise, false.</returns>
9811022
public static bool operator == (AVCaptureTimecode left, AVCaptureTimecode right) => left.Equals (right);
9821023

1024+
/// <summary>Determines whether two timecode instances are not equal.</summary>
1025+
/// <param name="left">The first timecode to compare.</param>
1026+
/// <param name="right">The second timecode to compare.</param>
1027+
/// <returns>True if the timecodes are not equal; otherwise, false.</returns>
9831028
public static bool operator != (AVCaptureTimecode left, AVCaptureTimecode right) => !left.Equals (right);
9841029

1030+
/// <summary>Determines whether this timecode is equal to the specified object.</summary>
1031+
/// <param name="obj">The object to compare with this timecode.</param>
1032+
/// <returns>True if the specified object is equal to this timecode; otherwise, false.</returns>
9851033
public override bool Equals (object? obj) => obj is AVCaptureTimecode other && Equals (other);
9861034

1035+
/// <summary>Determines whether this timecode is equal to another timecode.</summary>
1036+
/// <param name="other">The other timecode to compare with this timecode.</param>
1037+
/// <returns>True if the timecodes are equal; otherwise, false.</returns>
9871038
public bool Equals (AVCaptureTimecode other)
9881039
{
9891040
return Hours == other.Hours
@@ -995,6 +1046,8 @@ public bool Equals (AVCaptureTimecode other)
9951046
&& SourceType == other.SourceType;
9961047
}
9971048

1049+
/// <summary>Returns the hash code for this timecode.</summary>
1050+
/// <returns>A hash code for the current timecode.</returns>
9981051
public override int GetHashCode () => HashCode.Combine (Hours, Minutes, Seconds, Frames, UserBits, FrameDuration, SourceType);
9991052
#endif
10001053
}

0 commit comments

Comments
 (0)