Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit fe86806

Browse files
committed
Add legacy support for ogg file format
1 parent ec87244 commit fe86806

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

admin/rt-transcoder-handler.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class RT_Transcoder_Handler {
8383
* @access public
8484
* @var string $audio_extensions Audio extensions with comma separated.
8585
*/
86-
public $audio_extensions = ',wma,ogg,wav,m4a';
86+
public $audio_extensions = ',wma,wav,m4a';
8787

8888
/**
8989
* Initialize the class and set its properties.
@@ -185,24 +185,26 @@ function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat = true
185185

186186
$type_arry = explode( '.', $url );
187187
$type = strtolower( $type_arry[ count( $type_arry ) - 1 ] );
188+
$extension = pathinfo( $path, PATHINFO_EXTENSION );
188189
$not_allowed_type = array( 'mp3' );
189190
preg_match( '/video|audio/i', $metadata['mime_type'], $type_array );
190191

191-
if ( preg_match( '/video|audio/i', $metadata['mime_type'], $type_array ) && ! in_array( $metadata['mime_type'], array( 'audio/mp3' ), true ) && ! in_array( $type, $not_allowed_type, true ) ) {
192+
if ( ( preg_match( '/video|audio/i', $metadata['mime_type'], $type_array ) || 'application/ogg' === $metadata['mime_type'] ) && ! in_array( $metadata['mime_type'], array( 'audio/mp3' ), true ) && ! in_array( $type, $not_allowed_type, true ) ) {
192193
$options_video_thumb = $this->get_thumbnails_required( $attachment_id );
193194
if ( empty( $options_video_thumb ) ) {
194195
$options_video_thumb = 5;
195196
}
196197

197-
$job_type = 'video';
198198
/** FORMAT * */
199199
if ( 'video/mp4' === $metadata['mime_type'] && 'mp4' === $type ) {
200200
$autoformat = 'thumbnails';
201201
$job_type = 'thumbnail';
202-
}
203-
204-
if ( 'audio' === $type_array[0] ) {
202+
} elseif ( 'audio' === $type_array[0] || in_array( $extension, explode( ',', $this->audio_extensions ), true ) ) {
205203
$job_type = 'audio';
204+
} elseif ( 'application/ogg' === $metadata['mime_type'] ) {
205+
$job_type = 'ogg';
206+
} else {
207+
$job_type = 'video';
206208
}
207209

208210
/** Figure out who is requesting this job **/

0 commit comments

Comments
 (0)