forked from iina/iina
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFFmpegController.h
More file actions
69 lines (50 loc) · 2.75 KB
/
FFmpegController.h
File metadata and controls
69 lines (50 loc) · 2.75 KB
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
//
// FFmpegController.h
// iina
//
// Created by lhc on 9/6/2017.
// Copyright © 2017 lhc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface FFThumbnail: NSObject
@property(nonatomic) NSImage * _Nullable image;
@property(nonatomic) double realTime;
@end
@protocol FFmpegControllerDelegate <NSObject>
/**
A notification being sent
*/
- (void)didUpdateThumbnails:(nullable NSArray<FFThumbnail *> *)thumbnails forFile:(nonnull NSString *)filename withProgress:(NSInteger)progress;
/**
Did generated thumbnails for the video.
*/
- (void)didGenerateThumbnails:(nonnull NSArray<FFThumbnail *> *)thumbnails forFile:(nonnull NSString *)filename succeeded:(BOOL)succeeded;
@end
@interface FFmpegController: NSObject
@property(nonatomic, weak) id<FFmpegControllerDelegate> _Nullable delegate;
@property(nonatomic) NSInteger thumbnailCount;
/// Initializes and returns an image object with the contents of the specified URL
///
/// At this time, the normal [NSImage](https://developer.apple.com/documentation/appkit/nsimage/1519907-init)
/// initializer will fail to create an image object if the image file was encoded in [JPEG XL](https://jpeg.org/jpegxl/) format.
/// In older versions of macOS this will also occur if the image file was encoded in [WebP](https://en.wikipedia.org/wiki/WebP/)
/// format. As these are supported formats for screenshots it is desirable to have an alternative method for creating image objects that
/// supports these formats so that a screenshot preview can be displayed as is done for other screenshot formats. This method is
/// intended to be used when the normal AppKit supplied initializer is unable to create an image.
/// - Attention: This method only supports decoding JPEG XL and WebP encoded images. It is not intended to replace the normal
/// AppKit supplied initializer.
/// - Parameter url: The URL identifying the image.
/// - Returns: An initialized NSImage object or null if the method cannot create an image representation from the contents of the
/// specified URL.
+ (nullable NSImage *)createNSImageWithContentsOfURL:(nonnull NSURL *)url;
- (void)generateThumbnailForFile:(nonnull NSString *)file
thumbWidth:(int)thumbWidth;
/// Read artwork from the file with the given URL.
///
/// This method will open the file and search the streams for one that contains front cover artwork. If found the image data will be read
/// from the stream and an `NSImage` will be constructed and returned.
/// - Parameter url: URL of the file to read artwork from.
/// - Returns: An initialized NSImage object containing the artwork or null if no artwork was found.
+ (nullable NSImage *)readArtworkFromURL:(nonnull NSURL *)url;
+ (nullable NSDictionary *)probeVideoInfoForFile:(nonnull NSString *)file;
@end