Provided by: libltcsmpte-doc_0.4.4-1_all bug

NAME

       ltcsmpte.h -

       libltcsmpte - en+decode linear SMPTE timecode

SYNOPSIS

       #include <sys/types.h>
       #include <ltcsmpte/framerate.h>

   Data Structures
       struct SMPTEFrame
           Raw 80 bit SMPTE frame.
       struct SMPTETime
           Human readable time representation.
       struct SMPTEFrameExt
           Extended SMPTE frame The maximum error for startpos is 1/80 of a frame.

   Defines
       #define FPRNT_TIME   '%lf'
       #define TIME_DELIM   '   '
       #define WRITE_DECODER_BIPHASE_DIAGNOSTICS(A, B, C, D, E)
       #define WRITE_DECODER_BITS_DIAGNOSTICS(A, B, C, D, E)
       #define USE8BIT
       #define SAMPLE_AND_CURVE_ARE_DIFFERENT_TYPE
       #define SAMPLE_CENTER   128
       #define CURVE_MIN   -127
       #define CURVE_MAX   127
       #define SAMPLE_IS_UNSIGNED
       #define SAMPLE_IS_INTEGER
       #define LTC_FRAME_BIT_COUNT   80

   Typedefs
       typedef double timeu
       typedef unsigned char sample_t
       typedef short curve_sample_t
       typedef int diagnostics_t
       typedef struct SMPTEFrame SMPTEFrame
           Raw 80 bit SMPTE frame.
       typedef struct SMPTETime SMPTETime
           Human readable time representation.
       typedef struct SMPTEFrameExt SMPTEFrameExt
           Extended SMPTE frame The maximum error for startpos is 1/80 of a frame.
       typedef struct SMPTEDecoder SMPTEDecoder
           opaque structure.
       typedef struct SMPTEEncoder SMPTEEncoder
           opaque structure see: SMPTEEncoderCreate, SMPTEFreeEncoder

   Functions
       int SMPTEFrameToTime (SMPTEFrame *frame, SMPTETime *stime)
           convert binary SMPTEFrame into SMPTETime struct
       int SMPTETimeToFrame (SMPTETime *stime, SMPTEFrame *frame)
           convert SMPTETime struct into it's binary SMPTE representation.
       int SMPTEFrameReset (SMPTEFrame *frame)
           set all values of a SMPTE FRAME to zero except for the sync-word (0x3FFD) at the end.
       int SMPTEFrameIncrease (SMPTEFrame *frame, int framesPerSec)
           increments the SMPTE by one SMPTE-Frame (1/framerate seconds)
       SMPTEDecoder * SMPTEDecoderCreate (int sampleRate, FrameRate *fps, int queueSize, int
           correctJitter)
           Create a new decoder.
       int SMPTEFreeDecoder (SMPTEDecoder *d)
           release memory of Decoder structure.
       int SMPTEDecoderErrorReset (SMPTEDecoder *decoder)
           Reset the decoder error tracking internals.
       int SMPTEDecoderWrite (SMPTEDecoder *decoder, sample_t *buf, int size, long int posinfo)
           Feed the SMPTE decoder with new samples.
       int SMPTEDecoderRead (SMPTEDecoder *decoder, SMPTEFrameExt *frame)
           All decoded SMPTE frames are placed in a queue.
       int SMPTEDecoderReadLast (SMPTEDecoder *decoder, SMPTEFrameExt *frame)
           flush unread LTCs in queue and return the last timestamp.
       int SMPTEDecoderFrameToMillisecs (SMPTEDecoder *decoder, SMPTEFrameExt *frame, int
           *timems)
           Convert the frame to time in milliseconds.
       timeu SMPTEDecoderSamplesToSeconds (SMPTEDecoder *d, long int sampleCount)
           Convert the index or position of a sample to its position in time (seconds) relative
           to the first sample.
       int SMPTEDecoderErrors (SMPTEDecoder *decoder, int *errors)
           get accumulated error count since last reset.
       SMPTEEncoder * SMPTEEncoderCreate (int sampleRate, FrameRate *fps)
           Allocate and initialize LTC encoder sampleRate: audio sample rate (eg.
       int SMPTEFreeEncoder (SMPTEEncoder *e)
           release encoder data structure
       int SMPTESetNsamples (SMPTEEncoder *e, int val)
           set internal Audio-sample counter.
       int SMPTEGetNsamples (SMPTEEncoder *e)
           returns the current values of the Audio-sample counter.
       int SMPTEEncIncrease (SMPTEEncoder *e)
           moves the SMPTE to the next frame.
       int SMPTESetTime (SMPTEEncoder *e, SMPTETime *t)
           sets the current encoder SMPTE frame to SMPTETime.
       int SMPTEGetTime (SMPTEEncoder *e, SMPTETime *t)
           set t from current Encoder timecode
       long int SMPTEGetVideoFrameNumber (SMPTEEncoder *e)
           returns the current value of the encoder's SMPTE frame converted to video-frames
       int SMPTEGetTimeInMillisecs (SMPTEEncoder *e)
           returns the current value of the encoder's SMPTE frame converted to ms
       int SMPTEGetBuffer (SMPTEEncoder *e, sample_t *buf)
           returns and flushes the accumulated Encoded Audio.
       size_t SMPTEGetBuffersize (SMPTEEncoder *e)
           returns the size of the accumulated encoded Audio in bytes.
       int SMPTEEncode (SMPTEEncoder *e, int byteCnt)
           Generate LTC audio for byte 'byteCnt' of the current frame into the buffer of Encoder
           e.

Detailed Description

       libltcsmpte - en+decode linear SMPTE timecode

       Author:
           Robin Gareus <robin@gareus.org>

       Copyright (C) 2006 Robin Gareus <robin@gareus.org> Copyright (C) 2008-2009 Jan
       <jan@geheimwerk.de>

       inspired by SMPTE Decoder - Maarten de Boer <mdeboer@iua.upf.es>

       This program is free software; you can redistribute it and/or modify it under the terms of
       the GNU Lesser Public License as published by the Free Software Foundation; either version
       3, or (at your option) any later version.

       This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
       without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
       See the GNU Lesser Public License for more details.

       You should have received a copy of the GNU Lesser General Public License along with this
       library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
       Boston, MA 02110-1301 USA

       Definition in file ltcsmpte.h.

Define Documentation

   #define CURVE_MAX   127
       Definition at line 90 of file ltcsmpte.h.

   #define CURVE_MIN   -127
       Definition at line 89 of file ltcsmpte.h.

   #define FPRNT_TIME   '%lf'
       Examples:
           tests/decoder.c.

       Definition at line 51 of file ltcsmpte.h.

   #define LTC_FRAME_BIT_COUNT   80
       Definition at line 98 of file ltcsmpte.h.

   #define SAMPLE_AND_CURVE_ARE_DIFFERENT_TYPE
       Definition at line 87 of file ltcsmpte.h.

   #define SAMPLE_CENTER   128
       Definition at line 88 of file ltcsmpte.h.

   #define SAMPLE_IS_INTEGER
       Definition at line 92 of file ltcsmpte.h.

   #define SAMPLE_IS_UNSIGNED
       Definition at line 91 of file ltcsmpte.h.

   #define TIME_DELIM   ''
       Examples:
           tests/decoder.c.

       Definition at line 52 of file ltcsmpte.h.

   #define USE8BIT
       Definition at line 84 of file ltcsmpte.h.

   #define WRITE_DECODER_BIPHASE_DIAGNOSTICS(A, B, C, D, E)
       Definition at line 58 of file ltcsmpte.h.

   #define WRITE_DECODER_BITS_DIAGNOSTICS(A, B, C, D, E)
       Definition at line 59 of file ltcsmpte.h.

Typedef Documentation

   typedef short curve_sample_t
       Definition at line 86 of file ltcsmpte.h.

   typedef int diagnostics_t
       Definition at line 93 of file ltcsmpte.h.

   typedef unsigned char sample_t
       Definition at line 85 of file ltcsmpte.h.

   typedef struct SMPTEDecoder SMPTEDecoder
       opaque structure. see: SMPTEDecoderCreate, SMPTEFreeDecoder

       Definition at line 211 of file ltcsmpte.h.

   typedef struct SMPTEEncoder SMPTEEncoder
       opaque structure see: SMPTEEncoderCreate, SMPTEFreeEncoder

       Definition at line 217 of file ltcsmpte.h.

   typedef struct SMPTEFrame  SMPTEFrame
       Raw 80 bit SMPTE frame.

   typedef struct SMPTEFrameExt  SMPTEFrameExt
       Extended SMPTE frame The maximum error for startpos is 1/80 of a frame. Usually it is 0;

   typedef struct SMPTETime  SMPTETime
       Human readable time representation.

   typedef double timeu
       Definition at line 50 of file ltcsmpte.h.

Function Documentation

   SMPTEDecoder* SMPTEDecoderCreate (int sampleRate, FrameRate * fps, int queueSize, int
       correctJitter)
       Create a new decoder. Pass sample rate, number of smpte frames per seconds, and the size
       of the internal queue where decoded frames are stored. Set correctJitter flag, to correct
       jitter resulting from audio fragment size when decoding from a realtime audiostream. This
       works only correctly when buffers of exactly fragment size are passed to
       SMPTEDecoderWrite. (as discussed on LAD [msgID])

       Examples:
           tests/decoder.c.

   int SMPTEDecoderErrorReset (SMPTEDecoder * decoder)
       Reset the decoder error tracking internals.

   int SMPTEDecoderErrors (SMPTEDecoder * decoder, int * errors)
       get accumulated error count since last reset.

       Examples:
           tests/decoder.c.

   int SMPTEDecoderFrameToMillisecs (SMPTEDecoder * decoder, SMPTEFrameExt * frame, int * timems)
       Convert the frame to time in milliseconds. This uses the position of the end of the frame
       related to the sample-time to compensate for jitter.

       Examples:
           tests/decoder.c.

   int SMPTEDecoderRead (SMPTEDecoder * decoder, SMPTEFrameExt * frame)
       All decoded SMPTE frames are placed in a queue. This function gets a frame from the queue,
       and stores it in SMPTEFrameExt* frame. Returns 1 on success, 0 when no frames where on the
       queue, and and errorcode otherwise.

       Examples:
           tests/decoder.c.

   int SMPTEDecoderReadLast (SMPTEDecoder * decoder, SMPTEFrameExt * frame)
       flush unread LTCs in queue and return the last timestamp. (note that the last timestamp
       may not be the latest if the queue has overflown!)

   timeu SMPTEDecoderSamplesToSeconds (SMPTEDecoder * d, long int sampleCount)
       Convert the index or position of a sample to its position in time (seconds) relative to
       the first sample.

       Examples:
           tests/decoder.c.

   int SMPTEDecoderWrite (SMPTEDecoder * decoder, sample_t * buf, int size, long int posinfo)
       Feed the SMPTE decoder with new samples. parse raw audio for LTC timestamps. If found,
       store them in the Decoder queue (see SMPTEDecoderRead) always returns 1 ;-) d: the decoder
       buf: pointer to sample_t (defaults to unsigned 8 bit) mono audio data size: number of
       bytes to parse posinfo: (optional) byte offset in stream to set LTC location offset

       Examples:
           tests/decoder.c.

   int SMPTEEncIncrease (SMPTEEncoder * e)
       moves the SMPTE to the next frame. it uses SMPTEFrameIncrease().

       Examples:
           tests/encoder.c.

   int SMPTEEncode (SMPTEEncoder * e, int byteCnt)
       Generate LTC audio for byte 'byteCnt' of the current frame into the buffer of Encoder e.
       LTC has 10 bytes per frame: 0 <= bytecnt < 10 use SMPTESetTime(..) to set the current
       frame before Encoding. see tests/encoder.c for an example.

       Examples:
           tests/encoder.c.

   SMPTEEncoder* SMPTEEncoderCreate (int sampleRate, FrameRate * fps)
       Allocate and initialize LTC encoder sampleRate: audio sample rate (eg. 48000) fps:
       framerate

       Examples:
           tests/encoder.c.

   int SMPTEFrameIncrease (SMPTEFrame * frame, int framesPerSec)
       increments the SMPTE by one SMPTE-Frame (1/framerate seconds)

   int SMPTEFrameReset (SMPTEFrame * frame)
       set all values of a SMPTE FRAME to zero except for the sync-word (0x3FFD) at the end. This
       will also clear the dfbit.

   int SMPTEFrameToTime (SMPTEFrame * frame, SMPTETime * stime)
       convert binary SMPTEFrame into SMPTETime struct

       Examples:
           tests/decoder.c.

   int SMPTEFreeDecoder (SMPTEDecoder * d)
       release memory of Decoder structure.

       Examples:
           tests/decoder.c.

   int SMPTEFreeEncoder (SMPTEEncoder * e)
       release encoder data structure

       Examples:
           tests/encoder.c.

   int SMPTEGetBuffer (SMPTEEncoder * e, sample_t * buf)
       returns and flushes the accumulated Encoded Audio. returns the number of bytes written to
       the memory area pointed to by buf.

       no overflow check is perfomed! use DTMFGetBuffersize().

       Examples:
           tests/encoder.c.

   size_t SMPTEGetBuffersize (SMPTEEncoder * e)
       returns the size of the accumulated encoded Audio in bytes.

       Examples:
           tests/encoder.c.

   int SMPTEGetNsamples (SMPTEEncoder * e)
       returns the current values of the Audio-sample counter. ie. the number of encoded samples.

       Examples:
           tests/encoder.c.

   int SMPTEGetTime (SMPTEEncoder * e, SMPTETime * t)
       set t from current Encoder timecode

   int SMPTEGetTimeInMillisecs (SMPTEEncoder * e)
       returns the current value of the encoder's SMPTE frame converted to ms

       Examples:
           tests/encoder.c.

   long int SMPTEGetVideoFrameNumber (SMPTEEncoder * e)
       returns the current value of the encoder's SMPTE frame converted to video-frames

   int SMPTESetNsamples (SMPTEEncoder * e, int val)
       set internal Audio-sample counter. SMPTEEncode() increments this counter when it encodes
       samples.

       Examples:
           tests/encoder.c.

   int SMPTESetTime (SMPTEEncoder * e, SMPTETime * t)
       sets the current encoder SMPTE frame to SMPTETime.

       Examples:
           tests/encoder.c.

   int SMPTETimeToFrame (SMPTETime * stime, SMPTEFrame * frame)
       convert SMPTETime struct into it's binary SMPTE representation.

Author

       Generated automatically by Doxygen for libltcsmpte from the source code.