2 #Copyright 2009 Paul Hänsch
4 #This file is part of Viper.
6 #Viper is free software: you can redistribute it and/or modify
7 #it under the terms of the GNU General Public License as published by
8 #the Free Software Foundation, either version 3 of the License, or
9 #(at your option) any later version.
11 #Viper is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #GNU General Public License for more details.
16 #You should have received a copy of the GNU General Public License
17 #along with Viper. If not, see <http://www.gnu.org/licenses/>
21 class C_Custom(C_Plugin):
22 def build_dialog(self):
23 self.subgets['desc'] = Label(self, text = 'Enter a piece of mplayer command line\n'+
24 'specifying a container format. I.e.:\n' +
26 self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH)
27 self.subgets['line'] = Entry(self)
28 self.subgets['line'].pack(side = TOP, expand = True, fill = X)
34 return self.line.split(' ')
36 class C_Avi(C_Plugin):
37 def build_dialog(self):
38 self.subgets['desc'] = Label(self, text = 'This will output an avi file.')
39 self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH)
47 def is_available(self):
49 slave = os.popen2(['mencoder', '-of', 'help'])
52 line = slave[1].readline()
53 if line.lstrip().find('avi') == 0:
57 class C_Mpeg(C_Plugin):
58 def build_dialog(self):
59 self.subgets['l_format'] = Label(self, text = 'Format')
60 self.subgets['l_format'].grid(row = 0, column = 0)
61 self.subgets['format'] = Pmw.OptionMenu(self, initialitem = 1,
62 items = ['mpeg1', 'mpeg2', 'xvcd', 'xsvcd',
63 'dvd', 'pes1', 'pes2'])
64 self.subgets['format'].grid(row = 1, column = 0)
66 self.subgets['custom'] = False
67 self.subgets['c_custom'] = Checkbutton(self, text = 'Custom', command = self.c_custom)
68 self.subgets['c_custom'].deselect()
69 self.subgets['c_custom'].grid(row = 2, column = 0)
71 self.subgets['l_size'] = Label(self, text = 'Packetsize')
72 self.subgets['l_size'].grid(row = 0, column = 1)
73 self.subgets['size'] = Spinbox(self, from_ = 256, to = 65535,
74 increment = 256, width = 6)
75 self.subgets['size'].delete(0, END)
76 self.subgets['size'].insert(END, 2048)
77 self.subgets['size'].config(state = 'disabled')
78 self.subgets['size'].grid(row = 1, column = 1)
80 self.subgets['l_muxrate'] = Label(self, text = 'Muxrate')
81 self.subgets['l_muxrate'].grid(row = 0, column = 2)
82 self.subgets['muxrate'] = Spinbox(self, from_ = 0, to = 18000, increment = 100, width = 6)
83 self.subgets['muxrate'].delete(0, END)
84 self.subgets['muxrate'].insert(0, 1800)
85 self.subgets['muxrate'].config(state = 'disabled')
86 self.subgets['muxrate'].grid(row = 1, column = 2)
88 self.subgets['l_vbuf'] = Label(self, text = 'V Buffer (KB)')
89 self.subgets['l_vbuf'].grid(row = 0, column = 3)
90 self.subgets['vbuf'] = Spinbox(self, from_ = 40, to = 1194, increment = 10, width = 5)
91 self.subgets['vbuf'].delete(0, END)
92 self.subgets['vbuf'].insert(0, 400)
93 self.subgets['vbuf'].config(state = 'disabled')
94 self.subgets['vbuf'].grid(row = 1, column = 3)
96 self.subgets['l_abuf'] = Label(self, text = 'A Buffer (KB)')
97 self.subgets['l_abuf'].grid(row = 0, column = 4)
98 self.subgets['abuf'] = Spinbox(self, from_ = 4, to = 64, increment = 1, width = 3)
99 self.subgets['abuf'].delete(0, END)
100 self.subgets['abuf'].insert(0, 10)
101 self.subgets['abuf'].config(state = 'disabled')
102 self.subgets['abuf'].grid(row = 1, column = 4)
104 self.subgets['tsaf'] = False
105 self.subgets['c_tsaf'] = Checkbutton(self, text = 'Time Stamp for all Frames',
106 command = self.c_tsaf)
107 self.subgets['c_tsaf'].deselect()
108 self.subgets['c_tsaf'].config(state = 'disabled')
109 self.subgets['c_tsaf'].grid(row = 2, column = 1, columnspan = 2)
111 self.subgets['intl2'] = False
112 self.subgets['c_intl2'] = Checkbutton(self, text = 'Improved Interleaving',
113 command = self.c_intl2)
114 self.subgets['c_intl2'].deselect()
115 self.subgets['c_intl2'].config(state = 'disabled')
116 self.subgets['c_intl2'].grid(row = 2, column = 3, columnspan = 2)
119 if self.subgets['custom']:
120 for name in ['size', 'muxrate', 'vbuf', 'abuf', 'c_tsaf', 'c_intl2']:
121 self.subgets[name].config(state = 'disabled')
123 for name in ['size', 'muxrate', 'vbuf', 'abuf', 'c_tsaf', 'c_intl2']:
124 self.subgets[name].config(state = 'normal')
126 self.subgets['custom'] = not self.subgets['custom']
129 self.subgets['tsaf'] = not self.subgets['tsaf']
132 self.subgets['intl2'] = not self.subgets['intl2']
137 def subcommand(self):
138 opts = 'format='+self.subgets['format'].getvalue()
139 if self.subgets['custom']:
140 opts += ':size=' + self.subgets['size'].get()
141 opts += ':muxrate=' + self.subgets['muxrate'].get()
142 opts += ':vbuf_size=' + self.subgets['vbuf'].get()
143 opts += ':abuf_size=' + self.subgets['abuf'].get()
144 if self.subgets['tsaf']:
146 if self.subgets['intl2']:
147 opts += ':interleaving2'
149 return ['-of', 'mpeg', '-mpegopts', opts]
151 def is_available(self):
153 slave = os.popen2(['mencoder', '-of', 'help'])
156 line = slave[1].readline()
157 if line.lstrip().find('mpeg') == 0:
161 class C_RawVideo(C_Plugin):
162 def build_dialog(self):
163 self.subgets['desc'] = Label(self, text = 'This will output a raw video stream, '+
164 'an audio stream will not be contained.\n'+
165 'The resulting file may be used for further processing\n'+
166 'but will probably not be of any use by its own.')
167 self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH)
172 def subcommand(self):
173 return ['-of', 'rawvideo']
175 def is_available(self):
177 slave = os.popen2(['mencoder', '-of', 'help'])
180 line = slave[1].readline()
181 if line.lstrip().find('rawvideo') == 0:
185 class C_RawAudio(C_Plugin):
186 def build_dialog(self):
187 self.subgets['desc'] = Label(self, text = 'This will output a raw audio stream, '+
188 'a video stream will not be contained.\n'+
189 'The resulting file may be used for further processing\n'+
190 'but will probably not be of any use by its own.')
191 self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH)
196 def subcommand(self):
197 return ['-of', 'rawaudio']
199 def is_available(self):
201 slave = os.popen2(['mencoder', '-of', 'help'])
204 line = slave[1].readline()
205 if line.lstrip().find('rawaudio') == 0: