gst_plugins_base/gst/playback/gstinputselector.h
changeset 8 4a7fac7dd34a
equal deleted inserted replaced
7:71e347f905f2 8:4a7fac7dd34a
       
     1 /* GStreamer
       
     2  * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
       
     3  * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
       
     4  * Copyright (C) 2008 Nokia Corporation. (contact <stefan.kost@nokia.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., 59 Temple Place - Suite 330,
       
    19  * Boston, MA 02111-1307, USA.
       
    20  */
       
    21  
       
    22 #ifndef __GST_INPUT_SELECTOR_H__
       
    23 #define __GST_INPUT_SELECTOR_H__
       
    24 
       
    25 #include <gst/gst.h>
       
    26 
       
    27 G_BEGIN_DECLS
       
    28 
       
    29 #define GST_TYPE_INPUT_SELECTOR \
       
    30   (gst_input_selector_get_type())
       
    31 #define GST_INPUT_SELECTOR(obj) \
       
    32   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INPUT_SELECTOR, GstInputSelector))
       
    33 #define GST_INPUT_SELECTOR_CLASS(klass) \
       
    34   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_INPUT_SELECTOR, GstInputSelectorClass))
       
    35 #define GST_IS_INPUT_SELECTOR(obj) \
       
    36   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INPUT_SELECTOR))
       
    37 #define GST_IS_INPUT_SELECTOR_CLASS(klass) \
       
    38   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_INPUT_SELECTOR))
       
    39 
       
    40 typedef struct _GstInputSelector GstInputSelector;
       
    41 typedef struct _GstInputSelectorClass GstInputSelectorClass;
       
    42 
       
    43 #define GST_INPUT_SELECTOR_GET_LOCK(sel) (((GstInputSelector*)(sel))->lock)
       
    44 #define GST_INPUT_SELECTOR_GET_COND(sel) (((GstInputSelector*)(sel))->cond)
       
    45 #define GST_INPUT_SELECTOR_LOCK(sel) (g_mutex_lock (GST_INPUT_SELECTOR_GET_LOCK(sel)))
       
    46 #define GST_INPUT_SELECTOR_UNLOCK(sel) (g_mutex_unlock (GST_INPUT_SELECTOR_GET_LOCK(sel)))
       
    47 #define GST_INPUT_SELECTOR_WAIT(sel) (g_cond_wait (GST_INPUT_SELECTOR_GET_COND(sel), \
       
    48 			GST_INPUT_SELECTOR_GET_LOCK(sel)))
       
    49 #define GST_INPUT_SELECTOR_BROADCAST(sel) (g_cond_broadcast (GST_INPUT_SELECTOR_GET_COND(sel)))
       
    50 
       
    51 struct _GstInputSelector {
       
    52   GstElement element;
       
    53 
       
    54   GstPad *srcpad;
       
    55 
       
    56   GstPad *active_sinkpad;
       
    57   guint n_pads;
       
    58   guint padcount;
       
    59 
       
    60   GstSegment segment;      /* the output segment */
       
    61   gboolean pending_close;  /* if we should push a close first */
       
    62 
       
    63   GMutex *lock;
       
    64   GCond *cond;
       
    65   gboolean blocked;
       
    66   gboolean flushing;
       
    67 
       
    68   /* select all mode, send data from all input pads forward */
       
    69   gboolean select_all;
       
    70 };
       
    71 
       
    72 struct _GstInputSelectorClass {
       
    73   GstElementClass parent_class;
       
    74 
       
    75   gint64 (*block)	(GstInputSelector *self);
       
    76   void (*switch_)	(GstInputSelector *self, GstPad *pad,
       
    77                          gint64 stop_time, gint64 start_time);
       
    78 };
       
    79 
       
    80 GType gst_input_selector_get_type (void);
       
    81 GType gst_selector_pad_get_type (void);
       
    82 
       
    83 G_END_DECLS
       
    84 
       
    85 #endif /* __GST_INPUT_SELECTOR_H__ */