record-daemon: fix obs recording
This commit is contained in:
@@ -8,8 +8,8 @@ pub mod encoder;
|
||||
mod obs_context;
|
||||
mod output;
|
||||
|
||||
pub use capture::{CaptureSource, GameCapture};
|
||||
pub use encoder::{AudioEncoder, EncoderConfig, VideoEncoder};
|
||||
pub use capture::{CaptureMode, GameCapture, MonitorCapture, SourceType, WindowCapture};
|
||||
pub use encoder::{AudioEncoderConfig, EncoderCapability, EncoderConfig, EncoderSettings};
|
||||
pub use obs_context::{ObsContext, ObsContextBuilder};
|
||||
pub use output::{OutputConfig, RecordingOutput, RecordingResult};
|
||||
|
||||
@@ -17,7 +17,7 @@ use std::sync::Arc;
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use parking_lot::RwLock;
|
||||
use tracing::{info, warn};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
use crate::config::Settings;
|
||||
use crate::error::{RecordingError, Result};
|
||||
@@ -92,10 +92,17 @@ impl RecordingEngine {
|
||||
/// * `game_id` - Optional game ID for the recording.
|
||||
/// * `champion` - Optional champion name for the filename.
|
||||
pub fn start_recording(&mut self, game_id: Option<u64>, champion: Option<&str>) -> Result<()> {
|
||||
info!(
|
||||
"RecordingEngine::start_recording called - game_id: {:?}, champion: {:?}",
|
||||
game_id, champion
|
||||
);
|
||||
|
||||
if self.is_recording {
|
||||
warn!("Already recording, returning error");
|
||||
return Err(RecordingError::AlreadyRecording.into());
|
||||
}
|
||||
|
||||
info!("Reading settings...");
|
||||
let settings = self.settings.read().clone();
|
||||
|
||||
// Generate output filename
|
||||
@@ -105,10 +112,14 @@ impl RecordingEngine {
|
||||
info!("Starting recording to: {:?}", output_path);
|
||||
|
||||
// Start the recording
|
||||
let context = self.context.as_mut().ok_or(RecordingError::ObsInitError(
|
||||
"OBS not initialized".to_string(),
|
||||
))?;
|
||||
let context = self.context.as_mut().ok_or_else(|| {
|
||||
error!("OBS not initialized when start_recording was called");
|
||||
RecordingError::ObsInitError("OBS not initialized".to_string())
|
||||
})?;
|
||||
|
||||
info!("Calling OBS context start_recording...");
|
||||
context.start_recording(&output_path)?;
|
||||
info!("OBS context start_recording returned successfully");
|
||||
|
||||
self.current_output = Some(RecordingOutput {
|
||||
path: output_path,
|
||||
|
||||
Reference in New Issue
Block a user