exiftool_vendored 11.71.0 → 11.75.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of exiftool_vendored might be problematic. Click here for more details.

Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Changes +39 -0
  3. data/bin/MANIFEST +17 -4
  4. data/bin/META.json +1 -1
  5. data/bin/META.yml +1 -1
  6. data/bin/README +23 -26
  7. data/bin/config_files/convert_regions.config +139 -5
  8. data/bin/exiftool +21 -21
  9. data/bin/fmt_files/gpx.fmt +2 -1
  10. data/bin/fmt_files/gpx_wpt.fmt +2 -1
  11. data/bin/fmt_files/kml.fmt +2 -2
  12. data/bin/fmt_files/kml_track.fmt +46 -0
  13. data/bin/lib/Image/ExifTool.pm +42 -33
  14. data/bin/lib/Image/ExifTool.pod +21 -21
  15. data/bin/lib/Image/ExifTool/BuildTagLookup.pm +2 -2
  16. data/bin/lib/Image/ExifTool/Canon.pm +2 -1
  17. data/bin/lib/Image/ExifTool/CanonCustom.pm +30 -4
  18. data/bin/lib/Image/ExifTool/Exif.pm +36 -63
  19. data/bin/lib/Image/ExifTool/FujiFilm.pm +1 -0
  20. data/bin/lib/Image/ExifTool/Lang/ru.pm +4233 -503
  21. data/bin/lib/Image/ExifTool/MakerNotes.pm +6 -12
  22. data/bin/lib/Image/ExifTool/Nikon.pm +2 -1
  23. data/bin/lib/Image/ExifTool/Olympus.pm +2 -1
  24. data/bin/lib/Image/ExifTool/OpenEXR.pm +1 -1
  25. data/bin/lib/Image/ExifTool/Parrot.pm +751 -0
  26. data/bin/lib/Image/ExifTool/Photoshop.pm +12 -11
  27. data/bin/lib/Image/ExifTool/QuickTime.pm +18 -5
  28. data/bin/lib/Image/ExifTool/QuickTimeStream.pl +316 -44
  29. data/bin/lib/Image/ExifTool/Shortcuts.pm +1 -2
  30. data/bin/lib/Image/ExifTool/Sigma.pm +72 -55
  31. data/bin/lib/Image/ExifTool/TagLookup.pm +73 -7
  32. data/bin/lib/Image/ExifTool/TagNames.pod +249 -18
  33. data/bin/lib/Image/ExifTool/Text.pm +160 -0
  34. data/bin/lib/Image/ExifTool/WriteXMP.pl +1 -2
  35. data/bin/lib/Image/ExifTool/Writer.pl +1 -1
  36. data/bin/lib/Image/ExifTool/XMP.pm +19 -26
  37. data/bin/lib/Image/ExifTool/XMP2.pl +46 -9
  38. data/bin/lib/Image/ExifTool/XMPStruct.pl +14 -4
  39. data/bin/perl-Image-ExifTool.spec +19 -19
  40. data/lib/exiftool_vendored/version.rb +1 -1
  41. metadata +6 -7
  42. data/bin/config_files/blueskysea.config +0 -101
  43. data/bin/config_files/dji.config +0 -131
  44. data/bin/config_files/mini0806.config +0 -99
  45. data/bin/config_files/thinkware.config +0 -144
@@ -12,7 +12,7 @@ meta information extracted from or written to a file.
12
12
  =head1 TAG TABLES
13
13
 
14
14
  The tables listed below give the names of all tags recognized by ExifTool.
15
- They contain a total of 23036 tags, with 15080 unique tag names.
15
+ They contain a total of 23164 tags, with 15143 unique tag names.
16
16
 
17
17
  B<Tag ID>, B<Index#> or B<Sequence> is given in the first column of each
18
18
  table. A B<Tag ID> is the computer-readable equivalent of a tag name, and
