private function getExtensionFromSpec(SpecificationInterface $spec)
    {
        switch ($spec->getType()) {
            case SpecificationInterface::TYPE_IMAGE:
                return $this->getExtensionFromImageCodec($spec->getImageCodec());
            case SpecificationInterface::TYPE_ANIMATION:
                return 'gif';
            case SpecificationInterface::TYPE_AUDIO:
                return $this->getExtensionFromAudioCodec($spec->getAudioCodec());
            case SpecificationInterface::TYPE_VIDEO:
                return $this->getExtensionFromVideoCodec($spec->getVideoCodec());
            case SpecificationInterface::TYPE_SWF:
                return 'swf';
            case PdfSpecification::TYPE_PDF:
                return 'pdf';
        }

        return null;
    }