Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.5.1

* Updates to Pigeon 13.
Copy link
Contributor

@tarrinneal tarrinneal Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit ' ' -> ' '.

I can't believe this got merged... /s

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh! Luckily it shouldn't show up that way on pub.dev.


## 2.5.0

* Adds support for macOS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ - (int64_t)duration {
return FVPCMTimeToMillis([[[_player currentItem] asset] duration]);
}

- (void)seekTo:(int)location completionHandler:(void (^)(BOOL))completionHandler {
- (void)seekTo:(int64_t)location completionHandler:(void (^)(BOOL))completionHandler {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were calling this with input.position.intValue previously, which when I removed intValue to adjust for the lack of boxing turned into a warning about loss of precision passing an NSInteger as an int. But this is just used for CMTimeMake, which takes an int64_t, so it was better to change this type than to pointless cast at the call site and (in theory, but probably never in practice) truncate the value.

CMTime locationCMT = CMTimeMake(location, 1000);
CMTimeValue duration = _player.currentItem.asset.duration.value;
// Without adding tolerance when seeking to duration,
Expand Down Expand Up @@ -670,7 +670,7 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
// https://github.com/flutter/flutter/issues/135320
[registrar publish:instance];
#endif
FVPAVFoundationVideoPlayerApiSetup(registrar.messenger, instance);
SetUpFVPAVFoundationVideoPlayerApi(registrar.messenger, instance);
}

- (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
Expand Down Expand Up @@ -709,7 +709,7 @@ - (FVPTextureMessage *)onPlayerSetup:(FVPVideoPlayer *)player
[eventChannel setStreamHandler:player];
player.eventChannel = eventChannel;
self.playersByTextureId[@(textureId)] = player;
FVPTextureMessage *result = [FVPTextureMessage makeWithTextureId:@(textureId)];
FVPTextureMessage *result = [FVPTextureMessage makeWithTextureId:textureId];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it pigeon's change? the new pigeon supports primitives and the old version does not?

Copy link
Collaborator Author

@stuartmorgan-g stuartmorgan-g Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I changed Pigeon's Obj-C generator to stop boxing non-nullable values, to make its generated code more idiomatic and less error-prone (given that it turns out Xcode is less reliable about warning for buggy implicit NSNumber*->BOOL conversions than I thought).

return result;
}

Expand Down Expand Up @@ -761,9 +761,10 @@ - (FVPTextureMessage *)create:(FVPCreateMessage *)input error:(FlutterError **)e
}

- (void)dispose:(FVPTextureMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId];
[self.registry unregisterTexture:input.textureId.intValue];
[self.playersByTextureId removeObjectForKey:input.textureId];
NSNumber *playerKey = @(input.textureId);
FVPVideoPlayer *player = self.playersByTextureId[playerKey];
[self.registry unregisterTexture:input.textureId];
[self.playersByTextureId removeObjectForKey:playerKey];
// If the Flutter contains https://github.com/flutter/engine/pull/12695,
// the `player` is disposed via `onTextureUnregistered` at the right time.
// Without https://github.com/flutter/engine/pull/12695, there is no guarantee that the
Expand All @@ -783,46 +784,46 @@ - (void)dispose:(FVPTextureMessage *)input error:(FlutterError **)error {
}

- (void)setLooping:(FVPLoopingMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId];
player.isLooping = input.isLooping.boolValue;
FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
player.isLooping = input.isLooping;
}

- (void)setVolume:(FVPVolumeMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId];
[player setVolume:input.volume.doubleValue];
FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player setVolume:input.volume];
}

- (void)setPlaybackSpeed:(FVPPlaybackSpeedMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId];
[player setPlaybackSpeed:input.speed.doubleValue];
FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player setPlaybackSpeed:input.speed];
}

- (void)play:(FVPTextureMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId];
FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player play];
}

- (FVPPositionMessage *)position:(FVPTextureMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId];
FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
FVPPositionMessage *result = [FVPPositionMessage makeWithTextureId:input.textureId
position:@([player position])];
position:[player position]];
return result;
}

