mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-28 00:46:37 +00:00
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
7 changed files with 68 additions and 77 deletions
|
@ -34,9 +34,7 @@
|
||||||
#include "gstgssink.h"
|
#include "gstgssink.h"
|
||||||
#include "gstgssrc.h"
|
#include "gstgssrc.h"
|
||||||
|
|
||||||
static gboolean
|
static gboolean plugin_init(GstPlugin* plugin) {
|
||||||
plugin_init (GstPlugin * plugin)
|
|
||||||
{
|
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
ret |= GST_ELEMENT_REGISTER(gssrc, plugin);
|
ret |= GST_ELEMENT_REGISTER(gssrc, plugin);
|
||||||
|
@ -50,4 +48,7 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
gs,
|
gs,
|
||||||
"Read and write from and to a Google Cloud Storage",
|
"Read and write from and to a Google Cloud Storage",
|
||||||
plugin_init,
|
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 {
|
namespace {
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION(2, 62, 0)
|
#if !GLIB_CHECK_VERSION(2, 62, 0)
|
||||||
static inline gchar *
|
static inline gchar* g_date_time_format_iso8601(GDateTime* datetime) {
|
||||||
g_date_time_format_iso8601 (GDateTime * datetime)
|
GString* outstr = NULL;
|
||||||
{
|
gchar* main_date = NULL;
|
||||||
GString *
|
|
||||||
outstr = NULL;
|
|
||||||
gchar *
|
|
||||||
main_date = NULL;
|
|
||||||
gint64 offset;
|
gint64 offset;
|
||||||
|
|
||||||
// Main date and time.
|
// Main date and time.
|
||||||
|
@ -49,8 +45,7 @@ namespace {
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
g_string_append_c(outstr, 'Z');
|
g_string_append_c(outstr, 'Z');
|
||||||
} else {
|
} else {
|
||||||
gchar *
|
gchar* time_zone = g_date_time_format(datetime, "%:::z");
|
||||||
time_zone = g_date_time_format (datetime, "%:::z");
|
|
||||||
g_string_append(outstr, time_zone);
|
g_string_append(outstr, time_zone);
|
||||||
g_free(time_zone);
|
g_free(time_zone);
|
||||||
}
|
}
|
||||||
|
@ -61,20 +56,19 @@ namespace {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::unique_ptr <
|
std::unique_ptr<google::cloud::storage::Client> gst_gs_create_client(
|
||||||
google::cloud::storage::Client >
|
const gchar* service_account_email,
|
||||||
gst_gs_create_client (const gchar * service_account_email, GError ** error)
|
GError** error) {
|
||||||
{
|
|
||||||
if (service_account_email) {
|
if (service_account_email) {
|
||||||
// Meant to be used from a container running in the Cloud.
|
// Meant to be used from a container running in the Cloud.
|
||||||
|
|
||||||
google::cloud::StatusOr < std::shared_ptr <
|
google::cloud::StatusOr<std::shared_ptr<gcs::oauth2::Credentials>> creds(
|
||||||
gcs::oauth2::Credentials >> creds (std::make_shared <
|
std::make_shared<gcs::oauth2::ComputeEngineCredentials<>>(
|
||||||
gcs::oauth2::ComputeEngineCredentials <>> (service_account_email));
|
service_account_email));
|
||||||
if (!creds) {
|
if (!creds) {
|
||||||
g_set_error (error, GST_RESOURCE_ERROR,
|
g_set_error(error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NOT_AUTHORIZED,
|
||||||
GST_RESOURCE_ERROR_NOT_AUTHORIZED,
|
"Could not retrieve credentials for the given service "
|
||||||
"Could not retrieve credentials for the given service account %s (%s)",
|
"account %s (%s)",
|
||||||
service_account_email, creds.status().message().c_str());
|
service_account_email, creds.status().message().c_str());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +83,7 @@ gst_gs_create_client (const gchar * service_account_email, GError ** error)
|
||||||
gcs::ClientOptions::CreateDefaultClientOptions();
|
gcs::ClientOptions::CreateDefaultClientOptions();
|
||||||
|
|
||||||
if (!client_options) {
|
if (!client_options) {
|
||||||
g_set_error (error, GST_RESOURCE_ERROR,
|
g_set_error(error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NOT_AUTHORIZED,
|
||||||
GST_RESOURCE_ERROR_NOT_AUTHORIZED,
|
|
||||||
"Could not create default client options (%s)",
|
"Could not create default client options (%s)",
|
||||||
client_options.status().message().c_str());
|
client_options.status().message().c_str());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -99,12 +92,10 @@ gst_gs_create_client (const gchar * service_account_email, GError ** error)
|
||||||
gcs::StrictIdempotencyPolicy());
|
gcs::StrictIdempotencyPolicy());
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean gst_gs_get_buffer_date(GstBuffer* buffer,
|
||||||
gst_gs_get_buffer_date (GstBuffer * buffer, GDateTime * start_date,
|
GDateTime* start_date,
|
||||||
gchar ** buffer_date_str_ptr)
|
gchar** buffer_date_str_ptr) {
|
||||||
{
|
gchar* buffer_date_str = NULL;
|
||||||
gchar *
|
|
||||||
buffer_date_str = NULL;
|
|
||||||
GstClockTime buffer_timestamp = GST_CLOCK_TIME_NONE;
|
GstClockTime buffer_timestamp = GST_CLOCK_TIME_NONE;
|
||||||
GTimeSpan buffer_timespan = 0;
|
GTimeSpan buffer_timespan = 0;
|
||||||
|
|
||||||
|
@ -116,8 +107,7 @@ gst_gs_get_buffer_date (GstBuffer * buffer, GDateTime * start_date,
|
||||||
// GTimeSpan is in micro seconds.
|
// GTimeSpan is in micro seconds.
|
||||||
buffer_timespan = GST_TIME_AS_USECONDS(buffer_timestamp);
|
buffer_timespan = GST_TIME_AS_USECONDS(buffer_timestamp);
|
||||||
|
|
||||||
GDateTime *
|
GDateTime* buffer_date = g_date_time_add(start_date, buffer_timespan);
|
||||||
buffer_date = g_date_time_add (start_date, buffer_timespan);
|
|
||||||
if (!buffer_date)
|
if (!buffer_date)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue