Commit graph

54 commits

Author SHA1 Message Date
Sebastian Dröge 5002efbf8d timecodestamper: Require a non-0/1 framerate on the pad templates
We reject caps with other framerates as it's impossible to generate
timecodes unless we actually know a constant framerate. Reflect this
also in the pad template caps.
2019-08-06 16:22:27 +00:00
Sebastian Dröge 2386385822 avwait: Improve debug output a bit 2019-08-06 16:22:27 +00:00
Sebastian Dröge aafda1c76f timecodestamper: Validate LTC timestamps before trying to use them
There's no point in working with invalid LTC timestamps as all future
calculations will be wrong based on this, and invalid LTC timestamps can
sometimes be read via the audio input.
2019-07-25 18:27:30 +03:00
Sebastian Dröge 5c324cebb9 avwait: In running-time mode, select start/end running time based on the actual video timestamps
Otherwise we would start/end at exactly the given times, which might be
up to 1 frame earlier/later than the video.
2019-07-12 12:54:02 +03:00
Sebastian Dröge 3863a356cb avwait: Add some more debug output 2019-07-12 12:54:02 +03:00
Sebastian Dröge 407f311f2c avwait: Fix clipping of audio buffers at the start of recording 2019-07-12 12:54:02 +03:00
Sebastian Dröge 6ea4557271 timecodestamper: Add support for linear timecode (LTC) from an audio stream
Based on a patch by
  Georg Lippitsch <glippitsch@toolsonair.com>
  Vivia Nikolaidou <vivia@toolsonair.com>

Using libltc from https://github.com/x42/libltc
2019-07-08 16:45:12 +00:00
Sebastian Dröge 678064d603 timecodestamper: Rewrite element API and code flow
We now have a single property to select the timecode source that should
be applied, and for each timecode source the timecode is updated at
every frame. Then based on a set mode, the timecode is added to the
frame if none exists already or all existing timecodes are removed and
the timecode is added.

In addition the real-time clock is considered a proper timecode source
now instead of only allowing to initialize once in the beginning with
it, and also instead of just taking the current time we now take the
current time at the clock time of the video frame.
2019-07-08 16:45:12 +00:00
Sebastian Dröge 934d0fcdd3 avwait: Make sure to never unref an input buffer we already unreffed before 2019-06-24 14:20:54 +03:00
Sebastian Dröge cf35802c52 avwait: Add support for setting an end running time
It was possible to set a start running time and start/end timecode
before, but not an end running time.
2019-06-24 14:20:54 +03:00
Sebastian Dröge 074df2f4bc avwait: Correctly stop recording and signal recording stop on EOS
If recording is set to FALSE after the last audio or video buffer and
before the EOS event then recording stop is never signalled.

Similarly, we should signal recording stop once both audio and video are
EOS, regardless of the recording property, as there's nothing to be
recorded anymore.
2019-06-24 07:56:04 +00:00
Sebastian Dröge 7117ba0a53 avwait: Allow start and end timecode to be set back to NULL
And check everywhere if they're NULL before accessing them.
2019-06-05 11:47:36 +03:00
Vivia Nikolaidou 50075616f2 avwait: Don't print warnings for every buffer passed 2019-05-31 18:47:03 +03:00
Sebastian Dröge 1c712ca555 avwait: Protect properties and some other code with the mutex
These variables are all accessed from multiple threads.

Also fix some minor leaks in error code paths.
2019-05-24 10:41:35 +00:00
Sebastian Dröge d55dda6252 avwait: Insert some empty lines to give the code some space to breath 2019-05-24 10:41:35 +00:00
Sebastian Dröge c8876a37ba avwait: Allow setting start timecode after end timecode and the other way around
This might be necessary temporarily for changing the previous settings.
Make it an actual error if the settings are like this while processing a
buffer.
2019-05-24 10:41:35 +00:00
Thibault Saunier 47a49f3381 docs: Build documentation with hotdoc 2019-05-13 17:00:00 -04:00
Sebastian Dröge 3891bf2695 timecodestamper: Don't use deprecated API 2018-12-20 10:13:45 +02:00
Vivia Nikolaidou d89104c57f avwait: Fix sending of dropping=true messages
If the first audio buffer to be dropped started right between two video
buffers (after the end of the first but before the start of the second,
as is often the case with N/1001 video frame rates), we would miss
sending the dropping=true message.

