19
|
1 |
/*
|
25
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Base Gstreamer Adaptation Source
|
|
15 |
*
|
|
16 |
*/
|
19
|
17 |
|
|
18 |
#ifndef XAADAPTATIONGST_H_
|
|
19 |
#define XAADAPTATIONGST_H_
|
|
20 |
|
|
21 |
#include <pthread.h>
|
|
22 |
#include <semaphore.h>
|
|
23 |
#include <string.h>
|
|
24 |
#include <unistd.h>
|
53
|
25 |
#include <stdlib.h>
|
20
|
26 |
#include <gst/gst.h>
|
25
|
27 |
#include "openmaxalwrapper.h"
|
19
|
28 |
#include "xaadptbasectx.h"
|
53
|
29 |
|
19
|
30 |
|
|
31 |
#ifdef XA_IMPL_MEASURE_GST_DELAY
|
|
32 |
#include <time.h>
|
|
33 |
#endif /* XA_IMPL_MEASURE_GST_DELAY */
|
|
34 |
|
|
35 |
/* TYPEDEFS */
|
25
|
36 |
typedef gboolean (*GstBusCb)(GstBus *bus, GstMessage *message, gpointer data);
|
19
|
37 |
|
|
38 |
/* STRUCTURES */
|
|
39 |
|
|
40 |
/* Forward declaration of adaptation basecontext */
|
|
41 |
typedef struct XAAdaptationGstCtx_ XAAdaptationGstCtx;
|
|
42 |
|
|
43 |
/*
|
|
44 |
* Structure that holds all common variables for every
|
|
45 |
* Gst-Adaptation context structures.
|
|
46 |
*/
|
|
47 |
typedef struct XAAdaptationGstCtx_
|
25
|
48 |
{
|
19
|
49 |
/* Common Variables for all adaptation elements */
|
|
50 |
XAAdaptationBaseCtx baseObj;
|
|
51 |
|
25
|
52 |
GstState binWantedState; /** requested gst-bin target state **/
|
|
53 |
GstElement *bin; /** Container for all gst elements **/
|
19
|
54 |
|
25
|
55 |
GstBus *bus; /** Gst-bus where gst sends messages **/
|
|
56 |
GMainLoop *busloop; /** Gst-bus listener loop **/
|
|
57 |
pthread_t busloopThr;
|
|
58 |
GstBusCb busCb; /** Gst-Bus callback funtion*/
|
53
|
59 |
GError* busError;
|
|
60 |
|
25
|
61 |
XAboolean waitingasyncop;
|
|
62 |
sem_t semAsyncWait;
|
|
63 |
guint asynctimer;
|
19
|
64 |
|
|
65 |
#ifdef XA_IMPL_MEASURE_GST_DELAY
|
25
|
66 |
clock_t startTime;
|
|
67 |
clock_t endTime;
|
|
68 |
double diff;
|
19
|
69 |
#endif /*XA_IMPL_MEASURE_GST_DELAY*/
|
|
70 |
|
|
71 |
XAboolean thread_launched;
|
|
72 |
pthread_mutex_t ds_mutex;
|
|
73 |
pthread_cond_t ds_condition;
|
|
74 |
XAboolean cond_mutx_inited;
|
|
75 |
/* FUNCTIONS*/
|
|
76 |
|
25
|
77 |
} XAAdaptationGstCtx_;
|
19
|
78 |
|
|
79 |
/* FUNCTIONS */
|
|
80 |
/*
|
|
81 |
* gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data );
|
|
82 |
* Default CallBack handler for gst-bus messages. This will be called if object specific callback is
|
|
83 |
* not implemented.
|
|
84 |
*/
|
|
85 |
|
25
|
86 |
XAresult XAAdaptationGst_Init(XAAdaptationGstCtx* pSelf, XAuint32 ctxId);
|
|
87 |
XAresult XAAdaptationGst_PostInit(XAAdaptationGstCtx* ctx);
|
|
88 |
void XAAdaptationGst_Free(XAAdaptationGstCtx* ctx);
|
|
89 |
|
|
90 |
gboolean XAAdaptationGst_GstBusCb(GstBus *bus, GstMessage *message,
|
|
91 |
gpointer data);
|
19
|
92 |
|
|
93 |
XAresult XAAdaptationGst_InitGstListener(XAAdaptationGstCtx* ctx);
|
|
94 |
void* XAAdaptationGst_LaunchGstListener(void* args);
|
|
95 |
void XAAdaptationGst_StopGstListener(XAAdaptationGstCtx* ctx);
|
|
96 |
|
|
97 |
void XAAdaptationGst_PrepareAsyncWait(XAAdaptationGstCtx* ctx);
|
|
98 |
void XAAdaptationGst_StartAsyncWait(XAAdaptationGstCtx* ctx);
|
|
99 |
gboolean XAAdaptationGst_CancelAsyncWait(gpointer ctx);
|
|
100 |
void XAAdaptationGst_CompleteAsyncWait(XAAdaptationGstCtx* ctx);
|
|
101 |
|
25
|
102 |
GstElement* XAAdaptationGst_CreateGstSource(XADataSource* xaSrc,
|
53
|
103 |
const char *name, XAboolean *isPCM );
|
25
|
104 |
GstElement* XAAdaptationGst_CreateGstSink(XADataSink* xaSrc,
|
53
|
105 |
const char *name);
|
19
|
106 |
|
25
|
107 |
void XAAdaptationGst_PadBlockCb(GstPad *pad, gboolean blocked,
|
|
108 |
gpointer user_data);
|
19
|
109 |
|
|
110 |
#endif /* XAADAPTATIONGST_H_ */
|