Commit graph

6 commits

Author SHA1 Message Date
Sebastian Dröge
5a7fcfad7f Fix various new clippy warnings with clippy 1.43 2020-04-24 13:55:01 +03:00
Mathieu Duponchelle
510c1cf2df tttocea608: use mul_div_round
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:58:54 +02:00
Mathieu Duponchelle
5c82e6fe6c tttocea608: forward gaps from upstream
taking our own latency into account

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:10:42 +02:00
Mathieu Duponchelle
fbb2022b25 tttocea608: protect State with a simple mutex
There was no reason to use AtomicRefcell in this context,
aside from the dubious pleasure of panicing when attempting
to borrow mutably while another mutable borrow was already
held.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:10:42 +02:00
Mathieu Duponchelle
de796c95f0 tttocea608: refactor to fit more scenarios
- Report a latency:
  By design, tttocea608 will output buffers in the "past" when
  receiving an input buffer: we want the second to last buffer
  in the buffer list that we output to have the same pts as the
  input buffer, as it contains the end_of_caption control code
  which determines when the current closed caption actually gets
  displayed in pop_on mode. The previous buffers have timestamps
  decreasing as a function of the framerate, for up to potentially
  74 byte pairs (the breakdown is detailed in a comment).

  The element thus has to report a latency, at 30 frames per second
  it represents around 2.5 seconds.

- Refactor timestamping:
  Stop using a frame duration, but rather base our timestamps on
  a scaled frame index. This is to avoid rounding errors, and
  allow for exactly one byte pair per buffer if the proper framerate
  is set on the closed caption branch, and the video branch has
  perfect timestamps, eg videorate. In practice, that one byte
  pair per frame requirement should only matter for line 21 encoding,
  but we have to think about this use case too.

- Splice in erase_display_memory:
  When there is a gap between the end of a buffer and the start
  of the next one, we want to erase the display memory (this
  is unnecessary otherwise, as the end_of_caption control code
  will in effect ensure that the display is erased when the
  new caption is displayed). The previous implementation only
  supported this imperfectly, as it could cause timestamps to
  go backwards.

- Output last erase_display_memory:
  The previous implementation was missing the final
  erase_display_memory on EOS

- Output gaps

- Write more tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:10:42 +02:00
Arun Raghavan
dc3c8fd049 Drop gst-plugin- prefix in plugin directory name 2020-04-05 19:10:47 +00:00
Renamed from video/gst-plugin-closedcaption/src/tttocea608.rs (Browse further)