Homarus/src/Controller/HomarusController.php
private function getFfmpegFormat(array $content_types)
    {
        $content_type = null;
        foreach ($content_types as $type) {
            if (in_array($type, $this->mimetypes)) {
                $content_type = $type;
                break;
            }
        }

        if ($content_type === null) {
            $this->log->info('No matching content-type, falling back to default.');
            return [$this->default_mimetype, $this->default_format];
        }

        foreach ($this->mime_to_format as $format) {
            $format_info = explode("_", $format);
            if ($format_info[0] == $content_type) {
                return [$content_type, $format_info[1]];
            }
        }
        $this->log->info('No matching content-type to format mapping, falling back to default.');
        return [$this->default_mimetype, $this->default_format];
    }
private function getFfmpegFormat(array $content_types)
    {
        $content_type = null;
        foreach ($content_types as $type) {
            if (in_array($type, $this->mimetypes)) {
                $content_type = $type;
                break;
            }
        }

        if ($content_type === null) {
            $this->log->info('No matching content-type, falling back to default.');
            return [$this->default_mimetype, $this->default_format];
        }

        foreach ($this->mime_to_format as $format) {
            $format_info = explode("_", $format);
            if ($format_info[0] == $content_type) {
                return [$content_type, $format_info[1]];
            }
        }
        $this->log->info('No matching content-type to format mapping, falling back to default.');
        return [$this->default_mimetype, $this->default_format];
    }
private function getFfmpegFormat ( array $ content_types ) { $ content_type = null ; foreach ( $ content_types as $ type ) { if ( in_array ( $ type , $ this -> mimetypes ) ) { $ content_type = $ type ; break ; } } if ( $ content_type === null ) { $ this -> log -> info ( 'No matching content-type, falling back to default.' ) ; return [ $ this -> default_mimetype , $ this -> default_format ] ; } foreach ( $ this -> mime_to_format as $ format ) { $ format_info = explode ( "_" , $ format ) ; if ( $ format_info [ 0 ] == $ content_type ) { return [ $ content_type , $ format_info [ 1 ] ] ; } } $ this -> log -> info ( 'No matching content-type to format mapping, falling back to default.' ) ; return [ $ this -> default_mimetype , $ this -> default_format ] ; }
Filters through an array of acceptable content-types and returns a FFmpeg format.

@param array $content_types
The Accept content-types.

@return array
Array with [ $content-type, $format ], falls back to defaults.
Filters through an array of acceptable content - types and returns a FFmpeg format .