public:
~Display();
uint32_t GetSurfaceId() const { return surface_id_; }
- void SetDisplayQualityInfo(const GstCaps* video_appsrc);
void SetDisplayMode(const DisplayMode& mode);
void SetDisplayRotate(const DisplayRotation& rotate);
bool SetDisplay(const DisplayType& type, Evas_Object* obj);
}
void GetDisplayMode(DisplayMode* mode) { *mode = mode_; }
void GetDisplayRotate(DisplayRotation* rotate) { *rotate = rotate_; }
- void SetVideoQualityMode(const uint32_t mode) { qualitymode_ = mode; }
private:
bool SetDisplay_(const DisplayType& type, Ecore_Wl2_Window* ecore_wl2_window,
DisplayType type_ = DisplayType::kNone;
DisplayMode mode_ = DisplayMode::kFullScreen;
DisplayRotation rotate_ = DisplayRotation::kNone;
- uint32_t qualitymode_ = 0;
bool visible_ = true;
std::mutex settings_mutex_;
- gstguard::GstGuardPtr<GstCaps> video_quality_info_caps_;
};
} // namespace trackrenderer
return true;
}
-void TrackRenderer::SetVideoQualityInfo_() {
- GstCaps* video_caps = nullptr;
- pipeline_->GetProperty(Elements::kAppSrcVideo, "caps", &video_caps);
-
- if (video_caps == nullptr) return;
- auto video_caps_guard = gstguard::make_guard(video_caps);
- auto new_caps_guard = gstguard::make_guard(gst_caps_copy(video_caps));
-
- GstStructure* structure = gst_caps_get_structure(new_caps_guard.get(), 0);
- const gchar* stream_type = gst_structure_get_string(structure, "stream-type");
- if (stream_type) gst_structure_set_name(structure, stream_type);
-
- int max_w = 0, max_h = 0;
- if (!gst_structure_get_int(structure, "maxwidth", &max_w))
- gst_structure_get_int(structure, "width", &max_w);
- if (!gst_structure_get_int(structure, "maxheight", &max_h))
- gst_structure_get_int(structure, "height", &max_h);
-
- if (internal::IsUhd8kResolution(max_w, max_h)) {
- max_w = kMaxUhd8kWidth;
- max_h = kMaxUhd8kHeight;
- } else if (internal::IsUhdResolution(max_w, max_h)) {
- max_w = kMaxUhdWidth;
- max_h = kMaxUhdHeight;
- } else {
- max_w = kMaxFhdWidth;
- max_h = kMaxFhdHeight;
- }
- gst_caps_set_simple(new_caps_guard.get(), "maxwidth", G_TYPE_INT, max_w,
- "maxheight", G_TYPE_INT, max_h, NULL);
-
- TRACKRENDERER_INFO("max width [%d], max height [%d]", max_w, max_h);
- display_->SetDisplayQualityInfo(new_caps_guard.get());
-}
-
bool TrackRenderer::Prepare() {
TRACKRENDERER_ENTER_E;
std::unique_lock<std::mutex> lock(resource_m_);
TRACKRENDERER_ERROR("already stopped");
return false;
}
- ::PerfUsrTrace("Prepare GetResource");
+
if (GetResource_() == false) {
TRACKRENDERER_ERROR("resource acquire failed.");
ReleaseResource_();
return false;
}
- ::PerfUsrTrace("Prepare CreatePipeline");
+
if (CreatePipeline_() == false) {
TRACKRENDERER_ERROR("renderer pipeline creation failed");
return false;
}
- int max_width = 0;
- int max_height = 0;
- for (const Track& track : trackinfo_) {
- if (track.type == kTrackTypeVideo) {
- max_width = track.maxwidth;
- max_height = track.maxheight;
- break;
- }
- }
-
- if (internal::IsUhd8kResolution(max_width, max_height)) {
- constexpr uint32_t kAdaptiveStreaming8kMode =
- 0x80; // refer to waylandsink property value.
- TRACKRENDERER_INFO("Set 8K Video quality mode : 0x80");
- display_->SetVideoQualityMode(kAdaptiveStreaming8kMode);
- }
- ::PerfUsrTrace("Prepare SetVideoQualityInfo_ begin");
- SetVideoQualityInfo_();
- ::PerfUsrTrace("Prepare SetVideoQualityInfo_ end");
pipeline_->Execute(Elements::kSinkVideo, [this](GstElement* obj) noexcept {
return display_->Update(obj);
});
- auto audio_delay_info = gstguard::make_guard(gst_structure_new(
- "audio-delay-info", "video-max-width", G_TYPE_UINT, max_width,
- "video-max-height", G_TYPE_UINT, max_height, NULL));
- TRACKRENDERER_INFO("Set AudioDelayInformation v_res [%d x %d]", max_width,
- max_height);
-
- //TODO: should be enabled audio
- //pipeline_->SetProperty(Elements::kSinkAudio, "audio-delay-info-for-avsync",
- // audio_delay_info.get());
+
if (!pipeline_->SetState(Elements::kPipeline, GST_STATE_PAUSED)) {
TRACKRENDERER_ERROR("Set State to PAUSED failed");
return false;