@@ -317,8 +317,8 @@ other tags which are not part of the EXIF specification, but may co-exist
317
317
  with EXIF tags in some images. Tags which are part of the EXIF 2.32
318
318
  specification have an underlined B<Tag Name> in the HTML version of this
319
319
  documentation. See
320
- L<http://www.cipa.jp/std/documents/download_e.html?DC-008-Translation-2019-E> for the
321
- official EXIF 2.32 specification.
320
+ L<https://web.archive.org/web/20190624045241if_/http://www.cipa.jp:80/std/documents/e/DC-008-Translation-2019-E.pdf>
321
+ for the official EXIF 2.32 specification.
322
322
 
323
323
  Tag ID Tag Name Group Writable
324
324
  ------ -------- ----- --------
@@ -683,7 +683,6 @@ official EXIF 2.32 specification.
683
683
  MakerNoteSanyoC4 ExifIFD Sanyo
684
684
  MakerNoteSanyoPatch ExifIFD Sanyo
685
685
  MakerNoteSigma ExifIFD Sigma
686
- MakerNoteSigma3 ExifIFD Sigma
687
686
  MakerNoteSony ExifIFD Sony
688
687
  MakerNoteSony2 ExifIFD Olympus
689
688
  MakerNoteSony3 ExifIFD Olympus
@@ -880,9 +879,9 @@ official EXIF 2.32 specification.
880
879
  0xc71f RowInterleaveFactor - no
881
880
  0xc725 ProfileLookTableDims IFD0 int32u[3]!
882
881
  0xc726 ProfileLookTableData IFD0 float[n]!
883
- 0xc740 OpcodeList1 SubIFD undef~!
884
- 0xc741 OpcodeList2 SubIFD undef~!
885
- 0xc74e OpcodeList3 SubIFD undef~!
882
+ 0xc740 OpcodeList1 SubIFD undef!
883
+ 0xc741 OpcodeList2 SubIFD undef!
884
+ 0xc74e OpcodeList3 SubIFD undef!
886
885
  0xc761 NoiseProfile SubIFD double[n]!
887
886
  0xc763 TimeCodes IFD0 int8u[n]
888
887
  0xc764 FrameRate IFD0 rational64s
@@ -2437,8 +2436,8 @@ These tags belong to the ExifTool XMP-digiKam family 1 group.
2437
2436
  =head3 XMP exif Tags
2438
2437
 
2439
2438
  EXIF namespace for EXIF tags. See
2440
- L<http://www.cipa.jp/std/documents/e/DC-010-2017_E.pdf> for the
2441
- specification.
2439
+ L<https://web.archive.org/web/20180921145139if_/http://www.cipa.jp:80/std/documents/e/DC-010-2017_E.pdf>
2440
+ for the specification.
2442
2441
 
2443
2442
  These tags belong to the ExifTool XMP-exif family 1 group.
2444
2443
 
@@ -2926,9 +2925,9 @@ These tags belong to the ExifTool XMP-iptcCore family 1 group.
2926
2925
 
2927
2926
  =head3 XMP iptcExt Tags
2928
2927
 