- (void)seekTo:(FVPPositionMessage *)input
completion:(void (^)(FlutterError *_Nullable))completion {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId];
[player seekTo:input.position.intValue
FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player seekTo:input.position
completionHandler:^(BOOL finished) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.registry textureFrameAvailable:input.textureId.intValue];
[self.registry textureFrameAvailable:input.textureId];
completion(nil);
});
}];
}

- (void)pause:(FVPTextureMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId];
FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player pause];
}

Expand All @@ -831,7 +832,7 @@ - (void)setMixWithOthers:(FVPMixWithOthersMessage *)input
#if TARGET_OS_OSX
// AVAudioSession doesn't exist on macOS, and audio always mixes, so just no-op.
#else
if (input.mixWithOthers.boolValue) {
if (input.mixWithOthers) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:nil];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v11.0.1), do not edit directly.
// Autogenerated from Pigeon (v13.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import <Foundation/Foundation.h>
Expand All @@ -24,40 +24,40 @@ NS_ASSUME_NONNULL_BEGIN
@interface FVPTextureMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId;
@property(nonatomic, strong) NSNumber *textureId;
+ (instancetype)makeWithTextureId:(NSInteger)textureId;
@property(nonatomic, assign) NSInteger textureId;
@end

@interface FVPLoopingMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId isLooping:(NSNumber *)isLooping;
@property(nonatomic, strong) NSNumber *textureId;
@property(nonatomic, strong) NSNumber *isLooping;
+ (instancetype)makeWithTextureId:(NSInteger)textureId isLooping:(BOOL)isLooping;
@property(nonatomic, assign) NSInteger textureId;
@property(nonatomic, assign) BOOL isLooping;
@end

@interface FVPVolumeMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId volume:(NSNumber *)volume;
@property(nonatomic, strong) NSNumber *textureId;
@property(nonatomic, strong) NSNumber *volume;
+ (instancetype)makeWithTextureId:(NSInteger)textureId volume:(double)volume;
@property(nonatomic, assign) NSInteger textureId;
@property(nonatomic, assign) double volume;
@end

@interface FVPPlaybackSpeedMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId speed:(NSNumber *)speed;
@property(nonatomic, strong) NSNumber *textureId;
@property(nonatomic, strong) NSNumber *speed;
+ (instancetype)makeWithTextureId:(NSInteger)textureId speed:(double)speed;
@property(nonatomic, assign) NSInteger textureId;
@property(nonatomic, assign) double speed;
@end

@interface FVPPositionMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId position:(NSNumber *)position;
@property(nonatomic, strong) NSNumber *textureId;
@property(nonatomic, strong) NSNumber *position;
+ (instancetype)makeWithTextureId:(NSInteger)textureId position:(NSInteger)position;
@property(nonatomic, assign) NSInteger textureId;
@property(nonatomic, assign) NSInteger position;
@end

@interface FVPCreateMessage : NSObject
Expand All @@ -72,14 +72,14 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, copy, nullable) NSString *uri;
@property(nonatomic, copy, nullable) NSString *packageName;
@property(nonatomic, copy, nullable) NSString *formatHint;
@property(nonatomic, strong) NSDictionary<NSString *, NSString *> *httpHeaders;
@property(nonatomic, copy) NSDictionary<NSString *, NSString *> *httpHeaders;
@end

@interface FVPMixWithOthersMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithMixWithOthers:(NSNumber *)mixWithOthers;
@property(nonatomic, strong) NSNumber *mixWithOthers;
+ (instancetype)makeWithMixWithOthers:(BOOL)mixWithOthers;
@property(nonatomic, assign) BOOL mixWithOthers;
@end

/// The codec used by FVPAVFoundationVideoPlayerApi.
Expand All @@ -105,7 +105,7 @@ NSObject<FlutterMessageCodec> *FVPAVFoundationVideoPlayerApiGetCodec(void);
error:(FlutterError *_Nullable *_Nonnull)error;
@end

extern void FVPAVFoundationVideoPlayerApiSetup(
extern void SetUpFVPAVFoundationVideoPlayerApi(
id<FlutterBinaryMessenger> binaryMessenger,
NSObject<FVPAVFoundationVideoPlayerApi> *_Nullable api);

Expand Down
Loading