[FFmpeg-devel] [PATCH] FireWire DV/HDV input device using libiec61883

Georg Lippitsch georg.lippitsch at gmx.at
Sat May 5 20:50:20 CEST 2012


Am 02.05.2012, 02:00 Uhr, schrieb Stefano Sabatini <stefasab at gmail.com>:

> On date Tuesday 2012-05-01 11:43:18 +0200, Georg Lippitsch encoded:
>> +    inport = strtol(context->filename, &endptr, 10);
>> +    if (endptr != context->filename && *endptr == '\0') {
>> +        av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n",  
>> inport);
>> +        j = inport;
>> +        ports = inport + 1;
>> +    }
>> +
>
> What about to explicitely fail in case the string can't be parsed? I
> mean you could define a constant like "auto" and abort if the string
> can't be parsed as a number. This should prevent bogus input like
> "1f" or "1 ".

Actually I really do NOT want to fail here in any case. Any bogus input  
should trigger auto-detection, because I don't expect people to read  
documentation and search what they should enter here. If they enter  
anything, then the port is auto detected. Only if they enter a valid port  
number, this overrides auto-detection.

> Again I find this quite confusing, since the same field is used for
> two different purposes. What I suggest:
>
>     if (dv->type == AUTO) {
>         response = avc1394_transaction(dv->handle, dv->node,
>                                        AVC1394_CTYPE_STATUS |
>                                        AVC1394_SUBUNIT_TYPE_TAPE_RECORDER  
> |
>                                        AVC1394_SUBUNIT_ID_0 |
>                                        AVC1394_VCR_COMMAND_OUTPUT_SIGNAL_MODE  
> |
>                                        0xFF, 2);
>         response = AVC1394_GET_OPERAND0(response);
>         dv->type = (response == 0x10 || response == 0x90 || response ==  
> 0x1A || response == 0x9A) ? HDV : DV;
>     }

Indeed, that sounds reasonable. Fixed in attached patch.


> typo: prohibited

Fixed.


> Note: you can squeeze the two patches into one.

Done.

Also, I added some lines to return AVERROR(EIO) if poll() returns without  
data. This usually indicates that the device has been disconnected, and  
resulted in an endless loop.



Regards,

Georg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-FireWire-DV-HDV-input-device-using-libiec61883.patch
Type: text/x-patch
Size: 18091 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120505/f3356c3a/attachment.bin>


More information about the ffmpeg-devel mailing list