88
99public class JPEGEncoder extends AbstractVideoFrameEncoder {
1010
11- static {
12- try {
13- System .loadLibrary ("v4l4j" );
14- } catch (UnsatisfiedLinkError e ) {
15- System .err .println ("Cant load v4l4j JNI library" );
16- throw e ;
17- }
11+ protected int quality ;
12+
13+ public static JPEGEncoder from (int width , int height , ImagePalette from ) {
14+ return new JPEGEncoder (width , height , from );
1815 }
1916
20- protected int quality ;
17+ public static JPEGEncoder to (int width , int height , ImagePalette to ) {
18+ return new JPEGEncoder (width , height , ImagePalette .JPEG , to );
19+ }
20+
21+ protected JPEGEncoder (int width , int height , ImagePalette from , ImagePalette to ) {
22+ super (width , height , from , to );
23+ }
2124
2225 public JPEGEncoder (int width , int height , ImagePalette from ) {
2326 super (width , height , from , ImagePalette .JPEG );
@@ -35,6 +38,7 @@ public void setQuality(int quality) {
3538 quality = V4L4JConstants .MAX_JPEG_QUALITY ;
3639 this .quality = quality ;
3740 }
41+
3842 @ Override
3943 public VideoFrame encode (BaseVideoFrame frame ) throws V4L4JException {
4044 super .putBuffer (frame .getBytes (), frame .getFrameLength ());
0 commit comments