forked from Leak_Technologies/VideoTools
Compare commits
No commits in common. "792e5a6a5af4123a8ce12428b15c2ce2cceecdad" and "5e2c07ad2180fe86c928d87be9aa334c3f14c6bd" have entirely different histories.
792e5a6a5a
...
5e2c07ad21
|
|
@ -1,321 +0,0 @@
|
|||
# VT_Player Windows Compatibility Guide
|
||||
|
||||
This document explains how VT_Player has been made compatible with Windows 11 and how it shares dependencies with VideoTools.
|
||||
|
||||
---
|
||||
|
||||
## Quick Start (Windows 11)
|
||||
|
||||
If you already have VideoTools installed and working on Windows 11, VT_Player should work immediately with the same dependencies:
|
||||
|
||||
```bash
|
||||
# In Git Bash
|
||||
cd /path/to/VT_Player
|
||||
./scripts/build.sh
|
||||
```
|
||||
|
||||
The build will:
|
||||
1. Detect Windows platform automatically
|
||||
2. Build `vt_player.exe` with Windows GUI flags
|
||||
3. Check for FFmpeg on PATH (should already be there from VideoTools)
|
||||
|
||||
---
|
||||
|
||||
## What Was Changed for Windows Compatibility
|
||||
|
||||
### 1. **Universal Build Script** (`scripts/build.sh`)
|
||||
- Auto-detects platform (Linux/macOS/Windows)
|
||||
- Uses appropriate build flags for each platform
|
||||
- Windows-specific: `-ldflags="-H windowsgui -s -w"`
|
||||
- `-H windowsgui`: Hide console window for GUI app
|
||||
- `-s -w`: Strip debug symbols for smaller binary
|
||||
|
||||
### 2. **Console Window Hiding** (`internal/utils/`)
|
||||
|
||||
Added platform-specific utilities to hide FFmpeg/FFprobe console windows on Windows:
|
||||
|
||||
**`internal/utils/proc_windows.go`:**
|
||||
```go
|
||||
//go:build windows
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// ApplyNoWindow hides the console window for spawned processes on Windows.
|
||||
func ApplyNoWindow(cmd *exec.Cmd) {
|
||||
if cmd == nil {
|
||||
return
|
||||
}
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
|
||||
}
|
||||
```
|
||||
|
||||
**`internal/utils/proc_other.go`:**
|
||||
```go
|
||||
//go:build !windows
|
||||
|
||||
package utils
|
||||
|
||||
import "os/exec"
|
||||
|
||||
// ApplyNoWindow is a no-op on non-Windows platforms.
|
||||
func ApplyNoWindow(cmd *exec.Cmd) {
|
||||
_ = cmd
|
||||
}
|
||||
```
|
||||
|
||||
### 3. **FFmpeg Integration**
|
||||
|
||||
VT_Player shares FFmpeg with VideoTools on Windows. If you've already installed VideoTools on Windows 11:
|
||||
- FFmpeg and ffprobe are already on your PATH
|
||||
- VT_Player will use the same binaries
|
||||
- No additional FFmpeg installation needed
|
||||
|
||||
---
|
||||
|
||||
## Building on Windows 11
|
||||
|
||||
### Prerequisites
|
||||
|
||||
From your VideoTools setup, you should already have:
|
||||
- ✅ Go 1.21+ (`go version` to check)
|
||||
- ✅ MinGW-w64 (for CGO compilation)
|
||||
- ✅ FFmpeg on PATH
|
||||
- ✅ Git Bash or MSYS2
|
||||
|
||||
### Build Process
|
||||
|
||||
1. **Open Git Bash** (or MSYS2)
|
||||
|
||||
2. **Navigate to VT_Player:**
|
||||
```bash
|
||||
cd /path/to/VT_Player
|
||||
```
|
||||
|
||||
3. **Run the build script:**
|
||||
```bash
|
||||
./scripts/build.sh
|
||||
```
|
||||
|
||||
4. **Expected output:**
|
||||
```
|
||||
════════════════════════════════════════════════════════════════
|
||||
VT_Player Universal Build Script
|
||||
════════════════════════════════════════════════════════════════
|
||||
|
||||
🔍 Detected platform: Windows
|
||||
|
||||
📦 Go version:
|
||||
go version go1.21.x windows/amd64
|
||||
|
||||
🧹 Cleaning previous builds...
|
||||
✓ Cache cleaned
|
||||
|
||||
⬇️ Downloading dependencies...
|
||||
✓ Dependencies downloaded
|
||||
|
||||
🔨 Building VT_Player for Windows...
|
||||
✓ Build successful!
|
||||
|
||||
════════════════════════════════════════════════════════════════
|
||||
✅ BUILD COMPLETE
|
||||
════════════════════════════════════════════════════════════════
|
||||
|
||||
Output: vt_player.exe
|
||||
Size: ~45M
|
||||
|
||||
✓ FFmpeg detected on PATH
|
||||
|
||||
Ready to run:
|
||||
.\vt_player.exe
|
||||
```
|
||||
|
||||
5. **Run VT_Player:**
|
||||
```bash
|
||||
./vt_player.exe
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Shared Dependencies with VideoTools
|
||||
|
||||
VT_Player and VideoTools share the same dependencies on Windows:
|
||||
|
||||
| Dependency | Purpose | Shared? |
|
||||
|------------|---------|---------|
|
||||
| **Go 1.21+** | Compilation | ✅ Yes |
|
||||
| **MinGW-w64** | CGO for Fyne | ✅ Yes |
|
||||
| **FFmpeg** | Video processing | ✅ Yes (same PATH) |
|
||||
| **FFprobe** | Metadata extraction | ✅ Yes (same PATH) |
|
||||
|
||||
### Why This Works
|
||||
|
||||
Both projects:
|
||||
- Use the same Fyne GUI framework
|
||||
- Use the same video processing tools (FFmpeg)
|
||||
- Use the same build toolchain (Go + MinGW)
|
||||
- Are designed to be portable on Windows
|
||||
|
||||
The only difference is the executable name and specific features.
|
||||
|
||||
---
|
||||
|
||||
## Differences from VideoTools
|
||||
|
||||
### What VT_Player Does NOT Include:
|
||||
- ❌ Conversion queue system
|
||||
- ❌ Format conversion UI
|
||||
- ❌ Batch processing
|
||||
- ❌ DVD authoring
|
||||
|
||||
### What VT_Player DOES Include:
|
||||
- ✅ Frame-accurate playback
|
||||
- ✅ Keyframe detection and navigation
|
||||
- ✅ Timeline widget with visual keyframe markers
|
||||
- ✅ Frame-by-frame stepping
|
||||
- ✅ Keyframe jumping
|
||||
- ✅ Lossless cutting (upcoming)
|
||||
|
||||
VT_Player is focused exclusively on video playback and frame-accurate editing.
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "FFmpeg not found on PATH"
|
||||
|
||||
If the build completes but shows FFmpeg warning:
|
||||
1. Check if VideoTools FFmpeg is on PATH:
|
||||
```bash
|
||||
where ffmpeg
|
||||
where ffprobe
|
||||
```
|
||||
|
||||
2. If not found, add VideoTools FFmpeg to PATH:
|
||||
```powershell
|
||||
# In PowerShell as Administrator
|
||||
$env:Path += ";C:\path\to\VideoTools\dist\windows"
|
||||
```
|
||||
|
||||
3. Or copy FFmpeg from VideoTools:
|
||||
```bash
|
||||
cp /c/path/to/VideoTools/dist/windows/ffmpeg.exe .
|
||||
cp /c/path/to/VideoTools/dist/windows/ffprobe.exe .
|
||||
```
|
||||
|
||||
### "go.exe not found"
|
||||
|
||||
Ensure Go is installed and on PATH:
|
||||
```bash
|
||||
go version
|
||||
```
|
||||
|
||||
If not found, reinstall Go from https://go.dev/dl/
|
||||
|
||||
### "x86_64-w64-mingw32-gcc not found"
|
||||
|
||||
MinGW-w64 is required for CGO. If VideoTools builds successfully, MinGW is already installed.
|
||||
|
||||
Check with:
|
||||
```bash
|
||||
x86_64-w64-mingw32-gcc --version
|
||||
```
|
||||
|
||||
### Build Succeeds but App Crashes
|
||||
|
||||
1. Check FFmpeg availability:
|
||||
```bash
|
||||
ffmpeg -version
|
||||
ffprobe -version
|
||||
```
|
||||
|
||||
2. Run with debug output:
|
||||
```bash
|
||||
# Set debug environment variable
|
||||
export VIDEOTOOLS_DEBUG=1
|
||||
./vt_player.exe
|
||||
```
|
||||
|
||||
3. Check logs in current directory for errors
|
||||
|
||||
---
|
||||
|
||||
## Platform-Specific Build Flags
|
||||
|
||||
### Windows (`-ldflags="-H windowsgui -s -w"`)
|
||||
- `-H windowsgui`: Create GUI app (no console window)
|
||||
- `-s`: Strip symbol table
|
||||
- `-w`: Strip DWARF debugging info
|
||||
- Result: Smaller binary, cleaner UX
|
||||
|
||||
### Linux/macOS
|
||||
- Standard build flags
|
||||
- Console output available for debugging
|
||||
- No special GUI flags needed
|
||||
|
||||
---
|
||||
|
||||
## File Structure After Build
|
||||
|
||||
```
|
||||
VT_Player/
|
||||
├── vt_player.exe # Windows executable (~45MB)
|
||||
├── scripts/
|
||||
│ └── build.sh # Universal build script
|
||||
├── internal/
|
||||
│ └── utils/
|
||||
│ ├── proc_windows.go # Windows console hiding
|
||||
│ └── proc_other.go # Linux/macOS no-op
|
||||
└── ... (source files)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Next Steps After Successful Build
|
||||
|
||||
1. **Test basic playback:**
|
||||
- Drag and drop a video file onto VT_Player
|
||||
- Verify it loads and plays
|
||||
|
||||
2. **Enable Frame-Accurate Mode:**
|
||||
- Tools → Frame-Accurate Mode
|
||||
- Load a video
|
||||
- Verify keyframes are detected and shown on timeline
|
||||
|
||||
3. **Test frame navigation:**
|
||||
- Left/Right arrows: Step by frame
|
||||
- Up/Down arrows: Jump between keyframes
|
||||
- Space: Play/pause
|
||||
|
||||
---
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
If you encounter Windows-specific issues:
|
||||
|
||||
1. Check if the same issue occurs in VideoTools
|
||||
2. Verify FFmpeg is on PATH and working
|
||||
3. Run with `VIDEOTOOLS_DEBUG=1` for detailed logs
|
||||
4. Report with:
|
||||
- Windows version (should be Windows 11)
|
||||
- Go version
|
||||
- FFmpeg version
|
||||
- Error messages
|
||||
- Build log
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
VT_Player on Windows 11 should "just work" if VideoTools is already working:
|
||||
- ✅ Same build environment
|
||||
- ✅ Same dependencies
|
||||
- ✅ Same FFmpeg installation
|
||||
- ✅ Auto-detecting build script
|
||||
- ✅ Console windows hidden for clean UX
|
||||
|
||||
The universal build script handles all platform differences automatically.
|
||||
|
|
@ -12,29 +12,29 @@ import (
|
|||
// Using Material Symbols from Google Fonts
|
||||
// https://fonts.google.com/icons
|
||||
const (
|
||||
// Playback controls (ASCII fallback until custom icons)
|
||||
IconPlayArrow = "▶" // play_arrow
|
||||
IconPause = "||" // pause
|
||||
IconStop = "■" // stop
|
||||
IconSkipPrevious = "|◀" // skip_previous
|
||||
IconSkipNext = "▶|" // skip_next
|
||||
IconFastRewind = "◀◀" // fast_rewind
|
||||
IconFastForward = "▶▶" // fast_forward
|
||||
// Playback controls
|
||||
IconPlayArrow = "\ue037" // play_arrow
|
||||
IconPause = "\ue034" // pause
|
||||
IconStop = "\ue047" // stop
|
||||
IconSkipPrevious = "\ue045" // skip_previous
|
||||
IconSkipNext = "\ue044" // skip_next
|
||||
IconFastRewind = "\ue020" // fast_rewind
|
||||
IconFastForward = "\ue01f" // fast_forward
|
||||
|
||||
// Frame navigation (for frame-accurate mode)
|
||||
IconFramePrevious = "◀" // navigate_before / chevron_left
|
||||
IconFrameNext = "▶" // navigate_next / chevron_right
|
||||
IconKeyframePrevious = "◀◀" // first_page (double chevron left)
|
||||
IconKeyframeNext = "▶▶" // last_page (double chevron right)
|
||||
IconFramePrevious = "\ue408" // navigate_before / chevron_left
|
||||
IconFrameNext = "\ue409" // navigate_next / chevron_right
|
||||
IconKeyframePrevious = "\ue5dc" // first_page (double chevron left)
|
||||
IconKeyframeNext = "\ue5dd" // last_page (double chevron right)
|
||||
|
||||
// Volume controls
|
||||
IconVolumeUp = "🔊" // volume_up
|
||||
IconVolumeDown = "🔉" // volume_down
|
||||
IconVolumeMute = "🔇" // volume_mute
|
||||
IconVolumeOff = "🔇" // volume_off
|
||||
IconVolumeUp = "\ue050" // volume_up
|
||||
IconVolumeDown = "\ue04d" // volume_down
|
||||
IconVolumeMute = "\ue04e" // volume_mute
|
||||
IconVolumeOff = "\ue04f" // volume_off
|
||||
|
||||
// Playlist management
|
||||
IconMenu = "☰" // menu (hamburger)
|
||||
IconMenu = "\ue5d2" // menu (hamburger)
|
||||
IconPlaylistAdd = "\ue03b" // playlist_add
|
||||
IconPlaylistRemove = "\ue958" // playlist_remove
|
||||
IconClearAll = "\ue0b8" // clear_all
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
package ui
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
// TappableOverlay is an invisible widget that captures tap and double-tap events
|
||||
type TappableOverlay struct {
|
||||
widget.BaseWidget
|
||||
OnTapped func()
|
||||
OnDoubleTapped func()
|
||||
OnSecondaryTapped func()
|
||||
}
|
||||
|
||||
// NewTappableOverlay creates a new tappable overlay
|
||||
func NewTappableOverlay(onTapped, onDoubleTapped, onSecondaryTapped func()) *TappableOverlay {
|
||||
t := &TappableOverlay{
|
||||
OnTapped: onTapped,
|
||||
OnDoubleTapped: onDoubleTapped,
|
||||
OnSecondaryTapped: onSecondaryTapped,
|
||||
}
|
||||
t.ExtendBaseWidget(t)
|
||||
return t
|
||||
}
|
||||
|
||||
// Tapped handles single tap events
|
||||
func (t *TappableOverlay) Tapped(*fyne.PointEvent) {
|
||||
if t.OnTapped != nil {
|
||||
t.OnTapped()
|
||||
}
|
||||
}
|
||||
|
||||
// TappedSecondary handles right-click events
|
||||
func (t *TappableOverlay) TappedSecondary(*fyne.PointEvent) {
|
||||
if t.OnSecondaryTapped != nil {
|
||||
t.OnSecondaryTapped()
|
||||
}
|
||||
}
|
||||
|
||||
// DoubleTapped handles double-tap events
|
||||
func (t *TappableOverlay) DoubleTapped(*fyne.PointEvent) {
|
||||
if t.OnDoubleTapped != nil {
|
||||
t.OnDoubleTapped()
|
||||
}
|
||||
}
|
||||
|
||||
// CreateRenderer implements fyne.Widget
|
||||
func (t *TappableOverlay) CreateRenderer() fyne.WidgetRenderer {
|
||||
return &overlayRenderer{}
|
||||
}
|
||||
|
||||
// MinSize returns minimum size (should fill parent)
|
||||
func (t *TappableOverlay) MinSize() fyne.Size {
|
||||
return fyne.NewSize(1, 1)
|
||||
}
|
||||
|
||||
type overlayRenderer struct{}
|
||||
|
||||
func (r *overlayRenderer) Layout(size fyne.Size) {}
|
||||
func (r *overlayRenderer) MinSize() fyne.Size { return fyne.NewSize(1, 1) }
|
||||
func (r *overlayRenderer) Refresh() {}
|
||||
func (r *overlayRenderer) Objects() []fyne.CanvasObject { return nil }
|
||||
func (r *overlayRenderer) Destroy() {}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
//go:build !windows
|
||||
|
||||
package utils
|
||||
|
||||
import "os/exec"
|
||||
|
||||
// ApplyNoWindow is a no-op on non-Windows platforms.
|
||||
func ApplyNoWindow(cmd *exec.Cmd) {
|
||||
_ = cmd
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
//go:build windows
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// ApplyNoWindow hides the console window for spawned processes on Windows.
|
||||
func ApplyNoWindow(cmd *exec.Cmd) {
|
||||
if cmd == nil {
|
||||
return
|
||||
}
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
|
||||
}
|
||||
58
main.go
58
main.go
|
|
@ -199,7 +199,6 @@ type appState struct {
|
|||
compareFile1 *videoSource
|
||||
compareFile2 *videoSource
|
||||
keyframingMode bool // Toggle for frame-accurate editing features
|
||||
isFullscreen bool // Fullscreen mode state
|
||||
}
|
||||
|
||||
func (s *appState) stopPreview() {
|
||||
|
|
@ -209,11 +208,6 @@ func (s *appState) stopPreview() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *appState) toggleFullscreen() {
|
||||
s.isFullscreen = !s.isFullscreen
|
||||
s.window.SetFullScreen(s.isFullscreen)
|
||||
}
|
||||
|
||||
func (s *appState) updateStatsBar() {
|
||||
if s.statsBar == nil || s.jobQueue == nil {
|
||||
return
|
||||
|
|
@ -1068,34 +1062,6 @@ func (s *appState) showPlayerView() {
|
|||
})
|
||||
}
|
||||
|
||||
// Add tappable overlay to stage for video interactions
|
||||
// Double-click toggles fullscreen, right-click plays/pauses
|
||||
videoTapper := ui.NewTappableOverlay(
|
||||
nil, // Single tap does nothing for now
|
||||
func() {
|
||||
// Double-tap: toggle fullscreen
|
||||
s.toggleFullscreen()
|
||||
},
|
||||
func() {
|
||||
// Right-click: toggle play/pause
|
||||
if !ensureSession() {
|
||||
return
|
||||
}
|
||||
if s.playerPaused {
|
||||
s.playSess.Play()
|
||||
s.playerPaused = false
|
||||
playBtn.SetText(ui.IconPause)
|
||||
} else {
|
||||
s.playSess.Pause()
|
||||
s.playerPaused = true
|
||||
playBtn.SetText(ui.IconPlayArrow)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// Add tapper to stage
|
||||
stage.Objects = append(stage.Objects, videoTapper)
|
||||
|
||||
playerArea = container.NewBorder(
|
||||
nil,
|
||||
container.NewVBox(container.NewPadded(progressBar), container.NewPadded(controlRow)),
|
||||
|
|
@ -2058,30 +2024,6 @@ func runGUI() {
|
|||
w.SetOnDropped(func(pos fyne.Position, items []fyne.URI) {
|
||||
state.handleDropPlayer(items)
|
||||
})
|
||||
|
||||
// Global keyboard shortcuts (F11 for fullscreen, ESC to exit fullscreen, Space for play/pause)
|
||||
w.Canvas().SetOnTypedKey(func(key *fyne.KeyEvent) {
|
||||
switch key.Name {
|
||||
case fyne.KeyF11:
|
||||
state.toggleFullscreen()
|
||||
case fyne.KeyEscape:
|
||||
if state.isFullscreen {
|
||||
state.toggleFullscreen()
|
||||
}
|
||||
case fyne.KeySpace:
|
||||
// Space bar: toggle play/pause
|
||||
if state.playSess != nil {
|
||||
if state.playerPaused {
|
||||
state.playSess.Play()
|
||||
state.playerPaused = false
|
||||
} else {
|
||||
state.playSess.Pause()
|
||||
state.playerPaused = true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
state.showMainMenu()
|
||||
logging.Debug(logging.CatUI, "main menu rendered with %d modules", len(modulesList))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/bash
|
||||
# VT_Player Build Script
|
||||
# Cleans dependencies and builds the application with proper error handling
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BUILD_OUTPUT="$PROJECT_ROOT/vt_player"
|
||||
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " VT_Player Build Script"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Check if go is installed
|
||||
if ! command -v go &> /dev/null; then
|
||||
echo "❌ ERROR: Go is not installed. Please install Go 1.21 or later."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📦 Go version:"
|
||||
go version
|
||||
echo ""
|
||||
|
||||
# Change to project directory
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
echo "🧹 Cleaning previous builds and cache..."
|
||||
go clean -cache -modcache -testcache 2>/dev/null || true
|
||||
rm -f "$BUILD_OUTPUT" 2>/dev/null || true
|
||||
echo "✓ Cache cleaned"
|
||||
echo ""
|
||||
|
||||
echo "⬇️ Downloading and verifying dependencies..."
|
||||
go mod download
|
||||
go mod verify
|
||||
echo "✓ Dependencies verified"
|
||||
echo ""
|
||||
|
||||
echo "🔨 Building VT_Player..."
|
||||
# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled.
|
||||
export CGO_ENABLED=1
|
||||
if go build -o "$BUILD_OUTPUT" .; then
|
||||
echo "✓ Build successful!"
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo "✅ BUILD COMPLETE"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "Output: $BUILD_OUTPUT"
|
||||
echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)"
|
||||
echo ""
|
||||
echo "To run:"
|
||||
echo " $PROJECT_ROOT/vt_player"
|
||||
echo ""
|
||||
echo "Or use the convenience script:"
|
||||
echo " source $PROJECT_ROOT/scripts/alias.sh"
|
||||
echo " vt_player"
|
||||
echo ""
|
||||
else
|
||||
echo "❌ Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
141
scripts/build.sh
141
scripts/build.sh
|
|
@ -1,43 +1,20 @@
|
|||
#!/bin/bash
|
||||
# VT_Player Universal Build Script
|
||||
# Auto-detects platform and builds accordingly
|
||||
# VT Player Build Script
|
||||
# Cleans dependencies and builds the application with proper error handling
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
BUILD_OUTPUT="$PROJECT_ROOT/VTPlayer"
|
||||
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " VT_Player Universal Build Script"
|
||||
echo " VT Player Build Script"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Detect platform
|
||||
PLATFORM="$(uname -s)"
|
||||
case "${PLATFORM}" in
|
||||
Linux*)
|
||||
OS="Linux"
|
||||
;;
|
||||
Darwin*)
|
||||
OS="macOS"
|
||||
;;
|
||||
CYGWIN*|MINGW*|MSYS*)
|
||||
OS="Windows"
|
||||
;;
|
||||
*)
|
||||
echo "❌ Unknown platform: ${PLATFORM}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "🔍 Detected platform: $OS"
|
||||
echo ""
|
||||
|
||||
# Check if go is installed
|
||||
if ! command -v go &> /dev/null; then
|
||||
echo "❌ ERROR: Go is not installed. Please install Go 1.21 or later."
|
||||
echo ""
|
||||
echo "Download from: https://go.dev/dl/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -45,80 +22,42 @@ echo "📦 Go version:"
|
|||
go version
|
||||
echo ""
|
||||
|
||||
# Route to appropriate build script
|
||||
case "$OS" in
|
||||
Linux)
|
||||
echo "→ Building for Linux..."
|
||||
echo ""
|
||||
exec "$SCRIPT_DIR/build-linux.sh"
|
||||
;;
|
||||
# Change to project directory
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
macOS)
|
||||
echo "→ Building for macOS..."
|
||||
echo ""
|
||||
# macOS uses same build process as Linux (native build)
|
||||
exec "$SCRIPT_DIR/build-linux.sh"
|
||||
;;
|
||||
echo "🧹 Cleaning previous builds and cache..."
|
||||
go clean -cache -modcache -testcache 2>/dev/null || true
|
||||
rm -f "$BUILD_OUTPUT" 2>/dev/null || true
|
||||
echo "✓ Cache cleaned"
|
||||
echo ""
|
||||
|
||||
Windows)
|
||||
echo "→ Building for Windows..."
|
||||
echo ""
|
||||
echo "⬇️ Downloading and verifying dependencies..."
|
||||
go mod download
|
||||
go mod verify
|
||||
echo "✓ Dependencies verified"
|
||||
echo ""
|
||||
|
||||
# Check if running in Git Bash or similar
|
||||
if command -v go.exe &> /dev/null; then
|
||||
# Windows native build
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
echo "🧹 Cleaning previous builds..."
|
||||
rm -f vt_player.exe VTPlayer.exe 2>/dev/null || true
|
||||
echo "✓ Cache cleaned"
|
||||
echo ""
|
||||
|
||||
echo "⬇️ Downloading dependencies..."
|
||||
go mod download
|
||||
echo "✓ Dependencies downloaded"
|
||||
echo ""
|
||||
|
||||
echo "🔨 Building VT_Player for Windows..."
|
||||
export CGO_ENABLED=1
|
||||
|
||||
# Build with Windows GUI flags
|
||||
if go build -ldflags="-H windowsgui -s -w" -o vt_player.exe .; then
|
||||
echo "✓ Build successful!"
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo "✅ BUILD COMPLETE"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "Output: vt_player.exe"
|
||||
if [ -f "vt_player.exe" ]; then
|
||||
SIZE=$(du -h vt_player.exe 2>/dev/null | cut -f1 || echo "unknown")
|
||||
echo "Size: $SIZE"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
if ffmpeg -version >/dev/null 2>&1 && ffprobe -version >/dev/null 2>&1; then
|
||||
echo "✓ FFmpeg detected on PATH"
|
||||
echo ""
|
||||
echo "Ready to run:"
|
||||
echo " .\\vt_player.exe"
|
||||
else
|
||||
echo "⚠️ FFmpeg not detected on PATH"
|
||||
echo ""
|
||||
echo "VT_Player requires FFmpeg. Please install it:"
|
||||
echo " 1. Download from: https://ffmpeg.org/download.html"
|
||||
echo " 2. Add to PATH"
|
||||
echo " Or if VideoTools is installed, FFmpeg should already be available."
|
||||
fi
|
||||
else
|
||||
echo "❌ Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ ERROR: go.exe not found."
|
||||
echo "Please ensure Go is properly installed on Windows."
|
||||
echo "Download from: https://go.dev/dl/"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
echo "🔨 Building VT Player..."
|
||||
# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled.
|
||||
export CGO_ENABLED=1
|
||||
if go build -o "$BUILD_OUTPUT" .; then
|
||||
echo "✓ Build successful!"
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo "✅ BUILD COMPLETE"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "Output: $BUILD_OUTPUT"
|
||||
echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)"
|
||||
echo ""
|
||||
echo "To run:"
|
||||
echo " $PROJECT_ROOT/VTPlayer"
|
||||
echo ""
|
||||
echo "Or use the convenience script:"
|
||||
echo " source $PROJECT_ROOT/scripts/alias.sh"
|
||||
echo " VTPlayer"
|
||||
echo ""
|
||||
else
|
||||
echo "❌ Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/bash
|
||||
# VT Player Build Script
|
||||
# Cleans dependencies and builds the application with proper error handling
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BUILD_OUTPUT="$PROJECT_ROOT/VTPlayer"
|
||||
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " VT Player Build Script"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Check if go is installed
|
||||
if ! command -v go &> /dev/null; then
|
||||
echo "❌ ERROR: Go is not installed. Please install Go 1.21 or later."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📦 Go version:"
|
||||
go version
|
||||
echo ""
|
||||
|
||||
# Change to project directory
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
echo "🧹 Cleaning previous builds and cache..."
|
||||
go clean -cache -modcache -testcache 2>/dev/null || true
|
||||
rm -f "$BUILD_OUTPUT" 2>/dev/null || true
|
||||
echo "✓ Cache cleaned"
|
||||
echo ""
|
||||
|
||||
echo "⬇️ Downloading and verifying dependencies..."
|
||||
go mod download
|
||||
go mod verify
|
||||
echo "✓ Dependencies verified"
|
||||
echo ""
|
||||
|
||||
echo "🔨 Building VT Player..."
|
||||
# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled.
|
||||
export CGO_ENABLED=1
|
||||
if go build -o "$BUILD_OUTPUT" .; then
|
||||
echo "✓ Build successful!"
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo "✅ BUILD COMPLETE"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "Output: $BUILD_OUTPUT"
|
||||
echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)"
|
||||
echo ""
|
||||
echo "To run:"
|
||||
echo " $PROJECT_ROOT/VTPlayer"
|
||||
echo ""
|
||||
echo "Or use the convenience script:"
|
||||
echo " source $PROJECT_ROOT/scripts/alias.sh"
|
||||
echo " VTPlayer"
|
||||
echo ""
|
||||
else
|
||||
echo "❌ Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user