2 * Copyright (C) 2008 David Schleef <ds@schleef.org>
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.
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.
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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef _GST_BASE_VIDEO_PARSE_H_
21 #define _GST_BASE_VIDEO_PARSE_H_
24 #include <gst/video/video.h>
26 #include "gstbasevideoutils.h"
28 #define GST_TYPE_BASE_VIDEO_PARSE \
29 (gst_base_video_parse_get_type())
30 #define GST_BASE_VIDEO_PARSE(obj) \
31 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParse))
32 #define GST_BASE_VIDEO_PARSE_CLASS(klass) \
33 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParseClass))
34 #define GST_BASE_VIDEO_PARSE_GET_CLASS(obj) \
35 (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_PARSE,GstBaseVideoParseClass))
36 #define GST_IS_BASE_VIDEO_PARSE(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_PARSE))
38 #define GST_IS_BASE_VIDEO_PARSE_CLASS(obj) \
39 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_PARSE))
42 * GST_BASE_VIDEO_PARSE_SINK_NAME:
44 * The name of the templates for the sink pad.
46 #define GST_BASE_VIDEO_PARSE_SINK_NAME "sink"
48 * GST_BASE_VIDEO_PARSE_SRC_NAME:
50 * The name of the templates for the source pad.
52 #define GST_BASE_VIDEO_PARSE_SRC_NAME "src"
55 * GST_BASE_VIDEO_PARSE_SRC_PAD:
56 * @obj: base video parse instance
58 * Gives the pointer to the source #GstPad object of the element.
60 #define GST_BASE_VIDEO_PARSE_SRC_PAD(obj) (GST_BASE_VIDEO_PARSE_CAST (obj)->srcpad)
63 * GST_BASE_VIDEO_PARSE_SINK_PAD:
64 * @obj: base video parse instance
66 * Gives the pointer to the sink #GstPad object of the element.
68 #define GST_BASE_VIDEO_PARSE_SINK_PAD(obj) (GST_BASE_VIDEO_PARSE_CAST (obj)->sinkpad)
71 * GST_BASE_VIDEO_PARSE_NEED_DATA:
74 #define GST_BASE_VIDEO_PARSE_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS
76 typedef struct _GstBaseVideoParse GstBaseVideoParse
;
77 typedef struct _GstBaseVideoParseClass GstBaseVideoParseClass
;
79 struct _GstBaseVideoParse
86 GstAdapter
*input_adapter
;
87 GstAdapter
*output_adapter
;
95 GstVideoFrame
*current_frame
;
97 int distance_from_sync
;
99 gboolean sink_clipping
;
101 guint64 presentation_frame_number
;
102 guint64 system_frame_number
;
105 gboolean set_output_caps
;
107 GstClockTime buffer_timestamp
;
109 gint64 timestamp_offset
;
112 struct _GstBaseVideoParseClass
114 GstElementClass element_class
;
116 gboolean (*start
) (GstBaseVideoParse
*parse
);
117 gboolean (*stop
) (GstBaseVideoParse
*parse
);
118 gboolean (*reset
) (GstBaseVideoParse
*parse
);
119 GstFlowReturn (*parse_data
) (GstBaseVideoParse
*parse
, gboolean at_eos
);
120 int (*scan_for_sync
) (GstAdapter
*adapter
, gboolean at_eos
,
122 GstFlowReturn (*shape_output
) (GstBaseVideoParse
*parse
, GstVideoFrame
*frame
);
123 GstCaps
*(*get_caps
) (GstBaseVideoParse
*parse
);
127 GType
gst_base_video_parse_get_type (void);
129 int gst_base_video_parse_get_width (GstBaseVideoParse
*parse
);
130 int gst_base_video_parse_get_height (GstBaseVideoParse
*parse
);
131 GstVideoState
*gst_base_video_parse_get_state (GstBaseVideoParse
*parse
);
132 void gst_base_video_parse_set_state (GstBaseVideoParse
*parse
,
133 GstVideoState
*state
);
135 guint64
gst_base_video_parse_get_timestamp_offset (GstBaseVideoParse
*parse
);
137 gboolean
gst_base_video_parse_set_src_caps (GstBaseVideoParse
*base_video_parse
, GstCaps
*caps
);
139 GstFlowReturn
gst_base_video_parse_end_of_stream (GstBaseVideoParse
*base_video_parse
,
142 void gst_base_video_parse_lost_sync (GstBaseVideoParse
*base_video_parse
);
144 GstVideoFrame
* gst_base_video_parse_get_frame (GstBaseVideoParse
*base_video_parse
);
145 void gst_base_video_parse_add_to_frame (GstBaseVideoParse
*base_video_parse
, int n_bytes
);
146 GstFlowReturn
gst_base_video_parse_finish_frame (GstBaseVideoParse
*base_video_parse
);
147 void gst_base_video_parse_set_sync_point (GstBaseVideoParse
*base_video_parse
);
148 GstFlowReturn
gst_base_video_parse_push (GstBaseVideoParse
*base_video_parse
,