summaryrefslogtreecommitdiff
path: root/sys/vdpau/basevideodecoder/gstvideoframe.h
blob: ab293da8da851d24acfbf86defaade6e13cdabed (plain)
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
/*
* GStreamer
* Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
*
* 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 _GST_VIDEO_FRAME_H_
#define _GST_VIDEO_FRAME_H_

#include <gst/gst.h>

#define GST_TYPE_VIDEO_FRAME      (gst_video_frame_get_type())
#define GST_IS_VIDEO_FRAME(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_FRAME))
#define GST_VIDEO_FRAME(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_FRAME, GstVideoFrame))
#define GST_VIDEO_FRAME_CAST(obj) ((GstVideoFrame *)obj)

/**
 * GstVideoFrameFlag:
 * @GST_VIDEO_FRAME_FLAG_PREROLL: the frame is part of a preroll and should not be
 * displayed.
 * @GST_VIDEO_FRAME_FLAG_DISCONT: the frame marks a discontinuity in the stream.
 * This typically occurs after a seek or a dropped buffer from a live or
 * network source.
 * @GST_VIDEO_FRAME_FLAG_GAP: the frame has been created to fill a gap in the
 * stream and contains media neutral data (elements can switch to optimized code
 * path that ignores the buffer content).
 * @GST_VIDEO_FRAME_FLAG_DELTA_UNIT: the frame is a keyframe.
 * @GST_VIDEO_FRAME_FLAG_SYNC_POINT: the frame marks a sync point.
 * @GST_VIDEO_FRAME_FLAG_EOS: the frame is the last in the stream.
 * @GST_VIDEO_FRAME_FLAG_TFF: If the frame is interlaced, then the first
 * field in the video frame is the top field. If unset, the bottom field is first.
 * @GST_VIDEO_FRAME_FLAG_LAST: additional flags can be added starting from this flag.
 * A set of frame flags used to describe properties of a #GstVideoFrame.
 */
typedef enum
{
  GST_VIDEO_FRAME_FLAG_PREROLL = (GST_MINI_OBJECT_FLAG_LAST << 0),
  GST_VIDEO_FRAME_FLAG_DISCONT = (GST_MINI_OBJECT_FLAG_LAST << 1),
  GST_VIDEO_FRAME_FLAG_GAP = (GST_MINI_OBJECT_FLAG_LAST << 2),
  GST_VIDEO_FRAME_FLAG_KEYFRAME = (GST_MINI_OBJECT_FLAG_LAST << 3),
  GST_VIDEO_FRAME_FLAG_SYNC_POINT = (GST_MINI_OBJECT_FLAG_LAST << 4),
  GST_VIDEO_FRAME_FLAG_EOS = (GST_MINI_OBJECT_FLAG_LAST << 5),
  GST_VIDEO_FRAME_FLAG_TFF = (GST_MINI_OBJECT_FLAG_LAST << 6),
  GST_VIDEO_FRAME_FLAG_LAST = (GST_MINI_OBJECT_FLAG_LAST << 7)
} GstVideoFrameFlag;

typedef struct _GstVideoFrame GstVideoFrame;
typedef struct _GstVideoFrameClass GstVideoFrameClass;

struct _GstVideoFrame
{
  GstMiniObject mini_object;

  GstClockTime upstream_timestamp;
  GstClockTime upstream_duration;

  GstClockTime parsed_timestamp;

  guint n_fields;

	GstBuffer *sink_buffer;
  GstBuffer *src_buffer;
};

struct _GstVideoFrameClass
{
  GstMiniObjectClass mini_object_class;
};

/* refcounting */
/**
 * gst_video_frame_ref:
 * @frame: a #GstVideoFrame.
 *
 * Increases the refcount of the given frame by one.
 *
 * Returns: @frame
 */
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstVideoFrame * gst_buffer_ref (GstVideoFrame * frame);
#endif

static inline GstVideoFrame *
gst_video_frame_ref (GstVideoFrame *frame)
{
  return (GstVideoFrame *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (frame));
}

/**
 * gst_video_frame_unref:
 * @frame: a #GstVideoFrame.
 *
 * Decreases the refcount of the frame. If the refcount reaches 0, the frame
 * will be freed.
 */
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void gst_video_frame_unref (GstVideoFrame * frame);
#endif

static inline void
gst_video_frame_unref (GstVideoFrame * frame)
{
  gst_mini_object_unref (GST_MINI_OBJECT_CAST (frame));
}

/**
 * GST_VIDEO_FRAME_FLAG_IS_SET:
 * @buf: a #GstVideoFrame.
 * @flag: the #GstVideoFrameFlag to check.
 *
 * Gives the status of a specific flag on a video frame.
 */
#define GST_VIDEO_FRAME_FLAG_IS_SET(frame,flag)        GST_MINI_OBJECT_FLAG_IS_SET (frame, flag)
/**
 * GST_VIDEO_FRAME_FLAG_SET:
 * @buf: a #GstVideoFrame.
 * @flag: the #GstVideoFrameFlag to set.
 *
 * Sets a frame flag on a video frame.
 */
#define GST_VIDEO_FRAME_FLAG_SET(frame,flag)           GST_MINI_OBJECT_FLAG_SET (frame, flag)
/**
 * GST_VIDEO_FRAME_FLAG_UNSET:
 * @buf: a #GstVideoFrame.
 * @flag: the #GstVideoFrameFlag to clear.
 *
 * Clears a frame flag.
 */
#define GST_VIDEO_FRAME_FLAG_UNSET(frame,flag)         GST_MINI_OBJECT_FLAG_UNSET (frame, flag)

GstVideoFrame *gst_video_frame_new (void);

GType gst_video_frame_get_type (void);

#endif