• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 Ole André Vadla Ravnås <oleavr@soundrop.com>
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 
20 #ifndef __GST_VTENC_H__
21 #define __GST_VTENC_H__
22 
23 #include <gst/gst.h>
24 #include <gst/video/video.h>
25 #include <VideoToolbox/VideoToolbox.h>
26 
27 G_BEGIN_DECLS
28 
29 #define GST_VTENC_CAST(obj) \
30   ((GstVTEnc *) (obj))
31 #define GST_VTENC_CLASS_GET_CODEC_DETAILS(klass) \
32   ((const GstVTEncoderDetails *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), \
33       GST_VTENC_CODEC_DETAILS_QDATA))
34 
35 typedef struct _GstVTEncoderDetails GstVTEncoderDetails;
36 
37 typedef struct _GstVTEncClassParams GstVTEncClassParams;
38 typedef struct _GstVTEncClass GstVTEncClass;
39 typedef struct _GstVTEnc GstVTEnc;
40 
41 struct _GstVTEncoderDetails
42 {
43   const gchar * name;
44   const gchar * element_name;
45   const gchar * mimetype;
46   CMVideoCodecType format_id;
47   gboolean require_hardware;
48 };
49 
50 struct _GstVTEncClass
51 {
52   GstVideoEncoderClass parent_class;
53 };
54 
55 struct _GstVTEnc
56 {
57   GstVideoEncoder parent;
58 
59   const GstVTEncoderDetails * details;
60 
61   CMVideoCodecType specific_format_id;
62   CFStringRef profile_level;
63   guint bitrate;
64   gboolean allow_frame_reordering;
65   gboolean realtime;
66   gdouble quality;
67   gint max_keyframe_interval;
68   GstClockTime max_keyframe_interval_duration;
69   gint latency_frames;
70   gboolean preserve_alpha;
71 
72   gboolean dump_properties;
73   gboolean dump_attributes;
74 
75   gint negotiated_width, negotiated_height;
76   gint negotiated_fps_n, negotiated_fps_d;
77   gint caps_width, caps_height;
78   gint caps_fps_n, caps_fps_d;
79   gboolean have_field_order;
80   GstVideoCodecState *input_state;
81   GstVideoInfo video_info;
82   VTCompressionSessionRef session;
83   CFDictionaryRef keyframe_props;
84 
85   GAsyncQueue * cur_outframes;
86 };
87 
88 void gst_vtenc_register_elements (GstPlugin * plugin);
89 
90 G_END_DECLS
91 
92 #endif /* __GST_VTENC_H__ */
93