@@ -9,7 +9,12 @@ use compositor_pipeline::{
9
9
ffmpeg_h264:: { self } ,
10
10
ffmpeg_vp8, AudioEncoderOptions ,
11
11
} ,
12
- output:: { self , mp4:: Mp4OutputOptions , rtmp:: RtmpSenderOptions } ,
12
+ output:: {
13
+ self ,
14
+ mp4:: Mp4OutputOptions ,
15
+ rtmp:: RtmpSenderOptions ,
16
+ whip:: { AudioWhipOptions , VideoWhipOptions } ,
17
+ } ,
13
18
} ,
14
19
} ;
15
20
use tracing:: warn;
@@ -166,11 +171,11 @@ impl TryFrom<WhipOutput> for pipeline::RegisterOutputOptions<output::OutputOptio
166
171
}
167
172
168
173
if video. as_ref ( ) . filter ( |v| v. encoder . is_some ( ) ) . is_some ( ) {
169
- warn ! ( "Field 'video ' is deprecated. The codec will now be set automatically based on WHIP negotiation; manual specification is no longer needed." )
174
+ warn ! ( "Field 'encoder ' is deprecated. The codec will now be set automatically based on WHIP negotiation; manual specification is no longer needed." )
170
175
}
171
176
172
177
if audio. as_ref ( ) . filter ( |a| a. encoder . is_some ( ) ) . is_some ( ) {
173
- warn ! ( "Field 'audio ' is deprecated. The codec will now be set automatically based on WHIP negotiation; manual specification is no longer needed." )
178
+ warn ! ( "Field 'encoder ' is deprecated. The codec will now be set automatically based on WHIP negotiation; manual specification is no longer needed." )
174
179
}
175
180
176
181
if let Some ( token) = & bearer_token {
@@ -179,8 +184,8 @@ impl TryFrom<WhipOutput> for pipeline::RegisterOutputOptions<output::OutputOptio
179
184
} ;
180
185
}
181
186
182
- let output_video_options = maybe_whip_video_options ( video) ?;
183
- let output_audio_options = match audio {
187
+ let ( output_video_options, video_whip_options ) = maybe_whip_video_options ( video) ?;
188
+ let ( output_audio_options, audio_whip_options ) = match audio {
184
189
Some ( OutputWhipAudioOptions {
185
190
mixing_strategy,
186
191
send_eos_when,
@@ -193,17 +198,17 @@ impl TryFrom<WhipOutput> for pipeline::RegisterOutputOptions<output::OutputOptio
193
198
mixing_strategy : mixing_strategy. unwrap_or ( MixingStrategy :: SumClip ) . into ( ) ,
194
199
channels : AudioChannels :: Stereo , // hardcoded just temporarly, TODO when adding preferences
195
200
} ;
196
-
197
- Some ( output_audio_options)
201
+ let audio_whip_options = AudioWhipOptions ; //TODO when adding preferences
202
+ ( Some ( output_audio_options) , Some ( audio_whip_options ) )
198
203
}
199
- None => None ,
204
+ None => ( None , None ) ,
200
205
} ;
201
206
202
207
let output_options = output:: OutputOptions :: Whip ( output:: whip:: WhipSenderOptions {
203
208
endpoint_url,
204
209
bearer_token,
205
- video : None ,
206
- audio : None ,
210
+ video : video_whip_options ,
211
+ audio : audio_whip_options ,
207
212
} ) ;
208
213
209
214
Ok ( Self {
@@ -301,17 +306,25 @@ fn maybe_video_options(
301
306
302
307
fn maybe_whip_video_options (
303
308
options : Option < OutputWhipVideoOptions > ,
304
- ) -> Result < Option < pipeline:: OutputVideoOptions > , TypeError > {
309
+ ) -> Result <
310
+ (
311
+ Option < pipeline:: OutputVideoOptions > ,
312
+ Option < VideoWhipOptions > ,
313
+ ) ,
314
+ TypeError ,
315
+ > {
305
316
let Some ( options) = options else {
306
- return Ok ( None ) ;
317
+ return Ok ( ( None , None ) ) ;
307
318
} ;
308
-
309
319
let output_options = pipeline:: OutputVideoOptions {
310
320
initial : options. initial . try_into ( ) ?,
311
321
end_condition : options. send_eos_when . unwrap_or_default ( ) . try_into ( ) ?,
312
322
} ;
323
+ let video_whip_options = VideoWhipOptions {
324
+ resolution : options. resolution . into ( ) ,
325
+ } ;
313
326
314
- Ok ( Some ( output_options) )
327
+ Ok ( ( Some ( output_options) , Some ( video_whip_options ) ) )
315
328
}
316
329
317
330
impl From < Mp4AudioEncoderOptions > for pipeline:: encoder:: AudioEncoderOptions {
0 commit comments