Update for functions returning a Builder being renamed to builder() instead of new()

And new video event APIs.
This commit is contained in:
Sebastian Dröge 2020-06-25 19:49:07 +03:00
parent 392bfc0b1e
commit f62c11f851
11 changed files with 28 additions and 26 deletions

View file

@ -81,7 +81,7 @@ fn run_test(
.unwrap(); .unwrap();
sink.set_property("sync", &false).unwrap(); sink.set_property("sync", &false).unwrap();
let caps = gst_audio::AudioInfo::new(gst_audio::AUDIO_FORMAT_F64, 192_000, channels) let caps = gst_audio::AudioInfo::builder(gst_audio::AUDIO_FORMAT_F64, 192_000, channels)
.build() .build()
.unwrap() .unwrap()
.to_caps() .to_caps()
@ -92,7 +92,7 @@ fn run_test(
let samples_clone = samples.clone(); let samples_clone = samples.clone();
sink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::new() gst_app::AppSinkCallbacks::builder()
.new_sample(move |sink| { .new_sample(move |sink| {
let sample = sink.pull_sample().unwrap(); let sample = sink.pull_sample().unwrap();

View file

@ -394,7 +394,7 @@ fn get_gstaudioinfo(
}; };
let to = &FLAC_CHANNEL_POSITIONS[index - 1][..index]; let to = &FLAC_CHANNEL_POSITIONS[index - 1][..index];
let info_builder = let info_builder =
gst_audio::AudioInfo::new(format, streaminfo.sample_rate, streaminfo.channels) gst_audio::AudioInfo::builder(format, streaminfo.sample_rate, streaminfo.channels)
.positions(to); .positions(to);
let audio_info = info_builder let audio_info = info_builder

View file

@ -318,7 +318,7 @@ impl LewtonDec {
gst::FlowError::Error gst::FlowError::Error
})?; })?;
let mut audio_info = gst_audio::AudioInfo::new( let mut audio_info = gst_audio::AudioInfo::builder(
gst_audio::AUDIO_FORMAT_F32, gst_audio::AUDIO_FORMAT_F32,
ident.audio_sample_rate, ident.audio_sample_rate,
ident.audio_channels as u32, ident.audio_channels as u32,

View file

@ -105,7 +105,7 @@ fn test_pipeline() {
let sink = sink.downcast::<gst_app::AppSink>().unwrap(); let sink = sink.downcast::<gst_app::AppSink>().unwrap();
let adapter_clone = adapter.clone(); let adapter_clone = adapter.clone();
sink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::new() gst_app::AppSinkCallbacks::builder()
// Add a handler to the "new-sample" signal. // Add a handler to the "new-sample" signal.
.new_sample(move |appsink| { .new_sample(move |appsink| {
// Pull the sample in question out of the appsink's buffer. // Pull the sample in question out of the appsink's buffer.

View file

@ -2293,7 +2293,9 @@ mod custom_source {
.iter() .iter()
.map(|p| p.stream.clone()) .map(|p| p.stream.clone())
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let collection = gst::StreamCollection::new(None).streams(&streams).build(); let collection = gst::StreamCollection::builder(None)
.streams(&streams)
.build();
drop(state); drop(state);
element.no_more_pads(); element.no_more_pads();

View file

@ -158,7 +158,7 @@ impl FallbackSwitch {
"Can't change back to sinkpad, waiting for keyframe" "Can't change back to sinkpad, waiting for keyframe"
); );
self.sinkpad.push_event( self.sinkpad.push_event(
gst_video::new_upstream_force_key_unit_event() gst_video::UpstreamForceKeyUnitEvent::builder()
.all_headers(true) .all_headers(true)
.build(), .build(),
); );
@ -284,7 +284,7 @@ impl FallbackSwitch {
"Can't change to fallback sinkpad yet, waiting for keyframe" "Can't change to fallback sinkpad yet, waiting for keyframe"
); );
fallback_sinkpad.push_event( fallback_sinkpad.push_event(
gst_video::new_upstream_force_key_unit_event() gst_video::UpstreamForceKeyUnitEvent::builder()
.all_headers(true) .all_headers(true)
.build(), .build(),
); );

View file

@ -462,7 +462,7 @@ impl ToggleRecord {
gst_debug!(CAT, obj: pad, "Requesting a new keyframe"); gst_debug!(CAT, obj: pad, "Requesting a new keyframe");
stream stream
.sinkpad .sinkpad
.push_event(gst_video::new_upstream_force_key_unit_event().build()); .push_event(gst_video::UpstreamForceKeyUnitEvent::builder().build());
} }
return Ok(HandleResult::Pass(data)); return Ok(HandleResult::Pass(data));
@ -538,7 +538,7 @@ impl ToggleRecord {
gst_debug!(CAT, obj: pad, "Requesting a new keyframe"); gst_debug!(CAT, obj: pad, "Requesting a new keyframe");
stream stream
.sinkpad .sinkpad
.push_event(gst_video::new_upstream_force_key_unit_event().build()); .push_event(gst_video::UpstreamForceKeyUnitEvent::builder().build());
} }
return Ok(HandleResult::Drop); return Ok(HandleResult::Drop);

View file

@ -64,7 +64,7 @@ fn test_cdgdec() {
let sink = sink.downcast::<gst_app::AppSink>().unwrap(); let sink = sink.downcast::<gst_app::AppSink>().unwrap();
sink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::new() gst_app::AppSinkCallbacks::builder()
// Add a handler to the "new-sample" signal. // Add a handler to the "new-sample" signal.
.new_sample(move |appsink| { .new_sample(move |appsink| {
// Pull the sample in question out of the appsink's buffer. // Pull the sample in question out of the appsink's buffer.

View file

@ -27,7 +27,7 @@ fn init() {
fn test_encode_rgba() { fn test_encode_rgba() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Rgba, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Rgba, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -37,7 +37,7 @@ fn test_encode_rgba() {
fn test_encode_rgb() { fn test_encode_rgb() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Rgb, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Rgb, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();

View file

@ -28,7 +28,7 @@ fn init() {
fn test_encode_i420() { fn test_encode_i420() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::I420, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::I420, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -39,7 +39,7 @@ fn test_encode_i420() {
fn test_encode_i420_10() { fn test_encode_i420_10() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::I42010le, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::I42010le, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -50,7 +50,7 @@ fn test_encode_i420_10() {
fn test_encode_i420_12() { fn test_encode_i420_12() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::I42012le, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::I42012le, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -61,7 +61,7 @@ fn test_encode_i420_12() {
fn test_encode_y42b() { fn test_encode_y42b() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Y42b, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Y42b, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -72,7 +72,7 @@ fn test_encode_y42b() {
fn test_encode_i422_10() { fn test_encode_i422_10() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::I42210le, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::I42210le, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -83,7 +83,7 @@ fn test_encode_i422_10() {
fn test_encode_y422_12() { fn test_encode_y422_12() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::I42212le, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::I42212le, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -94,7 +94,7 @@ fn test_encode_y422_12() {
fn test_encode_y444() { fn test_encode_y444() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Y444, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Y444, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -105,7 +105,7 @@ fn test_encode_y444() {
fn test_encode_i444_10() { fn test_encode_i444_10() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Y44410le, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Y44410le, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -116,7 +116,7 @@ fn test_encode_i444_10() {
fn test_encode_i444_12() { fn test_encode_i444_12() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Y44412le, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Y44412le, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();

View file

@ -20,7 +20,7 @@ fn init() {
fn test_png_encode_gray() { fn test_png_encode_gray() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Gray8, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Gray8, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -31,7 +31,7 @@ fn test_png_encode_gray() {
fn test_png_encode_gray16() { fn test_png_encode_gray16() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Gray16Be, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Gray16Be, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -42,7 +42,7 @@ fn test_png_encode_gray16() {
fn test_png_encode_rgb() { fn test_png_encode_rgb() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Rgb, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Rgb, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();
@ -53,7 +53,7 @@ fn test_png_encode_rgb() {
fn test_png_encode_rgba() { fn test_png_encode_rgba() {
init(); init();
let video_info = gst_video::VideoInfo::new(gst_video::VideoFormat::Rgba, 160, 120) let video_info = gst_video::VideoInfo::builder(gst_video::VideoFormat::Rgba, 160, 120)
.fps((30, 1)) .fps((30, 1))
.build() .build()
.unwrap(); .unwrap();