Skip to content

Commit

Permalink
Add set rotation and display mode for Media player
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaowei-guan committed Dec 26, 2024
1 parent c89145d commit 94833c1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
27 changes: 27 additions & 0 deletions packages/video_player_avplay/tizen/src/media_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -729,3 +729,30 @@ int MediaPlayer::OnDrmUpdatePsshData(drm_init_data_type init_type, void *data,
}
return 0;
}

bool MediaPlayer::SetDisplayRotate(int64_t rotation) {
LOG_INFO("[MediaPlayer] rotation: %d", rotation);
int ret = player_set_display_rotation(
player_, static_cast<player_display_rotation_e>(rotation));
if (ret != PLAYER_ERROR_NONE) {
LOG_ERROR("[MediaPlayer] player_set_display_rotation failed: %s",
get_error_message(ret));
return false;
}
return true;
}
bool MediaPlayer::SetDisplayMode(int64_t display_mode) {
LOG_INFO("[MediaPlayer] display_mode: %d", display_mode);
if (display_mode > PLAYER_DISPLAY_MODE_NUM) {
LOG_ERROR("[MediaPlayer] display mode out of range");
return false;
}
int ret = player_set_display_mode(
player_, static_cast<player_display_mode_e>(display_mode));
if (ret != PLAYER_ERROR_NONE) {
LOG_ERROR("[MediaPlayer] player_set_display_mode failed: %s",
get_error_message(ret));
return false;
}
return true;
}
2 changes: 2 additions & 0 deletions packages/video_player_avplay/tizen/src/media_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class MediaPlayer : public VideoPlayer {
bool IsReady() override;
flutter::EncodableList GetTrackInfo(std::string track_type) override;
bool SetTrackSelection(int32_t track_id, std::string track_type) override;
bool SetDisplayRotate(int64_t rotation) override;
bool SetDisplayMode(int64_t display_mode) override;

private:
bool IsLive();
Expand Down
4 changes: 2 additions & 2 deletions packages/video_player_avplay/tizen/src/video_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class VideoPlayer {
};
virtual void SetStreamingProperty(const std::string &type,
const std::string &value){};
virtual bool SetDisplayRotate(int64_t rotation) { return false; };
virtual bool SetDisplayMode(int64_t display_mode) { return false; };
virtual bool SetDisplayRotate(int64_t rotation) = 0;
virtual bool SetDisplayMode(int64_t display_mode) = 0;

protected:
virtual void GetVideoSize(int32_t *width, int32_t *height) = 0;
Expand Down

0 comments on commit 94833c1

Please sign in to comment.