Skip to content

Commit

Permalink
MacOS/iOS: Use RV32 video format
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmercerind committed Sep 26, 2021
1 parent 94adf41 commit f2d41b1
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions dartvlc/internal/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ class PlayerEvents : public PlayerGetters {
open_callback_(*vlc_media_ptr.get());
}

std::function<void(int32_t, int32_t)> video_dimension_callback_ = [=](
int32_t, int32_t) -> void {};
std::function<void(int32_t, int32_t)> video_dimension_callback_ =
[=](int32_t, int32_t) -> void {};

void OnVideoDimensionsCallback() {
int32_t video_width = 0;
Expand All @@ -139,21 +139,31 @@ class PlayerEvents : public PlayerGetters {
vlc_media_player_.setVideoCallbacks(
std::bind(&PlayerEvents::OnVideoLockCallback, this,
std::placeholders::_1),
nullptr, std::bind(&PlayerEvents::OnVideoPictureCallback, this,
std::placeholders::_1));
nullptr,
std::bind(&PlayerEvents::OnVideoPictureCallback, this,
std::placeholders::_1));
vlc_media_player_.setVideoFormatCallbacks(
[=](char* chroma, uint32_t* w, uint32_t* h, uint32_t* p,
uint32_t* l) -> int32_t {
strcpy(chroma, "RGBA");
#ifndef __APPLE__
strncpy(chroma, "RGBA", 4);
#elif
strncpy(chroma, "RV32", 4);
#endif
*w = video_width;
*h = video_height;
*p = pitch;
*l = video_height;
return 1;
},
nullptr);
#ifndef __APPLE__
vlc_media_player_.setVideoFormat("RGBA", video_width, video_height,
pitch);
#elif
vlc_media_player_.setVideoFormat("RV32", video_width, video_height,
pitch);
#endif
}
}

Expand Down Expand Up @@ -192,8 +202,8 @@ class PlayerEvents : public PlayerGetters {
stop_callback_();
}

std::function<void(int32_t)> position_callback_ = [=](
int32_t position) -> void {};
std::function<void(int32_t)> position_callback_ =
[=](int32_t position) -> void {};

void OnPositionCallback(float relative_position) {
state()->is_playing_ = vlc_media_player_.isPlaying();
Expand Down

0 comments on commit f2d41b1

Please sign in to comment.