mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 10:19:59 +01:00
Fix Player menu for 'Timeline'
Replace 'Video' menu for MediaPlayer to 'Timeline'. Move Hardware decoding selection to MediaSource GUI Visitor.
This commit is contained in:
@@ -777,6 +777,9 @@ bool ImGuiToolkit::SliderTiming (const char* label, uint* ms, uint v_min, uint v
|
|||||||
|
|
||||||
void ImGuiToolkit::RenderTimeline (ImVec2 min_bbox, ImVec2 max_bbox, guint64 begin, guint64 end, guint64 step, bool verticalflip)
|
void ImGuiToolkit::RenderTimeline (ImVec2 min_bbox, ImVec2 max_bbox, guint64 begin, guint64 end, guint64 step, bool verticalflip)
|
||||||
{
|
{
|
||||||
|
if (begin == GST_CLOCK_TIME_NONE || end == GST_CLOCK_TIME_NONE || step == GST_CLOCK_TIME_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
const ImRect timeline_bbox(min_bbox, max_bbox);
|
const ImRect timeline_bbox(min_bbox, max_bbox);
|
||||||
const ImGuiWindow* window = ImGui::GetCurrentWindow();
|
const ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
static guint64 optimal_tick_marks[NUM_MARKS + LABEL_TICK_INCREMENT] = { 100 * MILISECOND, 500 * MILISECOND, 1 * SECOND, 2 * SECOND, 5 * SECOND, 10 * SECOND, 20 * SECOND, 1 * MINUTE, 2 * MINUTE, 5 * MINUTE, 10 * MINUTE, 60 * MINUTE, 60 * MINUTE };
|
static guint64 optimal_tick_marks[NUM_MARKS + LABEL_TICK_INCREMENT] = { 100 * MILISECOND, 500 * MILISECOND, 1 * SECOND, 2 * SECOND, 5 * SECOND, 10 * SECOND, 20 * SECOND, 1 * MINUTE, 2 * MINUTE, 5 * MINUTE, 10 * MINUTE, 60 * MINUTE, 60 * MINUTE };
|
||||||
|
|||||||
@@ -683,27 +683,55 @@ void ImGuiVisitor::visit (MediaSource& s)
|
|||||||
if ( !s.failed() ) {
|
if ( !s.failed() ) {
|
||||||
// icon (>) to open player
|
// icon (>) to open player
|
||||||
if ( s.playable() ) {
|
if ( s.playable() ) {
|
||||||
ImGui::SetCursorPos(top);
|
|
||||||
std::string decoder = s.mediaplayer()->decoderName();
|
|
||||||
if ( decoder.compare("software") != 0) {
|
|
||||||
decoder = "Hardware decoder\n" + decoder;
|
|
||||||
ImGuiToolkit::Indication(decoder.c_str(), 13, 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ImGuiToolkit::Indication("Software decoder", 14, 2);
|
|
||||||
top.x += ImGui::GetFrameHeight();
|
|
||||||
ImGui::SetCursorPos(top);
|
ImGui::SetCursorPos(top);
|
||||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||||
UserInterface::manager().showSourceEditor(&s);
|
UserInterface::manager().showSourceEditor(&s);
|
||||||
top.x += ImGui::GetFrameHeight();
|
top.x += ImGui::GetFrameHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SetCursorPos(top);
|
ImGui::SetCursorPos(top);
|
||||||
if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder"))
|
if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder"))
|
||||||
SystemToolkit::open(SystemToolkit::path_filename(s.path()));
|
SystemToolkit::open(SystemToolkit::path_filename(s.path()));
|
||||||
|
|
||||||
ImGui::SetCursorPos(botom);
|
ImGui::SetCursorPos(botom);
|
||||||
|
|
||||||
|
// Selector for Hardware or software decoding, if available
|
||||||
|
if ( Settings::application.render.gpu_decoding ) {
|
||||||
|
|
||||||
|
MediaPlayer *mp = s.mediaplayer();
|
||||||
|
if (mp) {
|
||||||
|
// Build string information on decoder name with icon HW/SW
|
||||||
|
bool hwdec = !mp->softwareDecodingForced();
|
||||||
|
std::string decoder = mp->decoderName();
|
||||||
|
if (hwdec) {
|
||||||
|
if ( decoder.compare("software") != 0)
|
||||||
|
decoder = ICON_FA_MICROCHIP " Hardware (" + decoder + ")";
|
||||||
|
else
|
||||||
|
decoder = ICON_FA_COGS " Software";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
decoder = ICON_FA_COGS " Software only";
|
||||||
|
// Combo selector shoing the current state and the option to choose
|
||||||
|
// between auto select and forced software decoding
|
||||||
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
|
if (ImGui::BeginCombo("Decoding", decoder.c_str() ) )
|
||||||
|
{
|
||||||
|
if (ImGui::Selectable( ICON_FA_MICROCHIP " / " ICON_FA_COGS " Auto select", &hwdec ))
|
||||||
|
mp->setSoftwareDecodingForced(false);
|
||||||
|
hwdec = mp->softwareDecodingForced();
|
||||||
|
if (ImGui::Selectable( ICON_FA_COGS " Software only", &hwdec ))
|
||||||
|
mp->setSoftwareDecodingForced(true);
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// info of software only decoding if disabled
|
||||||
|
ImGuiToolkit::Icon(14,2,false);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled("Hardware decoding disabled");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// failed
|
// failed
|
||||||
|
|||||||
@@ -372,77 +372,57 @@ void SourceControlWindow::Render()
|
|||||||
//
|
//
|
||||||
// Menu for video Mediaplayer control
|
// Menu for video Mediaplayer control
|
||||||
//
|
//
|
||||||
if (ImGui::BeginMenu(ICON_FA_PHOTO_VIDEO " Media", mediaplayer_active_) )
|
if (ImGui::BeginMenu(ICON_FA_FILM " Timeline", mediaplayer_active_) )
|
||||||
{
|
{
|
||||||
if ( !mediaplayer_active_->singleFrame() ) {
|
if ( mediaplayer_active_->isImage()) {
|
||||||
// if (ImGui::MenuItem( ICON_FA_REDO_ALT " Reload" ))
|
if ( ImGuiToolkit::MenuItemIcon(1, 14, "Remove")){
|
||||||
// mediaplayer_active_->reopen();
|
// set empty timeline
|
||||||
if (ImGuiToolkit::MenuItemIcon(16, 16, "Gstreamer effect", nullptr,
|
Timeline tl;
|
||||||
false, mediaplayer_active_->videoEffectAvailable()) )
|
mediaplayer_active_->setTimeline(tl);
|
||||||
mediaplayer_edit_pipeline_ = true;
|
mediaplayer_active_->play(false);
|
||||||
if (ImGui::BeginMenu(ICON_FA_MICROCHIP " Hardware decoding"))
|
// re-open the image with NO timeline
|
||||||
{
|
|
||||||
bool hwdec = !mediaplayer_active_->softwareDecodingForced();
|
|
||||||
if (ImGui::MenuItem("Auto", "", &hwdec ))
|
|
||||||
mediaplayer_active_->setSoftwareDecodingForced(false);
|
|
||||||
hwdec = mediaplayer_active_->softwareDecodingForced();
|
|
||||||
if (ImGui::MenuItem("Disabled", "", &hwdec ))
|
|
||||||
mediaplayer_active_->setSoftwareDecodingForced(true);
|
|
||||||
ImGui::EndMenu();
|
|
||||||
}
|
|
||||||
ImGui::Separator();
|
|
||||||
ImGui::TextDisabled("Timeline");
|
|
||||||
|
|
||||||
if ( mediaplayer_active_->isImage()) {
|
|
||||||
if ( ImGuiToolkit::MenuItemIcon(1, 14, "Remove")){
|
|
||||||
// set empty timeline
|
|
||||||
Timeline tl;
|
|
||||||
mediaplayer_active_->setTimeline(tl);
|
|
||||||
mediaplayer_active_->play(false);
|
|
||||||
// re-open the image with NO timeline
|
|
||||||
mediaplayer_active_->reopen();
|
|
||||||
mediaplayer_active_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ImGui::MenuItem(ICON_FA_HOURGLASS_HALF " Duration")){
|
|
||||||
mediaplayer_set_duration_ = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::MenuItem(ICON_FA_WINDOW_CLOSE " Reset")){
|
|
||||||
mediaplayer_timeline_zoom_ = 1.f;
|
|
||||||
mediaplayer_active_->timeline()->clearFading();
|
|
||||||
mediaplayer_active_->timeline()->clearGaps();
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << SystemToolkit::base_filename( mediaplayer_active_->filename() );
|
|
||||||
oss << ": Reset timeline";
|
|
||||||
Action::manager().store(oss.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::MenuItem(LABEL_EDIT_FADING))
|
|
||||||
mediaplayer_edit_fading_ = true;
|
|
||||||
|
|
||||||
if (ImGui::BeginMenu(ICON_FA_CLOCK " Metronome"))
|
|
||||||
{
|
|
||||||
Metronome::Synchronicity sync = mediaplayer_active_->syncToMetronome();
|
|
||||||
bool active = sync == Metronome::SYNC_NONE;
|
|
||||||
if (ImGuiToolkit::MenuItemIcon(5, 13, " Not synchronized", NULL, active ))
|
|
||||||
mediaplayer_active_->setSyncToMetronome(Metronome::SYNC_NONE);
|
|
||||||
active = sync == Metronome::SYNC_BEAT;
|
|
||||||
if (ImGuiToolkit::MenuItemIcon(6, 13, " Sync to beat", NULL, active ))
|
|
||||||
mediaplayer_active_->setSyncToMetronome(Metronome::SYNC_BEAT);
|
|
||||||
active = sync == Metronome::SYNC_PHASE;
|
|
||||||
if (ImGuiToolkit::MenuItemIcon(7, 13, " Sync to phase", NULL, active ))
|
|
||||||
mediaplayer_active_->setSyncToMetronome(Metronome::SYNC_PHASE);
|
|
||||||
ImGui::EndMenu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (ImGui::MenuItem( ICON_FA_REDO_ALT " Reload" ))
|
|
||||||
mediaplayer_active_->reopen();
|
mediaplayer_active_->reopen();
|
||||||
|
mediaplayer_active_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ImGui::MenuItem(ICON_FA_HOURGLASS_HALF " Duration")){
|
||||||
|
mediaplayer_set_duration_ = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::MenuItem(ICON_FA_WINDOW_CLOSE " Reset")){
|
||||||
|
mediaplayer_timeline_zoom_ = 1.f;
|
||||||
|
mediaplayer_active_->timeline()->clearFading();
|
||||||
|
mediaplayer_active_->timeline()->clearGaps();
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << SystemToolkit::base_filename( mediaplayer_active_->filename() );
|
||||||
|
oss << ": Reset timeline";
|
||||||
|
Action::manager().store(oss.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::MenuItem(LABEL_EDIT_FADING))
|
||||||
|
mediaplayer_edit_fading_ = true;
|
||||||
|
|
||||||
|
if (ImGui::BeginMenu(ICON_FA_CLOCK " Metronome"))
|
||||||
|
{
|
||||||
|
Metronome::Synchronicity sync = mediaplayer_active_->syncToMetronome();
|
||||||
|
bool active = sync == Metronome::SYNC_NONE;
|
||||||
|
if (ImGuiToolkit::MenuItemIcon(5, 13, " Not synchronized", NULL, active ))
|
||||||
|
mediaplayer_active_->setSyncToMetronome(Metronome::SYNC_NONE);
|
||||||
|
active = sync == Metronome::SYNC_BEAT;
|
||||||
|
if (ImGuiToolkit::MenuItemIcon(6, 13, " Sync to beat", NULL, active ))
|
||||||
|
mediaplayer_active_->setSyncToMetronome(Metronome::SYNC_BEAT);
|
||||||
|
active = sync == Metronome::SYNC_PHASE;
|
||||||
|
if (ImGuiToolkit::MenuItemIcon(7, 13, " Sync to phase", NULL, active ))
|
||||||
|
mediaplayer_active_->setSyncToMetronome(Metronome::SYNC_PHASE);
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
if (ImGuiToolkit::MenuItemIcon(16, 16, "Gstreamer effect", nullptr,
|
||||||
|
false, mediaplayer_active_->videoEffectAvailable()) )
|
||||||
|
mediaplayer_edit_pipeline_ = true;
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user