001    package railo.runtime.video;
002    
003    import railo.commons.io.res.Resource;
004    
005    public class VideoOutputImpl implements VideoOutput {
006    
007            private Resource resource;
008            private double offset=0;
009            private String comment;
010            private String title;
011            private String author;
012            private String copyright;
013            private int fileLimitation;
014            private long maxFrames =0;
015            private String format;
016            private int frameRate;
017    
018            public VideoOutputImpl(Resource resource) {
019                    this.resource=resource;
020            }
021                    
022            /**
023             * set time offset of the output file based on input file in seconds
024             * @param offset
025             */
026            public void setOffset(double offset){
027                    this.offset=offset;
028            }
029            
030            /**
031             * sets a comment to the output video
032             * @param comment
033             */
034            public void setComment(String comment){
035                    this.comment=comment;
036            }
037            
038            /**
039             * sets a title to the output video
040             * @param title
041             */
042            public void setTitle(String title){
043                    this.title=title;
044            }
045            
046            /**
047             * sets a author to the output video
048             * @param author
049             */
050            public void setAuthor(String author){
051                    this.author=author;
052            }
053            
054            /**
055             * sets a copyright to the output video
056             * @param copyright
057             */
058            public void setCopyright(String copyright) {
059                    this.copyright=copyright;
060            }
061    
062    
063            /**
064             * @return the res
065             */
066            public Resource getResource() {
067                    return resource;
068            }
069    
070    
071            /**
072             * @return the offset
073             */
074            public double getOffset() {
075                    return offset;
076            }
077    
078            /**
079             * @return the comment
080             */
081            public String getComment() {
082                    return comment;
083            }
084    
085    
086            /**
087             * @return the title
088             */
089            public String getTitle() {
090                    return title;
091            }
092    
093    
094            /**
095             * @return the author
096             */
097            public String getAuthor() {
098                    return author;
099            }
100    
101    
102            /**
103             * @return the copyright
104             */
105            public String getCopyright() {
106                    return copyright;
107            }
108    
109            /**
110             * @return the fileLimitation
111             */
112            public int getFileLimitation() {
113                    return fileLimitation;
114            }
115    
116            /**
117             * limit size of the output file
118             * @param size the size to set
119             */
120            public void limitFileSizeTo(int size) {
121                    this.fileLimitation = size;
122            }
123    
124            /**
125             * @return the maxFrames
126             */
127            public long getMaxFrames() {
128                    return maxFrames;
129            }
130    
131            /**
132             * @param maxFrames the maxFrames to set
133             */
134            public void setMaxFrames(long maxFrames) {
135                    this.maxFrames = maxFrames;
136            }
137    /*
138            /**
139             * @return the aspectRatio
140             * /
141            public int getAspectRatio() {
142                    return aspectRatio;
143            }
144    
145            /**
146             * sets the aspectRatio (VideoOutput.ASPECT_RATIO_xxx)
147             * @param aspectRatio the aspectRatio to set
148             * /
149            public void setAspectRatio(int aspectRatio) {
150                    this.aspectRatio = aspectRatio;
151            }
152    
153            /**
154             * @return the bitrateMin
155             * /
156            public int getVideoBitrateMin() {
157                    return videoBitrateMin;
158            }
159    
160            /**
161             * set min video bitrate tolerance (in kbit/s)
162             * @param bitrateMin the bitrateMin to set
163             * /
164            public void setVideoBitrateMin(int bitrateMin) {
165                    this.videoBitrateMin = bitrateMin;
166            }
167    
168            /**
169             * @return the bitrateMax
170             * /
171            public int getVideoBitrateMax() {
172                    return videoBitrateMax;
173            }
174    
175            /**
176             * set max video bitrate tolerance (in kbit/s)
177             * @param bitrateMax the bitrateMax to set
178             * /
179            public void setVideoBitrateMax(int bitrateMax) {
180                    this.videoBitrateMax = bitrateMax;
181            }
182    
183            /**
184             * @return the bitrateTolerance
185             * /
186            public int getVideoBitrateTolerance() {
187                    return videoBitrateTolerance;
188            }
189    
190            /**
191             * set video bitrate tolerance (in kbit/s)
192             * @param bitrateTolerance the bitrateTolerance to set
193             * /
194            public void setVideoBitrateTolerance(int bitrateTolerance) {
195                    this.videoBitrateTolerance = bitrateTolerance;
196            }
197    
198            /**
199             * @return the sameQualityAsSource
200             * /
201            public boolean doSameQualityAsSource() {
202                    return sameQualityAsSource;
203            }
204    
205            /**
206             * @param sameQualityAsSource the sameQualityAsSource to set
207             * /
208            public void setSameQualityAsSource(boolean sameQualityAsSource) {
209                    this.sameQualityAsSource = sameQualityAsSource;
210            }
211    
212            /**
213             * @return the audioBitrate
214             * /
215            public int getAudioBitrate() {
216                    return audioBitrate;
217            }
218    
219            /**
220             * @param audioBitrate the audioBitrate to set
221             * /
222            public void setAudioBitrate(int audioBitrate) {
223                    this.audioBitrate = audioBitrate;
224            }
225    
226            
227            /**
228             * set the type of the output format (see constants "TYPE_xxx" of this class)
229             * @param type 
230             * /
231            public void setType(String type){
232                    this.type=type;
233            }
234    
235    
236            /**
237             * @return the type
238             * /
239            public String getType() {
240                    return type;
241            }
242    
243            /**
244             * @return the dimension
245             * /
246            public String getDimension() {
247                    return dimension;
248            }
249    
250            public void setDimension(int width, int height) throws VideoException {
251                    checkDimension(width,"width");
252                    checkDimension(height,"height");
253                    this.dimension=width+"X"+height;
254            }
255            
256            /**
257             * @return the bitrate
258             * /
259            public int getVideoBitrate() {
260                    return videoBitrate;
261            }
262    
263            /**
264             * set video bitrate in kbit/s (default 200)
265             * @param bitrate the bitrate to set
266             * /
267            public void setVideoBitrate(int bitrate) {
268                    this.videoBitrate = bitrate;
269            }
270    
271            /**
272             * @return the framerate
273             * /
274            public int getFramerate() {
275                    return framerate;
276            }
277    
278            /**
279             * sets the framerate (default 25)
280             * @param framerate the framerate to set
281             * /
282            public void setFramerate(int framerate) {
283                    this.framerate = framerate;
284            }
285    */
286    
287            /**
288             * @param resource the resource to set
289             */
290            public void setResource(Resource resource) {
291                    this.resource = resource;
292            }
293    
294            /**
295             * @return the format
296             */
297            public String getFormat() {
298                    return format;
299            }
300    
301            /**
302             * @param format the format to set
303             */
304            public void setFormat(String format) {
305                    this.format = format;
306            }
307    
308            /**
309             * @param fileLimitation the fileLimitation to set
310             */
311            public void setFileLimitation(int fileLimitation) {
312                    this.fileLimitation = fileLimitation;
313            }
314    
315            /**
316             * @see railo.runtime.video.VideoOutput#getFrameRate()
317             */
318            public int getFrameRate() {
319                    return frameRate;
320            }
321    
322            /**
323             * @see railo.runtime.video.VideoOutput#setFrameRate(int)
324             */
325            public void setFrameRate(int frameRate) {
326                    this.frameRate=frameRate;
327            }
328    
329            /*public void setVideoCodec(String videoCodec) {
330                    this.videoCodec=videoCodec;
331            }
332    
333            public String getVideoCodec() {
334                    return videoCodec;
335            }
336    
337            public String getAudioCodec() {
338                    return audioCodec;
339            }
340    
341            public void setAudioCodec(String audioCodec) {
342                    this.audioCodec = audioCodec;
343            }*/
344    }