Skip to main content

gstrsanalytics/
lib.rs

1// Copyright (C) 2024 Benjamin Gaignard <benjamin.gaignard@collabora.com>
2// Copyright (C) 2025 Sebastian Dröge <sebastian@centricular.com>
3//
4// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
5// If a copy of the MPL was not distributed with this file, You can obtain one at
6// <https://mozilla.org/MPL/2.0/>.
7//
8// SPDX-License-Identifier: MPL-2.0
9#![allow(clippy::non_send_fields_in_send_ty, unused_doc_comments)]
10
11/**
12 * plugin-rsanalytics:
13 *
14 * Since: plugins-rs-0.14.0
15 */
16use gst::glib;
17
18pub(crate) const ONVIF_METADATA_SCHEMA: &str = "http://www.onvif.org/ver10/schema";
19pub(crate) const ONVIF_METADATA_PREFIX: &str = "tt";
20
21mod onvifmeta2relationmeta;
22mod relationmeta2onvifmeta;
23
24#[cfg(feature = "v1_28")]
25mod combiner;
26#[cfg(feature = "v1_28")]
27mod splitter;
28
29#[cfg(feature = "v1_28")]
30mod yoloxtensordec;
31
32fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
33    relationmeta2onvifmeta::register(plugin)?;
34    onvifmeta2relationmeta::register(plugin)?;
35
36    if !gst::meta::CustomMeta::is_registered("OnvifXMLFrameMeta") {
37        gst::meta::CustomMeta::register("OnvifXMLFrameMeta", &[]);
38    }
39
40    #[cfg(feature = "v1_28")]
41    {
42        combiner::register(plugin)?;
43        splitter::register(plugin)?;
44    }
45
46    #[cfg(feature = "v1_28")]
47    yoloxtensordec::register(plugin)?;
48
49    Ok(())
50}
51
52gst::plugin_define!(
53    rsanalytics,
54    env!("CARGO_PKG_DESCRIPTION"),
55    plugin_init,
56    concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
57    "MPL-2.0",
58    env!("CARGO_PKG_NAME"),
59    env!("CARGO_PKG_NAME"),
60    env!("CARGO_PKG_REPOSITORY"),
61    env!("BUILD_REL_DATE")
62);