• Home
  • Raw
  • Download

Lines Matching refs:sink

151 static gboolean gst_gs_sink_stop(GstBaseSink* sink);
152 static GstFlowReturn gst_gs_sink_render(GstBaseSink* sink, GstBuffer* buffer);
153 static GstFlowReturn gst_gs_sink_render_list(GstBaseSink* sink,
155 static gboolean gst_gs_sink_set_caps(GstBaseSink* sink, GstCaps* caps);
156 static gboolean gst_gs_sink_event(GstBaseSink* sink, GstEvent* event);
355 static void gst_gs_sink_init(GstGsSink* sink) { in gst_gs_sink_init() argument
356 sink->gcs_client = nullptr; in gst_gs_sink_init()
357 sink->gcs_stream = nullptr; in gst_gs_sink_init()
358 sink->index = DEFAULT_INDEX; in gst_gs_sink_init()
359 sink->post_messages = DEFAULT_POST_MESSAGES; in gst_gs_sink_init()
360 sink->service_account_email = NULL; in gst_gs_sink_init()
361 sink->service_account_credentials = NULL; in gst_gs_sink_init()
362 sink->bucket_name = NULL; in gst_gs_sink_init()
363 sink->object_name = g_strdup(DEFAULT_OBJECT_NAME); in gst_gs_sink_init()
364 sink->start_date_str = NULL; in gst_gs_sink_init()
365 sink->start_date = NULL; in gst_gs_sink_init()
366 sink->next_file = DEFAULT_NEXT_FILE; in gst_gs_sink_init()
367 sink->content_type = NULL; in gst_gs_sink_init()
368 sink->nb_percent_format = 0; in gst_gs_sink_init()
369 sink->percent_s_is_first = FALSE; in gst_gs_sink_init()
371 gst_base_sink_set_sync(GST_BASE_SINK(sink), FALSE); in gst_gs_sink_init()
375 GstGsSink* sink = GST_GS_SINK(object); in gst_gs_sink_finalize() local
377 sink->gcs_client = nullptr; in gst_gs_sink_finalize()
378 sink->gcs_stream = nullptr; in gst_gs_sink_finalize()
379 g_free(sink->service_account_email); in gst_gs_sink_finalize()
380 sink->service_account_email = NULL; in gst_gs_sink_finalize()
381 g_free(sink->service_account_credentials); in gst_gs_sink_finalize()
382 sink->service_account_credentials = NULL; in gst_gs_sink_finalize()
383 g_free(sink->bucket_name); in gst_gs_sink_finalize()
384 sink->bucket_name = NULL; in gst_gs_sink_finalize()
385 g_free(sink->object_name); in gst_gs_sink_finalize()
386 sink->object_name = NULL; in gst_gs_sink_finalize()
387 g_free(sink->start_date_str); in gst_gs_sink_finalize()
388 sink->start_date_str = NULL; in gst_gs_sink_finalize()
389 if (sink->start_date) { in gst_gs_sink_finalize()
390 g_date_time_unref(sink->start_date); in gst_gs_sink_finalize()
391 sink->start_date = NULL; in gst_gs_sink_finalize()
393 sink->content_type = NULL; in gst_gs_sink_finalize()
394 g_clear_pointer(&sink->metadata, gst_structure_free); in gst_gs_sink_finalize()
399 static gboolean gst_gs_sink_set_object_name(GstGsSink* sink, in gst_gs_sink_set_object_name() argument
401 g_free(sink->object_name); in gst_gs_sink_set_object_name()
402 sink->object_name = NULL; in gst_gs_sink_set_object_name()
403 sink->nb_percent_format = 0; in gst_gs_sink_set_object_name()
404 sink->percent_s_is_first = FALSE; in gst_gs_sink_set_object_name()
407 GST_ERROR_OBJECT(sink, "Object name is null"); in gst_gs_sink_set_object_name()
412 sink->nb_percent_format = std::count(name.begin(), name.end(), '%'); in gst_gs_sink_set_object_name()
413 if (sink->nb_percent_format > 2) { in gst_gs_sink_set_object_name()
414 GST_ERROR_OBJECT(sink, "Object name has too many formats"); in gst_gs_sink_set_object_name()
420 if (sink->nb_percent_format == 2) { in gst_gs_sink_set_object_name()
421 GST_ERROR_OBJECT(sink, "Object name must have just one number format"); in gst_gs_sink_set_object_name()
424 sink->object_name = g_strdup(object_name); in gst_gs_sink_set_object_name()
430 sink->percent_s_is_first = TRUE; in gst_gs_sink_set_object_name()
433 GST_ERROR_OBJECT(sink, "Object name expect max one string format"); in gst_gs_sink_set_object_name()
438 sink->object_name = g_strdup(object_name); in gst_gs_sink_set_object_name()
447 GstGsSink* sink = GST_GS_SINK(object); in gst_gs_sink_set_property() local
451 g_free(sink->bucket_name); in gst_gs_sink_set_property()
452 sink->bucket_name = g_strdup(g_value_get_string(value)); in gst_gs_sink_set_property()
455 gst_gs_sink_set_object_name(sink, g_value_get_string(value)); in gst_gs_sink_set_property()
458 sink->index = g_value_get_int(value); in gst_gs_sink_set_property()
461 sink->post_messages = g_value_get_boolean(value); in gst_gs_sink_set_property()
464 sink->next_file = (GstGsSinkNext)g_value_get_enum(value); in gst_gs_sink_set_property()
467 g_free(sink->service_account_email); in gst_gs_sink_set_property()
468 sink->service_account_email = g_strdup(g_value_get_string(value)); in gst_gs_sink_set_property()
471 g_free(sink->service_account_credentials); in gst_gs_sink_set_property()
472 sink->service_account_credentials = g_strdup(g_value_get_string(value)); in gst_gs_sink_set_property()
475 g_free(sink->start_date_str); in gst_gs_sink_set_property()
476 if (sink->start_date) in gst_gs_sink_set_property()
477 g_date_time_unref(sink->start_date); in gst_gs_sink_set_property()
478 sink->start_date_str = g_strdup(g_value_get_string(value)); in gst_gs_sink_set_property()
479 sink->start_date = in gst_gs_sink_set_property()
480 g_date_time_new_from_iso8601(sink->start_date_str, NULL); in gst_gs_sink_set_property()
481 if (!sink->start_date) { in gst_gs_sink_set_property()
482 GST_ERROR_OBJECT(sink, "Failed to parse start date %s", in gst_gs_sink_set_property()
483 sink->start_date_str); in gst_gs_sink_set_property()
484 g_free(sink->start_date_str); in gst_gs_sink_set_property()
485 sink->start_date_str = NULL; in gst_gs_sink_set_property()
489 g_clear_pointer(&sink->metadata, gst_structure_free); in gst_gs_sink_set_property()
490 sink->metadata = (GstStructure*)g_value_dup_boxed(value); in gst_gs_sink_set_property()
502 GstGsSink* sink = GST_GS_SINK(object); in gst_gs_sink_get_property() local
506 g_value_set_string(value, sink->bucket_name); in gst_gs_sink_get_property()
509 g_value_set_string(value, sink->object_name); in gst_gs_sink_get_property()
512 g_value_set_int(value, sink->index); in gst_gs_sink_get_property()
515 g_value_set_boolean(value, sink->post_messages); in gst_gs_sink_get_property()
518 g_value_set_enum(value, sink->next_file); in gst_gs_sink_get_property()
521 g_value_set_string(value, sink->service_account_email); in gst_gs_sink_get_property()
524 g_value_set_string(value, sink->service_account_credentials); in gst_gs_sink_get_property()
527 g_value_set_string(value, sink->start_date_str); in gst_gs_sink_get_property()
530 g_value_set_boxed(value, sink->metadata); in gst_gs_sink_get_property()
539 GstGsSink* sink = GST_GS_SINK(bsink); in gst_gs_sink_start() local
542 if (!sink->bucket_name) { in gst_gs_sink_start()
543 GST_ELEMENT_ERROR(sink, RESOURCE, SETTINGS, ("Bucket name is required"), in gst_gs_sink_start()
548 if (!sink->object_name) { in gst_gs_sink_start()
549 GST_ELEMENT_ERROR(sink, RESOURCE, SETTINGS, ("Object name is required"), in gst_gs_sink_start()
554 sink->content_type = ""; in gst_gs_sink_start()
556 sink->gcs_client = gst_gs_create_client( in gst_gs_sink_start()
557 sink->service_account_email, sink->service_account_credentials, &err); in gst_gs_sink_start()
559 GST_ELEMENT_ERROR(sink, RESOURCE, OPEN_READ, in gst_gs_sink_start()
566 GST_INFO_OBJECT(sink, "Using bucket name (%s) and object name (%s)", in gst_gs_sink_start()
567 sink->bucket_name, sink->object_name); in gst_gs_sink_start()
573 GstGsSink* sink = GST_GS_SINK(bsink); in gst_gs_sink_stop() local
575 sink->gcs_client = nullptr; in gst_gs_sink_stop()
576 sink->gcs_stream = nullptr; in gst_gs_sink_stop()
577 sink->content_type = NULL; in gst_gs_sink_stop()
582 static void gst_gs_sink_post_message_full(GstGsSink* sink, in gst_gs_sink_post_message_full() argument
593 if (!sink->post_messages) in gst_gs_sink_post_message_full()
598 sink->index, "timestamp", G_TYPE_UINT64, timestamp, in gst_gs_sink_post_message_full()
604 gst_element_post_message(GST_ELEMENT_CAST(sink), in gst_gs_sink_post_message_full()
605 gst_message_new_element(GST_OBJECT_CAST(sink), s)); in gst_gs_sink_post_message_full()
608 static void gst_gs_sink_post_message_from_time(GstGsSink* sink, in gst_gs_sink_post_message_from_time() argument
617 if (!sink->post_messages) in gst_gs_sink_post_message_from_time()
620 segment = &GST_BASE_SINK(sink)->segment; in gst_gs_sink_post_message_from_time()
629 gst_gs_sink_post_message_full(sink, timestamp, duration, offset, offset_end, in gst_gs_sink_post_message_from_time()
633 static void gst_gs_sink_post_message(GstGsSink* sink, in gst_gs_sink_post_message() argument
643 if (!sink->post_messages) in gst_gs_sink_post_message()
646 segment = &GST_BASE_SINK(sink)->segment; in gst_gs_sink_post_message()
657 gst_gs_sink_post_message_full(sink, timestamp, duration, offset, offset_end, in gst_gs_sink_post_message()
662 GstGsSink* sink; member
678 GST_LOG_OBJECT(it->sink, "metadata '%s' -> '%s'", key, value); in add_metadata_foreach()
681 GST_WARNING_OBJECT(it->sink, "Failed to convert metadata '%s' to string", in add_metadata_foreach()
689 static GstFlowReturn gst_gs_sink_write_buffer(GstGsSink* sink, in gst_gs_sink_write_buffer() argument
699 gcs::ObjectMetadata().set_content_type(sink->content_type); in gst_gs_sink_write_buffer()
701 if (sink->metadata) { in gst_gs_sink_write_buffer()
702 struct AddMetadataIter it = {sink, &metadata}; in gst_gs_sink_write_buffer()
704 gst_structure_foreach(sink->metadata, add_metadata_foreach, &it); in gst_gs_sink_write_buffer()
707 switch (sink->next_file) { in gst_gs_sink_write_buffer()
710 if (sink->start_date) { in gst_gs_sink_write_buffer()
711 if (sink->nb_percent_format != 2) { in gst_gs_sink_write_buffer()
712 GST_ERROR_OBJECT(sink, "Object name expects date and index"); in gst_gs_sink_write_buffer()
717 if (!gst_gs_get_buffer_date(buffer, sink->start_date, &buffer_date)) { in gst_gs_sink_write_buffer()
718 GST_ERROR_OBJECT(sink, "Could not get buffer date %s", object_name); in gst_gs_sink_write_buffer()
723 if (sink->percent_s_is_first) { in gst_gs_sink_write_buffer()
725 g_strdup_printf(sink->object_name, buffer_date, sink->index); in gst_gs_sink_write_buffer()
728 g_strdup_printf(sink->object_name, sink->index, buffer_date); in gst_gs_sink_write_buffer()
731 if (sink->nb_percent_format != 1) { in gst_gs_sink_write_buffer()
732 GST_ERROR_OBJECT(sink, "Object name expects only an index"); in gst_gs_sink_write_buffer()
737 object_name = g_strdup_printf(sink->object_name, sink->index); in gst_gs_sink_write_buffer()
740 GST_INFO_OBJECT(sink, "Writing %" G_GSIZE_FORMAT " bytes", map.size); in gst_gs_sink_write_buffer()
742 gcs::ObjectWriteStream gcs_stream = sink->gcs_client->WriteObject( in gst_gs_sink_write_buffer()
743 sink->bucket_name, object_name, gcs::WithObjectMetadata(metadata)); in gst_gs_sink_write_buffer()
747 GST_WARNING_OBJECT(sink, "Failed to write to %s", object_name); in gst_gs_sink_write_buffer()
752 sink->gcs_client->GetObjectMetadata(sink->bucket_name, object_name); in gst_gs_sink_write_buffer()
755 sink, "Could not get object metadata for object %s (%s)", in gst_gs_sink_write_buffer()
763 GST_INFO_OBJECT(sink, "Wrote object %s of size %" G_GUINT64_FORMAT "\n", in gst_gs_sink_write_buffer()
766 gst_gs_sink_post_message(sink, buffer, object_name, buffer_date); in gst_gs_sink_write_buffer()
769 ++sink->index; in gst_gs_sink_write_buffer()
773 if (!sink->gcs_stream) { in gst_gs_sink_write_buffer()
774 GST_INFO_OBJECT(sink, "Opening %s", sink->object_name); in gst_gs_sink_write_buffer()
775 sink->gcs_stream = std::make_unique<GSWriteStream>( in gst_gs_sink_write_buffer()
776 *sink->gcs_client.get(), sink->bucket_name, sink->object_name, in gst_gs_sink_write_buffer()
779 if (!sink->gcs_stream->stream().IsOpen()) { in gst_gs_sink_write_buffer()
781 sink, RESOURCE, OPEN_READ, in gst_gs_sink_write_buffer()
783 sink->gcs_stream->stream().last_status().message().c_str()), in gst_gs_sink_write_buffer()
790 GST_INFO_OBJECT(sink, "Writing %" G_GSIZE_FORMAT " bytes", map.size); in gst_gs_sink_write_buffer()
792 gcs::ObjectWriteStream& stream = sink->gcs_stream->stream(); in gst_gs_sink_write_buffer()
795 GST_WARNING_OBJECT(sink, "Failed to write to %s", object_name); in gst_gs_sink_write_buffer()
808 GstGsSink* sink = GST_GS_SINK(bsink); in gst_gs_sink_render() local
811 flow = gst_gs_sink_write_buffer(sink, buffer); in gst_gs_sink_render()
838 static GstFlowReturn gst_gs_sink_render_list(GstBaseSink* sink, in gst_gs_sink_render_list() argument
844 GST_LOG_OBJECT(sink, "total size of buffer list %p: %u", list, size); in gst_gs_sink_render_list()
852 gst_gs_sink_render(sink, buf); in gst_gs_sink_render_list()
859 GstGsSink* sink = GST_GS_SINK(bsink); in gst_gs_sink_set_caps() local
862 sink->content_type = gst_structure_get_name(s); in gst_gs_sink_set_caps()
864 GST_INFO_OBJECT(sink, "Content type: %s", sink->content_type); in gst_gs_sink_set_caps()
870 GstGsSink* sink = GST_GS_SINK(bsink); in gst_gs_sink_event() local
874 if (sink->gcs_stream) { in gst_gs_sink_event()
875 sink->gcs_stream = nullptr; in gst_gs_sink_event()
877 sink, GST_BASE_SINK(sink)->segment.position, -1, sink->object_name); in gst_gs_sink_event()