https://bugzilla.gnome.org/show_bug.cgi?id=797248
2018-10-04 12:40:45 +03:00
Vivia Nikolaidou b1b4a04338 avwait: Send dropping=true message after all streams stopped
Previously it was dispatched before the last video buffer, and audio
buffers would follow afterwards. It's misleading to send the
dropping=true message before both streams have really stopped, it can
lead to races when someone is e.g. waiting for that message to send EOS.

Also added some debug output.

https://bugzilla.gnome.org/show_bug.cgi?id=797145
2018-09-21 17:31:25 +03:00
Vivia Nikolaidou ae7ecfceed timecodestamper: Fix typo in set_drop_frame
Was checking if fps_d == 60000 (instead of fps_n), causing 60000/1001 to
be always falsely interpreted as non-drop-frame
2018-09-03 15:15:45 +03:00
Vivia Nikolaidou ff952374b5 avwait: Start video and audio together if audio starts late
Also add test to meson

https://bugzilla.gnome.org/show_bug.cgi?id=796977
2018-08-17 14:57:36 +03:00
Vivia Nikolaidou 8ede252a8a avwait: Don't wait if audio_running_time_to_wait_for is NONE
The case is properly handled a few lines below by dropping the buffer.
We shouldn't perpetually block the audio chain function until the
target-timecode is reached.

https://bugzilla.gnome.org/show_bug.cgi?id=796906
2018-08-01 20:18:19 +03:00
Vivia Nikolaidou 854baf4fdb avwait: Add recording property
It works like a valve in front of the actual avwait. When recording ==
TRUE, other rules are then examined. When recording == FALSE, nothing is
passing through.

https://bugzilla.gnome.org/show_bug.cgi?id=796836
2018-07-24 13:20:59 +03:00
Xavier Claessens 83d0623293 Meson: Generate pc file for all plugins in bad
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:08:09 +01:00
Vivia Nikolaidou f042e57d4e Revert "WIP: Revert "Revert "timecodestamper: LTC from audio"""
This reverts commit e0be05dc70.
2018-01-04 15:41:49 +02:00
Vivia Nikolaidou 7ecf3347d1 Revert "WIP: Revert "Revert "timecodestamper: Modify ltc-add to tc-add"""
This reverts commit 2f9da0ab59.
2018-01-04 15:41:48 +02:00
Vivia Nikolaidou 2f9da0ab59 WIP: Revert "Revert "timecodestamper: Modify ltc-add to tc-add""
This reverts commit 05426d9298.
2018-01-04 13:54:37 +02:00
Vivia Nikolaidou e0be05dc70 WIP: Revert "Revert "timecodestamper: LTC from audio""
This reverts commit 1998ccf1fb.
2018-01-04 13:54:37 +02:00
Vivia Nikolaidou cbeebfea49 avwait: Added "avwait-status" element message
"avwait-status" is posted when avwait starts or stops passing through
data (e.g. because target-timecode and end-timecode respectively have
been reached). The attached structure includes a "dropping" boolean (set
to TRUE if we are currently dropping data, FALSE otherwise), and a
"running-time" GST_CLOCK_TIME which contains the running time of the
change.

https://bugzilla.gnome.org/show_bug.cgi?id=790170
2017-12-08 21:56:32 +02:00
Vivia Nikolaidou f3b539e0ff avwait: Deserialised timecodes set after caps event now get correct framerate
A deserialised timecode has a framerate of 0/1 by default. That breaks
it when comparing the frames field with another timecode (incoming from
the frame). We were setting the framerate when receiving the caps event,
but not when setting the timecode in set_property, so it was broken for
timecodes set after the caps event.

Also checking if the fps_n we got from the caps event is != 0 before
setting it - also at the caps event.

https://bugzilla.gnome.org/show_bug.cgi?id=790334
2017-11-14 18:29:49 +02:00
Vivia Nikolaidou d364c7b443 timecode: Fix incorrect wording in error message 2017-11-10 17:28:07 +02:00
Vivia Nikolaidou 38120376c6 avwait: Better handling of deserialised timecode framerates
Now that timecodes support proper serialisation / deserialisation, a
timecode might have an invalid fps_n / fps_d even without using the
target-time-code-string property. Detect those cases and set fps_n/fps_d
properly.
2017-11-10 17:28:05 +02:00
Vivia Nikolaidou 1998ccf1fb Revert "timecodestamper: LTC from audio"
This reverts commit c01afab9f7.

