Skip to content

Refactor servicemp3#3683

Open
WXbet wants to merge 4 commits intoopenatv:masterfrom
WXbet:servicemp3
Open

Refactor servicemp3#3683
WXbet wants to merge 4 commits intoopenatv:masterfrom
WXbet:servicemp3

Conversation

@WXbet
Copy link
Contributor

@WXbet WXbet commented Feb 1, 2026

No description provided.

WXbet added 4 commits February 1, 2026 18:11
- Add inline timing conversion functions (nsToMs, nsTo90kPts, pts90kToMs, msTo90kPts)
  to replace magic numbers like /11111, /90, *90, /1000000
- Add helper methods isWebVTT(), isWebVTTLive(), isTextSubtitle() to simplify
  complex condition checks throughout the code
- Add resetWebVTTState() to centralize WebVTT state variable resets
- Add getDecoderTimeNs() to consolidate decoder time queries from audio/video sinks
- Clean up pushSubtitles() by removing commented debug code and simplifying logic
- No functional changes, only code readability improvements
- Create new servicewebvtt.h/cpp with WebVTTParser class and WebVTTSubtitleEntry struct
- Move WebVTT parsing logic from servicemp3.cpp to dedicated module
- WebVTTParser handles X-TIMESTAMP-MAP for HLS/MPEG-TS synchronization
- Add WebVTTState struct for runtime synchronization state (prepared for future use)
- Remove ~180 lines of duplicated code from servicemp3.cpp
- Update Makefile.inc to build new module
- Add SubtitleResult enum for handler return values
- Extract handleWebVTTLiveSubtitle() for live stream wall-clock timing
- Extract handleWebVTTSubtitle() for VOD decoder-based timing
- Extract handleTextSubtitle() for SRT/SSA/ASS with fps conversion
- Simplify pushSubtitles() to ~70 lines dispatcher from ~200 lines
- Remove goto statements and simplify control flow
- Each handler is self-contained and independently testable
…helpers

- Extract handleStateChange(), handleAsyncDone(), handleTagMessage(),
  handleElementMessage() from 600-line gstBusCall() switch statement
- Add GstMessageContainerType enum to replace magic numbers 1/2/3
- Add clearSubtitleState() helper to deduplicate enable/disableSubtitles
- Simplify gstBusCall() to clean dispatcher pattern (~70 lines)
- Remove dead code blocks (#if 0) and obsolete xtrend workaround comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments