"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/Image/ExifTool/M2TS.pm" between
Image-ExifTool-12.26.tar.gz and Image-ExifTool-12.27.tar.gz

About: ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta information in a wide variety of files.

M2TS.pm  (Image-ExifTool-12.26):M2TS.pm  (Image-ExifTool-12.27)
skipping to change at line 34 skipping to change at line 34
# #
# To Do: - parse PCR to obtain average bitrates? # To Do: - parse PCR to obtain average bitrates?
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
package Image::ExifTool::M2TS; package Image::ExifTool::M2TS;
use strict; use strict;
use vars qw($VERSION); use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils); use Image::ExifTool qw(:DataAccess :Utils);
$VERSION = '1.19'; $VERSION = '1.20';
# program map table "stream_type" lookup (ref 6/1) # program map table "stream_type" lookup (ref 6/1)
my %streamType = ( my %streamType = (
0x00 => 'Reserved', 0x00 => 'Reserved',
0x01 => 'MPEG-1 Video', 0x01 => 'MPEG-1 Video',
0x02 => 'MPEG-2 Video', 0x02 => 'MPEG-2 Video',
0x03 => 'MPEG-1 Audio', 0x03 => 'MPEG-1 Audio',
0x04 => 'MPEG-2 Audio', 0x04 => 'MPEG-2 Audio',
0x05 => 'ISO 13818-1 private sections', 0x05 => 'ISO 13818-1 private sections',
0x06 => 'ISO 13818-1 PES private data', 0x06 => 'ISO 13818-1 PES private data',
skipping to change at line 116 skipping to change at line 116
0xbc => 1, # program_stream_map 0xbc => 1, # program_stream_map
0xbe => 1, # padding_stream 0xbe => 1, # padding_stream
0xbf => 1, # private_stream_2 0xbf => 1, # private_stream_2
0xf0 => 1, # ECM_stream 0xf0 => 1, # ECM_stream
0xf1 => 1, # EMM_stream 0xf1 => 1, # EMM_stream
0xf2 => 1, # DSMCC_stream 0xf2 => 1, # DSMCC_stream
0xf8 => 1, # ITU-T Rec. H.222.1 type E stream 0xf8 => 1, # ITU-T Rec. H.222.1 type E stream
0xff => 1, # program_stream_directory 0xff => 1, # program_stream_directory
); );
my $knotsToKph = 1.852; # knots --> km/h
# information extracted from the MPEG-2 transport stream # information extracted from the MPEG-2 transport stream
%Image::ExifTool::M2TS::Main = ( %Image::ExifTool::M2TS::Main = (
GROUPS => { 2 => 'Video' }, GROUPS => { 2 => 'Video' },
VARS => { NO_ID => 1 }, VARS => { NO_ID => 1 },
NOTES => q{ NOTES => q{
The MPEG-2 transport stream is used as a container for many different The MPEG-2 transport stream is used as a container for many different
audio/video formats (including AVCHD). This table lists information audio/video formats (including AVCHD). This table lists information
extracted from M2TS files. extracted from M2TS files.
}, },
VideoStreamType => { VideoStreamType => {
skipping to change at line 330 skipping to change at line 332
# 00d0: 01 00 02 00 03 00 04 00 05 00 06 00 [........... .] # 00d0: 01 00 02 00 03 00 04 00 05 00 06 00 [........... .]
# (Viofo A119V3) # (Viofo A119V3)
# 0000: 08 00 00 00 07 00 00 00 18 00 00 00 15 00 00 00 [........... .....] # 0000: 08 00 00 00 07 00 00 00 18 00 00 00 15 00 00 00 [........... .....]
# 0010: 03 00 00 00 0b 00 00 00 41 4e 45 00 01 f2 ac 45 [........ANE ....E] # 0010: 03 00 00 00 0b 00 00 00 41 4e 45 00 01 f2 ac 45 [........ANE ....E]
# 0020: 2d 7f 6e 45 b8 1e 97 41 d7 23 46 43 00 00 00 00 [-.nE...A.#F C....] # 0020: 2d 7f 6e 45 b8 1e 97 41 d7 23 46 43 00 00 00 00 [-.nE...A.#F C....]
# pad with dummy header and parse with existing FreeGPS code (minimu m 92 bytes) # pad with dummy header and parse with existing FreeGPS code (minimu m 92 bytes)
my $dat = ("\0" x 16) . substr($$dataPt, length($1 || '')) . ("\0" x 20); my $dat = ("\0" x 16) . substr($$dataPt, length($1 || '')) . ("\0" x 20);
my $tbl = GetTagTable('Image::ExifTool::QuickTime::Stream'); my $tbl = GetTagTable('Image::ExifTool::QuickTime::Stream');
Image::ExifTool::QuickTime::ProcessFreeGPS($et, { DataPt => \$dat }, $tbl); Image::ExifTool::QuickTime::ProcessFreeGPS($et, { DataPt => \$dat }, $tbl);
$more = 1; $more = 1;
} elsif ($$dataPt =~ /^A([NS])([EW])\0/s) {
# INNOVV TS video (same format is INNOVV MP4)
SetByteOrder('II');
while ($$dataPt =~ /(A[NS][EW]\0.{28})/g) {
my $dat = $1;
my $lat = abs(GetFloat(\$dat, 4)); # (abs just to be safe)
my $lon = abs(GetFloat(\$dat, 8)); # (abs just to be safe)
my $spd = GetFloat(\$dat, 12) * $knotsToKph;
my $trk = GetFloat(\$dat, 16);
my @acc = unpack('x20V3', $dat);
map { $_ = $_ - 4294967296 if $_ >= 0x80000000 } @acc;
my $deg = int($lat / 100);
$lat = $deg + ($lat - $deg * 100) / 60;
$deg = int($lon / 100);
$lon = $deg + ($lon - $deg * 100) / 60;
$$et{DOC_NUM} = ++$$et{DOC_COUNT};
my $tagTbl = GetTagTable('Image::ExifTool::QuickTime::Stream');
$et->HandleTag($tagTbl, GPSLatitude => $lat * (substr($dat,1,1)
eq 'S' ? -1 : 1));
$et->HandleTag($tagTbl, GPSLongitude => $lon * (substr($dat,2,1)
eq 'W' ? -1 : 1));
$et->HandleTag($tagTbl, GPSSpeed => $spd);
$et->HandleTag($tagTbl, GPSSpeedRef => 'K');
$et->HandleTag($tagTbl, GPSTrack => $trk);
$et->HandleTag($tagTbl, GPSTrackRef => 'T');
$et->HandleTag($tagTbl, Accelerometer => "@acc");
}
SetByteOrder('MM');
$more = 1;
} }
} }
return $more; return $more;
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Extract information from a M2TS file # Extract information from a M2TS file
# Inputs: 0) ExifTool object reference, 1) DirInfo reference # Inputs: 0) ExifTool object reference, 1) DirInfo reference
# Returns: 1 on success, 0 if this wasn't a valid M2TS file # Returns: 1 on success, 0 if this wasn't a valid M2TS file
sub ProcessM2TS($$) sub ProcessM2TS($$)
 End of changes. 3 change blocks. 
1 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)