Struct ChapterList
Represents the collection of chapters in a FormatContext.
Inherited Members
Namespace: FFmpeg.Formats
Assembly: FFmpeg.dll
Syntax
public readonly struct ChapterList : IEnumerable<AVChapter>, IEnumerable
Remarks
This collection provides access to the chapters stored in a media container. Changes made through this collection directly modify the underlying FFmpeg format context.
Constructors
View SourceChapterList(FormatContext, bool)
Represents the collection of chapters in a FormatContext.
Declaration
public ChapterList(FormatContext context, bool readOnly)
Parameters
| Type | Name | Description |
|---|---|---|
| FormatContext | context | |
| bool | readOnly |
Remarks
This collection provides access to the chapters stored in a media container. Changes made through this collection directly modify the underlying FFmpeg format context.
Properties
View SourceCount
Gets the number of chapters in the collection.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
IsReadOnly
Gets a value indicating whether the collection can be modified.
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
this[int]
Gets the chapter at the specified index.
Declaration
public AVChapter this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the chapter. |
Property Value
| Type | Description |
|---|---|
| AVChapter | The chapter at the specified index. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
Methods
View SourceAddChapter(Rational, long, long, string)
Adds a new chapter using the first available chapter identifier.
Declaration
public void AddChapter(Rational timeBase, long start, long end, string title)
Parameters
| Type | Name | Description |
|---|---|---|
| Rational | timeBase | The time base used for |
| long | start | The chapter start timestamp. |
| long | end | The chapter end timestamp. |
| string | title | The chapter title. |
Remarks
The chapter identifier is automatically selected so that it does not conflict with an existing chapter.
GetEnumerator()
Returns an enumerator that iterates through the chapters in the collection.
Declaration
public IEnumerator<AVChapter> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<AVChapter> |
Remove(AVChapter)
Removes the specified chapter.
Declaration
public bool Remove(AVChapter chapter)
Parameters
| Type | Name | Description |
|---|---|---|
| AVChapter | chapter | The chapter to remove. |
Returns
| Type | Description |
|---|---|
| bool |
RemoveAt(long)
Removes the chapter at the specified index.
Declaration
public void RemoveAt(long index)
Parameters
| Type | Name | Description |
|---|---|---|
| long | index | The zero-based index of the chapter to remove. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
| NotSupportedException | The collection is read-only. |
RemoveById(long)
Removes the chapter with the specified identifier.
Declaration
public bool RemoveById(long id)
Parameters
| Type | Name | Description |
|---|---|---|
| long | id | The chapter identifier. |
Returns
| Type | Description |
|---|---|
| bool |
SetChapter(long, Rational, long, long, string)
Adds a new chapter or updates an existing chapter with the specified identifier.
Declaration
public void SetChapter(long id, Rational timeBase, long start, long end, string title)
Parameters
| Type | Name | Description |
|---|---|---|
| long | id | The unique chapter identifier. |
| Rational | timeBase | The time base used for |
| long | start | The chapter start timestamp expressed in units of |
| long | end | The chapter end timestamp expressed in units of |
| string | title | The chapter title. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | The collection is read-only. |
| FFmpegException | FFmpeg failed to allocate or add the chapter. |
SetChapter(long, TimeSpan, TimeSpan, string)
Adds a new chapter or updates an existing chapter with the specified identifier.
Declaration
public void SetChapter(long id, TimeSpan start, TimeSpan end, string title)
Parameters
| Type | Name | Description |
|---|---|---|
| long | id | The unique chapter identifier. |
| TimeSpan | start | The chapter start time. |
| TimeSpan | end | The chapter end time. |
| string | title | The chapter title. |
Remarks
A suitable time base is automatically chosen based on the specified start and end times.