felipec / gst-dsp

GStreamer elements for TI's OMAP DSP

This URL has Read+Write access

cymacs (author)
Thu Aug 13 08:21:14 -0700 2009
felipec (committer)
Sat Sep 19 04:01:59 -0700 2009
gst-dsp / gstdspbase.h
100644 116 lines (91 sloc) 2.895 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* Copyright (C) 2009 Felipe Contreras
*
* Author: Felipe Contreras <felipe.contreras@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
 
#ifndef GST_DSP_BASE_H
#define GST_DSP_BASE_H
 
#include <gst/gst.h>
 
G_BEGIN_DECLS
 
#define GST_DSP_BASE(obj) (GstDspBase *)(obj)
#define GST_DSP_BASE_TYPE (gst_dsp_base_get_type())
#define GST_DSP_BASE_CLASS(obj) (GstDspBaseClass *)(obj)
 
/* #define TS_COUNT */
 
typedef struct GstDspBase GstDspBase;
typedef struct GstDspBaseClass GstDspBaseClass;
 
typedef struct du_port_t du_port_t;
 
#include "dmm_buffer.h"
#include "sem.h"
#include "async_queue.h"
 
typedef void (*port_buffer_cb_t) (GstDspBase *base,
du_port_t *port,
dmm_buffer_t *p,
dmm_buffer_t *b);
 
struct du_port_t {
guint index;
dmm_buffer_t **buffers;
dmm_buffer_t **comm; /**< arm-dsp communication structure */
dmm_buffer_t *param;
guint num_buffers;
AsyncQueue *queue;
port_buffer_cb_t send_cb;
port_buffer_cb_t recv_cb;
};
 
struct GstDspBase {
GstElement element;
 
GstPad *sinkpad, *srcpad;
 
int dsp_handle;
void *proc;
dsp_node_t *node;
struct dsp_notification *events[3];
 
GstFlowReturn status;
unsigned long input_buffer_size;
unsigned long output_buffer_size;
GThread *dsp_thread, *out_thread;
gboolean done, eos;
gint keyframe;
 
du_port_t *ports[2];
dmm_buffer_t *alg_ctrl;
GstClockTime ts_array[20];
guint ts_in_pos, ts_out_pos, ts_push_pos;
GMutex *ts_mutex;
#ifdef TS_COUNT
gulong ts_count;
#endif
GSem *flush;
guint alg;
 
gboolean use_pad_alloc; /**< Use pad_alloc for output buffers. */
gboolean use_eos_align; /**< Wait for all buffers before EOS. */
guint dsp_error;
 
void *(*create_node)(GstDspBase *base);
gboolean (*parse_func)(GstDspBase *base, GstBuffer *buf);
GstCaps *tmp_caps;
 
/* hacks */
guint skip_hack; /* don't push x number of buffers */
};
 
struct GstDspBaseClass {
GstElementClass parent_class;
};
 
GType gst_dsp_base_get_type(void);
 
du_port_t *du_port_new(guint index, guint num_buffers);
void du_port_free(du_port_t *p);
 
gboolean gstdsp_start(GstDspBase *self);
gboolean gstdsp_send_codec_data(GstDspBase *self, GstBuffer *buf);
void gstdsp_post_error(GstDspBase *self, const char *message);
 
G_END_DECLS
 
#endif /* GST_DSP_BASE_H */