blob: 83332e521a7763e20b17d6a41020bcc52442d2fe [file] [log] [blame]
Vivia Nikolaidou978bcd72015-04-21 21:09:19 +03001/*
2 * GStreamer
3 * Copyright (C) 2015 Vivia Nikolaidou <vivia@toolsonair.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef __GST_VIDEOFRAME_AUDIOLEVEL_H__
22#define __GST_VIDEOFRAME_AUDIOLEVEL_H__
23
24#include <gst/gst.h>
25#include <gst/audio/audio.h>
26
27G_BEGIN_DECLS
28#define GST_TYPE_VIDEOFRAME_AUDIOLEVEL (gst_videoframe_audiolevel_get_type())
29#define GST_VIDEOFRAME_AUDIOLEVEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEOFRAME_AUDIOLEVEL,GstVideoFrameAudioLevel))
30#define GST_IS_VIDEOFRAME_AUDIOLEVEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEOFRAME_AUDIOLEVEL))
31#define GST_VIDEOFRAME_AUDIOLEVEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_VIDEOFRAME_AUDIOLEVEL,GstVideoFrameAudioLevelClass))
32#define GST_IS_VIDEOFRAME_AUDIOLEVEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_VIDEOFRAME_AUDIOLEVEL))
33#define GST_VIDEOFRAME_AUDIOLEVEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_VIDEOFRAME_AUDIOLEVEL,GstVideoFrameAudioLevelClass))
34typedef struct _GstVideoFrameAudioLevel GstVideoFrameAudioLevel;
35typedef struct _GstVideoFrameAudioLevelClass GstVideoFrameAudioLevelClass;
36
37struct _GstVideoFrameAudioLevel
38{
39 GstElement parent;
40
41 GstPad *asrcpad, *asinkpad, *vsrcpad, *vsinkpad;
42
43 GstAudioInfo ainfo;
44
45 gdouble *CS; /* normalized Cumulative Square */
46
47 GstSegment asegment, vsegment;
48
49 void (*process) (gpointer, guint, guint, gdouble *);
50
51 GQueue vtimeq;
52 GstAdapter *adapter;
53 GstClockTime first_time;
54 guint total_frames;
55 guint64 next_offset, alignment_threshold, discont_time, discont_wait;
56
57 gboolean video_eos_flag;
58 gboolean audio_flush_flag;
59 gboolean shutdown_flag;
60
61 GCond cond;
62 GMutex mutex;
63};
64
65struct _GstVideoFrameAudioLevelClass
66{
67 GstElementClass parent_class;
68};
69
70GType gst_videoframe_audiolevel_get_type (void);
71
72G_END_DECLS
73#endif /* __GST_VIDEOFRAME_AUDIOLEVEL_H__ */