Re: [linux-audio-dev] MTC, SMPTE, etc.

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] MTC, SMPTE, etc.
From: Maarten de Boer (maarten.deboer_AT_iua.upf.es)
Date: Fri Jul 21 2000 - 21:54:27 EEST


Would the following API be acceptable for everybody?
If we agree on this, it's a matter of minuts of putting
the actual decoding code in place.
=======================================================
/* Name: SMPTE Decoder
   Version: 0.1
   Author: Maarten de Boer <mdeboer_AT_iua.upf.es>
   License: GPL
*/

/* Raw 80 bit SMPTE frame
*/
typedef struct SMPTEFrame
{
        /*.....*/
} SMPTEFrame;

/* Extended SMPTE frame
   position is the position of the end of the SMPTE frame in the incoming
   sample stream, feeded to SMPTEDecoderWrite
*/
typedef struct SMPTEFrameExt
{
        SMPTEFrame base;
        int position;
} SMPTEFrameExt

typedef struct SMPTETime
{
        unsigned char hours;
        unsigned char mins;
        unsigned char secs;
        unsigned char frame;
} SMPTETime;

typedef struct SMPTEDecoder;
{
        int sampleRate;
        int fps;

        SMPTEFrameExt* queue;
        int queueSize;
        int queueReadPos;
        int queueWritePos;

        int position;

        /* ... other internal variables needed by low level decoding
           functions ... */
} SMPTEDecoder;

/* Initialize the decoder. Pass sample rate, number of smpte frames per
   seconds, and the size of the internal queue where decoded frames are
   stored
*/
int SMPTEDecoderInit(
        SMPTEDecoder* decoder, int sampleRate, int fps,int queueSize);

/* Feed the SMPTE decoder with new samples. Returns 1 on success
*/
int SMPTEDecoderWrite(
        SMPTEDecoder* decoder, unsigned char* buf,int size);

/* 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.
*/
int SMPTEDecoderRead(
        SMPTEDecoder* decoder,SMPTEFrameExt* frame);

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

/* Convert a raw SMPTE frame to a more pleasant struct
*/
int SMPTEDecoderConvertFrame(SMPTEFrame* frame, SMPTETime* smpteTime);


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Jul 21 2000 - 22:30:22 EEST