Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaowei-guan authored Nov 9, 2023
2 parents 1ade24a + 045c9a0 commit cfdfa4c
Show file tree
Hide file tree
Showing 15 changed files with 192 additions and 185 deletions.
101 changes: 0 additions & 101 deletions packages/sqflite/analysis_options.yaml

This file was deleted.

10 changes: 9 additions & 1 deletion packages/sqflite/example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,18 @@ linter:
- unnecessary_new
- unnecessary_null_in_if_null_operators
- use_rethrow_when_possible

- dangling_library_doc_comments
- deprecated_member_use_from_same_package
- implicit_reopen
- invalid_case_patterns
- no_literal_bool_comparisons
- no_self_assignments
- no_wildcard_variable_uses
- type_literal_in_constant_pattern
# === doc rules ===
- public_member_api_docs
#
# - prefer_final_locals
- sort_constructors_first
- sort_unnamed_constructors_first

2 changes: 1 addition & 1 deletion packages/sqflite/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:

dev_dependencies:
pedantic: ^1.11.0
flutter_lints:
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
flutter_driver:
Expand Down
2 changes: 2 additions & 0 deletions packages/sqflite/lib/sqflite_tizen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: avoid_classes_with_only_static_members

import 'package:sqflite/sqflite.dart';

/// A class to initialize the plugin.
Expand Down
3 changes: 0 additions & 3 deletions packages/sqflite/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,3 @@ dependencies:
flutter:
sdk: flutter
sqflite: ^2.3.0

dev_dependencies:
flutter_lints: ^1.0.4
4 changes: 4 additions & 0 deletions packages/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.4.9

* Fix event channel issue, sending messages from native to Flutter on the platform thread.

## 2.4.8

