Re: dvgrab wait for device

Carl Karsten <[email protected]>
Newsgroups gmane.comp.video.kino.devel
Message-ID <[email protected]>
On Mon, Jun 29, 2009 at 9:59 PM, Carl Karsten<[email protected]> wrote:
> On Mon, Jun 29, 2009 at 7:52 PM, Dan Dennedy<[email protected]> wrote:
>> On Mon, Jun 29, 2009 at 11:16 AM, Carl Karsten<[email protected]> wrote:
>>> On Mon, Jun 29, 2009 at 12:41 PM, Dan Dennedy<[email protected]> wrote:
>>>> On Mon, Jun 29, 2009 at 7:35 AM, Carl Karsten<[email protected]> wrote:
>>>>> if there is no device when dvgrab is first run, it aborts.  Yet if it
>>>>> is streaming I can unplug the device and plug it back in, and the
>>>>> stream continues.  If there were some way to get dvgrab to just wait
>>>>> for a device, that would be great.  Or if someone can replace the
>>>>> execvp(dvgrab with the C code from dvgrab... then I can take that off
>>>>> my list of things to look into :)
>>>>
>>>> Hmm, well, there can be multiple Firewire buses on your system, and
>>>> dvgrab looks for a device across all the buses to see which bus to
>>>> use, which is required to acquire a  libraw1394 handle. You would have
>>>> to add some loop around that with a limited retry.
>>>
>>> Would it help if this was limited to being told what -card was in use?
>>>  or guid, or something to avoid the scan?
>>
>> It should work today using -card and -noavc, but it will time out
>> waiting for DV after 10 seconds. Thiis timeout is a feature. Do you
>> need AV/C
>
> Nope.  one of the args is:
>    *argp++ = "-noavc";
>
>>  and what do you want to do about this timeout?
>
> how about
> --timeout 0
>
> Looks ilke this is the place...  tomorrow I will take a shot at tweaking it.
>
>
>        // Wait up to N seconds to see if we got any data
>        // this is a little unclean, checking global g_done from
> main.cc to allow interruption
>        while ( !g_done && m_frame == NULL && tryCounter-- > 0 )
>        {
>                timespec t = {0, 25000000L};
>                nanosleep( &t, NULL );
>        }
>
>        // OK, we have data, commence capture
>        if ( !g_done && m_frame )
>        {
>                sendEvent( "Capture Started" );
>                m_captureActive = true;
>                m_total_frames = 0;
>
>                // parse the SMIL time value duration
>                if ( m_timeDuration == NULL && ! m_duration.empty() )
>                        m_timeDuration = new SMIL::MediaClippingTime(
> m_duration, m_frame->GetFrameRate() );
>
>                if ( m_dst_file_name )
>                        pthread_mutex_unlock( &capture_mutex );
>        }
>
>        // No data received in N seconds, throw an error
>        else if ( !g_done )
>        {
>                if ( m_dst_file_name )
>                        pthread_mutex_unlock( &capture_mutex );
>                const char *err = m_hdv ? "no HDV. Try again before
> giving up." : "no DV";
>                if ( m_hdv )
>                        reset_bus( m_port );
>                throw std::string( err );
>        }
>        else
>        {
>                if ( m_dst_file_name )
>                        pthread_mutex_unlock( &capture_mutex );
>        }

skipped trying to figure out how to add parameters (and given the 10
second time out isn't documented, does it really have to be kept?)

This may to do what I need:

-while ( !g_done && m_frame == NULL && tryCounter-- > 0 )
+while ( !g_done && m_frame == NULL )

Now to see how dvswitch works with this.

-- 
Carl K

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.