2929
- IPTC Extension namespace tags. The actual namespace prefix is
2930
- "Iptc4xmpExt", but ExifTool shortens this for the family 1 group name. (see
2931
- L<http://www.iptc.org/IPTC4XMP/>)
2928
+ This table contains tags defined by the IPTC Extension schema version 1.5.
2929
+ The actual namespace prefix is "Iptc4xmpExt", but ExifTool shortens this for
2930
+ the family 1 group name. (see L<http://www.iptc.org/IPTC4XMP/>)
2932
2931
 
2933
2932
  These tags belong to the ExifTool XMP-iptcExt family 1 group.
2934
2933
 
@@ -3012,6 +3011,26 @@ These tags belong to the ExifTool XMP-iptcExt family 1 group.
3012
3011
  GenreCvTermName lang-alt_+
3013
3012
  GenreCvTermRefinedAbout string_+
3014
3013
  Headline lang-alt/
3014
+ ImageRegion ImageRegion Struct+
3015
+ ImageRegionName lang-alt_+
3016
+ ImageRegionCtype Entity Struct_+
3017
+ ImageRegionCtypeIdentifier string_+
3018
+ ImageRegionCtypeName lang-alt_+
3019
+ ImageRegionBoundary RegionBoundary Struct_+
3020
+ ImageRegionBoundaryH real_+
3021
+ ImageRegionBoundaryRx real_+
3022
+ ImageRegionBoundaryShape string_+
3023
+ ImageRegionBoundaryUnit string_+
3024
+ ImageRegionBoundaryVertices BoundaryPoint Struct_+
3025
+ ImageRegionBoundaryVerticesX real_+
3026
+ ImageRegionBoundaryVerticesY real_+
3027
+ ImageRegionBoundaryW real_+
3028
+ ImageRegionBoundaryX real_+
3029
+ ImageRegionBoundaryY real_+
3030
+ ImageRegionID string_+
3031
+ ImageRegionRole Entity Struct_+
3032
+ ImageRegionRoleIdentifier string_+
3033
+ ImageRegionRoleName lang-alt_+
3015
3034
  IPTCLastEdited date
3016
3035
  LinkedEncRightsExpr LEREDetails Struct+
3017
3036
  LinkedEncodedRightsExpr string_+
@@ -3074,7 +3093,7 @@ These tags belong to the ExifTool XMP-iptcExt family 1 group.
3074
3093
  PublicationEventIdentifier string_+
3075
3094
  PublicationEventName string_+
3076
3095
  Rating Rating Struct+
3077
- RatingRatingRegion LocationDetails Struct_+
3096
+ RatingRegion LocationDetails Struct_+
3078
3097
  RatingRegionCity string_+
3079
3098
  RatingRegionCountryCode string_+
3080
3099
  RatingRegionCountryName string_+
@@ -3236,6 +3255,41 @@ These tags belong to the ExifTool XMP-iptcExt family 1 group.
3236
3255
  Name string
3237
3256
  Number string
3238
3257
 
3258
+ =head3 XMP ImageRegion Struct
3259
+
3260
+ As well as the fields defined below, this structure may contain any
3261
+ top-level XMP tags, but since they aren't pre-defined the only way to add
3262
+ these tags is to write ImageRegion as a structure with these tags as new
3263
+ fields.
3264
+
3265
+ Field Name Writable
3266
+ ---------- --------
3267
+ Name lang-alt
3268
+ RegionBoundary RegionBoundary Struct
3269
+ RCtype Entity Struct+
3270
+ RId string
3271
+ RRole Entity Struct+
3272
+
3273
+ =head3 XMP RegionBoundary Struct
3274
+
3275
+ Field Name Writable
3276
+ ---------- --------
3277
+ RbH real
3278
+ RbRx real
3279
+ RbShape string
3280
+ RbUnit string
3281
+ RbVertices BoundaryPoint Struct+
3282
+ RbW real
3283
+ RbX real
3284
+ RbY real
3285
+
3286
+ =head3 XMP BoundaryPoint Struct
3287
+
3288
+ Field Name Writable
3289
+ ---------- --------
3290
+ RbX real
3291
+ RbY real
3292
+
3239
3293
  =head3 XMP LEREDetails Struct
3240
3294
 
3241
3295
  Field Name Writable
@@ -3810,8 +3864,8 @@ These tags belong to the ExifTool XMP-swf family 1 group.
3810
3864
  =head3 XMP tiff Tags
3811
3865
 
3812
3866
  EXIF namespace for TIFF tags. See
3813
- L<http://www.cipa.jp/std/documents/e/DC-010-2017_E.pdf> for the
3814
- specification.
3867
+ L<https://web.archive.org/web/20180921145139if_/http://www.cipa.jp:80/std/documents/e/DC-010-2017_E.pdf>
3868
+ for the specification.
3815
3869
 
3816
3870
  These tags belong to the ExifTool XMP-tiff family 1 group.
3817
3871
 
@@ -4335,6 +4389,7 @@ These tags belong to the ExifTool XMP-xmpMM family 1 group.
4335
4389
  ManifestReferenceVersionID string_+
4336
4390
  OriginalDocumentID string
4337
4391
  Pantry PantryItem Struct+
4392
+ PantryInstanceID string_+
4338
4393
  PreservedFileName string
4339
4394
  RenditionClass string
4340
4395
  RenditionOf ResourceRef Struct
@@ -7873,6 +7928,7 @@ well as newer tags and values added by later models.
7873
7928
  0x0813 DefaultEraseOption int32s
7874
7929
  0x0814 RetractLensOnPowerOff int32s
7875
7930
  0x0815 AddIPTCInformation int32s
7931
+ 0x0816 AudioCompression int32s
7876
7932
 
7877
7933
  =head2 CanonVRD Tags
7878
7934
 
@@ -16334,6 +16390,8 @@ are less than consistent about their metadata formats.
16334
16390
  0x0024 Calibration string
16335
16391
  0x0026 FileFormat string
16336
16392
  0x0027 LensType string
16393
+ LensType -
16394
+ Sigma LensType
16337
16395
  0x002a LensFocalRange rational64u[2]
16338
16396
  0x002b LensMaxApertureRange rational64u[2]
16339
16397
  0x002c ColorMode int32u
@@ -16356,10 +16414,14 @@ are less than consistent about their metadata formats.
16356
16414
  0x004d ExposureCompensation rational64s
16357
16415
  0x0055 SensorTemperature string
16358
16416
  0x0056 FlashExposureComp rational64s
16359
- 0x0057 Firmware string
16417
+ 0x0057 Firmware2 string
16360
16418
  0x0058 WhiteBalance string
16361
16419
  0x0059 DigitalFilter string
16362
16420
  0x0084 Model string
16421
+ 0x0086 ISO int16u
16422
+ 0x0087 ResolutionMode string
16423
+ 0x0088 WhiteBalance string
16424
+ 0x008c Firmware string
16363
16425
 
16364
16426
  =head2 Sony Tags
16365
16427
 
@@ -18250,7 +18312,6 @@ still proprietary) Adobe format.
18250
18312
  MakerNoteSanyoC4 Sanyo
18251
18313
  MakerNoteSanyoPatch Sanyo
18252
18314
  MakerNoteSigma Sigma
18253
- MakerNoteSigma3 Sigma
18254
18315
  MakerNoteSony Sony
18255
18316
  MakerNoteSony2 Olympus
18256
18317
  MakerNoteSony3 Olympus
@@ -24602,9 +24663,15 @@ the ExtractEmbedded option is used.
24602
24663
  Tag Name Writable
24603
24664
  -------- --------
24604
24665
  Accelerometer no
24666
+ AccelerometerData no
24605
24667
  AngularVelocity no
24606
24668
  CTMD Canon CTMD
24607
24669
  CameraDateTime no
24670
+ Car no
24671
+ Distance no
24672
+ ExposureCompensation no
24673
+ ExposureTime no
24674
+ FNumber no
24608
24675
  FrameNumber no
24609
24676
  GPSAltitude no
24610
24677
  GPSDOP no
@@ -24617,7 +24684,9 @@ the ExtractEmbedded option is used.
24617
24684
  GPSTimeStamp no
24618
24685
  GPSTrack no
24619
24686
  GPSTrackRef no
24687
+ GSensor no
24620
24688
  INSV QuickTime INSV_MakerNotes
24689
+ ISO no
24621
24690
  JpgFromRaw no
24622
24691
  PreviewInfo QuickTime PreviewInfo
24623
24692
  RVMI_gReV QuickTime RVMI_gReV
@@ -24632,6 +24701,7 @@ the ExtractEmbedded option is used.
24632
24701
  Unknown02? no
24633
24702
  Unknown03? no
24634
24703
  UserLabel no
24704
+ VerticalSpeed no
24635
24705
  camm0 QuickTime camm0
24636
24706
  camm1 QuickTime camm1
24637
24707
  camm2 QuickTime camm2
@@ -24643,6 +24713,7 @@ the ExtractEmbedded option is used.
24643
24713
  fdsc GoPro fdsc
24644
24714
  gpmd GoPro GPMF
24645
24715
  mebx QuickTime Keys
24716
+ mett Parrot mett
24646
24717
  rtmd Sony rtmd
24647
24718
  tx3g QuickTime tx3g
24648
24719
 
@@ -25917,6 +25988,149 @@ Tags used in QTIF QuickTime Image Files.
25917
25988
  'idsc' ImageDescription QuickTime ImageDesc
25918
25989
  'iicc' ICC_Profile ICC_Profile
25919
25990
 
25991
+ =head2 Parrot Tags
25992
+
25993
+ =head3 Parrot mett Tags
25994
+
25995
+ Streaming metadata found in Parrot drone videos. See
25996
+ L<https://developer.parrot.com/docs/pdraw/metadata.html> for the
25997
+ specification.
25998
+
25999
+ Tag ID Tag Name Writable
26000
+ ------ -------- --------
26001
+ 'P1' ParrotV1 Parrot V1
26002
+ 'P2' ParrotV2 Parrot V2
26003
+ 'P3' ParrotV3 Parrot V3
26004
+ 'E1' ParrotTimeStamp Parrot TimeStamp
26005
+ 'E2' ParrotFollowMe Parrot FollowMe
26006
+ 'E3' ParrotAutomation Parrot Automation
26007
+
26008
+ =head3 Parrot V1 Tags
26009
+
26010
+ Parrot version 1 streaming metadata.
26011
+
26012
+ Index1 Tag Name Writable
26013
+ ------ -------- --------
26014
+ 4 DroneYaw no
26015
+ 6 DronePitch no
26016
+ 8 DroneRoll no
26017
+ 10 CameraPan no
26018
+ 12 CameraTilt no
26019
+ 14 FrameView no
26020
+ 22 ExposureTime no
26021
+ 24 ISO no
26022
+ 26 WifiRSSI no
26023
+ 27 Battery no
26024
+ 28 GPSLatitude no
26025
+ 32 GPSLongitude no
26026
+ 36 GPSAltitude no
26027
+ 36.1 GPSSatellites no
26028
+ 40 AltitudeFromTakeOff no
26029
+ 44 DistanceFromHome no
26030
+ 48 SpeedX no
26031
+ 50 SpeedY no
26032
+ 52 SpeedZ no
26033
+ 54 Binning no
26034
+ 54.1 FlyingState no
26035
+ 55 Animation no
26036
+ 55.1 PilotingMode no
26037
+
26038
+ =head3 Parrot V2 Tags
26039
+
26040
+ Parrot version 2 basic streaming metadata.
26041
+
26042
+ Index1 Tag Name Writable
26043
+ ------ -------- --------
26044
+ 4 Elevation no
26045
+ 8 GPSLatitude no
26046
+ 12 GPSLongitude no
26047
+ 16 GPSAltitude no
26048
+ 16.1 GPSSatellites no
26049
+ 20 GPSVelocityNorth no
26050
+ 22 GPSVelocityEast no
26051
+ 24 GPSVelocityDown no
26052
+ 26 AirSpeed no
26053
+ 28 DroneQuaternion no
26054
+ 36 FrameView no
26055
+ 44 CameraPan no
26056
+ 46 CameraTilt no
26057
+ 48 ExposureTime no
26058
+ 50 ISO no
26059
+ 52 Binning no
26060
+ 52.1 FlyingState no
26061
+ 53 Animation no
26062
+ 53.1 PilotingMode no
26063
+ 54 WifiRSSI no
26064
+ 55 Battery no
26065
+ 'Groups' Groups no
26066
+
26067
+ =head3 Parrot V3 Tags
26068
+
26069
+ Parrot version 3 basic streaming metadata.
26070
+
26071
+ Index1 Tag Name Writable
26072
+ ------ -------- --------
26073
+ 4 Elevation no
26074
+ 8 GPSLatitude no
26075
+ 12 GPSLongitude no
26076
+ 16 GPSAltitude no
26077
+ 16.1 GPSSatellites no
26078
+ 20 GPSVelocityNorth no
26079
+ 22 GPSVelocityEast no
26080
+ 24 GPSVelocityDown no
26081
+ 26 AirSpeed no
26082
+ 28 DroneQuaternion no
26083
+ 36 FrameBaseView no
26084
+ 44 FrameView no
26085
+ 52 ExposureTime no
26086
+ 54 ISO no
26087
+ 56 RedBalance no
26088
+ 58 BlueBalance no
26089
+ 60 FOV no
26090
+ 64 LinkGoodput no
26091
+ 64.1 LinkQuality no
26092
+ 68 WifiRSSI no
26093
+ 69 Battery no
26094
+ 70 Binning no
26095
+ 70.1 FlyingState no
26096
+ 71 Animation no
26097
+ 71.1 PilotingMode no
26098
+
26099
+ =head3 Parrot TimeStamp Tags
26100
+
26101
+ Parrot streaming metadata timestamp extension.
26102
+
26103
+ Index1 Tag Name Writable
26104
+ ------ -------- --------
26105
+ 4 TimeStamp no
26106
+
26107
+ =head3 Parrot FollowMe Tags
26108
+
26109
+ Parrot streaming metadata follow-me extension.
26110
+
26111
+ Index1 Tag Name Writable
26112
+ ------ -------- --------
26113
+ 4 GPSTargetLatitude no
26114
+ 8 GPSTargetLongitude no
26115
+ 12 GPSTargetAltitude no
26116
+ 16 Follow-meMode no
26117
+ 17 Follow-meAnimation no
26118
+
26119
+ =head3 Parrot Automation Tags
26120
+
26121
+ Parrot streaming metadata automation extension.
26122
+
26123
+ Index1 Tag Name Writable
26124
+ ------ -------- --------
26125
+ 4 GPSFramingLatitude no
26126
+ 8 GPSFramingLongitude no
26127
+ 12 GPSFramingAltitude no
26128
+ 16 GPSDestLatitude no
26129
+ 20 GPSDestLongitude no
26130
+ 24 GPSDestAltitude no
26131
+ 28 AutomationAnimation no
26132
+ 29 AutomationFlags no
26133
+
25920
26134
  =head2 PLIST Tags
25921
26135
 
25922
26136
  Apple Property List tags. ExifTool reads both XML and binary-format PLIST
@@ -33012,6 +33226,21 @@ name. See L<http://tools.ietf.org/html/rfc5545> for the official iCalendar
33012
33226
  'X-wr-relcalid' CalendarID no
33013
33227
  'X-wr-timezone' TimeZone2 no
33014
33228
 
33229
+ =head2 Text Tags
33230
+
33231
+ Although basic text files contain no metadata, the following tags are
33232
+ determined from a simple analysis of the text data. LineCount and WordCount
33233
+ are generated only for 8-bit character sets if the FastScan option is not
33234
+ used.
33235
+
33236
+ Tag Name Writable
33237
+ -------- --------
33238
+ ByteOrderMark no
33239
+ LineCount no
33240
+ MIMEEncoding no
33241
+ Newlines no
33242
+ WordCount no
33243
+
33015
33244
  =head2 RSRC Tags
33016
33245
 
33017
33246
  Tags extracted from Mac OS resource files and DFONT files. These tags may
@@ -33656,6 +33885,9 @@ values, may created via the ExifTool configuration file.
33656
33885
  GPSAltitudeRef QuickTime:LocationInformation no
33657
33886
  GPSDateTime GPS:GPSDateStamp no
33658
33887
  GPS:GPSTimeStamp
33888
+ GPSDateTime Parrot:GPSLatitude no
33889
+ Main:CreateDate
33890
+ SampleTime
33659
33891
  GPSDestLatitude GPS:GPSDestLatitude no
33660
33892
  GPS:GPSDestLatitudeRef
33661
33893
  GPSDestLatitudeRef XMP-exif:GPSDestLatitude no
@@ -34033,7 +34265,6 @@ for more details.
34033
34265
  MakerNoteSanyoC4
34034
34266
  MakerNoteSanyoPatch
34035
34267
  MakerNoteSigma
34036
- MakerNoteSigma3
34037
34268
  MakerNoteSony
34038
34269
  MakerNoteSony2
34039
34270
  MakerNoteSony3
@@ -0,0 +1,160 @@
1
+ #------------------------------------------------------------------------------
2
+ # File: Text.pm
3
+ #
4
+ # Description: Deduce characteristics of a text file
5
+ #
6
+ # Revisions: 2019-11-01 - P. Harvey Created
7
+ #
8
+ # References: 1) https://github.com/file/file
9
+ #------------------------------------------------------------------------------
10
+
11
+ package Image::ExifTool::Text;
12
+
13
+ use strict;
14
+ use vars qw($VERSION);
15
+ use Image::ExifTool qw(:DataAccess :Utils);
16
+ use Image::ExifTool::XMP;
17
+
18
+ $VERSION = '1.00';
19
+
20
+ # Text tags
21
+ %Image::ExifTool::Text::Main = (
22
+ VARS => { NO_ID => 1 },
23
+ GROUPS => { 0 => 'File', 1 => 'File', 2 => 'Document' },
24
+ NOTES => q{
25
+ Although basic text files contain no metadata, the following tags are
26
+ determined from a simple analysis of the text data. LineCount and WordCount
27
+ are generated only for 8-bit character sets if the FastScan option is not
28
+ used.
29
+ },
30
+ MIMEEncoding => { Groups => { 2 => 'Other' } },
31
+ Newlines => {
32
+ PrintConv => {
33
+ "\r\n" => 'Windows CRLF',
34
+ "\r" => 'Macintosh CR',
35
+ "\n" => 'Unix LF',
36
+ '' => '(none)',
37
+ },
38
+ },
39
+ ByteOrderMark => { PrintConv => { 0 => 'No', 1 => 'Yes' } },
40
+ LineCount => { },
41
+ WordCount => { },
42
+ );
43
+
44
+ #------------------------------------------------------------------------------
45
+ # Extract some stats from a text file
46
+ # Inputs: 0) ExifTool ref, 1) dirInfo ref
47
+ # Returns: 1 on success, 0 if this wasn't a text file
48
+ sub ProcessTXT($$)
49
+ {
50
+ my ($et, $dirInfo) = @_;
51
+ my $dataPt = $$dirInfo{TestBuff};
52
+ my $fast = $et->Options('FastScan') || 0;
53
+ my ($buff, $enc, $isBOM);
54
+ my $nl = '';
55
+
56
+ return 0 unless length $$dataPt; # can't call it a text file if it has no text
57
+
58
+ if ($$dataPt =~ /[\0-\x06\x0e-\x1f\x7f\xff]/) {
59
+ # file contains weird control characters, could be multi-byte Unicode
60
+ if ($$dataPt =~ /^(\xff\xfe\0\0|\0\0\xfe\xff)/) {
61
+ if ($1 eq "\xff\xfe\0\0") {
62
+ $enc = 'utf-32le';
63
+ $nl = $1 if $$dataPt =~ /(\r\0\0\0\n|\r|\n)\0\0\0/;
64
+ } else {
65
+ $enc = 'utf-32be';
66
+ $nl = $1 if $$dataPt =~ /\0\0\0(\r\0\0\0\n|\r|\n)/;
67
+ }
68
+ } elsif ($$dataPt =~ /^(\xff\xfe|\xfe\xff)/) {
69
+ if ($1 eq "\xff\xfe") {
70
+ $enc = 'utf-16le';
71
+ $nl = $1 if $$dataPt =~ /(\r\0\n|\r|\n)\0/;
72
+ } else {
73
+ $enc = 'utf-16be';
74
+ $nl = $1 if $$dataPt =~ /\0(\r\0\n|\r|\n)/;
75
+ }
76
+ } else {
77
+ return 0; # probably not a text file
78
+ }
79
+ $nl =~ tr/\0//d; # remove nulls from newline sequence
80
+ $isBOM = 1; # (we don't recognize UTF-16/UTF-32 without one)
81
+ } else {
82
+ if ($$dataPt !~ /[\x80-\xff]/) {
83
+ $enc = 'us-ascii';
84
+ } elsif (Image::ExifTool::XMP::IsUTF8($dataPt,1) > 0) {
85
+ $enc = 'utf-8';
86
+ $isBOM = ($$dataPt =~ /^\xef\xbb\xbf/ ? 1 : 0);
87
+ } elsif ($$dataPt !~ /[\x80-\x9f]/) {
88
+ $enc = 'iso-8859-1';
89
+ } else {
90
+ $enc = 'unknown-8bit';
91
+ }
92
+ $nl = $1 if $$dataPt =~ /(\r\n|\r|\n)/;
93
+ }
94
+
95
+ my $tagTablePtr = GetTagTable('Image::ExifTool::Text::Main');
96
+ $et->SetFileType();
97
+ $et->HandleTag($tagTablePtr, MIMEEncoding => $enc);
98
+ return 1 if $fast == 3;
99
+ $et->HandleTag($tagTablePtr, ByteOrderMark => $isBOM) if defined $isBOM;
100
+ $et->HandleTag($tagTablePtr, Newlines => $nl);
101
+ unless ($enc =~ /^utf-(16|32)/ or $fast) {
102
+ my $raf = $$dirInfo{RAF};
103
+ my ($lines, $words) = (0, 0);
104
+ my $oldNL = $/;
105
+ $/ = $nl if $nl;
106
+ while ($raf->ReadLine($buff)) {
107
+ if (not $nl and $buff =~ /(\r\n|\r|\n)$/) {
108
+ # (the first line must have been longer than 1024 characters)
109
+ $$et{VALUE}{Newlines} = $nl = $1;
110
+ }
111
+ ++$lines;
112
+ ++$words while $buff =~ /\S+/g;
113
+ }
114
+ $/ = $oldNL;
115
+ $et->HandleTag($tagTablePtr, LineCount => $lines);
116
+ $et->HandleTag($tagTablePtr, WordCount => $words);
117
+ }
118
+ return 1;
119
+ }
120
+
121
+
122
+ 1; # end
123
+
124
+ __END__
125
+
126
+ =head1 NAME
127
+
128
+ Image::ExifTool::Text - Read Text meta information
129
+
130
+ =head1 SYNOPSIS
131
+
132
+ This module is used by Image::ExifTool
133
+
134
+ =head1 DESCRIPTION
135
+
136
+ This module contains definitions required by Image::ExifTool to deduce some
137
+ characteristics of Text files.
138
+
139
+ =head1 AUTHOR
140
+
141
+ Copyright 2003-2019, Phil Harvey (phil at owl.phy.queensu.ca)
142
+
143
+ This library is free software; you can redistribute it and/or modify it
144
+ under the same terms as Perl itself.
145
+
146
+ =head1 REFERENCES
147
+
148
+ =over 4
149
+
150
+ =item L<https://github.com/file/file>
151
+
152
+ =back
153
+
154
+ =head1 SEE ALSO
155
+
156
+ L<Image::ExifTool::TagNames/Text Tags>,
157
+ L<Image::ExifTool(3pm)|Image::ExifTool>
158
+
159
+ =cut
160
+