Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2023-11-03 07:04:06 +0300
committerMatthew Waters <matthew@centricular.com>2023-11-21 15:33:09 +0300
commitfb9b511e1508e8289b7018f8526bcba665930f79 (patch)
treeeea194421834ad7cb8647f009210932e0601e059 /video
parent4333e90220116b295d504755f292bf86d2819d59 (diff)
closedcaption: move 708 service writing to shared file
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1398>
Diffstat (limited to 'video')
-rw-r--r--video/closedcaption/src/cea608tocea708/imp.rs4
-rw-r--r--video/closedcaption/src/cea608tocea708/mod.rs1
-rw-r--r--video/closedcaption/src/cea708utils.rs (renamed from video/closedcaption/src/cea608tocea708/fmt.rs)32
-rw-r--r--video/closedcaption/src/lib.rs1
4 files changed, 22 insertions, 16 deletions
diff --git a/video/closedcaption/src/cea608tocea708/imp.rs b/video/closedcaption/src/cea608tocea708/imp.rs
index f512dba5d..414ea5cdb 100644
--- a/video/closedcaption/src/cea608tocea708/imp.rs
+++ b/video/closedcaption/src/cea608tocea708/imp.rs
@@ -13,8 +13,8 @@ use gst::subclass::prelude::*;
use atomic_refcell::AtomicRefCell;
-use crate::cea608tocea708::fmt::Cea708ServiceWriter;
use crate::cea608utils::*;
+use crate::cea708utils::Cea708ServiceWriter;
use gst::glib::once_cell::sync::Lazy;
@@ -545,7 +545,7 @@ pub struct Cea608ToCea708 {
state: AtomicRefCell<State>,
}
-pub(crate) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
+static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"cea608tocea708",
gst::DebugColorFlags::empty(),
diff --git a/video/closedcaption/src/cea608tocea708/mod.rs b/video/closedcaption/src/cea608tocea708/mod.rs
index 41d1e4a1e..36ec14980 100644
--- a/video/closedcaption/src/cea608tocea708/mod.rs
+++ b/video/closedcaption/src/cea608tocea708/mod.rs
@@ -9,7 +9,6 @@
use gst::glib;
use gst::prelude::*;
-mod fmt;
mod imp;
glib::wrapper! {
diff --git a/video/closedcaption/src/cea608tocea708/fmt.rs b/video/closedcaption/src/cea708utils.rs
index 0131a41db..a6071798c 100644
--- a/video/closedcaption/src/cea608tocea708/fmt.rs
+++ b/video/closedcaption/src/cea708utils.rs
@@ -8,6 +8,16 @@
use cea708_types::{tables::*, Service};
+use gst::glib::once_cell::sync::Lazy;
+
+static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
+ gst::DebugCategory::new(
+ "cea708utils",
+ gst::DebugColorFlags::empty(),
+ Some("CEA-708 Utilities"),
+ )
+});
+
#[derive(Debug)]
pub enum WriteError {
// returns the number of characters/bytes written
@@ -42,7 +52,7 @@ impl Cea708ServiceWriter {
}
pub fn popon_preamble(&mut self) -> Result<usize, WriteError> {
- gst::trace!(super::imp::CAT, "popon_preamble");
+ gst::trace!(CAT, "popon_preamble");
let window = match self.hidden_window {
// switch up the newly defined window
WindowBits::ZERO => 0,
@@ -64,7 +74,7 @@ impl Cea708ServiceWriter {
1,
1,
);
- gst::trace!(super::imp::CAT, "active window {:?}", self.active_window);
+ gst::trace!(CAT, "active window {:?}", self.active_window);
let codes = [
Code::DeleteWindows(!self.active_window),
Code::DefineWindow(args),
@@ -73,30 +83,26 @@ impl Cea708ServiceWriter {
}
pub fn clear_current_window(&mut self) -> Result<usize, WriteError> {
- gst::trace!(
- super::imp::CAT,
- "clear_current_window {:?}",
- self.active_window
- );
+ gst::trace!(CAT, "clear_current_window {:?}", self.active_window);
self.push_codes(&[Code::ClearWindows(self.active_window)])
}
pub fn clear_hidden_window(&mut self) -> Result<usize, WriteError> {
- gst::trace!(super::imp::CAT, "clear_hidden_window");
+ gst::trace!(CAT, "clear_hidden_window");
self.push_codes(&[Code::ClearWindows(self.hidden_window)])
}
pub fn end_of_caption(&mut self) -> Result<usize, WriteError> {
- gst::trace!(super::imp::CAT, "end_of_caption");
+ gst::trace!(CAT, "end_of_caption");
let ret =
self.push_codes(&[Code::ToggleWindows(self.active_window | self.hidden_window)])?;
std::mem::swap(&mut self.active_window, &mut self.hidden_window);
- gst::trace!(super::imp::CAT, "active window {:?}", self.active_window);
+ gst::trace!(CAT, "active window {:?}", self.active_window);
Ok(ret)
}
pub fn paint_on_preamble(&mut self) -> Result<usize, WriteError> {
- gst::trace!(super::imp::CAT, "paint_on_preamble");
+ gst::trace!(CAT, "paint_on_preamble");
let window = match self.active_window {
WindowBits::ZERO => 0,
WindowBits::ONE => 1,
@@ -126,7 +132,7 @@ impl Cea708ServiceWriter {
let base_row = std::cmp::max(rollup_count, base_row);
let anchor_vertical = (base_row as u32 * 100 / 15) as u8;
gst::trace!(
- super::imp::CAT,
+ CAT,
"rollup_preamble base {base_row} count {rollup_count}, anchor-v {anchor_vertical}"
);
let codes = [
@@ -170,7 +176,7 @@ impl Cea708ServiceWriter {
}
for code in codes.iter() {
gst::trace!(
- super::imp::CAT,
+ CAT,
"pushing for service:{} code: {code:?}",
service.number()
);
diff --git a/video/closedcaption/src/lib.rs b/video/closedcaption/src/lib.rs
index 6fd22a6a9..6b691d6d6 100644
--- a/video/closedcaption/src/lib.rs
+++ b/video/closedcaption/src/lib.rs
@@ -30,6 +30,7 @@ mod cea608tocea708;
mod cea608tojson;
mod cea608tott;
mod cea608utils;
+mod cea708utils;
mod jsontovtt;
mod line_reader;
mod mcc_enc;