gs: Fix indentation and make it consistent
Apparently this partially used clang-format's default settings, so let's use that for everything now. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/934>
This commit is contained in:
parent
6d4d4edfcc
commit
c514f939c9
@ -34,9 +34,7 @@
|
||||
#include "gstgssink.h"
|
||||
#include "gstgssrc.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
static gboolean plugin_init(GstPlugin* plugin) {
|
||||
gboolean ret = FALSE;
|
||||
|
||||
ret |= GST_ELEMENT_REGISTER(gssrc, plugin);
|
||||
@ -50,4 +48,7 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
gs,
|
||||
"Read and write from and to a Google Cloud Storage",
|
||||
plugin_init,
|
||||
PACKAGE_VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|
||||
PACKAGE_VERSION,
|
||||
GST_LICENSE,
|
||||
GST_PACKAGE_NAME,
|
||||
GST_PACKAGE_ORIGIN)
|
||||
|
@ -28,13 +28,9 @@ namespace gcs = google::cloud::storage;
|
||||
namespace {
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2, 62, 0)
|
||||
static inline gchar *
|
||||
g_date_time_format_iso8601 (GDateTime * datetime)
|
||||
{
|
||||
GString *
|
||||
outstr = NULL;
|
||||
gchar *
|
||||
main_date = NULL;
|
||||
static inline gchar* g_date_time_format_iso8601(GDateTime* datetime) {
|
||||
GString* outstr = NULL;
|
||||
gchar* main_date = NULL;
|
||||
gint64 offset;
|
||||
|
||||
// Main date and time.
|
||||
@ -49,8 +45,7 @@ namespace {
|
||||
if (offset == 0) {
|
||||
g_string_append_c(outstr, 'Z');
|
||||
} else {
|
||||
gchar *
|
||||
time_zone = g_date_time_format (datetime, "%:::z");
|
||||
gchar* time_zone = g_date_time_format(datetime, "%:::z");
|
||||
g_string_append(outstr, time_zone);
|
||||
g_free(time_zone);
|
||||
}
|
||||
@ -61,20 +56,19 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr <
|
||||
google::cloud::storage::Client >
|
||||
gst_gs_create_client (const gchar * service_account_email, GError ** error)
|
||||
{
|
||||
std::unique_ptr<google::cloud::storage::Client> gst_gs_create_client(
|
||||
const gchar* service_account_email,
|
||||
GError** error) {
|
||||
if (service_account_email) {
|
||||
// Meant to be used from a container running in the Cloud.
|
||||
|
||||
google::cloud::StatusOr < std::shared_ptr <
|
||||
gcs::oauth2::Credentials >> creds (std::make_shared <
|
||||
gcs::oauth2::ComputeEngineCredentials <>> (service_account_email));
|
||||
google::cloud::StatusOr<std::shared_ptr<gcs::oauth2::Credentials>> creds(
|
||||
std::make_shared<gcs::oauth2::ComputeEngineCredentials<>>(
|
||||
service_account_email));
|
||||
if (!creds) {
|
||||
g_set_error (error, GST_RESOURCE_ERROR,
|
||||
GST_RESOURCE_ERROR_NOT_AUTHORIZED,
|
||||
"Could not retrieve credentials for the given service account %s (%s)",
|
||||
g_set_error(error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NOT_AUTHORIZED,
|
||||
"Could not retrieve credentials for the given service "
|
||||
"account %s (%s)",
|
||||
service_account_email, creds.status().message().c_str());
|
||||
return nullptr;
|
||||
}
|
||||
@ -89,8 +83,7 @@ gst_gs_create_client (const gchar * service_account_email, GError ** error)
|
||||
gcs::ClientOptions::CreateDefaultClientOptions();
|
||||
|
||||
if (!client_options) {
|
||||
g_set_error (error, GST_RESOURCE_ERROR,
|
||||
GST_RESOURCE_ERROR_NOT_AUTHORIZED,
|
||||
g_set_error(error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NOT_AUTHORIZED,
|
||||
"Could not create default client options (%s)",
|
||||
client_options.status().message().c_str());
|
||||
return nullptr;
|
||||
@ -99,12 +92,10 @@ gst_gs_create_client (const gchar * service_account_email, GError ** error)
|
||||
gcs::StrictIdempotencyPolicy());
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_gs_get_buffer_date (GstBuffer * buffer, GDateTime * start_date,
|
||||
gchar ** buffer_date_str_ptr)
|
||||
{
|
||||
gchar *
|
||||
buffer_date_str = NULL;
|
||||
gboolean gst_gs_get_buffer_date(GstBuffer* buffer,
|
||||
GDateTime* start_date,
|
||||
gchar** buffer_date_str_ptr) {
|
||||
gchar* buffer_date_str = NULL;
|
||||
GstClockTime buffer_timestamp = GST_CLOCK_TIME_NONE;
|
||||
GTimeSpan buffer_timespan = 0;
|
||||
|
||||
@ -116,8 +107,7 @@ gst_gs_get_buffer_date (GstBuffer * buffer, GDateTime * start_date,
|
||||
// GTimeSpan is in micro seconds.
|
||||
buffer_timespan = GST_TIME_AS_USECONDS(buffer_timestamp);
|
||||
|
||||
GDateTime *
|
||||
buffer_date = g_date_time_add (start_date, buffer_timespan);
|
||||
GDateTime* buffer_date = g_date_time_add(start_date, buffer_timespan);
|
||||
if (!buffer_date)
|
||||
return FALSE;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user