refact (core): removes useless fields from CODEC_INFO
This commit is contained in:
@@ -13,18 +13,18 @@ export function useFilterCodecs(
|
||||
) {
|
||||
const filteredAudioCodecs = useMemo(() => {
|
||||
const entry = compatibility?.[container || '']
|
||||
if (!entry) return codecs.filter(c => c.supports_transcoding)
|
||||
if (!entry) return codecs.filter(c => c.codec_type === 'audio')
|
||||
const audioList = entry.audio
|
||||
if (audioList === null) return codecs.filter(c => c.supports_transcoding)
|
||||
return codecs.filter(c => c.supports_transcoding && audioList.includes(c.name))
|
||||
if (audioList === null) return codecs.filter(c => c.codec_type === 'audio')
|
||||
return codecs.filter(c => c.codec_type === 'audio' && audioList.includes(c.name))
|
||||
}, [compatibility, container, codecs])
|
||||
|
||||
const filteredVideoCodecs = useMemo(() => {
|
||||
const entry = compatibility?.[container || '']
|
||||
if (!entry) return codecs.filter(c => c.supports_video)
|
||||
if (!entry) return codecs.filter(c => c.codec_type === 'video')
|
||||
const videoList = entry.video
|
||||
if (videoList === null) return codecs.filter(c => c.supports_video)
|
||||
return codecs.filter(c => c.supports_video && videoList.includes(c.name))
|
||||
if (videoList === null) return codecs.filter(c => c.codec_type === 'video')
|
||||
return codecs.filter(c => c.codec_type === 'video' && videoList.includes(c.name))
|
||||
}, [compatibility, container, codecs])
|
||||
|
||||
return { filteredAudioCodecs, filteredVideoCodecs }
|
||||
|
||||
@@ -57,8 +57,7 @@ export interface CodecInfo {
|
||||
ffmpeg: string
|
||||
recommended_container: string
|
||||
recommended_extension: string
|
||||
supports_transcoding: boolean
|
||||
supports_video: boolean
|
||||
codec_type: 'audio' | 'video' | 'subtitle'
|
||||
}
|
||||
|
||||
export interface CompatibilityEntry {
|
||||
|
||||
Reference in New Issue
Block a user