Skip to content

Commit 1e2bbe4

Browse files
committed
[refactor] Merge input/output components into FileIO component.
1 parent 9c538b0 commit 1e2bbe4

File tree

7 files changed

+117
-147
lines changed

7 files changed

+117
-147
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ffmpeg-commander",
3-
"version": "0.7.2",
3+
"version": "0.8.0",
44
"scripts": {
55
"serve": "vue-cli-service serve",
66
"build": "vue-cli-service build",

src/App.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ App
66
router-view
77
Editor Container component.
88
Presets Pre-defined and user-saved presets.
9-
Input Input source.
10-
Output Output destination.
11-
Format FFmpeg Format Options
12-
Video FFmpeg Video Options
13-
Audio FFmpeg Audio Options
14-
Filters FFmpeg Filter Options
15-
Options FFmpeg General Options and Logging. Saves to localstorage.
9+
FileIO Source and destination inputs.
10+
Format FFmpeg format options.
11+
Video FFmpeg video options.
12+
Audio FFmpeg audio options.
13+
Filters FFmpeg filter options.
14+
Options FFmpeg general options and logging. Saves to localstorage.
1615
Command Command building and rendering logic.
1716
CommandFragment Builds command fragments with tooltips.
1817
Toolbar User controls for copying command output and managing presets.

src/components/Editor.vue

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@
66
<Presets v-model="preset" />
77

88
<!-- Input and Output protocol and filenames. -->
9-
<b-form-row>
10-
<b-col>
11-
<Input v-model="form.input" />
12-
</b-col>
13-
14-
<b-col>
15-
<Output v-model="form.output" />
16-
</b-col>
17-
</b-form-row>
9+
<FileIO v-model="form.io" />
1810

1911
<!-- Tabs for each command building component.
2012
Format, Video, Audio, Filters and Options -->
@@ -85,8 +77,7 @@ import util from '@/util';
8577
import storage from '@/storage';
8678
8779
import Presets from './Presets.vue';
88-
import Input from './Input.vue';
89-
import Output from './Output.vue';
80+
import FileIO from './FileIO.vue';
9081
import Format from './Format.vue';
9182
import Video from './Video.vue';
9283
import Audio from './Audio.vue';
@@ -106,8 +97,7 @@ export default {
10697
name: 'Editor',
10798
components: {
10899
Presets,
109-
Input,
110-
Output,
100+
FileIO,
111101
Format,
112102
Video,
113103
Audio,
@@ -126,6 +116,12 @@ export default {
126116
name: null,
127117
},
128118
form: {
119+
io: {
120+
input: 'input.mp4',
121+
inputFile: null,
122+
output: 'output.mp4',
123+
outputFile: null,
124+
},
129125
input: {
130126
name: 'input.mp4',
131127
file: null,

src/components/FileIO.vue

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<template>
2+
<div class="input">
3+
<b-form-row>
4+
<!-- Input -->
5+
<b-col>
6+
<b-form-group label="Input:" label-for="input">
7+
<b-input-group>
8+
<b-form-select
9+
v-if="!$store.state.ffmpegdEnabled || !$store.state.wsConnected"
10+
class="protocol"
11+
v-model="protocolInput"
12+
@change="update('input', $event)"
13+
>
14+
<option v-for="o in protocols" :key="o.id" :value="o.value">{{o.name}}</option>
15+
</b-form-select>
16+
17+
<b-form-input
18+
v-if="!$store.state.ffmpegdEnabled || !$store.state.wsConnected"
19+
v-model="value.input"
20+
:state="Boolean(value.input)"
21+
placeholder="Example: input.mp4"
22+
></b-form-input>
23+
24+
<b-form-input
25+
v-else
26+
v-model="value.input"
27+
placeholder=""
28+
@focus="onFileFocus"
29+
></b-form-input>
30+
31+
<div v-if="showFileBrowser">
32+
<FileBrowser v-on:file="onFileSelect" v-on:close="onClose" />
33+
</div>
34+
</b-input-group>
35+
</b-form-group>
36+
</b-col>
37+
38+
<!-- Output -->
39+
<b-col>
40+
<b-form-group label="Output:" label-for="output">
41+
<b-input-group>
42+
<b-form-select
43+
v-if="!$store.state.ffmpegdEnabled"
44+
class="protocol"
45+
v-model="protocolOutput"
46+
@change="update('output', $event)"
47+
>
48+
<option v-for="o in protocols" :key="o.id" :value="o.value">{{o.name}}</option>
49+
</b-form-select>
50+
51+
<b-form-input
52+
v-model="value.output"
53+
:state="Boolean(value.output)"
54+
placeholder="Example: output.mp4"
55+
></b-form-input>
56+
</b-input-group>
57+
</b-form-group>
58+
</b-col>
59+
</b-form-row>
60+
</div>
61+
</template>
62+
63+
<script>
64+
import form from '@/form';
65+
66+
import FileBrowser from '@/components/FileBrowser.vue';
67+
68+
const {
69+
protocols,
70+
} = form;
71+
72+
export default {
73+
name: 'Input',
74+
components: {
75+
FileBrowser,
76+
},
77+
props: ['value'],
78+
data() {
79+
return {
80+
protocolInput: 'movie.mp4',
81+
protocolOutput: 'movie.mp4',
82+
protocols,
83+
showFileBrowser: false,
84+
};
85+
},
86+
methods: {
87+
update(key, value) {
88+
this.$emit('input', { ...this.value, [key]: value });
89+
},
90+
},
91+
};
92+
</script>
93+
94+
<style scoped>
95+
.protocol {
96+
flex: 0 0 20% !important;
97+
}
98+
</style>

src/components/Input.vue

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/components/Output.vue

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import codecMap from '@/codecs';
33
// Transforms the form options to ffmpeg build options.
44
function transform(formData) {
55
const {
6-
input, output, format, video, audio, filters, options,
6+
io, format, video, audio, filters, options,
77
} = formData;
88

99
const opt = {
10-
input: input.name,
11-
output: output.name,
10+
input: io.input,
11+
output: io.output,
1212

1313
// Format.
1414
container: format.container,

0 commit comments

Comments
 (0)