Was not ready to be pushed yet
2017-11-07 21:12:32 +02:00
Vivia Nikolaidou 05426d9298 Revert "timecodestamper: Modify ltc-add to tc-add"
This reverts commit 6552981b79.

Was not ready to be pushed yet
2017-11-07 21:12:25 +02:00
Vivia Nikolaidou 503403ff0a avwait: Fix crash when explicitly setting end_tc to NULL
If end_tc is NULL, it means that we don't want avwait to stop at any
timecode. When explicitly setting end_tc to NULL, there is no point in
comparing end_tc with start_tc (to see if we'll reject end_tc for being
before start_tc), so the check in question is completely disabled
instead of letting it crash.
2017-11-07 21:03:22 +02:00
Georg Lippitsch 6552981b79 timecodestamper: Modify ltc-add to tc-add
It is more general now and also adds TC to internal counter
2017-11-07 16:45:52 +02:00
Georg Lippitsch c01afab9f7 timecodestamper: LTC from audio
Add support for parsing linear time code from
an audio source using libltc

https://github.com/x42/libltc

The user can now choose between 3 different and independently
running timecode sources. The old override-existing property
has been replaced by timecode-source.

https://bugzilla.gnome.org/show_bug.cgi?id=784295
2017-11-07 16:45:52 +02:00
Vivia Nikolaidou a160b85f0a avwait: Added end-timecode property
avwait can now be configured to stop when a given timecode has been
reached. It will start at the timecode indicated with start-timecode and
end at the timecode indicated with end-timecode. If end-timecode is
NULL (default), the previous functionality is preserved: keep going and
not end.

https://bugzilla.gnome.org/show_bug.cgi?id=789403
2017-10-25 13:39:19 +02:00
Nicolas Dufresne 4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Thibault Saunier 78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Sebastian Dröge 9b5c46ca57 timecodestamper: Only unref daily jam if not NULL 2017-03-08 15:52:43 +02:00
Sebastian Dröge 6357d3aada timecodestamper: Unref daily jam after usage 2017-03-08 15:48:19 +02:00
Vivia Nikolaidou e5d2f7dc6f meson: Added meson.build for audiomixmatrix and timecode
https://bugzilla.gnome.org/show_bug.cgi?id=779154
2017-02-24 10:10:07 +02:00
Georg Lippitsch fc2ca69c25 timecodestamper: Remove clock-source property
Remove clock-source property, because the GST clock usually starts at
some random value and is thus uselsess for creating a timecode from it.

https://bugzilla.gnome.org/show_bug.cgi?id=778703
2017-02-23 20:00:55 +02:00
Georg Lippitsch 2cc62641c3 timecodestamper: First timecode from current system time
Add a new flag which automatically sets this first timecode to the
current system time in local time zone.

https://bugzilla.gnome.org/show_bug.cgi?id=778703
2017-02-23 20:00:55 +02:00
Georg Lippitsch 290f3ca6d7 timecodestamper: First timecode property
Add an new property to start from a given timecode
instead of zero.

https://bugzilla.gnome.org/show_bug.cgi?id=778703
2017-02-23 20:00:55 +02:00
Vivia Nikolaidou a5933dc002 avwait: Fix potential deadlock when flushing / shutting down audio
The mutex must be unlocked in the error case

https://bugzilla.gnome.org/show_bug.cgi?id=778076
2017-02-02 15:29:25 +02:00
Vivia Nikolaidou 9e4e447ad4 avwait: Rename timecodewait to avwait, add modes
Renamed timecodewait to avwait. Added running-time and video-first
modes. Default mode is timecode (the previous behaviour).

https://bugzilla.gnome.org/show_bug.cgi?id=777741
2017-01-26 16:21:55 +02:00
Vivia Nikolaidou b16cd484bf timecodestamper: Post element message with current timecode
timecodestamper will post an element message which contains the current
timecode it just stamped. If a timecode was already found and not
replaced, it will still post it in a message.

https://bugzilla.gnome.org/show_bug.cgi?id=777048
2017-01-09 18:52:24 +02:00