[H-GEN] For those at the meeting late last Saturday
Tomas Marko Miljenović
TomasM at tomasm.tk
Mon Dec 8 08:32:25 EST 2014
Finally. Thanks for nothing, you ethernet frame-abusing so-and-so's at Lenkeng. I hope those extra bytes from the trailer and FCS result in a huge improvement in speed and image quality.
For posterity, sample code to extract one frame is included below. (Yes, everyone needs the necessary privileges/capabilities for libpcap just to capture some damn video.)
#!/usr/bin/perl -w
use strict;
use Net::PcapUtils;
use constant {
PACKET_LENGTH => 1066,
HEADER_STRIP_LENGTH => 46,
JPEG_PACKET_DATA_LENGTH => 1020, # 1066 - 46
ETHERNET_DEVICE => 'em1'
};
my $count = 0;
sub process_pkt {
my($arg, $hdr, $pkt) = @_;
my $jpeg_data = substr($pkt, HEADER_STRIP_LENGTH, JPEG_PACKET_DATA_LENGTH);
if($jpeg_data =~ /JFIF/){
$count++;
if($count>1){die}
}
print $jpeg_data;
}
Net::PcapUtils::loop(\&process_pkt, DEV => ETHERNET_DEVICE, SNAPLEN => PACKET_LENGTH, FILTER => 'port 2068');
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hdmi-extender-output.jpg
Type: image/jpeg
Size: 29580 bytes
Desc: not available
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20141208/ad3829c2/attachment-0001.jpg>
More information about the General
mailing list