File: nleobject.h

package info (click to toggle)
gstreamer-editing-services1.0 1.14.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,388 kB
  • sloc: ansic: 43,396; sh: 4,773; perl: 1,583; makefile: 1,172; python: 581; xml: 80; lex: 44
file content (179 lines) | stat: -rw-r--r-- 5,349 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/* GStreamer
 * Copyright (C) 2001 Wim Taymans <wim.taymans@gmail.com>
 *               2004-2008 Edward Hervey <bilboed@bilboed.com>
 *
 * nleobject.h: Header for base NleObject
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */


#ifndef __NLE_OBJECT_H__
#define __NLE_OBJECT_H__

#include <gst/gst.h>

#include "nletypes.h"

G_BEGIN_DECLS
#define NLE_TYPE_OBJECT \
  (nle_object_get_type())
#define NLE_OBJECT(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj),NLE_TYPE_OBJECT,NleObject))
#define NLE_OBJECT_CAST(obj) ((NleObject*) (obj))
#define NLE_OBJECT_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST((klass),NLE_TYPE_OBJECT,NleObjectClass))
#define NLE_OBJECT_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_CLASS ((obj), NLE_TYPE_OBJECT, NleObjectClass))
#define NLE_IS_OBJECT(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),NLE_TYPE_OBJECT))
#define NLE_IS_OBJECT_CLASS(obj) \
  (G_TYPE_CHECK_CLASS_TYPE((klass),NLE_TYPE_OBJECT))

#define NLE_OBJECT_SRC(obj) (((NleObject *) obj)->srcpad)

/**
 * NleObjectFlags:
 * @NLE_OBJECT_IS_SOURCE:
 * @NLE_OBJECT_IS_OPERATION:
 * @NLE_OBJECT_IS_EXPANDABLE: The #NleObject start/stop will extend accross the full composition.
 * @NLE_OBJECT_LAST_FLAG:
*/

typedef enum
{
  NLE_OBJECT_SOURCE = (GST_BIN_FLAG_LAST << 0),
  NLE_OBJECT_OPERATION = (GST_BIN_FLAG_LAST << 1),
  NLE_OBJECT_EXPANDABLE = (GST_BIN_FLAG_LAST << 2),
  NLE_OBJECT_COMPOSITION = (GST_BIN_FLAG_LAST << 3),
  /* padding */
  NLE_OBJECT_LAST_FLAG = (GST_BIN_FLAG_LAST << 5)
} NleObjectFlags;


#define NLE_OBJECT_IS_SOURCE(obj) \
  (GST_OBJECT_FLAG_IS_SET(obj, NLE_OBJECT_SOURCE))
#define NLE_OBJECT_IS_OPERATION(obj) \
  (GST_OBJECT_FLAG_IS_SET(obj, NLE_OBJECT_OPERATION))
#define NLE_OBJECT_IS_EXPANDABLE(obj) \
  (GST_OBJECT_FLAG_IS_SET(obj, NLE_OBJECT_EXPANDABLE))
#define NLE_OBJECT_IS_COMPOSITION(obj) \
  (GST_OBJECT_FLAG_IS_SET(obj, NLE_OBJECT_COMPOSITION))

/* For internal usage only */
#define NLE_OBJECT_START(obj) (NLE_OBJECT_CAST (obj)->start)
#define NLE_OBJECT_STOP(obj) (NLE_OBJECT_CAST (obj)->stop)
#define NLE_OBJECT_DURATION(obj) (NLE_OBJECT_CAST (obj)->duration)
#define NLE_OBJECT_INPOINT(obj) (NLE_OBJECT_CAST (obj)->inpoint)
#define NLE_OBJECT_PRIORITY(obj) (NLE_OBJECT_CAST (obj)->priority)
#define NLE_OBJECT_ACTIVE(obj) (NLE_OBJECT_DURATION(obj) > 0 && NLE_OBJECT_CAST (obj)->active)

#define NLE_OBJECT_IS_COMMITING(obj) (NLE_OBJECT_CAST (obj)->commiting)

struct _NleObject
{
  GstBin parent;

  GstPad *srcpad;

  /* Time positionning */
  GstClockTime start;
  GstClockTime inpoint;
  GstClockTimeDiff duration;

  /* Pending time positionning
   * Should be == GST_CLOCK_TIME_NONE when nothing to do
   */
  GstClockTime pending_start;
  GstClockTime pending_inpoint;
  GstClockTimeDiff pending_duration;
  guint32 pending_priority;
  gboolean pending_active;

  gboolean commit_needed;
  gboolean commiting; /* Set to TRUE during the commiting time only */

  gboolean expandable;

  /* read-only */
  GstClockTime stop;

  /* priority in parent */
  guint32 priority;

  /* active in parent */
  gboolean active;

  /* Filtering caps */
  GstCaps *caps;

  /* current segment seek <RO> */
  gdouble segment_rate;
  GstSeekFlags segment_flags;
  gint64 segment_start;
  gint64 segment_stop;

  /* the rate at which this object speeds up or slows down media */
  gdouble media_duration_factor;
  /* the rate at which this object and all of its children speed up or slow
   * down media */
  gdouble recursive_media_duration_factor;

  gboolean in_composition;
};

struct _NleObjectClass
{
  GstBinClass parent_class;

  /* Signal method handler */
  gboolean (*commit_signal_handler) (NleObject * object, gboolean recurse);

  /* virtual methods for subclasses */
    gboolean (*prepare) (NleObject * object);
    gboolean (*cleanup) (NleObject * object);
    gboolean (*commit) (NleObject * object, gboolean recurse);
};

GType nle_object_get_type (void)G_GNUC_INTERNAL;

gboolean
nle_object_to_media_time (NleObject * object, GstClockTime otime,
			  GstClockTime * mtime) G_GNUC_INTERNAL;

gboolean
nle_media_to_object_time (NleObject * object, GstClockTime mtime,
			  GstClockTime * otime) G_GNUC_INTERNAL;

void
nle_object_set_caps (NleObject * object, const GstCaps * caps) G_GNUC_INTERNAL;

void
nle_object_set_commit_needed (NleObject *object) G_GNUC_INTERNAL;

gboolean
nle_object_commit (NleObject *object, gboolean recurse) G_GNUC_INTERNAL;

void
nle_object_reset (NleObject *object) G_GNUC_INTERNAL;

GstStateChangeReturn
nle_object_cleanup (NleObject * object) G_GNUC_INTERNAL;

void nle_object_seek_all_children (NleObject *object, GstEvent *seek_event) G_GNUC_INTERNAL;

G_END_DECLS
#endif /* __NLE_OBJECT_H__ */