Skip to content

Commit be55665

Browse files
committed
Fix texture_id type
1 parent 3b50ea9 commit be55665

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

dartvlc/internal/events.hpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ class PlayerEvents : public PlayerGetters {
7373
playlist_callback_ = callback;
7474
}
7575

76-
void OnVideo(std::function<void(uint8_t* frame, int32_t width,
77-
int32_t height)> callback) {
76+
void OnVideo(
77+
std::function<void(uint8_t* frame, int32_t width, int32_t height)>
78+
callback) {
7879
video_callback_ = callback;
7980
}
8081

@@ -114,8 +115,8 @@ class PlayerEvents : public PlayerGetters {
114115
open_callback_(*vlc_media_ptr.get());
115116
}
116117

117-
std::function<void(int32_t, int32_t)> video_dimension_callback_ = [=](
118-
int32_t, int32_t) -> void {};
118+
std::function<void(int32_t, int32_t)> video_dimension_callback_ =
119+
[=](int32_t, int32_t) -> void {};
119120

120121
void OnVideoDimensionsCallback() {
121122
int32_t video_width = preferred_video_width_.has_value()
@@ -126,7 +127,7 @@ class PlayerEvents : public PlayerGetters {
126127
? preferred_video_height_.value()
127128
: libvlc_video_get_height(vlc_media_player_.get());
128129
video_dimension_callback_(video_width, video_height);
129-
if (video_width_ != video_width && video_height_ != video_height) {
130+
if (video_width_ != video_width || video_height_ != video_height) {
130131
video_width_ = video_width;
131132
video_height_ = video_height;
132133
int32_t pitch = video_width * 4;
@@ -135,8 +136,9 @@ class PlayerEvents : public PlayerGetters {
135136
vlc_media_player_.setVideoCallbacks(
136137
std::bind(&PlayerEvents::OnVideoLockCallback, this,
137138
std::placeholders::_1),
138-
nullptr, std::bind(&PlayerEvents::OnVideoPictureCallback, this,
139-
std::placeholders::_1));
139+
nullptr,
140+
std::bind(&PlayerEvents::OnVideoPictureCallback, this,
141+
std::placeholders::_1));
140142
vlc_media_player_.setVideoFormatCallbacks(
141143
[=](char* chroma, uint32_t* w, uint32_t* h, uint32_t* p,
142144
uint32_t* l) -> int32_t {
@@ -188,8 +190,8 @@ class PlayerEvents : public PlayerGetters {
188190
stop_callback_();
189191
}
190192

191-
std::function<void(int32_t)> position_callback_ = [=](
192-
int32_t position) -> void {};
193+
std::function<void(int32_t)> position_callback_ =
194+
[=](int32_t position) -> void {};
193195

194196
void OnPositionCallback(float relative_position) {
195197
state()->is_playing_ = vlc_media_player_.isPlaying();
@@ -232,8 +234,8 @@ class PlayerEvents : public PlayerGetters {
232234

233235
std::function<void(float)> rate_callback_ = [=](float) -> void {};
234236

235-
std::function<void(uint8_t*, int32_t, int32_t)> video_callback_ = [=](
236-
uint8_t*, int32_t width, int32_t height) -> void {};
237+
std::function<void(uint8_t*, int32_t, int32_t)> video_callback_ =
238+
[=](uint8_t*, int32_t width, int32_t height) -> void {};
237239

238240
void* OnVideoLockCallback(void** planes) {
239241
planes[0] = static_cast<void*>(video_frame_buffer_.get());

windows/video_outlet.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
#include <mutex>
21
#include <flutter/method_channel.h>
32
#include <flutter/plugin_registrar_windows.h>
43
#include <flutter/standard_method_codec.h>
54

5+
#include <mutex>
6+
67
class VideoOutlet {
78
public:
89
VideoOutlet(flutter::TextureRegistrar* texture_registrar);
910

10-
int32_t texture_id() const { return texture_id_; }
11+
int64_t texture_id() const { return texture_id_; }
1112

1213
void OnVideo(uint8_t* buffer, int32_t width, int32_t height);
1314

@@ -17,6 +18,6 @@ class VideoOutlet {
1718
FlutterDesktopPixelBuffer flutter_pixel_buffer_;
1819
flutter::TextureRegistrar* texture_registrar_ = nullptr;
1920
std::unique_ptr<flutter::TextureVariant> texture_ = nullptr;
20-
int32_t texture_id_;
21+
int64_t texture_id_;
2122
mutable std::mutex mutex_;
2223
};

0 commit comments

Comments
 (0)