[H-GEN] For those at the meeting late last Saturday
matt
matheist76 at westnet.com.au
Mon Dec 8 13:56:32 EST 2014
You did it awesome. Well done.
On 08/12/14 23:32, Tomas Marko Miljenovic' wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug and ]
> [ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
>
>
>
> 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');
>
>
> _______________________________________________
> General mailing list
> General at lists.humbug.org.au
> http://lists.humbug.org.au/mailman/listinfo/general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20141209/b0475a01/attachment.html>
More information about the General
mailing list