Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / ext / resindvd / resindvdsrc.h
1 /* GStreamer
2  * Copyright (C) 2008 Jan Schmidt <thaytan@noraisin.net>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 #ifndef __RESINDVDSRC_H__
20 #define __RESINDVDSRC_H__
21
22 #include <gst/gst.h>
23
24 #include <gst/base/gstbasesrc.h>
25
26 #ifdef HAVE_STDINT_H
27 #include <stdint.h>
28 #endif
29
30 #include <dvdnav/dvdnav.h>
31 #include <dvdread/ifo_read.h>
32 #include <dvdread/nav_read.h>
33
34 G_BEGIN_DECLS
35
36 #define RESIN_TYPE_DVDSRC (rsn_dvdsrc_get_type())
37 #define RESINDVDSRC(obj) \
38   (G_TYPE_CHECK_INSTANCE_CAST((obj),RESIN_TYPE_DVDSRC,resinDvdSrc))
39 #define RESINDVDSRC_CLASS(klass) \
40   (G_TYPE_CHECK_CLASS_CAST((klass),RESIN_TYPE_DVDSRC,resinDvdSrcClass))
41 #define IS_RESINDVDSRC(obj) \
42   (G_TYPE_CHECK_INSTANCE_TYPE((obj),RESIN_TYPE_DVDSRC))
43 #define IS_RESINDVDSRC_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_TYPE((klass),RESIN_TYPE_DVDSRC))
45
46 typedef struct _resinDvdSrc      resinDvdSrc;
47 typedef struct _resinDvdSrcClass resinDvdSrcClass;
48
49 struct _resinDvdSrc
50 {
51   GstBaseSrc parent;
52
53   gboolean      faststart;
54
55   GMutex        dvd_lock;
56   GCond         still_cond;
57   GMutex        branch_lock;
58   gboolean      branching;
59
60   gchar         *device;
61   dvdnav_t      *dvdnav;
62
63   gchar     *disc_name;
64
65   /* dvd_reader instance is used to load and cache VTS/VMG ifo info */
66   dvd_reader_t  *dvdread;
67
68   /* vmgi_mat_t from the VMG ifo: */
69   vmgi_mat_t                vmgm_attr;        /* VMGM domain info             */
70   /* Array of cached vtsi_mat_t strctures from each IFO: */
71   GArray                   *vts_attrs;
72
73   ifo_handle_t              *vmg_file;
74   ifo_handle_t              *vts_file;
75
76   /* Current playback location: VTS 0 = VMG, plus in_menu or not */
77   gint          vts_n;
78   gboolean      in_menu;
79   gint          title_n; /* Title num */
80   gint          part_n; /* Part num */
81   gint          n_angles; /* number of angles */
82   gint          cur_angle; /* current angle */
83
84   gboolean      running;
85   gboolean      discont;
86   gboolean      first_seek;
87   gboolean      flushing_seek;
88   gboolean      need_segment;
89   gboolean      need_tag_update;
90   gboolean      active_highlight;
91   gboolean      in_still_state;
92   gboolean      in_playing;
93
94   gboolean      was_mouse_over;
95
96   /* Remaining time to wait in a timed still: */
97   GstClockTime  still_time_remaining;
98
99   GstBuffer     *alloc_buf;
100   GstBuffer     *next_buf;
101   /* TRUE if the next_buf is a nav block that needs enqueueing */
102   gboolean      next_is_nav_block;
103   /* PTS for activating the pending nav block in next_buf */
104   GstClockTime  next_nav_ts;
105   /* Track accumulated segment position, cleared by flushing */
106   GstSegment    src_segment;
107
108   /* Start timestamp of the previous NAV block */
109   GstClockTime  cur_start_ts;
110   /* End timestamp of the previous NAV block */
111   GstClockTime  cur_end_ts;
112   /* base ts is cur_start_ts - cell_time for each VOBU */
113   GstClockTime  cur_vobu_base_ts;
114   /* Position info of the previous NAV block */
115   GstClockTime  cur_position;
116   /* Duration of the current PGC */
117   GstClockTime  pgc_duration;
118
119   gint          active_button;
120   dvdnav_highlight_area_t area;
121
122   /* Pending events to output */
123   GstEvent      *streams_event;
124   GstEvent      *clut_event;
125   GstEvent      *spu_select_event;
126   GstEvent      *audio_select_event;
127   GstEvent      *highlight_event;
128
129   gboolean      angles_changed;
130   gboolean      commands_changed;
131
132   /* GList of NAV packets awaiting activation, and the
133    * running times to activate them. */
134   GSList *pending_nav_blocks;
135   GSList *pending_nav_blocks_end;
136
137   GstClockID nav_clock_id;
138
139   gboolean have_pci;
140   pci_t cur_pci;
141
142   /* Current state tracking */
143   gint8         cur_audio_phys_stream;
144   gint8         cur_spu_phys_stream;
145   gboolean      cur_spu_forced_only;
146   guint32       cur_clut[16];
147
148   guint32       cur_btn_mask;
149 };
150
151 struct _resinDvdSrcClass 
152 {
153   GstBaseSrcClass parent_class;
154 };
155
156 GType rsn_dvdsrc_get_type (void);
157
158 G_END_DECLS
159
160 #endif /* __RESINDVDSRC_H__ */