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