123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.Collections;
- using Bmp.Core.FFMpeg.CsCorePorts.FFMpegWrap.Interops;
- namespace Bmp.Core.FFMpeg.CsCoreExt
- {
- public unsafe class FFMpegAttachedPicCollection : IReadOnlyList<FFMpegAttachedPic>
- {
- private readonly FFMpegAttachedPic[] _items;
- internal FFMpegAttachedPicCollection(AVFormatContext formatContext)
- {
- var pics = new List<FFMpegAttachedPic>((int)(formatContext.nb_streams - 1));
- for (var i = 0; i < formatContext.nb_streams; i++)
- {
- var stream = formatContext.streams[i];
- if ((stream->disposition & 0x0400) != 0x0400) continue; // AV_DISPOSITION_ATTACHED_PIC
- var item = new FFMpegAttachedPic(stream);
- pics.Add(item);
- }
- _items = pics.ToArray();
- }
- public IEnumerator<FFMpegAttachedPic> GetEnumerator()
- {
- var x = _items.Where(p => true);
- return x.GetEnumerator();
- }
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- public int Count => _items.Length;
- public FFMpegAttachedPic this[int index] => _items[index];
- }
- }
|