Skip to content

Commit

Permalink
Prep 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
belgattitude committed Jan 5, 2019
1 parent ba86292 commit 36ff9d6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.9.1 (2019-01-05)

### Added

- Missing phpdoc typehints for `VideoInfoInterface`

## 0.9.0 (2019-01-05)

### Added
Expand Down
18 changes: 9 additions & 9 deletions src/Video/VideoInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function getDuration(): float
}

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getDimensions(int $streamIndex = 0): array
{
Expand All @@ -123,7 +123,7 @@ public function getDimensions(int $streamIndex = 0): array
}

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getWidth(int $streamIndex = 0): int
{
Expand All @@ -133,7 +133,7 @@ public function getWidth(int $streamIndex = 0): int
}

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getHeight(int $streamIndex = 0): int
{
Expand All @@ -143,7 +143,7 @@ public function getHeight(int $streamIndex = 0): int
}

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getNbFrames(int $streamIndex = 0): int
{
Expand All @@ -153,7 +153,7 @@ public function getNbFrames(int $streamIndex = 0): int
}

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getVideoBitrate(int $streamIndex = 0): int
{
Expand All @@ -165,7 +165,7 @@ public function getVideoBitrate(int $streamIndex = 0): int
/**
* Convenience method to get audio stream bitrate.
*
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getAudioBitrate(int $streamIndex = 0): int
{
Expand All @@ -175,7 +175,7 @@ public function getAudioBitrate(int $streamIndex = 0): int
}

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getAudioCodecName(int $streamIndex = 0): ?string
{
Expand All @@ -185,7 +185,7 @@ public function getAudioCodecName(int $streamIndex = 0): ?string
}

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getVideoCodecName(int $streamIndex = 0): ?string
{
Expand All @@ -208,7 +208,7 @@ public function getVideoStreamsMetadata(): array
* @throws InvalidArgumentException
*
* @param string $streamType any of self::SUPPORTED_STREAM_TYPES
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*
* @return array<string, mixed>
*/
Expand Down
19 changes: 12 additions & 7 deletions src/Video/VideoInfoInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getFile(): string;
public function getDuration(): float;

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*
* @return array<string, int> associative array with 'height' and 'width'
*/
Expand All @@ -59,40 +59,45 @@ public function getDimensions(int $streamIndex = 0): array;
/**
* Return video stream width.
*
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getWidth(int $streamIndex = 0): int;

/**
* Return video stream height.
*
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getHeight(int $streamIndex = 0): int;

/**
* Return number of frames.
*
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getNbFrames(int $streamIndex = 0): int;

/**
* Return video bitrate of the first video stream.
*
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getVideoBitrate(int $streamIndex = 0): int;

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getVideoCodecName(int $streamIndex = 0): ?string;

/**
* Return video bitrate.
*
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getAudioBitrate(int $streamIndex = 0): int;

/**
* @param int $streamIndex by default will take the first available video stream
* @param int $streamIndex selected a specific stream by index, default: 0 = the first available
*/
public function getAudioCodecName(int $streamIndex = 0): ?string;

Expand Down
10 changes: 10 additions & 0 deletions tests/unit/Video/VideoInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ public function testCountStreams(): void
self::assertEquals(0, $vi->countStreams(VideoInfo::STREAM_TYPE_DATA));
}

public function testGetNbFrames(): void
{
$vi = new VideoInfo($this->getTestFile(), self::getExampleFFProbeData());
self::assertSame(1113, $vi->getNbFrames());

// Non existent video stream
self::assertSame(0, $vi->getNbFrames(2));
}


public function testGetDimensions(): void
{
$vi = new VideoInfo($this->getTestFile(), self::getExampleFFProbeData());
Expand Down

0 comments on commit 36ff9d6

Please sign in to comment.