Commit graph

107 commits

Author SHA1 Message Date
Mathieu Duponchelle
64190e7452 cccombiner: mark field 0 as valid when generating padding CDP
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2383>
2021-07-08 00:26:05 +00:00
Matthew Waters
8fd2c68968 ccconverter: fix framerate caps negotiation from non-cdp to cdp
We can only convert from non-cdp to cdp within the confines of valid cdp
framerates.  The existing caps negotiation code was allowing any
framerate to convert to a cdp output which is incorrect and would hit an
assertion later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2372>
2021-07-02 10:22:31 +03:00
Sebastian Dröge
c2635c154d cccombiner: Use correct enum when registering the max-scheduled property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2171>
2021-04-19 13:51:57 +03:00
Mathieu Duponchelle
ff3cce38b6 line21dec: relax caps requirements
Instead of requiring interlaced video, simply skip CC detection
when the input is progressive.

This allows placing line21decoder unconditionally in pipelines,
without having to worry about whether the input stream will be
interlaced, or even worse interlacing just in case!

+ update doc cache

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1885>
2021-04-03 00:42:15 +00:00
Mathieu Duponchelle
42586dd536 line21dec: expose mode property
That new property can be used to control whether and how
detected CC meta should be inserted in the list of existing
CC meta on the input frame (if there was any).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1885>
2021-04-03 00:42:14 +00:00
Mathieu Duponchelle
c915cb923e line21dec: expose ntsc-only property
When this is set, the element only tries to detect CC when the
height is 525 or 486 (NTSC resolutions). The height is already
checked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1885>
2021-04-03 00:42:14 +00:00
Stéphane Cerveau
bbe3eecd3f closedcaption: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2038>
2021-03-23 14:19:16 +00:00
Matthew Waters
640a65bf96 gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2098>
2021-03-22 14:34:36 +11:00
Mathieu Duponchelle
08442cc792 cccombiner: implement scheduling
Prior to that, cccombiner's behaviour was essentially that of
a funnel: it strictly looked at input timestamps to associate
together video and caption buffers.

This patch instead exposes a "schedule" property, with a default
of TRUE, to control whether caption buffers should be smoothly
scheduled, in order to have exactly one per output video buffer.

This can involve rewriting input captions, for example when the
input is CDP sequence counters are rewritten, time codes are dropped
and potentially re-injected if the input video frame had a time code
meta.

Caption buffers may also get split up in order to assign captions to
the correct field when the input is interlaced.

This can also imply that the input will drift from synchronization,
when there isn't enough padding in the input stream to catch up. In
that case the element will start dropping old caption buffers once
the number of buffers in its internal queue reaches a certain limit
(configurable).

The property is exposed so that existing users of cccombiner can
revert back to the original behaviour, but should eventually be
removed, as that behaviour was simply inadequate.

This commit also disallows changing the input caption type, as
this would needlessly complicate implementation, and removes
the corresponding test.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2076>
2021-03-17 22:00:25 +00:00
Sebastian Dröge
0243afcb9d ccconverter: Add property to specify which sections to include in CDP packets
Various software, including ffmpeg's Decklink support, fails parsing CDP
packets that contain anything but CC data in the CDP packets.

Based on this property, timecodes are not written into the CDP packets
even if they're present.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1833>
2020-12-07 19:23:42 +02:00
Sebastian Dröge
b6debae2c0 ccconverter: Refactor code to only retrieve the timecode meta once
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1833>
2020-12-07 09:40:52 +00:00
Mathieu Duponchelle
c58357fb66 line21enc: add remove-caption-meta property
Similar to #GstCCExtractor:remove-caption-meta

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1554>
2020-09-09 22:11:28 +02:00
Mathieu Duponchelle
c07e2a89ba line21enc: heavily constrain video height
We can only determine a correct placement for the CC line
with:

