-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ecb2ada
commit 1005f3d
Showing
10 changed files
with
259 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {AudioOperation} from '@remotion/webcodecs'; | ||
import React from 'react'; | ||
import {AudioOperationOption} from './AudioOperationOption'; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectGroup, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from './ui/select'; | ||
|
||
export const AudioCodecSelection: React.FC<{ | ||
readonly audioTrackOptions: AudioOperation[]; | ||
readonly index: number; | ||
readonly setIndex: (v: number) => void; | ||
}> = ({audioTrackOptions, index, setIndex}) => { | ||
return ( | ||
<Select value={String(index)} onValueChange={(v) => setIndex(Number(v))}> | ||
<SelectTrigger id="audioCodec"> | ||
<SelectValue placeholder="Select a audio codec" /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
{audioTrackOptions.map((operation, i) => { | ||
return ( | ||
<SelectGroup key={i}> | ||
<SelectItem | ||
// eslint-disable-next-line react/jsx-key | ||
value={String(i)} | ||
> | ||
<AudioOperationOption operation={operation} /> | ||
</SelectItem> | ||
</SelectGroup> | ||
); | ||
})} | ||
</SelectContent> | ||
</Select> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {AudioOperation} from '@remotion/webcodecs'; | ||
import {renderAudioCodecLabel} from '@remotion/webcodecs/src/codec-id'; | ||
|
||
export const AudioOperationOption: React.FC<{ | ||
readonly operation: AudioOperation; | ||
}> = ({operation}) => { | ||
if (operation.type === 'reencode') { | ||
return renderAudioCodecLabel(operation.audioCodec); | ||
} | ||
|
||
if (operation.type === 'copy') { | ||
return 'Copy'; | ||
} | ||
|
||
if (operation.type === 'drop') { | ||
return 'Drop audio track'; | ||
} | ||
|
||
throw new Error('Unknown operation type'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import {Skeleton} from './ui/skeleton'; | ||
|
||
export const SelectionSkeleton: React.FC = () => { | ||
return ( | ||
<div> | ||
<Skeleton className="h-4 w-[100px] inline-block mt-2" /> | ||
<Skeleton className="h-10 w-full block" /> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import {Label} from './ui/label'; | ||
|
||
export const VideoTrackLabel: React.FC<{ | ||
readonly trackId: number; | ||
readonly totalVideoTracks: number; | ||
}> = ({trackId, totalVideoTracks}) => { | ||
if (totalVideoTracks === 1) { | ||
return <Label htmlFor="videoCodec">Video Codec</Label>; | ||
} | ||
|
||
return <Label htmlFor="videoCodec">Video Codec for track {trackId}</Label>; | ||
}; | ||
|
||
export const AudioTrackLabel: React.FC<{ | ||
readonly trackId: number; | ||
readonly totalAudioTracks: number; | ||
}> = ({trackId, totalAudioTracks}) => { | ||
if (totalAudioTracks === 1) { | ||
return <Label htmlFor="audioCodec">Audio Codec</Label>; | ||
} | ||
|
||
return <Label htmlFor="audioCodec">Audio Codec for track {trackId}</Label>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {VideoOperation} from '@remotion/webcodecs'; | ||
import React from 'react'; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectGroup, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from './ui/select'; | ||
import {VideoOperationOption} from './VideoOperationOption'; | ||
|
||
export const VideoCodecSelection: React.FC<{ | ||
readonly videoOperations: VideoOperation[]; | ||
readonly index: number; | ||
readonly setIndex: (v: number) => void; | ||
}> = ({videoOperations, index, setIndex}) => { | ||
return ( | ||
<Select value={String(index)} onValueChange={(v) => setIndex(Number(v))}> | ||
<SelectTrigger id="videoCodec"> | ||
<SelectValue placeholder="Select a video codec" /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
{videoOperations.map((operation, i) => { | ||
return ( | ||
<SelectGroup key={i}> | ||
<SelectItem | ||
// eslint-disable-next-line react/jsx-key | ||
value={String(i)} | ||
> | ||
<VideoOperationOption operation={operation} /> | ||
</SelectItem> | ||
</SelectGroup> | ||
); | ||
})} | ||
</SelectContent> | ||
</Select> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {VideoOperation} from '@remotion/webcodecs'; | ||
import {renderVideoCodecLabel} from '@remotion/webcodecs/src/codec-id'; | ||
|
||
export const VideoOperationOption: React.FC<{ | ||
readonly operation: VideoOperation; | ||
}> = ({operation}) => { | ||
if (operation.type === 'reencode') { | ||
return renderVideoCodecLabel(operation.videoCodec); | ||
} | ||
|
||
if (operation.type === 'copy') { | ||
return 'Copy'; | ||
} | ||
|
||
if (operation.type === 'drop') { | ||
return 'Drop video track'; | ||
} | ||
|
||
throw new Error('Unknown operation type'); | ||
}; |
Oops, something went wrong.