raw1394Reader Class Reference

#include <ieee1394io.h>

Inheritance diagram for raw1394Reader:

IEEE1394Reader List of all members.

Public Member Functions

 raw1394Reader (int crd=0, int chn=63, int frames=50)
 Initializes the raw1394Reader object.
 ~raw1394Reader ()
bool Open (void)
 Open the raw1394 interface.
void Close (void)
 Close the raw1394 interface.
bool StartReceive (void)
void StopReceive (void)
bool StartThread (void)
 Start receiving DV frames.
void StopThread (void)
 Stop the receiver thread.
int Handler (int channel, size_t length, quadlet_t *data)
void * Thread ()

Static Private Member Functions

static int HandlerProxy (raw1394handle_t handle, int channel, size_t length, quadlet_t *data)
 assembles a DIF sequence to a DV frame
static void * ThreadProxy (void *arg)
 The thread responsible for polling the raw1394 interface.

Private Attributes

int port
 the interface card to use (typically == 0)
raw1394handle_t handle
 the handle to the ieee1394 subsystem

Constructor & Destructor Documentation

raw1394Reader::raw1394Reader ( int  p = 0,
int  c = 63,
int  bufSize = 50 
)

Initializes the raw1394Reader object.

The object is initialized with port and channel number. These parameters define the interface card and the iso channel on which the camcorder sends its data.

Parameters:
p the number of the interface card to use
c the iso channel number to use
bufSize the number of frames to allocate for the frames buffer

raw1394Reader::~raw1394Reader (  ) 


Member Function Documentation

void raw1394Reader::Close ( void   )  [virtual]

Close the raw1394 interface.

Implements IEEE1394Reader.

int raw1394Reader::Handler ( int  channel,
size_t  length,
quadlet_t *  data 
)

int raw1394Reader::HandlerProxy ( raw1394handle_t  handle,
int  channel,
size_t  length,
quadlet_t *  data 
) [static, private]

assembles a DIF sequence to a DV frame

The PAL/NTSC DV data has the following format:

The long packets contain the actual video and audio contents that goes into the AVI file.

The actual DV data starts at quadlet 4 of the long packet, so we have 480 bytes of DV data per packet. For PAL, each rame is made out of 300 packets and there are 25 frames per second. That is 144000 bytes per frame and 3600000 bytes per second. For NTSC we have 250 packages per frame and 30 frames per second. That is 120000 bytes per frame and 3600000 bytes per second too.

We also attempt to detect incomplete frames. The idea is: If we hit the begin of frame indicator and this is not the very first packet for this frame, then at least one packed has been dropped by the driver. This does not guarantee that no incomplete frames are saved, because if we miss the frame header of the next frame, we can“t tell whether the last one is incomplete.

Parameters:
handle the handle to the ieee1394 subsystem
channel the channel this data has been read from
length the length of the data
data a pointer to the data
Returns:
unused, we return always zero

bool raw1394Reader::Open ( void   )  [virtual]

Open the raw1394 interface.

Returns:
success/failure

Implements IEEE1394Reader.

bool raw1394Reader::StartReceive ( void   )  [virtual]

Implements IEEE1394Reader.

bool raw1394Reader::StartThread ( void   )  [virtual]

Start receiving DV frames.

The ieee1394 subsystem is initialized with the parameters provided to the constructor (port and channel). The received frames can be retrieved from the outFrames queue.

Implements IEEE1394Reader.

void raw1394Reader::StopReceive ( void   )  [virtual]

Implements IEEE1394Reader.

void raw1394Reader::StopThread ( void   )  [virtual]

Stop the receiver thread.

The receiver thread is being canceled. It will finish the next time it calls the pthread_testcancel() function. After it is canceled, we turn off iso receive and close the ieee1394 subsystem. We also remove all frames in the outFrames queue that have not been processed until now.

Implements IEEE1394Reader.

void * raw1394Reader::Thread (  ) 

void * raw1394Reader::ThreadProxy ( void *  arg  )  [static, private]

The thread responsible for polling the raw1394 interface.

Though this is an infinite loop, it can be canceled by StopThread, but only in the pthread_testcancel() function.


Member Data Documentation

raw1394handle_t raw1394Reader::handle [private]

the handle to the ieee1394 subsystem

int raw1394Reader::port [private]

the interface card to use (typically == 0)


The documentation for this class was generated from the following files:
Generated on Tue Jan 22 17:07:31 2008 for MUAN by  doxygen 1.4.7