/** * @covers MediaVorus\MediaCollection::match */ public function testMatch() { $logger = new Logger('test'); $logger->pushHandler(new NullHandler()); $mediavorus = new MediaVorus(Reader::create($logger), Writer::create($logger), FFProbe::create()); $collection = $mediavorus->inspectDirectory(__DIR__ . '/../../files/'); $audio = $collection->match(new MediaType(MediaInterface::TYPE_AUDIO)); $this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $audio); $this->assertGreaterThan(0, $audio->count()); foreach ($audio as $audio) { $this->assertEquals(MediaInterface::TYPE_AUDIO, $audio->getType()); } $notAudio = $collection->match(new MediaType(MediaInterface::TYPE_AUDIO), true); $this->assertGreaterThan(0, $notAudio->count()); $this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $notAudio); foreach ($notAudio as $audio) { $this->assertFalse(MediaInterface::TYPE_AUDIO === $audio->getType()); } }
public function setUp() { parent::setUp(); $this->mediavorus = MediaVorus::create(); $this->file = __DIR__ . '/../../../files/videoFlashed.MOV'; $this->object = $this->mediavorus->guess($this->file); }
public function __construct($id, AMQPConnection $conn, $queue, TemporaryFilesystem $filesystem, Logger $logger) { $this->id = $id; $this->queue = $queue; $this->conn = $conn; $this->channel = $conn->channel(); $this->logger = $logger; $this->filesystem = $filesystem; $this->jobCounter = new Counter(); $this->mediavorus = MediaVorus::create(); AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . '/../../../vendor/jms/serializer/src'); $this->serializer = $serializer = SerializerBuilder::create()->setCacheDir(__DIR__ . '/../../../cache')->build(); $this->running = false; declare (ticks=1); $this->clock = new Clock(); $this->clock->addPeriodicTimer(1, array($this, 'sendPresence')); }
/** * @covers MediaVorus\MediaVorus::create */ public function testCreate() { $this->assertInstanceOf('MediaVorus\\MediaVorus', MediaVorus::create()); }
/** * Read the technical datas of the file. * Returns an empty array for non physical present files * * @return array An array of technical datas Key/values */ public function readTechnicalDatas(MediaVorus $mediavorus) { if (!$this->is_physically_present()) { return []; } $media = $mediavorus->guess($this->get_pathfile()); $datas = []; $methods = [self::TC_DATA_WIDTH => 'getWidth', self::TC_DATA_HEIGHT => 'getHeight', self::TC_DATA_FOCALLENGTH => 'getFocalLength', self::TC_DATA_CHANNELS => 'getChannels', self::TC_DATA_COLORDEPTH => 'getColorDepth', self::TC_DATA_CAMERAMODEL => 'getCameraModel', self::TC_DATA_FLASHFIRED => 'getFlashFired', self::TC_DATA_APERTURE => 'getAperture', self::TC_DATA_SHUTTERSPEED => 'getShutterSpeed', self::TC_DATA_HYPERFOCALDISTANCE => 'getHyperfocalDistance', self::TC_DATA_ISO => 'getISO', self::TC_DATA_LIGHTVALUE => 'getLightValue', self::TC_DATA_COLORSPACE => 'getColorSpace', self::TC_DATA_DURATION => 'getDuration', self::TC_DATA_FRAMERATE => 'getFrameRate', self::TC_DATA_AUDIOSAMPLERATE => 'getAudioSampleRate', self::TC_DATA_VIDEOCODEC => 'getVideoCodec', self::TC_DATA_AUDIOCODEC => 'getAudioCodec', self::TC_DATA_ORIENTATION => 'getOrientation']; foreach ($methods as $tc_name => $method) { if (method_exists($media, $method)) { $result = call_user_func([$media, $method]); if (null !== $result) { $datas[$tc_name] = $result; } } } $datas[self::TC_DATA_LONGITUDE] = $media->getLongitude(); $datas[self::TC_DATA_LATITUDE] = $media->getLatitude(); $datas[self::TC_DATA_MIMETYPE] = $media->getFile()->getMimeType(); $datas[self::TC_DATA_FILESIZE] = $media->getFile()->getSize(); unset($media); return $datas; }