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
4 changes: 4 additions & 0 deletions packages/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.3

* Apply new texture APIs.

## 0.3.2

* Update the example app and integration_test.
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This package is not an _endorsed_ implementation of `camera`. Therefore, you hav
```yaml
dependencies:
camera: ^0.9.4
camera_tizen: ^0.3.2
camera_tizen: ^0.3.3
```

Then you can import `camera` in your Dart code:
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_tizen
description: Tizen implementation of the camera plugin
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/camera
version: 0.3.2
version: 0.3.3

dependencies:
camera_platform_interface: ^2.1.1
Expand Down
26 changes: 13 additions & 13 deletions packages/camera/tizen/src/camera_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,10 @@ CameraDevice::CameraDevice(flutter::PluginRegistrar *registrar,

// Init channels
texture_variant_ =
std::make_unique<flutter::TextureVariant>(flutter::GpuBufferTexture(
std::make_unique<flutter::TextureVariant>(flutter::GpuSurfaceTexture(
kFlutterDesktopGpuSurfaceTypeNone,
[this](size_t width,
size_t height) -> const FlutterDesktopGpuBuffer * {
size_t height) -> const FlutterDesktopGpuSurfaceDescriptor * {
std::lock_guard<std::mutex> lock(mutex_);
if (!current_packet_) {
return nullptr;
Expand All @@ -345,20 +346,19 @@ CameraDevice::CameraDevice(flutter::PluginRegistrar *registrar,
current_packet_ = nullptr;
return nullptr;
}
flutter_desktop_gpu_buffer_->buffer = surface;
flutter_desktop_gpu_buffer_->width = width;
flutter_desktop_gpu_buffer_->height = height;
flutter_desktop_gpu_buffer_->release_callback =
[](void *release_context) {
CameraDevice *cd = (CameraDevice *)release_context;
cd->ReleaseMediaPacket();
};
flutter_desktop_gpu_buffer_->release_context = this;
return flutter_desktop_gpu_buffer_.get();
gpu_surface_->handle = surface;
gpu_surface_->width = width;
gpu_surface_->height = height;
gpu_surface_->release_callback = [](void *release_context) {
CameraDevice *cd = (CameraDevice *)release_context;
Copy link
Member

Choose a reason for hiding this comment

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

We may need another PR to do some refactoring (to fix the C type cast).

Copy link
Contributor Author

@bbrto21 bbrto21 Sep 6, 2022

Choose a reason for hiding this comment

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

I also think another PR is better.

cd->ReleaseMediaPacket();
};
gpu_surface_->release_context = this;
return gpu_surface_.get();
}));
texture_id_ =
registrar_->texture_registrar()->RegisterTexture(texture_variant_.get());
flutter_desktop_gpu_buffer_ = std::make_unique<FlutterDesktopGpuBuffer>();
gpu_surface_ = std::make_unique<FlutterDesktopGpuSurfaceDescriptor>();

LOG_DEBUG("texture_id_[%ld]", texture_id_);
camera_method_channel_ =
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/tizen/src/camera_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class CameraDevice {
long texture_id_{0};
flutter::PluginRegistrar *registrar_{nullptr};
std::unique_ptr<flutter::TextureVariant> texture_variant_;
std::unique_ptr<FlutterDesktopGpuBuffer> flutter_desktop_gpu_buffer_;
std::unique_ptr<FlutterDesktopGpuSurfaceDescriptor> gpu_surface_;
media_packet_h current_packet_{nullptr};

std::mutex mutex_;
Expand Down
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.1

* Apply new texture APIs.

## 2.4.0

* Update video_player to 2.4.2.
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 @@ -29,7 +29,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.0
video_player_tizen: ^2.4.1
```

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 @@ -3,7 +3,7 @@ description: Flutter plugin for displaying inline video with other Flutter
widgets on Tizen.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player
version: 2.4.0
version: 2.4.1

flutter:
plugin:
Expand Down
25 changes: 13 additions & 12 deletions packages/video_player/tizen/src/video_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void VideoPlayer::ReleaseMediaPacket(void *data) {
}
}

FlutterDesktopGpuBuffer *VideoPlayer::ObtainGpuBuffer(size_t width,
size_t height) {
FlutterDesktopGpuSurfaceDescriptor *VideoPlayer::ObtainGpuSurface(
size_t width, size_t height) {
std::lock_guard<std::mutex> lock(mutex_);
if (!current_media_packet_) {
LOG_ERROR("[VideoPlayer] No valid media packet.");
Expand All @@ -67,12 +67,12 @@ FlutterDesktopGpuBuffer *VideoPlayer::ObtainGpuBuffer(size_t width,
current_media_packet_ = nullptr;
return nullptr;
}
flutter_desktop_gpu_buffer_->buffer = surface;
flutter_desktop_gpu_buffer_->width = width;
flutter_desktop_gpu_buffer_->height = height;
flutter_desktop_gpu_buffer_->release_context = this;
flutter_desktop_gpu_buffer_->release_callback = ReleaseMediaPacket;
return flutter_desktop_gpu_buffer_.get();
gpu_surface_->handle = surface;
gpu_surface_->width = width;
gpu_surface_->height = height;
gpu_surface_->release_context = this;
gpu_surface_->release_callback = ReleaseMediaPacket;
return gpu_surface_.get();
}

VideoPlayer::VideoPlayer(flutter::PluginRegistrar *plugin_registrar,
Expand All @@ -82,12 +82,13 @@ VideoPlayer::VideoPlayer(flutter::PluginRegistrar *plugin_registrar,
texture_registrar_ = texture_registrar;

texture_variant_ =
std::make_unique<flutter::TextureVariant>(flutter::GpuBufferTexture(
std::make_unique<flutter::TextureVariant>(flutter::GpuSurfaceTexture(
kFlutterDesktopGpuSurfaceTypeNone,
[this](size_t width,
size_t height) -> const FlutterDesktopGpuBuffer * {
return this->ObtainGpuBuffer(width, height);
size_t height) -> const FlutterDesktopGpuSurfaceDescriptor * {
return this->ObtainGpuSurface(width, height);
}));
flutter_desktop_gpu_buffer_ = std::make_unique<FlutterDesktopGpuBuffer>();
gpu_surface_ = std::make_unique<FlutterDesktopGpuSurfaceDescriptor>();
texture_id_ = texture_registrar->RegisterTexture(texture_variant_.get());

int ret = player_create(&player_);
Expand Down
5 changes: 3 additions & 2 deletions packages/video_player/tizen/src/video_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class VideoPlayer {
void Initialize();
void SetUpEventChannel(flutter::BinaryMessenger *messenger);
void SendInitialized();
FlutterDesktopGpuBuffer *ObtainGpuBuffer(size_t width, size_t height);
FlutterDesktopGpuSurfaceDescriptor *ObtainGpuSurface(size_t width,
size_t height);
static void ReleaseMediaPacket(void *packet);

static void OnPrepared(void *data);
Expand All @@ -61,7 +62,7 @@ class VideoPlayer {
int64_t texture_id_;
flutter::TextureRegistrar *texture_registrar_;
std::unique_ptr<flutter::TextureVariant> texture_variant_;
std::unique_ptr<FlutterDesktopGpuBuffer> flutter_desktop_gpu_buffer_;
std::unique_ptr<FlutterDesktopGpuSurfaceDescriptor> gpu_surface_;
std::mutex mutex_;
SeekCompletedCallback on_seek_completed_;
media_packet_h current_media_packet_ = nullptr;
Expand Down
4 changes: 4 additions & 0 deletions packages/webview_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.3

* Apply new texture APIs.

## 0.5.2
* Add a back key handling.

Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This package is not an _endorsed_ implementation of `webview_flutter`. Therefore
```yaml
dependencies:
webview_flutter: ^3.0.4
webview_flutter_tizen: ^0.5.2
webview_flutter_tizen: ^0.5.3
```

## Example
Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_tizen
description: Tizen implementation of the webview plugin
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/webview_flutter
version: 0.5.2
version: 0.5.3

environment:
sdk: ">=2.17.0 <3.0.0"
Expand Down
24 changes: 12 additions & 12 deletions packages/webview_flutter/tizen/src/buffer_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ BufferUnit::~BufferUnit() {
tbm_surface_destroy(tbm_surface_);
tbm_surface_ = nullptr;
}
if (gpu_buffer_) {
delete gpu_buffer_;
gpu_buffer_ = nullptr;
if (gpu_surface_) {
delete gpu_surface_;
gpu_surface_ = nullptr;
}
}

Expand Down Expand Up @@ -47,21 +47,21 @@ void BufferUnit::Reset(int32_t width, int32_t height) {
tbm_surface_destroy(tbm_surface_);
tbm_surface_ = nullptr;
}
if (gpu_buffer_) {
delete gpu_buffer_;
gpu_buffer_ = nullptr;
if (gpu_surface_) {
delete gpu_surface_;
gpu_surface_ = nullptr;
}

tbm_surface_ = tbm_surface_create(width_, height_, TBM_FORMAT_ARGB8888);
gpu_buffer_ = new FlutterDesktopGpuBuffer();
gpu_buffer_->width = width_;
gpu_buffer_->height = height_;
gpu_buffer_->buffer = tbm_surface_;
gpu_buffer_->release_callback = [](void* release_context) {
gpu_surface_ = new FlutterDesktopGpuSurfaceDescriptor();
gpu_surface_->width = width_;
gpu_surface_->height = height_;
gpu_surface_->handle = tbm_surface_;
gpu_surface_->release_callback = [](void* release_context) {
BufferUnit* buffer = reinterpret_cast<BufferUnit*>(release_context);
buffer->UnmarkInUse();
};
gpu_buffer_->release_context = this;
gpu_surface_->release_context = this;
}

BufferPool::BufferPool(int32_t width, int32_t height, size_t pool_size) {
Expand Down
4 changes: 2 additions & 2 deletions packages/webview_flutter/tizen/src/buffer_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BufferUnit {

tbm_surface_h Surface();

FlutterDesktopGpuBuffer* GpuBuffer() { return gpu_buffer_; }
FlutterDesktopGpuSurfaceDescriptor* GpuSurface() { return gpu_surface_; }

#ifndef NDEBUG
// TODO: Unused code.
Expand All @@ -38,7 +38,7 @@ class BufferUnit {
int32_t width_ = 0;
int32_t height_ = 0;
tbm_surface_h tbm_surface_ = nullptr;
FlutterDesktopGpuBuffer* gpu_buffer_ = nullptr;
FlutterDesktopGpuSurfaceDescriptor* gpu_surface_ = nullptr;
};

class BufferPool {
Expand Down
14 changes: 8 additions & 6 deletions packages/webview_flutter/tizen/src/webview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int view_id,
}

texture_variant_ =
std::make_unique<flutter::TextureVariant>(flutter::GpuBufferTexture(
std::make_unique<flutter::TextureVariant>(flutter::GpuSurfaceTexture(
kFlutterDesktopGpuSurfaceTypeNone,
[this](size_t width,
size_t height) -> const FlutterDesktopGpuBuffer* {
return ObtainGpuBuffer(width, height);
size_t height) -> const FlutterDesktopGpuSurfaceDescriptor* {
return ObtainGpuSurface(width, height);
}));
SetTextureId(texture_registrar_->RegisterTexture(texture_variant_.get()));

Expand Down Expand Up @@ -862,11 +863,12 @@ void WebView::HandleCookieMethodCall(
}
}

FlutterDesktopGpuBuffer* WebView::ObtainGpuBuffer(size_t width, size_t height) {
FlutterDesktopGpuSurfaceDescriptor* WebView::ObtainGpuSurface(size_t width,
size_t height) {
std::lock_guard<std::mutex> lock(mutex_);
if (!candidate_surface_) {
if (rendered_surface_) {
return rendered_surface_->GpuBuffer();
return rendered_surface_->GpuSurface();
}
return nullptr;
}
Expand All @@ -875,5 +877,5 @@ FlutterDesktopGpuBuffer* WebView::ObtainGpuBuffer(size_t width, size_t height) {
}
rendered_surface_ = candidate_surface_;
candidate_surface_ = nullptr;
return rendered_surface_->GpuBuffer();
return rendered_surface_->GpuSurface();
}
3 changes: 2 additions & 1 deletion packages/webview_flutter/tizen/src/webview.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class WebView : public PlatformView {

LWE::WebContainer* GetWebViewInstance() { return webview_instance_; }

FlutterDesktopGpuBuffer* ObtainGpuBuffer(size_t width, size_t height);
FlutterDesktopGpuSurfaceDescriptor* ObtainGpuSurface(size_t width,
size_t height);

private:
void HandleMethodCall(
Expand Down