aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-02-11 10:51:33 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-02-28 10:42:19 +0100
commitc729caf6cc34630877a0e5a1bda1719384cd0c8a (patch)
tree1d2e13722e518c73d2c9e6f0969615e29d51cf8c /shared/models
parenta24bf4dc659cebb65d887862bf21d7a35e9ec791 (diff)
downloadPeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.tar.gz
PeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.tar.zst
PeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.zip
Add basic video editor support
Diffstat (limited to 'shared/models')
-rw-r--r--shared/models/server/custom-config.model.ts4
-rw-r--r--shared/models/server/job.model.ts39
-rw-r--r--shared/models/server/server-config.model.ts4
-rw-r--r--shared/models/videos/editor/index.ts1
-rw-r--r--shared/models/videos/editor/video-editor-create-edit.model.ts42
-rw-r--r--shared/models/videos/index.ts1
-rw-r--r--shared/models/videos/transcoding/video-transcoding-fps.model.ts1
-rw-r--r--shared/models/videos/transcoding/video-transcoding.model.ts7
-rw-r--r--shared/models/videos/video-state.enum.ts3
9 files changed, 99 insertions, 3 deletions
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts
index 52d3d9588..c9e7654de 100644
--- a/shared/models/server/custom-config.model.ts
+++ b/shared/models/server/custom-config.model.ts
@@ -143,6 +143,10 @@ export interface CustomConfig {
143 } 143 }
144 } 144 }
145 145
146 videoEditor: {
147 enabled: boolean
148 }
149
146 import: { 150 import: {
147 videos: { 151 videos: {
148 concurrency: number 152 concurrency: number
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts
index 1519d1c3e..d0293f542 100644
--- a/shared/models/server/job.model.ts
+++ b/shared/models/server/job.model.ts
@@ -1,4 +1,5 @@
1import { ContextType } from '../activitypub/context' 1import { ContextType } from '../activitypub/context'
2import { VideoEditorTaskCut } from '../videos/editor'
2import { VideoResolution } from '../videos/file/video-resolution.enum' 3import { VideoResolution } from '../videos/file/video-resolution.enum'
3import { SendEmailOptions } from './emailer.model' 4import { SendEmailOptions } from './emailer.model'
4 5
@@ -20,6 +21,7 @@ export type JobType =
20 | 'video-live-ending' 21 | 'video-live-ending'
21 | 'actor-keys' 22 | 'actor-keys'
22 | 'move-to-object-storage' 23 | 'move-to-object-storage'
24 | 'video-edition'
23 25
24export interface Job { 26export interface Job {
25 id: number 27 id: number
@@ -155,3 +157,40 @@ export interface MoveObjectStoragePayload {
155 videoUUID: string 157 videoUUID: string
156 isNewVideo: boolean 158 isNewVideo: boolean
157} 159}
160
161export type VideoEditorTaskCutPayload = VideoEditorTaskCut
162
163export type VideoEditorTaskIntroPayload = {
164 name: 'add-intro'
165
166 options: {
167 file: string
168 }
169}
170
171export type VideoEditorTaskOutroPayload = {
172 name: 'add-outro'
173
174 options: {
175 file: string
176 }
177}
178
179export type VideoEditorTaskWatermarkPayload = {
180 name: 'add-watermark'
181
182 options: {
183 file: string
184 }
185}
186
187export type VideoEditionTaskPayload =
188 VideoEditorTaskCutPayload |
189 VideoEditorTaskIntroPayload |
190 VideoEditorTaskOutroPayload |
191 VideoEditorTaskWatermarkPayload
192
193export interface VideoEditionPayload {
194 videoUUID: string
195 tasks: VideoEditionTaskPayload[]
196}
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index 32be96b9d..0fe8b0de8 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -167,6 +167,10 @@ export interface ServerConfig {
167 } 167 }
168 } 168 }
169 169
170 videoEditor: {
171 enabled: boolean
172 }
173
170 import: { 174 import: {
171 videos: { 175 videos: {
172 http: { 176 http: {
diff --git a/shared/models/videos/editor/index.ts b/shared/models/videos/editor/index.ts
new file mode 100644
index 000000000..3436f2c3f
--- /dev/null
+++ b/shared/models/videos/editor/index.ts
@@ -0,0 +1 @@
export * from './video-editor-create-edit.model'
diff --git a/shared/models/videos/editor/video-editor-create-edit.model.ts b/shared/models/videos/editor/video-editor-create-edit.model.ts
new file mode 100644
index 000000000..36b7c8d55
--- /dev/null
+++ b/shared/models/videos/editor/video-editor-create-edit.model.ts
@@ -0,0 +1,42 @@
1export interface VideoEditorCreateEdition {
2 tasks: VideoEditorTask[]
3}
4
5export type VideoEditorTask =
6 VideoEditorTaskCut |
7 VideoEditorTaskIntro |
8 VideoEditorTaskOutro |
9 VideoEditorTaskWatermark
10
11export interface VideoEditorTaskCut {
12 name: 'cut'
13
14 options: {
15 start?: number
16 end?: number
17 }
18}
19
20export interface VideoEditorTaskIntro {
21 name: 'add-intro'
22
23 options: {
24 file: Blob | string
25 }
26}
27
28export interface VideoEditorTaskOutro {
29 name: 'add-outro'
30
31 options: {
32 file: Blob | string
33 }
34}
35
36export interface VideoEditorTaskWatermark {
37 name: 'add-watermark'
38
39 options: {
40 file: Blob | string
41 }
42}
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts
index 67614efc9..e8eb227ab 100644
--- a/shared/models/videos/index.ts
+++ b/shared/models/videos/index.ts
@@ -3,6 +3,7 @@ export * from './caption'
3export * from './change-ownership' 3export * from './change-ownership'
4export * from './channel' 4export * from './channel'
5export * from './comment' 5export * from './comment'
6export * from './editor'
6export * from './live' 7export * from './live'
7export * from './file' 8export * from './file'
8export * from './import' 9export * from './import'
diff --git a/shared/models/videos/transcoding/video-transcoding-fps.model.ts b/shared/models/videos/transcoding/video-transcoding-fps.model.ts
index 25fc1c2da..9a330ac94 100644
--- a/shared/models/videos/transcoding/video-transcoding-fps.model.ts
+++ b/shared/models/videos/transcoding/video-transcoding-fps.model.ts
@@ -2,6 +2,7 @@ export type VideoTranscodingFPS = {
2 MIN: number 2 MIN: number
3 STANDARD: number[] 3 STANDARD: number[]
4 HD_STANDARD: number[] 4 HD_STANDARD: number[]
5 AUDIO_MERGE: number
5 AVERAGE: number 6 AVERAGE: number
6 MAX: number 7 MAX: number
7 KEEP_ORIGIN_FPS_RESOLUTION_MIN: number 8 KEEP_ORIGIN_FPS_RESOLUTION_MIN: number
diff --git a/shared/models/videos/transcoding/video-transcoding.model.ts b/shared/models/videos/transcoding/video-transcoding.model.ts
index 3a7fb6472..91eacf8dc 100644
--- a/shared/models/videos/transcoding/video-transcoding.model.ts
+++ b/shared/models/videos/transcoding/video-transcoding.model.ts
@@ -7,8 +7,11 @@ export type EncoderOptionsBuilderParams = {
7 7
8 resolution: VideoResolution 8 resolution: VideoResolution
9 9
10 // Could be null for "merge audio" transcoding 10 // If PeerTube applies a filter, transcoding profile must not copy input stream
11 fps?: number 11 canCopyAudio: boolean
12 canCopyVideo: boolean
13
14 fps: number
12 15
13 // Could be undefined if we could not get input bitrate (some RTMP streams for example) 16 // Could be undefined if we could not get input bitrate (some RTMP streams for example)
14 inputBitrate: number 17 inputBitrate: number
diff --git a/shared/models/videos/video-state.enum.ts b/shared/models/videos/video-state.enum.ts
index 09268d2ff..e45e4adc2 100644
--- a/shared/models/videos/video-state.enum.ts
+++ b/shared/models/videos/video-state.enum.ts
@@ -6,5 +6,6 @@ export const enum VideoState {
6 LIVE_ENDED = 5, 6 LIVE_ENDED = 5,
7 TO_MOVE_TO_EXTERNAL_STORAGE = 6, 7 TO_MOVE_TO_EXTERNAL_STORAGE = 6,
8 TRANSCODING_FAILED = 7, 8 TRANSCODING_FAILED = 7,
9 TO_MOVE_TO_EXTERNAL_STORAGE_FAILED = 8 9 TO_MOVE_TO_EXTERNAL_STORAGE_FAILED = 8,
10 TO_EDIT = 9
10} 11}