1 /* GStreamer 2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> 3 * Copyright (C) 2012 Collabora Ltd. 4 * Author : Edward Hervey <edward@collabora.com> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library 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 GNU 14 * Library General Public License for more details. 15 * 16 * You should have received a copy of the GNU Library General Public 17 * License along with this library; if not, write to the 18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 23 #ifndef __GST_JPEGENC_H__ 24 #define __GST_JPEGENC_H__ 25 26 27 #include <gst/gst.h> 28 #include <gst/video/video.h> 29 #include <gst/video/gstvideoencoder.h> 30 /* this is a hack hack hack to get around jpeglib header bugs... */ 31 #ifdef HAVE_STDLIB_H 32 # undef HAVE_STDLIB_H 33 #endif 34 #include <stdio.h> 35 #include <jpeglib.h> 36 37 G_BEGIN_DECLS 38 #define GST_TYPE_JPEGENC \ 39 (gst_jpegenc_get_type()) 40 #define GST_JPEGENC(obj) \ 41 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEGENC,GstJpegEnc)) 42 #define GST_JPEGENC_CLASS(klass) \ 43 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEGENC,GstJpegEncClass)) 44 #define GST_IS_JPEGENC(obj) \ 45 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEGENC)) 46 #define GST_IS_JPEGENC_CLASS(klass) \ 47 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEGENC)) 48 49 typedef struct _GstJpegEnc GstJpegEnc; 50 typedef struct _GstJpegEncClass GstJpegEncClass; 51 52 struct _GstJpegEnc 53 { 54 GstVideoEncoder encoder; 55 56 GstVideoCodecState *input_state; 57 GstVideoFrame current_vframe; 58 GstVideoCodecFrame *current_frame; 59 GstFlowReturn res; 60 61 gboolean input_caps_changed; 62 63 guint channels; 64 65 gint inc[GST_VIDEO_MAX_COMPONENTS]; 66 gint cwidth[GST_VIDEO_MAX_COMPONENTS]; 67 gint cheight[GST_VIDEO_MAX_COMPONENTS]; 68 gint h_samp[GST_VIDEO_MAX_COMPONENTS]; 69 gint v_samp[GST_VIDEO_MAX_COMPONENTS]; 70 gint h_max_samp; 71 gint v_max_samp; 72 gboolean planar; 73 gint sof_marker; 74 /* the video buffer */ 75 gint bufsize; 76 /* the jpeg line buffer */ 77 guchar **line[3]; 78 /* indirect encoding line buffers */ 79 guchar *row[3][4 * DCTSIZE]; 80 81 struct jpeg_compress_struct cinfo; 82 struct jpeg_error_mgr jerr; 83 struct jpeg_destination_mgr jdest; 84 85 /* properties */ 86 gint quality; 87 gint smoothing; 88 gint idct_method; 89 gboolean snapshot; 90 91 GstMemory *output_mem; 92 GstMapInfo output_map; 93 }; 94 95 struct _GstJpegEncClass 96 { 97 GstVideoEncoderClass parent_class; 98 }; 99 100 GType gst_jpegenc_get_type (void); 101 102 G_END_DECLS 103 #endif /* __GST_JPEGENC_H__ */ 104