00001 #include "dv1394input.h"
00002
00003
00004
00005 DV1394Input::DV1394Input(VideoDevice *device)
00006 : Thread(1, 1, 0)
00007 {
00008 this->device = device;
00009 done = 0;
00010 fd = 0;
00011 }
00012
00013
00014 DV1394Input::~DV1394Input()
00015 {
00016 if(Thread::running())
00017 {
00018 done = 1;
00019 Thread::cancel();
00020 Thread::join();
00021 }
00022
00023 if(fd > 0) close(fd);
00024 }
00025
00026 void DV1394Input::start()
00027 {
00028 Thread::start();
00029 }
00030
00031
00032
00033 void DV1394Input::run()
00034 {
00035
00036 int error = 0;
00037 if((fd = open(device->in_config->dv1394_path, O_RDWR)) < 0)
00038 {
00039 fprintf(stderr,
00040 "DV1394Input::run path=s: %s\n",
00041 device->in_config->dv1394_path,
00042 strerror(errno));
00043 error = 1;
00044 }
00045
00046 if(!error)
00047 {
00048 struct dv1394_init init =
00049 {
00050 api_version: DV1394_API_VERSION,
00051 channel: device->out_config->dv1394_channel,
00052 n_frames: length,
00053 format: is_pal ? DV1394_PAL : DV1394_NTSC,
00054 cip_n: 0,
00055 cip_d: 0,
00056 syt_offset: syt
00057 };
00058
00059
00060 }
00061
00062 while(!done)
00063 {
00064
00065 }
00066 }