* height == 525 (standard NTSC, line 21 / 22)
* height == 486 (NTSC usable lines + 6 lines for VBI, line 1 / 2)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1554>
2020-09-09 19:38:58 +02:00
Mathieu Duponchelle
1d416750d1 line21enc: add support for CDP closed caption meta
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1554>
2020-09-09 19:12:11 +02:00
Seungha Yang
91f9490529 cccombiner: Correct sink_query chain up and fix caps leaks
Don't chain up to src_query() from sink_query() method, and
returned caps by gst_static_pad_template_get_caps() needs to be
cleared.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1513>
2020-08-13 20:42:51 +09:00
Sebastian Dröge
1d1b3eb8b4 cccombiner: Update for additional info parameter to the "samples-selected" signal
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/590

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1498>
2020-08-07 17:53:14 +00:00
Mathieu Duponchelle
1522e40397 cccombiner: update to new samples selection API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1497>
2020-08-05 18:16:32 +02:00
Mathieu Duponchelle
265128e7f7 cccombiner: implement samples selection API
Call gst_aggregator_selected_samples() after identifying the
caption buffers that will be added as a meta on the next video
buffer.

Implement GstAggregator.peek_next_sample.

Add an example that demonstrates usage of the new API in
combination with the existing buffer-consumed signal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1390>
2020-07-30 23:10:33 +00:00
Vivia Nikolaidou
bf38898af8 cccombiner: Update segment according to video sink pad
Otherwise the following pipeline would preroll after 1000 hours:
gst-launch-1.0 videotestsrc ! x264enc ! cccombiner ! fakesink silent=0 sync=1 -v

Fixes #1355

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1419>
2020-07-08 17:11:38 +00:00
Matthew Waters
ebd1b2c929 ccconverter: write the cdp timecode data correctly
We were mixing up the tens part with the unit parts all over the place.

e.g. 12 seconds would be encoded as 0x21 instead of the correct 0x12

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1400>
2020-07-03 06:54:46 +00:00
Matthew Waters
327a79e982 ccconverter: output warning log if parsing a cdp packet fails
Simplifies figuring out why there may be no output from ccconverter with
a cdp input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1400>
2020-07-03 06:54:46 +00:00
Matthew Waters
6fa4a8c3c3 ccconverter: fix cdp timecode parsing
The first reserved bits are in the most significant bit.

i.e. 0xc0 vs 0x0c

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1400>
2020-07-03 06:54:46 +00:00
Matthew Waters
c6c4d42c4a ccconverter: fail negotiation when framerate conversion is not possible
Converting between anything but cdp will fail at converting
framerates and negotiation should reflect that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1393>
2020-07-01 19:33:56 +00:00
Matthew Waters
4f334234c8 ccconverter: fix missing output framerate on the caps
A pipeline like this:

closedcaption/x-cea-708,format=cdp,framerate=30000/1001 ! ccconverter ! closedcaption/x-cea-708,format=cc_data

would produce a critical/assert:

GStreamer-CRITICAL **: 14:21:11.509: gst_util_fraction_multiply: assertion 'a_d != 0' failed

because there would be no framerate field on ccconverter's output.

Fixed by always fixating a framerate if the input has a framerate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1393>
2020-07-01 19:33:56 +00:00
Sebastian Dröge
ed3417219a ccextractor: Push a GAP event if we have a caption pad but a video buffer did not contain any captions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1371>
2020-06-25 08:18:37 +00:00
Sebastian Dröge
f694956511 ccextractor: Add property to remove caption meta from the outgoing video buffers
This is disabled by default to keep backwards compatibility.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1371>
2020-06-25 08:18:37 +00:00
Mathieu Duponchelle
a048ce81d4 plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:40:42 +02:00
Matthew Waters
8396e16f85 ccconverter: signal cea608 padding as invalid
Outputting a valid but null cea608 byte pair may cause some issues with
some checksum packets.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1318>
2020-06-05 07:36:22 +00:00
Matthew Waters
bfd03537f0 ccconverter: also copy buffer metadata when draining
Fixes buffers without PTS/DTS/meta/etc when receiving an EOS with data
still stored in the internal scratch buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1318>
2020-06-05 07:36:22 +00:00
Matthew Waters
00bbaff371 ccconverter: Output the limit hit in debug lines
Fix two case of the input triplet limit not applying in cea608 -> cdp
conversion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1318>
2020-06-05 07:36:22 +00:00
Sebastian Dröge
74f2f733be plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-04 13:33:16 -04:00
Matthew Waters
6dae95d60f ccconverter: check fraction multiply for overflow
It should not happen and if it does, something went very wrong earlier

