update to libltc-1.1.0

add support for TV standard specific offset and
binary-group-flags

git-svn-id: svn://localhost/ardour2/branches/3.0@13514 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Robin Gareus 2012-11-17 20:15:41 +00:00
parent 4c5ef5318e
commit 3b63eae41d
3 changed files with 40 additions and 10 deletions

View File

@ -200,9 +200,9 @@ LTC_Slave::detect_discontinuity(LTCFrameExt *frame, int fps, bool fuzzy) {
}
if (frame->reverse) {
ltc_frame_decrement(&prev_frame.ltc, fps , 0);
ltc_frame_decrement(&prev_frame.ltc, fps, LTC_TV_525_60, 0);
} else {
ltc_frame_increment(&prev_frame.ltc, fps , 0);
ltc_frame_increment(&prev_frame.ltc, fps, LTC_TV_525_60, 0);
}
if (!equal_ltc_frame_time(&prev_frame.ltc, &frame->ltc)) {
discontinuity_detected = true;
@ -298,6 +298,7 @@ void
LTC_Slave::process_ltc(framepos_t const now)
{
LTCFrameExt frame;
enum LTC_TV_STANDARD tv_standard = LTC_TV_625_50;
while (ltc_decoder_read(decoder, &frame)) {
SMPTETimecode stime;
@ -337,15 +338,34 @@ LTC_Slave::process_ltc(framepos_t const now)
* is expected to start at the end of the current frame
*/
int fps_i = ceil(timecode.rate);
switch(fps_i) {
case 30:
if (timecode.drop) {
tv_standard = LTC_TV_525_60;
} else {
tv_standard = LTC_TV_1125_60;
}
break;
case 25:
tv_standard = LTC_TV_625_50;
break;
default:
tv_standard = LTC_TV_FILM_24; /* == LTC_TV_1125_60 == no offset, 24,30fps BGF */
break;
}
if (!frame.reverse) {
ltc_frame_increment(&frame.ltc, fps_i , 0);
ltc_frame_increment(&frame.ltc, fps_i, tv_standard, 0);
ltc_frame_to_time(&stime, &frame.ltc, 0);
transport_direction = 1;
frame.off_start -= ltc_frame_alignment(session.frame_rate(), tv_standard);
frame.off_end -= ltc_frame_alignment(session.frame_rate(), tv_standard);
} else {
ltc_frame_decrement(&frame.ltc, fps_i , 0);
ltc_frame_decrement(&frame.ltc, fps_i, tv_standard, 0);
int off = frame.off_end - frame.off_start;
frame.off_start += off;
frame.off_end += off;
frame.off_start += off - ltc_frame_alignment(session.frame_rate(), tv_standard);
frame.off_end += off - ltc_frame_alignment(session.frame_rate(), tv_standard);
transport_direction = -1;
}

View File

@ -56,7 +56,11 @@ using namespace Timecode;
* This filter is adaptive so that fast vari-speed signals
* will not be affected by it.
*/
#define LTC_RISE_TIME(speed) MIN (100, MAX(25, (4000000 / ((speed==0)?1:speed) / engine().frame_rate())))
#define LTC_RISE_TIME(speed) MIN (100, MAX(40, (4000000 / ((speed==0)?1:speed) / engine().frame_rate())))
#define TV_STANDARD(tcf) \
(timecode_to_frames_per_second(tcf)==25.0 ? LTC_TV_625_50 : \
timecode_has_drop_frames(tcf)? LTC_TV_525_60 : LTC_TV_FILM_24)
void
Session::ltc_tx_initialize()
@ -67,7 +71,7 @@ Session::ltc_tx_initialize()
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX init sr: %1 fps: %2\n", nominal_frame_rate(), timecode_to_frames_per_second(ltc_enc_tcformat)));
ltc_encoder = ltc_encoder_create(nominal_frame_rate(),
timecode_to_frames_per_second(ltc_enc_tcformat),
-2);
TV_STANDARD(ltc_enc_tcformat), 0);
ltc_encoder_set_bufsize(ltc_encoder, nominal_frame_rate(), 23.0);
ltc_encoder_set_filter(ltc_encoder, LTC_RISE_TIME(1.0));
@ -208,7 +212,10 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
TimecodeFormat cur_timecode = config.get_timecode_format();
if (cur_timecode != ltc_enc_tcformat) {
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX1: TC format mismatch - reinit sr: %1 fps: %2\n", nominal_frame_rate(), timecode_to_frames_per_second(cur_timecode)));
if (ltc_encoder_reinit(ltc_encoder, nominal_frame_rate(), timecode_to_frames_per_second(cur_timecode), -2)) {
if (ltc_encoder_reinit(ltc_encoder, nominal_frame_rate(),
timecode_to_frames_per_second(cur_timecode),
TV_STANDARD(cur_timecode), 0
)) {
PBD::error << _("LTC encoder: invalid framerate - LTC encoding is disabled for the remainder of this session.") << endmsg;
ltc_tx_cleanup();
return;
@ -238,6 +245,9 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
*/
framepos_t cycle_start_frame = (current_speed < 0) ? (start_frame - ltc_out_latency.max) : (start_frame + ltc_out_latency.max);
/* LTC TV standard offset */
cycle_start_frame += ltc_frame_alignment(nominal_frame_rate(), TV_STANDARD(cur_timecode));
/* cycle-start may become negative due to latency compensation */
if (cycle_start_frame < 0) { cycle_start_frame = 0; }

View File

@ -282,7 +282,7 @@ def configure(conf):
autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
atleast_version='7.0.0')
autowaf.check_pkg(conf, 'ltc', uselib_store='LTC',
atleast_version='1.0.3', mandatory=False)
atleast_version='1.1.0', mandatory=False)
# we don't try to detect this, since its part of our source tree