gst_plugins_good/gst/camerabin/gstcamerabin.h
branchRCL_3
changeset 29 567bb019e3e3
parent 6 9b2c3c7a1a9c
child 30 7e817e7e631c
equal deleted inserted replaced
6:9b2c3c7a1a9c 29:567bb019e3e3
     1 /*
       
     2  * GStreamer
       
     3  * Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
       
     4  *
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Library General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Library General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Library General Public
       
    16  * License along with this library; if not, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 #ifndef __GST_CAMERABIN_H__
       
    22 #define __GST_CAMERABIN_H__
       
    23 
       
    24 #ifdef HAVE_CONFIG_H
       
    25 #  include <config.h>
       
    26 #endif
       
    27 
       
    28 #include <gst/gstbin.h>
       
    29 #include <gst/interfaces/photography.h>
       
    30 
       
    31 #include "camerabinimage.h"
       
    32 #include "camerabinvideo.h"
       
    33 
       
    34 G_BEGIN_DECLS
       
    35 
       
    36 /* #defines don't like whitespacey bits */
       
    37 #define GST_TYPE_CAMERABIN \
       
    38   (gst_camerabin_get_type())
       
    39 #define GST_CAMERABIN(obj) \
       
    40   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAMERABIN,GstCameraBin))
       
    41 #define GST_CAMERABIN_CLASS(klass) \
       
    42   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAMERABIN,GstCameraBinClass))
       
    43 #define GST_IS_CAMERABIN(obj) \
       
    44   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAMERABIN))
       
    45 #define GST_IS_CAMERABIN_CLASS(klass) \
       
    46   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAMERABIN))
       
    47 
       
    48 typedef struct _GstCameraBin GstCameraBin;
       
    49 typedef struct _GstCameraBinClass GstCameraBinClass;
       
    50 
       
    51 /**
       
    52  * GstCameraBin:
       
    53  *
       
    54  * The opaque #GstCameraBin structure.
       
    55  */
       
    56 
       
    57 struct _GstCameraBin
       
    58 {
       
    59   GstPipeline parent;
       
    60 
       
    61   /* private */
       
    62   GString *filename;
       
    63   gint mode;                    /* MODE_IMAGE or MODE_VIDEO */
       
    64   guint num_img_buffers;        /* no of image buffers captured */
       
    65   gboolean stop_requested;      /* TRUE if capturing stop needed */
       
    66   gboolean paused;              /* TRUE if capturing paused */
       
    67 
       
    68   /* resolution and frames per second of image captured by v4l2 device */
       
    69   gint width;
       
    70   gint height;
       
    71   gint fps_n;
       
    72   gint fps_d;
       
    73 
       
    74   /* Caps applied to capsfilters when taking still image */
       
    75   GstCaps *image_capture_caps;
       
    76 
       
    77   /* Caps applied to capsfilters when in view finder mode */
       
    78   GstCaps *view_finder_caps;
       
    79 
       
    80   /* Caps that videosrc supports */
       
    81   GstCaps *allowed_caps;
       
    82 
       
    83   /* The digital zoom (from 100% to 1000%) */
       
    84   gint zoom;
       
    85 
       
    86   /* concurrency control */
       
    87   GMutex *capture_mutex;
       
    88   GCond *cond;
       
    89   gboolean capturing;
       
    90 
       
    91   /* pad names for output and input selectors */
       
    92   GstPad *pad_src_view;
       
    93   GstPad *pad_view_src;
       
    94   GstPad *pad_src_img;
       
    95   GstPad *pad_view_img;
       
    96   GstPad *pad_src_vid;
       
    97   GstPad *pad_view_vid;
       
    98 
       
    99   GstPad *srcpad_zoom_filter;
       
   100 
       
   101   GstElement *imgbin;           /* bin that holds image capturing elements */
       
   102   GstElement *vidbin;           /*  bin that holds video capturing elements */
       
   103   GstElement *active_bin;       /* image or video bin that is currently in use */
       
   104 
       
   105   /* source elements */
       
   106   GstElement *src_vid_src;
       
   107   GstElement *src_filter;
       
   108   GstElement *src_zoom_crop;
       
   109   GstElement *src_zoom_scale;
       
   110   GstElement *src_zoom_filter;
       
   111   GstElement *src_out_sel;
       
   112 
       
   113   /* view finder elements */
       
   114   GstElement *view_in_sel;
       
   115   GstElement *view_scale;
       
   116   GstElement *view_sink;
       
   117 
       
   118   /* User configurable elements */
       
   119   GstElement *user_vid_src;
       
   120   GstElement *user_vf_sink;
       
   121 
       
   122   /* Night mode handling */
       
   123   gboolean night_mode;
       
   124   gint pre_night_fps_n;
       
   125   gint pre_night_fps_d;
       
   126 };
       
   127 
       
   128 /**
       
   129  * GstCameraBinClass:
       
   130  *
       
   131  * The #GstCameraBin class structure.
       
   132  */
       
   133 struct _GstCameraBinClass
       
   134 {
       
   135   GstPipelineClass parent_class;
       
   136 
       
   137   /* action signals */
       
   138 
       
   139   void (*user_start) (GstCameraBin * camera);
       
   140   void (*user_stop) (GstCameraBin * camera);
       
   141   void (*user_pause) (GstCameraBin * camera);
       
   142   void (*user_res_fps) (GstCameraBin * camera, gint width, gint height,
       
   143       gint fps_n, gint fps_d);
       
   144   void (*user_image_res) (GstCameraBin * camera, gint width, gint height);
       
   145 
       
   146   /* signals (callback) */
       
   147 
       
   148     gboolean (*img_done) (GstCameraBin * camera, GString * filename);
       
   149 };
       
   150 
       
   151 /**
       
   152  * GstCameraBinMode:
       
   153  * @MODE_IMAGE: image capture
       
   154  * @MODE_VIDEO: video capture
       
   155  *
       
   156  * Capture mode to use.
       
   157  */
       
   158 typedef enum
       
   159 {
       
   160   MODE_IMAGE = 0,
       
   161   MODE_VIDEO
       
   162 } GstCameraBinMode;
       
   163 
       
   164 GType gst_camerabin_get_type (void);
       
   165 
       
   166 G_END_DECLS
       
   167 
       
   168 #endif /* #ifndef __GST_CAMERABIN_H__ */