Skip to content

Latest commit

 

History

History
89 lines (62 loc) · 2.5 KB

File metadata and controls

89 lines (62 loc) · 2.5 KB

Video Processor API

This page documents the main Android video-processing interface centered on processing/VideoProcessor.kt.

Main class

VideoProcessor(context, modelManager, segmentDetectionConfig = SegmentDetectionConfig.balanced())

Responsibilities:

  • inspect source video metadata
  • classify input resolution
  • detect slide-change segments
  • enhance representative frames
  • reuse cached results or bypass already-readable frames
  • re-encode a final output video

Main entry point

suspend fun processVideo(inputUri: Uri, outputFile: File, onProgress: (ProcessingProgressUpdate) -> Unit): ProcessingResult

Inputs

Parameter Meaning
inputUri source video selected by the user or downloaded by the app
outputFile destination under app-private storage
onProgress callback for UI and WorkManager progress updates

Result types

Type Meaning
ProcessingResult.Success output path plus ProcessingStats
ProcessingResult.Error failure message

Processing phases

The pipeline reports progress by ProcessingPhase:

  • PREPARING
  • DETECTING
  • ENHANCING
  • RE_ENCODING
  • SAVING

ProcessingProgressUpdate carries:

  • overall progress
  • estimated seconds left
  • current phase

Important data classes

Type Purpose
VideoSegment start/end timestamps plus representative frame
EnhancedSegment per-segment enhancement outcome and timing
VideoMetadata width, height, duration, rotation, frame rate, bitrate, audio presence
ProcessingStats total frames, enhanced frames, cached frames, bypassed frames, segment counts, battery impact

Related collaborators

Class Role
ModelManager loads the correct TFLite model and runs inference
SlideDetector detects scene or slide boundaries
SequentialFrameDecoder efficient frame sampling for detection
QualityMetrics OCR-based bypass and quality-related calculations
BatteryMonitor collects battery usage estimates

Notable policy

The class exposes OCR_BYPASS_THRESHOLD to skip SR inference when a frame is already readable enough to avoid unnecessary work.

Worker integration

VideoEnhancementWorker is the main caller. It:

  • creates the output path
  • subscribes to progress
  • maps ProcessingResult into WorkManager output data

See also: