• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * GStreamer AVTP Plugin
3  * Copyright (C) 2019 Intel Corporation
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_AVTP_CRF_BASE_H__
22 #define __GST_AVTP_CRF_BASE_H__
23 
24 #include <gst/base/gstbasetransform.h>
25 #include <gst/gst.h>
26 #include <linux/if_packet.h>
27 
28 G_BEGIN_DECLS
29 #define GST_TYPE_AVTP_CRF_BASE (gst_avtp_crf_base_get_type())
30 #define GST_AVTP_CRF_BASE(obj) \
31   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVTP_CRF_BASE,GstAvtpCrfBase))
32 #define GST_AVTP_CRF_BASE_CLASS(klass) \
33   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVTP_CRF_BASE,GstAvtpCrfBaseClass))
34 #define GST_IS_AVTP_CRF_BASE(obj) \
35   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVTP_CRF_BASE))
36 #define GST_IS_AVTP_CRF_BASE_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVTP_CRF_BASE))
38 typedef struct _GstAvtpCrfBase GstAvtpCrfBase;
39 typedef struct _GstAvtpCrfBaseClass GstAvtpCrfBaseClass;
40 typedef struct _GstAvtpCrfThreadData GstAvtpCrfThreadData;
41 
42 struct _GstAvtpCrfThreadData
43 {
44   GThread *thread;
45   gboolean is_running;
46 
47   guint64 num_pkt_tstamps;
48   GstClockTime timestamp_interval;
49   guint64 base_freq;
50   guint64 pull;
51   guint64 type;
52   guint64 mr;
53 
54   gdouble *past_periods;
55   int past_periods_iter;
56   int periods_stored;
57   /** The time in ns between two events. The type of the event is depending on
58    *  the CRF type: Audio sample, video frame sync, video line sync, ...
59    */
60   gdouble average_period;
61   GstClockTime current_ts;
62   GstClockTime last_received_tstamp;
63   guint64 last_seqnum;
64 };
65 
66 struct _GstAvtpCrfBase
67 {
68   GstBaseTransform element;
69 
70   guint64 streamid;
71   gchar *ifname;
72   gchar *address;
73 
74   GstAvtpCrfThreadData thread_data;
75 };
76 
77 struct _GstAvtpCrfBaseClass
78 {
79   GstBaseTransformClass parent_class;
80 
81   gpointer _gst_reserved[GST_PADDING];
82 };
83 
84 GType gst_avtp_crf_base_get_type (void);
85 
86 G_END_DECLS
87 #endif /* __GST_AVTP_CRF_BASE_H__ */
88