• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2020 Seungha Yang <seungha@centricular.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_MF_AUDIO_ENC_H__
21 #define __GST_MF_AUDIO_ENC_H__
22 
23 #include <gst/gst.h>
24 #include <gst/audio/audio.h>
25 #include "gstmfutils.h"
26 #include "gstmftransform.h"
27 
28 G_BEGIN_DECLS
29 
30 #define GST_TYPE_MF_AUDIO_ENC           (gst_mf_audio_enc_get_type())
31 #define GST_MF_AUDIO_ENC(obj)           (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MF_AUDIO_ENC,GstMFAudioEnc))
32 #define GST_MF_AUDIO_ENC_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_MF_AUDIO_ENC,GstMFAudioEncClass))
33 #define GST_MF_AUDIO_ENC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_MF_AUDIO_ENC,GstMFAudioEncClass))
34 #define GST_IS_MF_AUDIO_ENC(obj)        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MF_AUDIO_ENC))
35 #define GST_IS_MF_AUDIO_ENC_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_MF_AUDIO_ENC))
36 
37 typedef struct _GstMFAudioEnc GstMFAudioEnc;
38 typedef struct _GstMFAudioEncClass GstMFAudioEncClass;
39 
40 struct _GstMFAudioEnc
41 {
42   GstAudioEncoder parent;
43 
44   GstMFTransform *transform;
45   guint64 sample_duration_in_mf;
46   guint64 sample_count;
47 };
48 
49 struct _GstMFAudioEncClass
50 {
51   GstAudioEncoderClass parent_class;
52 
53   GUID codec_id;
54   guint32 enum_flags;
55   guint device_index;
56   gint frame_samples;
57 
58   gboolean (*get_output_type) (GstMFAudioEnc * mfenc,
59                                GstAudioInfo * info,
60                                IMFMediaType ** output_type);
61 
62   gboolean (*get_input_type)  (GstMFAudioEnc * mfenc,
63                                GstAudioInfo * info,
64                                IMFMediaType ** input_type);
65 
66   gboolean (*set_src_caps)    (GstMFAudioEnc * mfenc,
67                                GstAudioInfo * info);
68 };
69 
70 GType gst_mf_audio_enc_get_type (void);
71 
72 G_END_DECLS
73 
74 #endif /* __GST_MF_AUDIO_ENC_H__ */