Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
- "8.4"

steps:
- name: Install PHP
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
# php examples/dump-media.php -d tests/media-samples/image/broken/pel-176-RPT200076_03.jpg

- name: Run test suite
continue-on-error: true
# continue-on-error: true
run: vendor/bin/phpunit --color=always --testdox --display-deprecations --display-phpunit-deprecations ./tests

# - name: Code style test
Expand All @@ -84,5 +84,5 @@ jobs:
# - name: "Install PHPStan"
# run: "composer require --dev phpstan/phpstan:^1.2 --ansi"

- name: "Run a static analysis with phpstan/phpstan"
run: vendor/bin/phpstan analyze
# - name: "Run a static analysis with phpstan/phpstan"
# run: vendor/bin/phpstan analyze
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"monolog/monolog": "^3",
"shanethehat/pretty-xml": "*",
"sibche/plist": "*",
"symfony/stopwatch": "^7"
"symfony/stopwatch": "^7.2"
},
"require-dev" : {
"ext-exif": "*",
"phpunit/phpunit": "^10 | ^11",
"phpunit/phpunit": "^11",
"squizlabs/php_codesniffer": "*",
"symfony/console": "^7",
"symfony/finder": "^7",
"symfony/filesystem": "^7",
"symfony/process": "^7",
"symfony/var-dumper": "^7",
"symfony/yaml": "^7",
"symfony/console": "^7.2",
"symfony/finder": "^7.2",
"symfony/filesystem": "^7.2",
"symfony/process": "^7.2",
"symfony/var-dumper": "^7.2",
"symfony/yaml": "^7.2",
"bramus/monolog-colored-line-formatter": "^3",
"phpstan/phpstan": "^2",
"phpstan/extension-installer": "*",
Expand Down
41 changes: 20 additions & 21 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="MediaProbe Testing Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<!-- Filter for coverage reports. -->
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
<exclude>
<directory suffix=".php">./src/Command/</directory>
<directory suffix=".php">./src/Collection/</directory>
</exclude>
</whitelist>
</filter>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="MediaProbe Testing Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<!-- Filter for coverage reports. -->
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Command/</directory>
<directory suffix=".php">./src/Collection/</directory>
</exclude>
</source>
</phpunit>
3 changes: 3 additions & 0 deletions specs/ExifMakerNotes/Apple/Main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ items:
DOMNode: 'Apple:BurstUUID'
desc: 'Burst UUID'
12:
entryClass: FileEye\MediaProbe\Entry\Vendor\Apple\Exif\FocusDistanceRange
exiftool:
-
name: FocusDistanceRange
Expand All @@ -121,6 +122,7 @@ items:
DOMNode: 'Apple:ContentIdentifier'
desc: 'Content Identifier'
20:
entryClass: FileEye\MediaProbe\Entry\Vendor\Apple\Exif\ImageCaptureType
exiftool:
-
name: ImageCaptureType
Expand Down Expand Up @@ -199,6 +201,7 @@ items:
DOMNode: 'Apple:HDRHeadroom'
desc: 'HDR Headroom'
35:
entryClass: FileEye\MediaProbe\Entry\Vendor\Apple\Exif\AFPerformance
exiftool:
-
name: AFPerformance
Expand Down
1 change: 1 addition & 0 deletions specs/ExifMakerNotes/Apple/RunTime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ items:
DOMNode: 'Apple:RunTimeEpoch'
desc: 'Run Time Epoch'
flags:
entryClass: FileEye\MediaProbe\Entry\Vendor\Apple\Exif\RunTimeFlags
format: Char
exiftool:
-
Expand Down
1 change: 1 addition & 0 deletions specs/ExifMakerNotes/Canon/CameraSettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ items:
DOMNode: 'Canon:FlashActivity'
desc: 'Flash Activity'
29:
entryClass: FileEye\MediaProbe\Entry\Vendor\Canon\Exif\CameraSettings\FlashBits
exiftool:
-
name: FlashBits
Expand Down
3 changes: 3 additions & 0 deletions src/Collection/ExifMakerNotes/Apple/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ class Main extends CollectionBase {
array (
0 =>
array (
'entryClass' => 'FileEye\\MediaProbe\\Entry\\Vendor\\Apple\\Exif\\FocusDistanceRange',
'collection' => 'Tiff\\Tag',
'name' => 'FocusDistanceRange',
'title' => 'Focus Distance Range',
Expand Down Expand Up @@ -549,6 +550,7 @@ class Main extends CollectionBase {
array (
0 =>
array (
'entryClass' => 'FileEye\\MediaProbe\\Entry\\Vendor\\Apple\\Exif\\ImageCaptureType',
'collection' => 'Tiff\\Tag',
'name' => 'ImageCaptureType',
'title' => 'Image Capture Type',
Expand Down Expand Up @@ -686,6 +688,7 @@ class Main extends CollectionBase {
array (
0 =>
array (
'entryClass' => 'FileEye\\MediaProbe\\Entry\\Vendor\\Apple\\Exif\\AFPerformance',
'collection' => 'Tiff\\Tag',
'name' => 'AFPerformance',
'title' => 'AF Performance',
Expand Down
1 change: 1 addition & 0 deletions src/Collection/ExifMakerNotes/Apple/RunTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class RunTime extends CollectionBase {
array (
0 =>
array (
'entryClass' => 'FileEye\\MediaProbe\\Entry\\Vendor\\Apple\\Exif\\RunTimeFlags',
'format' =>
array (
0 => 2000,
Expand Down
1 change: 1 addition & 0 deletions src/Collection/ExifMakerNotes/Canon/CameraSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,7 @@ class CameraSettings extends CollectionBase {
array (
0 =>
array (
'entryClass' => 'FileEye\\MediaProbe\\Entry\\Vendor\\Canon\\Exif\\CameraSettings\\FlashBits',
'collection' => 'Tiff\\Tag',
'name' => 'FlashBits',
'title' => 'Flash Bits',
Expand Down
14 changes: 14 additions & 0 deletions src/Entry/Vendor/Apple/Exif/AFPerformance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace FileEye\MediaProbe\Entry\Vendor\Apple\Exif;

use FileEye\MediaProbe\Entry\Core\SignedLong;

class AFPerformance extends SignedLong
{
public function toString(array $options = []): string
{
$value = $this->getValue($options);
return sprintf('%d %d %d', $value[0], $value[1] >> 28, $value[1] & 0xfffffff);
}
}
16 changes: 16 additions & 0 deletions src/Entry/Vendor/Apple/Exif/FocusDistanceRange.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace FileEye\MediaProbe\Entry\Vendor\Apple\Exif;

use FileEye\MediaProbe\Entry\Core\SignedRational;

class FocusDistanceRange extends SignedRational
{
public function toString(array $options = []): string
{
$value = $this->getValue($options);
return $value[0] <= $value[1] ?
sprintf('%4.2f - %4.2f m', $value[0], $value[1]) :
sprintf('%4.2f - %4.2f m', $value[1], $value[0]);
}
}
14 changes: 14 additions & 0 deletions src/Entry/Vendor/Apple/Exif/ImageCaptureType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace FileEye\MediaProbe\Entry\Vendor\Apple\Exif;

use FileEye\MediaProbe\Entry\Core\SignedLong;

class ImageCaptureType extends SignedLong
{
public function toString(array $options = []): string
{
$value = (int) $this->getValue($options);
return $this->getMappedText($value) ?? sprintf('Unknown (%d)', $value);
}
}
27 changes: 27 additions & 0 deletions src/Entry/Vendor/Apple/Exif/RunTimeFlags.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace FileEye\MediaProbe\Entry\Vendor\Apple\Exif;

use FileEye\MediaProbe\Entry\Core\Char;

class RunTimeFlags extends Char
{
public function toString(array $options = []): string
{
$value = (int) $this->getValue($options);
$ret = [];
for ($i = 0; $i < 32; $i++) {
$mask = 2 ** $i;
if ($value & $mask) {
$text = $this->getMappedText('Bit' . (string) $i);

if ($text === null) {
$text = '[' . (string) $i . ']';
}

$ret[] = $text;
}
}
return implode(', ', $ret);
}
}
32 changes: 32 additions & 0 deletions src/Entry/Vendor/Canon/Exif/CameraSettings/FlashBits.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace FileEye\MediaProbe\Entry\Vendor\Canon\Exif\CameraSettings;

use FileEye\MediaProbe\Entry\Core\SignedShort;

class FlashBits extends SignedShort
{
public function toString(array $options = []): string
{
$value = (int) $this->getValue($options);

if ($value === 0) {
return $this->getMappedText($value);
}

$ret = [];
for ($i = 0; $i < 32; $i++) {
$mask = 2 ** $i;
if ($value & $mask) {
$text = $this->getMappedText('Bit' . (string) $i);

if ($text === null) {
$text = '[' . (string) $i . ']';
}

$ret[] = $text;
}
}
return implode(', ', $ret);
}
}
19 changes: 5 additions & 14 deletions src/Entry/Vendor/Canon/Exif/Functions2/AEBShotCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,17 @@
*/
class AEBShotCount extends SignedLong
{
/**
* {@inheritdoc}
*/
public static function resolveItemCollectionIndex(?int $components_count, ElementInterface $context): mixed
{
switch ($components_count) {
case 1:
return 0;

case 2:
return 1;
}
return match ($components_count) {
1 => 1,
2 => 2,
};
}

/**
* {@inheritdoc}
*/
public function toString(array $options = []): string
{
$val = $this->getValue($options);
return $this->getMappedText(is_array($val) ? implode(' ', $val) : $val);
return $this->getMappedText(is_array($val) ? implode(' ', $val) : $val) ?? '';
}
}
34 changes: 25 additions & 9 deletions src/Entry/Vendor/Canon/Exif/Functions2/TimerLength.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,40 @@

namespace FileEye\MediaProbe\Entry\Vendor\Canon\Exif\Functions2;

use FileEye\MediaProbe\Model\ElementInterface;
use FileEye\MediaProbe\Entry\Core\SignedLong;

/**
* Handler for CanonCustom TimerLength tags.
*/
class TimerLength extends SignedLong
{
/**
* {@inheritdoc}
*/
public static function resolveItemCollectionIndex(?int $components_count, ElementInterface $context): mixed
{
return match ($components_count) {
3 => 0,
4 => 1,
};
}

public function toString(array $options = []): string
{
$val = $this->getValue($options);
$ret = [];
$ret[] = $this->getMappedText($val[0]);
$ret[] = '6 s: ' . $val[1];
$ret[] = '16 s: ' . $val[2];
$ret[] = 'After release: ' . $val[3];
return implode('; ', $ret);

if (count($val) === 4) {
$ret = [];
$ret[] = $this->getMappedText($val[0]);
$ret[] = '6 s: ' . $val[1];
$ret[] = '16 s: ' . $val[2];
$ret[] = 'After release: ' . $val[3];
return implode('; ', $ret);
}
else {
$ret = [];
$ret[] = '6 s: ' . $val[1];
$ret[] = '16 s: ' . $val[2];
$ret[] = 'After release: ' . $val[3];
return implode('; ', $ret);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
*/
class ViewfinderWarnings extends SignedLong
{
/**
* {@inheritdoc}
*/
public function toString(array $options = []): string
{
$value = (int) $this->getValue($options);

$ret = [];
for ($i = 0; $i < 32; $i++) {
$mask = 2 ** $i;
if ($value & $mask) {
$text = $this->getMappedText($mask);
$text = $this->getMappedText('Bit' . (string) $i);

if ($text === null) {
$text = '[' . (string) $i . ']';
Expand Down
Loading
Loading