* Disable screensaver when player is playing.
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This package is not an _endorsed_ implementation of `video_player`. Therefore, y
```yaml
dependencies:
video_player: ^2.4.2
video_player_tizen: ^2.4.8
video_player_tizen: ^2.4.9
```
Then you can import `video_player` in your Dart code:
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: video_player_tizen
description: Tizen implementation of the video_player plugin.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player
version: 2.4.8
version: 2.4.9

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down
83 changes: 62 additions & 21 deletions packages/video_player/tizen/src/video_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ void VideoPlayer::InitScreenSaverApi() {
VideoPlayer::VideoPlayer(flutter::PluginRegistrar *plugin_registrar,
flutter::TextureRegistrar *texture_registrar,
const std::string &uri, VideoPlayerOptions &options) {
sink_event_pipe_ = ecore_pipe_add(
[](void *data, void *buffer, unsigned int nbyte) -> void {
auto *self = static_cast<VideoPlayer *>(data);
self->SendPendingEvents();
},
this);

texture_registrar_ = texture_registrar;

texture_variant_ =
Expand Down Expand Up @@ -205,6 +212,45 @@ VideoPlayer::~VideoPlayer() {
}
}

void VideoPlayer::SendPendingEvents() {
std::lock_guard<std::mutex> lock(queue_mutex_);
while (!encodable_event_queue_.empty()) {
if (event_sink_) {
event_sink_->Success(encodable_event_queue_.front());
}
encodable_event_queue_.pop();
}

while (!error_event_queue_.empty()) {
if (event_sink_) {
event_sink_->Error(error_event_queue_.front().first,
error_event_queue_.front().second);
}
error_event_queue_.pop();
}
}

void VideoPlayer::PushEvent(const flutter::EncodableValue &encodable_value) {
if (!event_sink_) {
LOG_ERROR("[VideoPlayer] event sink is nullptr.");
return;
}
std::lock_guard<std::mutex> lock(queue_mutex_);
encodable_event_queue_.push(encodable_value);
ecore_pipe_write(sink_event_pipe_, nullptr, 0);
}

void VideoPlayer::SendError(const std::string &error_code,
const std::string &error_message) {
if (!event_sink_) {
LOG_ERROR("[VideoPlayer] event sink is nullptr.");
return;
}
std::lock_guard<std::mutex> lock(queue_mutex_);
error_event_queue_.push(std::make_pair(error_code, error_message));
ecore_pipe_write(sink_event_pipe_, nullptr, 0);
}

void VideoPlayer::Play() {
LOG_DEBUG("[VideoPlayer] Player starting.");

Expand Down Expand Up @@ -306,6 +352,11 @@ void VideoPlayer::Dispose() {

std::lock_guard<std::mutex> lock(mutex_);
is_initialized_ = false;

if (sink_event_pipe_) {
ecore_pipe_del(sink_event_pipe_);
}

event_sink_ = nullptr;
event_channel_->SetStreamHandler(nullptr);

Expand Down Expand Up @@ -384,25 +435,23 @@ void VideoPlayer::SendInitialized() {
int duration = 0;
int ret = player_get_duration(player_, &duration);
if (ret != PLAYER_ERROR_NONE) {
event_sink_->Error("player_get_duration failed", get_error_message(ret));
SendError("player_get_duration failed", get_error_message(ret));
return;
}
LOG_DEBUG("[VideoPlayer] Video duration: %d", duration);

int width = 0, height = 0;
ret = player_get_video_size(player_, &width, &height);
if (ret != PLAYER_ERROR_NONE) {
event_sink_->Error("player_get_video_size failed",
get_error_message(ret));
SendError("player_get_video_size failed", get_error_message(ret));
return;
}
LOG_DEBUG("[VideoPlayer] Video width: %d, height: %d", width, height);

player_display_rotation_e rotation = PLAYER_DISPLAY_ROTATION_NONE;
ret = player_get_display_rotation(player_, &rotation);
if (ret != PLAYER_ERROR_NONE) {
event_sink_->Error("player_get_display_rotation failed",
get_error_message(ret));
SendError("player_get_display_rotation failed", get_error_message(ret));
} else {
LOG_DEBUG("[VideoPlayer] rotation: %s",
RotationToString(rotation).c_str());
Expand All @@ -421,7 +470,7 @@ void VideoPlayer::SendInitialized() {
{flutter::EncodableValue("width"), flutter::EncodableValue(width)},
{flutter::EncodableValue("height"), flutter::EncodableValue(height)},
};
event_sink_->Success(flutter::EncodableValue(result));
PushEvent(flutter::EncodableValue(result));
}
}

Expand Down Expand Up @@ -468,13 +517,10 @@ void VideoPlayer::OnPlayCompleted(void *data) {
LOG_DEBUG("[VideoPlayer] Play completed.");

auto *player = static_cast<VideoPlayer *>(data);
if (player->event_sink_) {
flutter::EncodableMap result = {
{flutter::EncodableValue("event"),
flutter::EncodableValue("completed")},
};
player->event_sink_->Success(flutter::EncodableValue(result));
}
flutter::EncodableMap result = {
{flutter::EncodableValue("event"), flutter::EncodableValue("completed")},
};
player->PushEvent(flutter::EncodableValue(result));

player->Pause();
}
Expand All @@ -483,21 +529,16 @@ void VideoPlayer::OnInterrupted(player_interrupted_code_e code, void *data) {
LOG_ERROR("[VideoPlayer] Interrupt code: %d", code);

auto *player = static_cast<VideoPlayer *>(data);
if (player->event_sink_) {
player->event_sink_->Error("Interrupted error",
"Video player has been interrupted.");
}
player->SendError("Interrupted error", "Video player has been interrupted.");
}

void VideoPlayer::OnError(int error_code, void *data) {
LOG_ERROR("[VideoPlayer] Error code: %d (%s)", error_code,
get_error_message(error_code));

auto *player = static_cast<VideoPlayer *>(data);
if (player->event_sink_) {
player->event_sink_->Error(
"Player error", std::string("Error: ") + get_error_message(error_code));
}
player->SendError("Player error",
std::string("Error: ") + get_error_message(error_code));
}

void VideoPlayer::OnVideoFrameDecoded(media_packet_h packet, void *data) {
Expand Down
9 changes: 9 additions & 0 deletions packages/video_player/tizen/src/video_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class VideoPlayer {
int64_t GetTextureId() { return texture_id_; }

private:
void SendPendingEvents();
void PushEvent(const flutter::EncodableValue &encodable_value);
void SendError(const std::string &error_code,
const std::string &error_message);
FlutterDesktopGpuSurfaceDescriptor *ObtainGpuSurface(size_t width,
size_t height);

Expand Down Expand Up @@ -89,6 +93,11 @@ class VideoPlayer {
void *screensaver_handle_;
ScreensaverResetTimeout screensaver_reset_timeout_;
Ecore_Timer *timer_;

Ecore_Pipe *sink_event_pipe_ = nullptr;
std::mutex queue_mutex_;
std::queue<flutter::EncodableValue> encodable_event_queue_;
std::queue<std::pair<std::string, std::string>> error_event_queue_;
};

#endif // FLUTTER_PLUGIN_VIDEO_PLAYER_H_
4 changes: 4 additions & 0 deletions packages/video_player_videohole/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.3

* Fix event channel issue, sending messages from native to Flutter on the platform thread.

## 0.1.2

* Increase the minimum Flutter version to 3.3.
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player_videohole/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To use this package, add `video_player_videohole` as a dependency in your `pubsp

```yaml
dependencies:
video_player_videohole: ^0.1.1
video_player_videohole: ^0.1.3
```
Then you can import `video_player_videohole` in your Dart code:
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player_videohole/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: video_player_videohole
description: Flutter plugin for displaying inline video on Tizen TV devices.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player_videohole
version: 0.1.2
version: 0.1.3

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down
Loading

0 comments on commit cfdfa4c

Please sign in to comment.