CID 1463350

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1262>
2020-05-12 16:06:32 +10:00
Matthew Waters
09cbe4cd03 ccconverter: tighten up a couple of NULL checks
CID 1463347
CID 1463346
CID 1463345

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1262>
2020-05-12 16:06:32 +10:00
Matthew Waters
ebc19d19bb ccconverter: fix unintialized read of mapped output info in error case
We only need to gst_buffer_unmap() if we have gst_buffer_map()ed.  In
most cases we can shorten the lenght of time we need to map the output
buffer.  Fix similar occurences elsewhere.

CID 1463349

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1262>
2020-05-12 16:06:32 +10:00
Matthew Waters
f077189809 ccconverter: fix uninitialized read in error case
CID 1463351

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1262>
2020-05-12 16:06:32 +10:00
Matthew Waters
12edc0d9b8 ccconverter: implement discont handling
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
ba1558a7ab ccconverter: use a better padding byte sequence for writing cdp
0xf8 can be interpreted as cea608 data at the beginning of a cdp packet
as the cc_valid bit is not checked when cc_valid in (0b00 or 0b01).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
7ed0bc539f ccconverter: split temporary storage into 3
Instead of storing the raw cc_data, store the 2 cea608 fields individually
as well as the ccp data.

Simply copying the input cc_data to the output cc_data violates a number of
requirements in the cea708 specification.  The most prominent being, that
cea608 triples must be placed at the beginning of each cdp.

We also need to comply with the framerate-dpendent limits for both the
cea608 and the ccp data which may involve splitting or merging some
cea608 data but not ccp data or vice versa.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
3417a1709c ccconvert: compact input cc_data where possible
Skip over padding cc_data triples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
7d028af675 ccconverter: implement support for CDP framerate conversions
- Any format involving CDP is supported.
- Time codes (if present) are scaled as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
75503017c2 ccconverter: introduce define for max cdp packet length
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
44c874fd9e ccconverter: don't rely on external state in *_internal()
This allows using the _internal() variants for simply converting some
caption data without relying on any external state.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
31a0bf367d ccconverter: cc_count limits are per framerate
Enforce this and add a test for cdp input being too large.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
b25d75f201 ccconverter: refactor cdp id, fps, max_cc_count into a table
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Matthew Waters
afc120fa74 ccconverter: pivot to implementing generate_output
Will make a n-n buffer element much easier to implement.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1116>
2020-05-11 12:30:31 +00:00
Mathieu Duponchelle
62d1a3a143 cccombiner: don't drop buffers on video timestamp discontinuities
If we receive video buffers with non-perfect timestamps, the
caption buffers' timestamps might fall in the interval between
the end of one video buffer and the start of the next one.

Make our criteria for dropping that the caption buffer has
a timestamp older than the end of the previous video buffer,
not older than the start of the new one, unless of course
this is the first video buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1207>
2020-04-24 08:47:50 +00:00
Mathieu Duponchelle
f02300eef5 cccombiner: handle gap buffers adequately
- Don't try to map them as actual CC data, that was raising
  a critical

- Consume video buffers up to the end of the gap

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1207>
2020-04-24 08:47:50 +00:00
Sebastian Dröge
0478e2dc1a ccconverter: Fill remainder of the cc_data in CDP packets with empty packets
Instead of filling it completely with zeroes. Filling with zeroes is
considered invalid by various CC implementations.
2020-01-24 09:26:28 +00:00
Olivier Crête
fad9096647 Revert "ccextractor: support new CEA 608 formats"
This reverts commit 80dd7b2d3d.
2019-12-17 16:43:54 -05:00
Aaron Boxer
80dd7b2d3d ccextractor: support new CEA 608 formats 2019-12-17 18:26:35 +00:00