gst-plugins-rs/net/aws/src/s3sink/mod.rs
Arun Raghavan a54b2dd39e aws: s3: Add a new awss3putobjectsink
When streaming small amounts of data, using awss3sink might not be a
good idea, as we need to accumulate at least 5 MB of data for a
multipart upload (or we flush on EOS).

The alternative, while inefficient, is to do a complete PutObject of
_all_ the data periodically so as to not lose data in case of a pipeline
failure. This element makes a start on this idea by doing a PutObject
for every buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1337>
2023-12-18 10:39:23 -05:00

62 lines
1.8 KiB
Rust

// Copyright (C) 2019 Amazon.com, Inc. or its affiliates <mkolny@amazon.com>
// Copyright (C) 2023 Asymptotic Inc
// Author: Arun Raghavan <arun@asymptotic.io>
//
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at
// <https://mozilla.org/MPL/2.0/>.
//
// SPDX-License-Identifier: MPL-2.0
use gst::glib;
use gst::prelude::*;
mod multipartsink;
mod putobjectsink;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[enum_type(name = "GstS3SinkOnError")]
pub(crate) enum OnError {
#[enum_value(name = "Abort: Abort multipart upload on error.", nick = "abort")]
Abort,
#[enum_value(
name = "Complete: Complete multipart upload on error.",
nick = "complete"
)]
Complete,
#[enum_value(name = "DoNothing: Do nothing on error.", nick = "nothing")]
DoNothing,
}
glib::wrapper! {
pub struct S3Sink(ObjectSubclass<multipartsink::S3Sink>) @extends gst_base::BaseSink, gst::Element, gst::Object;
}
glib::wrapper! {
pub struct S3PutObjectSink(ObjectSubclass<putobjectsink::S3PutObjectSink>) @extends gst_base::BaseSink, gst::Element, gst::Object;
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
#[cfg(not(feature = "doc"))]
gst::Element::register(
Some(plugin),
"rusotos3sink",
gst::Rank::PRIMARY,
S3Sink::static_type(),
)?;
gst::Element::register(
Some(plugin),
"awss3sink",
gst::Rank::PRIMARY,
S3Sink::static_type(),
)?;
gst::Element::register(
Some(plugin),
"awss3putobjectsink",
// This element should not be autoplugged as it is only useful for specific use cases
gst::Rank::NONE,
S3PutObjectSink::static_type(),
)
}