Replies: 16 comments 2 replies
-
|
Care to share a bit more? Curious nature I am... |
Beta Was this translation helpful? Give feedback.
-
Architecture Solution Document: Picframe Next Gen. Modernization1. Executive SummaryThis document outlines the comprehensive architectural redesign of the 2. Architectural Concept & ReasoningThe Picframe Next Gen. architecture is built upon several advanced software design patterns to ensure strict testability, maintainability, and thread safety in a concurrent Python environment. 2.1 Clean Architecture (Hexagonal)
2.2 Strict Event-Driven Architecture (EDA) & PriorityQueue
2.3 Interface Segregation Principle (ISP)
2.4 Command Pattern & Immutable DTOs
2.5 Separation of Concerns (SoC): Orchestration
2.6 Dual-Database Strategy (Repository Pattern)
2.7 Decoupling Presentation from Domain Logic (SRP)
2.8 Asynchronous Media Monitoring
2.9 Hardware Abstraction Layer (HAL) & Cross-Platform Ports
3. System Diagrams3.1 Component ArchitectureThis diagram illustrates the strict layers and dependencies of the system, highlighting how the Composition Root wires the application together and how the Event Bus acts as the central nervous system. graph TD
subgraph ControlPlane [Background Threads]
API[FastAPI / Uvicorn]
UI[Vue.js SPA]
MQTT[MQTT Client]
MON[MediaMonitorService]
HW[HardwareInputService]
SCH[SchedulerService]
end
subgraph EventBus [Thread-Safe PriorityQueue]
PUB[IEventPublisher]
SUB[IEventSubscriber]
end
subgraph MediaOrchestrator [Main Thread]
PE[PlaybackEngine]
PM[PlaylistManager]
IPS[ImageProcessingService]
end
subgraph PresentationLayer [Main Thread / Subprocess]
PI3D[Pi3dRenderer]
GST[GstVideoRenderer]
DPM[DisplayPowerManager]
SYS[SystemManager]
end
subgraph DataLayer [Repositories]
DB_CONF[(config.db3)]
DB_MEDIA[(media_cache.db3)]
end
%% Relationships
UI <-->|REST / WebSockets| API
API -->|Publish Commands| PUB
MQTT -->|Publish Commands| PUB
MON -->|Publish FileEvents| PUB
HW -->|Publish HardwareEvents| PUB
SCH -->|Publish Commands| PUB
PUB -->|Route Events| SUB
SUB -->|Consume Commands| PE
SUB -->|Consume Commands| DPM
SUB -->|Consume Commands| SYS
PE <-->|Request Media| PM
PE <-->|Process Images| IPS
PE -->|Render Commands| PI3D
PE -->|Render Commands| GST
PM -->|Query| DB_MEDIA
API -->|Read/Write| DB_CONF
%% Styling
classDef thread fill:#f9f,stroke:#333,stroke-width:2px;
classDef main fill:#bbf,stroke:#333,stroke-width:2px;
class PE,PM,IPS,PI3D main;
class API,MQTT,MON,HW,SCH thread;
3.2 Concurrency & Event FlowThis sequence diagram demonstrates the lifecycle and flow of immutable events between the background threads (Control Plane), the Event Bus, and the synchronous Main Thread (Orchestrator & Renderers). sequenceDiagram
participant User as User / UI
participant API as FastAPI (Background Thread)
participant Bus as PriorityQueue Event Bus
participant PE as PlaybackEngine (Main Thread)
participant PM as PlaylistManager (Main Thread)
participant Render as Pi3dRenderer (Main Thread)
User->>API: POST /control/next
Note over API: Create Immutable DTO<br/>CommandEvent(NEXT)
API->>Bus: publish(CommandEvent(NEXT), priority=1)
loop Main Thread Render Loop
PE->>Bus: poll() (Non-blocking)
Bus-->>PE: CommandEvent(NEXT)
Note over PE: Process High-Priority Command
PE->>PM: get_next_media()
PM-->>PE: MediaItem(image.jpg)
PE->>PE: Update State to TRANSITIONING
PE->>Render: execute(RenderCommand(image.jpg))
Render-->>PE: Render Complete
PE->>PE: Update State to PLAYING
Note over PE: Create Immutable DTO<br/>StateEvent(PLAYING, image.jpg)
PE->>Bus: publish(StateEvent)
end
Bus-->>API: StateEvent (via WebSocket Subscriber)
API-->>User: WebSocket Update (State: PLAYING)
4. Gap Analysis Resolutions & Mitigation Strategies4.1 The Main Loop Concurrency Conflict
4.2 Configuration Migration AdapterTo prevent data loss for existing users, a Migration Adapter will run on startup. If 4.3 Event Bus "Poison Pill" HandlingTo ensure system resilience, the 4.4 Dynamic Overlays & Clock Management
4.5 Audio & Volume Control
4.6 Cross-Platform Rendering (pi3d)
|
Beta Was this translation helpful? Give feedback.
-
Frontend Specification: Picframe Next Gen. (Vue.js SPA)1. Executive SummaryThis document outlines the frontend architecture and user interface specification for the Picframe Next Gen Single Page Application (SPA). Built with Vue.js 3, the SPA serves as the primary control plane for the digital picture frame, communicating with the FastAPI backend via REST APIs for configuration and WebSockets for real-time playback state. 2. Technology Stack
3. Core Architecture & Data Flow3.1 State Management (Pinia Stores)
3.2 Responsive Design StrategyThe UI follows a mobile-first approach. On mobile devices, the layout stacks vertically (Media Player on top, Metadata below). On desktop/tablet, it utilizes a multi-column grid (Media Player on the left, Metadata/Map on the right). 4. View 1: Media Player Interface ("The Remote")This view acts as the real-time remote control and information display for the currently playing media. 4.1 Media Display & Playback Controls
4.2 Metadata PanelA dedicated panel surfacing the
4.3 Dynamic OpenStreetMap Component
5. View 2: Administrative Dashboard ("Settings")This view provides robust configuration and system management, protected by basic authentication if configured. 5.1 Configuration ManagementA comprehensive form interface mapping to the
5.2 Advanced Maintenance OperationsA dedicated "Danger Zone" or Maintenance tab for system-level operations. All actions here require a confirmation modal to prevent accidental clicks.
6. API Integration Contract6.1 WebSockets (
|
Beta Was this translation helpful? Give feedback.
-
|
Quite a list! Is it more of an architectural change, or where do you see the biggest benefits for the average user? Improving high-res video playback would come to my mind. |
Beta Was this translation helpful? Give feedback.
-
high-res video playback depends on the gpu capabilities of the raspberry. I haven't testet gstreamer in combination with pi3d yet. But I hope we can use the hardware more effectively. |
Beta Was this translation helpful? Give feedback.
-
|
Wonderful! Thank you for the initiative. Last time I checked, my Pi 5 got so hot during 4k playback that it was basically unusable. But I must admit that having video in between images is quite appealing. |
Beta Was this translation helpful? Give feedback.
-
|
This is my actual Work Breakdown Structure: 5. Work Breakdown Structure (WBS)Note: This WBS is structured into Vertical Slices. Each phase delivers a functional, testable increment of the product, ensuring continuous usability rather than relying on a final "big bang" integration. Phase 0: Technical Spike (Video Handoff PoC)Goal: De-risk the most complex technical challenge by proving the seamless EGL/OpenGL context handoff between pi3d and GStreamer on target hardware before building the full architecture.
Phase 1: Core Image MVP (The "Walking Skeleton")Goal: A functional, headless digital picture frame that reads from SQLite and renders images via pi3d in a continuous loop.
Phase 2: Control Plane & UIGoal: Make the MVP controllable via a modern Web UI, MQTT, and physical buttons, with real-time state reflection.
Phase 3: Video Engine IntegrationGoal: Add multimedia support with seamless transitions between images and hardware-accelerated video.
Phase 4: Advanced System Services & PolishGoal: Feature-complete, production-ready system with background monitoring, scheduling, and legacy migration support.
|
Beta Was this translation helpful? Give feedback.
-
|
Happy to provide testing support anytime! |
Beta Was this translation helpful? Give feedback.
-
|
Sounds good and I'm happy to be allocated a slice once I'm home in a week or two, sensible to do the vertical split to start with. Reading the mutability issues you're working round makes me think we should have written picframe in Rust (much nicer and faster than python, but probably too late now!) I did convert much of the core functionality of pi3d to Rust, but it still uses the same OpenGL system behind the scenes. Anyway, I'll keep an eye out as the ideas form. Paddy |
Beta Was this translation helpful? Give feedback.
-
|
PS having an event engine running separately makes it possible to have 'oversight' of components crashing so they can be restarted and logged even in the event of unforeseen exceptional issues. |
Beta Was this translation helpful? Give feedback.
-
|
Also, I think we need to test at an early stage that the lighter weight, low memory raspberry Pis, such a zero, can run the JavaScript OK. I vaguely remember that being an issue somewhere. We can probably abandon the v. 1 and 2 Pis, but some of the modern web architecture assumes a reasonably 'meaty' setup for the client, albeit in a mobile device. |
Beta Was this translation helpful? Give feedback.
-
|
Another thing that I've intended to do in pi3d for a long time is make a system to enable testing. It would have to set the display dimensions to a standard value, use a standard image and geometry then screen capture and compare with a previously recorded image. |
Beta Was this translation helpful? Give feedback.
-
|
Helge, you're making brilliant progress on this project. I wonder if this might be a good time to update the I don't think this needs to be on the main event bus as the render loop can't afford the luxury of being asynchronous or having arbitrary delays, but it could be done with a pi3d renderer (in the engine?) local service of PriorityQueue objects. There aren't too many events I think: externally: Although pi3d was mainly envisioned as a synchronous loop with blocking delay in the |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Wow! |
Beta Was this translation helpful? Give feedback.
-
|
This is very exciting, I'd love to try and test it when it's ready to go. |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
Actual im thinking about a fundamental change of picframe architecture
Beta Was this translation helpful? Give feedback.
All reactions