2026-06-01 23:16:22 +08:00
|
|
|
import type { WorkflowTask } from '@shumai/db'
|
2026-07-19 12:32:08 +08:00
|
|
|
import { transcodeVideoWorkflow } from './transcode-video'
|
|
|
|
|
import { transcodeImageWorkflow } from './transcode-image'
|
|
|
|
|
import { transcodePdfWorkflow } from './transcode-pdf'
|
|
|
|
|
import { renderPdfPagesWorkflow } from './render-pdf-pages'
|
|
|
|
|
import { takeVideoScreenshotsWorkflow } from './take-video-screenshots'
|
|
|
|
|
import { overlayImageAnnotationWorkflow } from './overlay-image-annotation'
|
2026-05-19 16:05:09 +08:00
|
|
|
|
|
|
|
|
export async function transcodeMedia(task: WorkflowTask): Promise<void> {
|
2026-07-19 12:32:08 +08:00
|
|
|
const payload = task.payload
|
|
|
|
|
if (payload?.pdfPages) {
|
|
|
|
|
return renderPdfPagesWorkflow(task)
|
2026-05-19 16:05:09 +08:00
|
|
|
}
|
2026-07-19 12:32:08 +08:00
|
|
|
if (payload?.screenshot) {
|
|
|
|
|
return takeVideoScreenshotsWorkflow(task)
|
2026-05-19 16:05:09 +08:00
|
|
|
}
|
2026-07-19 12:32:08 +08:00
|
|
|
if (payload?.imageAnnotation) {
|
|
|
|
|
return overlayImageAnnotationWorkflow(task)
|
2026-05-30 14:15:45 +08:00
|
|
|
}
|
2026-07-19 12:32:08 +08:00
|
|
|
if (task.type === 'transcode_image') {
|
|
|
|
|
return transcodeImageWorkflow(task)
|
2026-05-30 12:09:27 +08:00
|
|
|
}
|
2026-07-19 12:32:08 +08:00
|
|
|
if (task.type === 'transcode_pdf') {
|
|
|
|
|
return transcodePdfWorkflow(task)
|
2026-05-19 16:05:09 +08:00
|
|
|
}
|
2026-07-19 12:32:08 +08:00
|
|
|
return transcodeVideoWorkflow(task)
|
2026-05-19 16:05:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const transcodeWorkflow = transcodeMedia
|
2026-07-19 12:32:08 +08:00
|
|
|
|
|
|
|
|
export * from './transcode-video'
|
|
|
|
|
export * from './transcode-image'
|
|
|
|
|
export * from './transcode-pdf'
|
|
|
|
|
export * from './render-pdf-pages'
|
|
|
|
|
export * from './take-video-screenshots'
|
|
|
|
|
export * from './overlay-image-annotation'
|
|
|
|
|
export * from './common'
|
|
|
|
|
export * from './transcode-utils'
|