20 |
20 |
21 #include <pthread.h> |
21 #include <pthread.h> |
22 #include <semaphore.h> |
22 #include <semaphore.h> |
23 #include <string.h> |
23 #include <string.h> |
24 #include <unistd.h> |
24 #include <unistd.h> |
|
25 #include <stdlib.h> |
25 #include <gst/gst.h> |
26 #include <gst/gst.h> |
26 #include <gst/app/gstappsrc.h> |
|
27 #include <gst/app/gstappsink.h> |
|
28 #include <gst/app/gstappbuffer.h> |
|
29 #include "openmaxalwrapper.h" |
27 #include "openmaxalwrapper.h" |
30 #include "xaglobals.h" |
|
31 #include "xaplatform.h" |
|
32 #include "xaadptbasectx.h" |
28 #include "xaadptbasectx.h" |
33 #include <stdlib.h> |
29 |
34 |
30 |
35 #ifdef XA_IMPL_MEASURE_GST_DELAY |
31 #ifdef XA_IMPL_MEASURE_GST_DELAY |
36 #include <time.h> |
32 #include <time.h> |
37 #endif /* XA_IMPL_MEASURE_GST_DELAY */ |
33 #endif /* XA_IMPL_MEASURE_GST_DELAY */ |
38 |
34 |
39 /* MACROS */ |
|
40 #define FLIP_NONE 0 |
|
41 #define FLIP_CLOCKWISE 1 /* Rotate clockwise 90 degrees */ |
|
42 #define FLIP_ROTATE_180 2 /* Rotate 180 degrees */ |
|
43 #define FLIP_COUNTERCLOCKWISE 3 /* Rotate counter-clockwise 90 degrees */ |
|
44 #define FLIP_HORIZONTAL 4 /* Flip image horizontally */ |
|
45 #define FLIP_VERTICAL 5 /* Flip image vertically */ |
|
46 |
|
47 /* TYPEDEFS */ |
35 /* TYPEDEFS */ |
48 typedef gboolean (*GstBusCb)(GstBus *bus, GstMessage *message, gpointer data); |
36 typedef gboolean (*GstBusCb)(GstBus *bus, GstMessage *message, gpointer data); |
49 |
|
50 #define CONTENT_PIPE_BUFFER_SIZE 1000 |
|
51 #define TEST_VIDEO_WIDTH 640 |
|
52 #define TEST_VIDEO_HEIGHT 480 |
|
53 |
|
54 /*typedef enum |
|
55 { |
|
56 XA_AUDIO_WAVENC = 0, |
|
57 XA_AUDIO_VORBISENC, |
|
58 XA_AUDIO_PCM, |
|
59 XA_NUM_OF_AUDIOENCODERS Do not move this line |
|
60 } XAAudioEnc;*/ |
|
61 |
|
62 /*typedef enum |
|
63 { |
|
64 XA_VIDEO_JPEGENC = 0, |
|
65 XA_VIDEO_THEORAENC, |
|
66 XA_NUM_OF_VIDEOENCODERS Do not move this line |
|
67 } XAVideoEnc;*/ |
|
68 |
|
69 /*typedef enum CP_STATE |
|
70 { |
|
71 CPStateNull =0, |
|
72 CPStateInitialized, |
|
73 CPStatePrerolling, |
|
74 CPStateStarted, |
|
75 CPStateRunning, |
|
76 CPStatePaused, |
|
77 CPStateStopped, |
|
78 CPStateWaitForData, |
|
79 CPStateEOS, |
|
80 CPStateError |
|
81 }CP_STATE;*/ |
|
82 |
|
83 /*typedef enum |
|
84 { |
|
85 XA_IMAGE_JPEGENC = 0, |
|
86 XA_IMAGE_RAW, |
|
87 XA_NUM_OF_IMAGEENCODERS Do not move this line |
|
88 } XAImageEnc;*/ |
|
89 |
37 |
90 /* STRUCTURES */ |
38 /* STRUCTURES */ |
91 |
39 |
92 /* Forward declaration of adaptation basecontext */ |
40 /* Forward declaration of adaptation basecontext */ |
93 typedef struct XAAdaptationGstCtx_ XAAdaptationGstCtx; |
41 typedef struct XAAdaptationGstCtx_ XAAdaptationGstCtx; |
106 |
54 |
107 GstBus *bus; /** Gst-bus where gst sends messages **/ |
55 GstBus *bus; /** Gst-bus where gst sends messages **/ |
108 GMainLoop *busloop; /** Gst-bus listener loop **/ |
56 GMainLoop *busloop; /** Gst-bus listener loop **/ |
109 pthread_t busloopThr; |
57 pthread_t busloopThr; |
110 GstBusCb busCb; /** Gst-Bus callback funtion*/ |
58 GstBusCb busCb; /** Gst-Bus callback funtion*/ |
111 |
59 GError* busError; |
|
60 |
112 XAboolean waitingasyncop; |
61 XAboolean waitingasyncop; |
113 sem_t semAsyncWait; |
62 sem_t semAsyncWait; |
114 guint asynctimer; |
63 guint asynctimer; |
115 |
64 |
116 #ifdef XA_IMPL_MEASURE_GST_DELAY |
65 #ifdef XA_IMPL_MEASURE_GST_DELAY |
149 void XAAdaptationGst_StartAsyncWait(XAAdaptationGstCtx* ctx); |
98 void XAAdaptationGst_StartAsyncWait(XAAdaptationGstCtx* ctx); |
150 gboolean XAAdaptationGst_CancelAsyncWait(gpointer ctx); |
99 gboolean XAAdaptationGst_CancelAsyncWait(gpointer ctx); |
151 void XAAdaptationGst_CompleteAsyncWait(XAAdaptationGstCtx* ctx); |
100 void XAAdaptationGst_CompleteAsyncWait(XAAdaptationGstCtx* ctx); |
152 |
101 |
153 GstElement* XAAdaptationGst_CreateGstSource(XADataSource* xaSrc, |
102 GstElement* XAAdaptationGst_CreateGstSource(XADataSource* xaSrc, |
154 const char *name, XAboolean *isobj, XAboolean *isPCM, |
103 const char *name, XAboolean *isPCM ); |
155 XAboolean *isRawImage); |
|
156 GstElement* XAAdaptationGst_CreateGstSink(XADataSink* xaSrc, |
104 GstElement* XAAdaptationGst_CreateGstSink(XADataSink* xaSrc, |
157 const char *name, XAboolean *isobj); |
105 const char *name); |
158 GstElement* XAAdaptationGst_CreateVideoPP(void); |
|
159 |
106 |
160 GstElement* XAAdaptationGst_CreateVideoPPBlackScr(void); |
|
161 GstElement* XAAdaptationGst_CreateInputSelector(void); |
|
162 GstElement* XAAdaptationGst_CreateAudioPP(void); |
|
163 void XAAdaptationGst_PadBlockCb(GstPad *pad, gboolean blocked, |
107 void XAAdaptationGst_PadBlockCb(GstPad *pad, gboolean blocked, |
164 gpointer user_data); |
108 gpointer user_data); |
165 void XAAdaptationGst_SetAllCaps(GstCaps * caps, char *field, ...); |
|
166 |
|
167 /*XAresult XAMetadataAdapt_TryWriteTags(XAAdaptationGstCtx* mCtx, GstBin* binToWriteTo);*/ |
|
168 |
109 |
169 #endif /* XAADAPTATIONGST_H_ */ |
110 #endif /* XAADAPTATIONGST_H_ */ |