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   CFStringRef profile_level;
62   guint bitrate;
63   gboolean allow_frame_reordering;
64   gboolean realtime;
65   gdouble quality;
66   gint max_keyframe_interval;
67   GstClockTime max_keyframe_interval_duration;
68   gint latency_frames;
69 
70   gboolean dump_properties;
71   gboolean dump_attributes;
72 
73   gint negotiated_width, negotiated_height;
74   gint negotiated_fps_n, negotiated_fps_d;
75   gint caps_width, caps_height;
76   gint caps_fps_n, caps_fps_d;
77   GstVideoCodecState *input_state;
78   GstVideoInfo video_info;
79   VTCompressionSessionRef session;
80   CFDictionaryRef keyframe_props;
81 
82   GAsyncQueue * cur_outframes;
83 };
84 
85 void gst_vtenc_register_elements (GstPlugin * plugin);
86 
87 G_END_DECLS
88 
89 #endif /* __GST_VTENC_H__ */
90