gst_plugins_base/gst/playback/gstplaybasebin.h
changeset 0 0e761a78d257
child 8 4a7fac7dd34a
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /* GStreamer
       
     2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
       
     3  *               <2007> Wim Taymans <wim.taymans@gmail.com>
       
     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_PLAYBASEBIN_H__
       
    22 #define __GST_PLAYBASEBIN_H__
       
    23 
       
    24 #include <gst/gst.h>
       
    25 #include "gststreaminfo.h"
       
    26 
       
    27 G_BEGIN_DECLS
       
    28 
       
    29 #define GST_TYPE_PLAY_BASE_BIN            (gst_play_base_bin_get_type())
       
    30 #define GST_PLAY_BASE_BIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_BASE_BIN,GstPlayBaseBin))
       
    31 #define GST_PLAY_BASE_BIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_BASE_BIN,GstPlayBaseBinClass))
       
    32 #define GST_IS_PLAY_BASE_BIN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_BASE_BIN))
       
    33 #define GST_IS_PLAY_BASE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_BASE_BIN))
       
    34 #define GST_PLAY_BASE_BIN_GET_CLASS(obj) \
       
    35   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAY_BASE_BIN, \
       
    36                               GstPlayBaseBinClass))
       
    37 
       
    38 typedef struct _GstPlayBaseBin GstPlayBaseBin;
       
    39 typedef struct _GstPlayBaseBinClass GstPlayBaseBinClass;
       
    40 
       
    41 /* a GstPlayBaseGroup is a group of pads and streaminfo that together 
       
    42  * make up a playable stream. A new group is created from the current 
       
    43  * set of pads that are alive when the preroll elements are filled or 
       
    44  * when the no-more-pads signal is fired.
       
    45  *
       
    46  * We have to queue the groups as they can be created while the preroll
       
    47  * queues are still playing the old group. We monitor the EOS signals
       
    48  * on the preroll queues and when all the streams in the current group
       
    49  * have EOSed, we switch to the next queued group.
       
    50  */
       
    51 typedef struct
       
    52 {
       
    53   GstPlayBaseBin *bin;  /* ref to the owner */
       
    54 
       
    55   gint           nstreams;
       
    56   GList         *streaminfo;
       
    57   GValueArray   *streaminfo_value_array;
       
    58 
       
    59   /* contained decoded elementary streams */
       
    60   struct {
       
    61     gint         npads;
       
    62     GstBin      *bin;
       
    63     GstElement  *preroll;
       
    64     GstElement  *selector;
       
    65     gboolean     done;
       
    66 #define NUM_TYPES 3
       
    67   } type[NUM_TYPES]; /* AUDIO, VIDEO, TEXT */
       
    68 } GstPlayBaseGroup;
       
    69 
       
    70 struct _GstPlayBaseBin {
       
    71   GstPipeline    pipeline;
       
    72         
       
    73   /* properties */
       
    74   guint64        queue_size;
       
    75   guint64        queue_threshold;
       
    76   guint64        queue_min_threshold;
       
    77   /* connection speed in bits/sec (0 = unknown) */
       
    78   guint          connection_speed;
       
    79   
       
    80 
       
    81   /* currently loaded media */
       
    82   gint           current[NUM_TYPES];
       
    83   gchar         *uri, *suburi;
       
    84   gboolean       is_stream;
       
    85   GstElement    *source;
       
    86   GSList        *decoders;
       
    87   GstElement    *subtitle;              /* additional filesrc ! subparse bin */
       
    88   gboolean       subtitle_done;
       
    89   gboolean       need_rebuild;
       
    90 
       
    91   GSList        *subtitle_elements;     /* subtitle elements that have 'subtitle-encoding' property */
       
    92   gchar         *subencoding;           /* encoding to propagate to the above subtitle elements     */
       
    93   GMutex        *sub_lock;              /* protecting subtitle_elements and subencoding members     */
       
    94 
       
    95   /* group management - using own lock */
       
    96   GMutex        *group_lock;            /* lock and mutex to signal availability of new group */
       
    97   GCond         *group_cond;
       
    98   GstPlayBaseGroup *building_group;     /* the group that we are constructing */
       
    99   GList         *queued_groups;         /* the constructed groups, head is the active one */
       
   100 
       
   101   /* for dynamic sources */
       
   102   guint          src_np_sig_id;		/* new-pad signal id */
       
   103   guint          src_nmp_sig_id;        /* no-more-pads signal id */
       
   104   gint           pending;
       
   105 };
       
   106 
       
   107 struct _GstPlayBaseBinClass {
       
   108   GstPipelineClass parent_class;
       
   109 
       
   110   /* virtual fuctions */
       
   111   gboolean (*setup_output_pads) (GstPlayBaseBin *play_base_bin,
       
   112                                  GstPlayBaseGroup *group);
       
   113 
       
   114   void     (*set_subtitles_visible) (GstPlayBaseBin *play_base_bin,
       
   115                                      gboolean visible);
       
   116 };
       
   117 #ifdef __SYMBIAN32__
       
   118 IMPORT_C
       
   119 #endif
       
   120 
       
   121 
       
   122 GType gst_play_base_bin_get_type (void);
       
   123 
       
   124 G_END_DECLS
       
   125 
       
   126 #endif /* __GST_PLAYBASEBIN_H__ */
       
   127