author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 23 Jun 2010 18:47:10 +0300 | |
changeset 31 | 8dfd592727cb |
parent 16 | 43d09473c595 |
child 32 | 94fc26b6e006 |
permissions | -rw-r--r-- |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
3 |
* All rights reserved. |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
8 |
* |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
9 |
* Initial Contributors: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
11 |
* |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
12 |
* Contributors: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
13 |
* |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
14 |
* Description: Base GStreamer Adaptation Source |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
15 |
* |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
16 |
*/ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <assert.h> |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <string.h> |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
20 |
#include <gst/gst.h> |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
21 |
#include <gst/gstbuffer.h> |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include "xaobjectitf.h" |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include "xacameradevice.h" |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include "xaradiodevice.h" |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include "xaoutputmix.h" |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include "xamediaplayeradaptctx.h" |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include "xacameraadaptctx.h" |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <stdlib.h> |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
29 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
30 |
#ifdef OMAX_CAMERABIN |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
extern XAboolean cameraRealized; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
32 |
|
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
extern XACameraAdaptationCtx_* cameraCtx; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
34 |
#else |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
35 |
XAboolean cameraRealized = XA_BOOLEAN_FALSE; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
36 |
XACameraAdaptationCtx_* cameraCtx = NULL; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
37 |
#endif |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
/* |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
* XAAdaptationGstCtx* XAAdaptationGst_Create() |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
* 1st phase initialization function for Adaptation Base context structure. |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
* Reserves memory for base context and initializes GStreamer FW. |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
43 |
XAresult XAAdaptationGst_Init(XAAdaptationGstCtx* pSelf, XAuint32 ctxId) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
44 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
DEBUG_API("->XAAdaptationGst_Init"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
47 |
if (pSelf) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
48 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
49 |
if (XAAdaptationBase_Init(&(pSelf->baseObj), ctxId) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
50 |
!= XA_RESULT_SUCCESS) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
{ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
DEBUG_ERR("Failed to init base context!!!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
free(pSelf); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
pSelf = NULL; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
else |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
{ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
GError* gerror = 0; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
59 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
60 |
/* Add default handler for Gst-bus messages */ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
pSelf->busCb = XAAdaptationGst_GstBusCb; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
62 |
|
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
// VASU MOD BEGINS |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
pSelf->cond_mutx_inited = XA_BOOLEAN_FALSE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
// VASU MOD ENDS |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
66 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
67 |
sem_init(&(pSelf->semAsyncWait), 0, 0); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
68 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
69 |
if (!gst_init_check(NULL, NULL, &gerror)) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
71 |
DEBUG_ERR("Gst Initalization failure."); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
72 |
return XA_RESULT_INTERNAL_ERROR; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
74 |
|
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
75 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
76 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
else |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
78 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
DEBUG_ERR("Invalid Gst Base Context.") |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
return XA_RESULT_PARAMETER_INVALID; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
81 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
83 |
DEBUG_API("<-XAAdaptationGst_Init"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
84 |
return XA_RESULT_SUCCESS; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
85 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
86 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
/* |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
* XAresult XAAdaptationGst_PostInit() |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
* 2nd phase initialization for Adaptation Base. |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
91 |
XAresult XAAdaptationGst_PostInit(XAAdaptationGstCtx* ctx) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
92 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
XAresult ret = XA_RESULT_SUCCESS; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
DEBUG_API("->XAAdaptationGst_PostInit"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
95 |
// VASU MOD BEGINS |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
XAAdaptationBase_PostInit(&ctx->baseObj); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
97 |
|
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
ctx->thread_launched = XA_BOOLEAN_FALSE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
pthread_mutex_init(&(ctx->ds_mutex), NULL); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
pthread_cond_init(&(ctx->ds_condition), NULL); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
ctx->cond_mutx_inited = XA_BOOLEAN_TRUE; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
102 |
|
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
// VASU MOD ENDS |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
DEBUG_API("<-XAAdaptationGst_PostInit"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
return ret; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
106 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
/* |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
* void XAAdaptationGst_Free( XAAdaptationGstCtx* ctx ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
* Frees all Base context variables . |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
112 |
void XAAdaptationGst_Free(XAAdaptationGstCtx* ctx) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
113 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
114 |
GstElement* fakesink = NULL; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
DEBUG_API("->XAAdaptationGst_Free"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
117 |
if (ctx->bin) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
118 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
119 |
fakesink = gst_bin_get_by_name(GST_BIN(ctx->bin), "fakesink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
120 |
if (fakesink) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
121 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
122 |
gst_element_set_state(GST_ELEMENT(fakesink), GST_STATE_NULL); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
123 |
gst_object_unref(fakesink); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
124 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
125 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
126 |
if (gst_element_set_state(GST_ELEMENT(ctx->bin), GST_STATE_NULL) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
127 |
!= GST_STATE_CHANGE_SUCCESS) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
128 |
{ /*not much we can do*/ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
129 |
DEBUG_ERR("WARNING: Failed to change to NULL state before deletion!!") |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
130 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
132 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
133 |
if (ctx->asynctimer) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
134 |
{ /*cancel timer*/ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
g_source_remove(ctx->asynctimer); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
136 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
sem_post(&(ctx->semAsyncWait)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
sem_destroy(&(ctx->semAsyncWait)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
XAAdaptationGst_StopGstListener(ctx); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
142 |
if (ctx->bin) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
143 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
gst_object_unref(ctx->bin); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
145 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
//g_array_free(ctx->evtHdlrs, TRUE); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
// VASU MOD BEGINS |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
if (ctx->cond_mutx_inited == XA_BOOLEAN_TRUE) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
{ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
ctx->thread_launched = XA_BOOLEAN_FALSE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
pthread_mutex_destroy(&(ctx->ds_mutex)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
pthread_cond_destroy(&(ctx->ds_condition)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
ctx->cond_mutx_inited = XA_BOOLEAN_FALSE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
// VASU MOD ENDS |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
157 |
XAAdaptationBase_Free(&ctx->baseObj); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
158 |
|
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
159 |
DEBUG_API("<-XAAdaptationGst_Free"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
160 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
/* |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
* gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
* Default Gst-bus message handler (Callback) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
165 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
166 |
gboolean XAAdaptationGst_GstBusCb(GstBus *bus, GstMessage *message, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
167 |
gpointer data) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
168 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
GError *error; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
170 |
gchar *debug; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
171 |
DEBUG_API("->XAAdaptationGst_GstBusCb");DEBUG_INFO_A2("Received Gst callback \"%s\" from \"%s\"", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
172 |
GST_MESSAGE_TYPE_NAME(message), |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
173 |
GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
174 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
175 |
switch (GST_MESSAGE_TYPE(message)) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
176 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
case GST_MESSAGE_ERROR: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
178 |
gst_message_parse_error(message, &error, &debug); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
179 |
DEBUG_INFO_A1("%s", debug) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
180 |
; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
case GST_MESSAGE_EOS: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
case GST_MESSAGE_UNKNOWN: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
case GST_MESSAGE_WARNING: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
case GST_MESSAGE_INFO: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
case GST_MESSAGE_TAG: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
case GST_MESSAGE_BUFFERING: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
194 |
case GST_MESSAGE_STATE_CHANGED: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
case GST_MESSAGE_STATE_DIRTY: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
198 |
case GST_MESSAGE_STEP_DONE: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
case GST_MESSAGE_CLOCK_PROVIDE: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
case GST_MESSAGE_CLOCK_LOST: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
204 |
case GST_MESSAGE_NEW_CLOCK: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
case GST_MESSAGE_STRUCTURE_CHANGE: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
207 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
case GST_MESSAGE_STREAM_STATUS: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
210 |
case GST_MESSAGE_APPLICATION: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
case GST_MESSAGE_ELEMENT: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
213 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
case GST_MESSAGE_SEGMENT_START: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
case GST_MESSAGE_SEGMENT_DONE: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
case GST_MESSAGE_DURATION: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
case GST_MESSAGE_LATENCY: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
222 |
case GST_MESSAGE_ASYNC_START: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
224 |
case GST_MESSAGE_ASYNC_DONE: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
case GST_MESSAGE_ANY: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
228 |
default: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
229 |
DEBUG_INFO("Unhandled Gst-Bus message") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
230 |
; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
break; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
232 |
}DEBUG_API("<-XAAdaptationGst_GstBusCb"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
233 |
return TRUE; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
236 |
XAresult XAAdaptationGst_InitGstListener(XAAdaptationGstCtx* ctx) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
237 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
int ret; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
DEBUG_API("->XAAdaptationGst_InitGstListener"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
240 |
if (ctx->bin) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
241 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
242 |
ctx->bus = gst_pipeline_get_bus(GST_PIPELINE( ctx->bin )); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
243 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
244 |
if (!ctx->bus) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
245 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
246 |
DEBUG_ERR("could not get gst bus!") |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
247 |
return XA_RESULT_INTERNAL_ERROR; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
248 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
249 |
ret = pthread_create(&(ctx->busloopThr), NULL, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
250 |
(XAAdaptationGst_LaunchGstListener), (void*) ctx); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
// VASU MOD BEGINS |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
252 |
if (ctx->thread_launched == XA_BOOLEAN_FALSE) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
253 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
// Wait until the thread is created |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
pthread_mutex_lock(&(ctx->ds_mutex)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
pthread_cond_wait(&(ctx->ds_condition), &(ctx->ds_mutex)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
pthread_mutex_unlock(&(ctx->ds_mutex)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
// VASU MOD ENDS |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
259 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
260 |
if (ret) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
261 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
DEBUG_ERR_A1("could not create thread!! (%d)",ret) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
return XA_RESULT_INTERNAL_ERROR; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
264 |
}DEBUG_API("<-XAAdaptationGst_InitGstListener"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
265 |
return XA_RESULT_SUCCESS; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
void * XAAdaptationGst_LaunchGstListener(void* args) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
269 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
270 |
XAAdaptationGstCtx* ctx = (XAAdaptationGstCtx*) args; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
DEBUG_API("->XAAdaptationGst_LaunchGstListener"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
// VASU MOD BEGINS |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
// Signal calling thread that this thread creation is completed |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
ctx->thread_launched = XA_BOOLEAN_TRUE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
pthread_mutex_lock(&(ctx->ds_mutex)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
pthread_cond_signal(&(ctx->ds_condition)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
pthread_mutex_unlock(&(ctx->ds_mutex)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
278 |
// VASU MOD ENDS |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
280 |
ctx->busloop = g_main_loop_new(NULL, FALSE); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
281 |
if (!ctx->busloop) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
282 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
283 |
DEBUG_ERR("Glib main loop failure."); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
284 |
DEBUG_API("<-XAAdaptationGst_LaunchGstListener"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
assert(0); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
286 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
287 |
else |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
288 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
DEBUG_INFO("Start Glib main loop") |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
290 |
g_main_loop_run(ctx->busloop); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
291 |
DEBUG_INFO("Glib main loop stopped - exiting thread"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
292 |
DEBUG_API("<-XAAdaptationGst_LaunchGstListener"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
293 |
pthread_exit(NULL); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
294 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
295 |
return NULL; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
296 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
297 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
298 |
void XAAdaptationGst_StopGstListener(XAAdaptationGstCtx* ctx) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
299 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
300 |
DEBUG_API("->XAAdaptationGst_StopGstListener"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
301 |
if (ctx->busloop) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
302 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
303 |
g_main_loop_quit(ctx->busloop); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
304 |
g_main_loop_unref(ctx->busloop); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
305 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
306 |
if (ctx->bus) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
307 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
gst_object_unref(ctx->bus); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
ctx->bus = NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
310 |
}DEBUG_API("<-XAAdaptationGst_StopGstListener"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
311 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
312 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
313 |
/* |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
* ASynchronous operation managing |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
315 |
**/ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
317 |
/* NOTE: This should NOT be called from gst callbacks - danger of deadlock!! |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
*/ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
319 |
void XAAdaptationGst_PrepareAsyncWait(XAAdaptationGstCtx* ctx) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
320 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
321 |
DEBUG_API("->XAAdaptationGst_PrepareAsyncWait"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
322 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
323 |
if (ctx->waitingasyncop) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
324 |
{ /*wait previous async op*/ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
325 |
DEBUG_INFO("::WARNING:: previous asynch still ongoing!!!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
326 |
DEBUG_INFO(">>>> WAIT PREVIOUS"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
327 |
sem_wait(&(ctx->semAsyncWait)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
328 |
DEBUG_INFO("<<<< PREVIOUS COMPLETED"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
329 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
330 |
sem_init(&(ctx->semAsyncWait), 0, 0); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
331 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
332 |
ctx->waitingasyncop = XA_BOOLEAN_TRUE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
333 |
DEBUG_API("<-XAAdaptationGst_PrepareAsyncWait"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
334 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
335 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
336 |
void XAAdaptationGst_StartAsyncWait(XAAdaptationGstCtx* ctx) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
337 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
338 |
DEBUG_API("->XAAdaptationGst_StartAsyncWait"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
339 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
340 |
/* timeout to try to avoid gst freeze in rollup */ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
341 |
ctx->asynctimer = g_timeout_add(XA_ADAPT_ASYNC_TIMEOUT, |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
342 |
XAAdaptationGst_CancelAsyncWait, ctx); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
/* check flag once again if callback already happened before wait */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
344 |
if (ctx->waitingasyncop) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
345 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
346 |
DEBUG_INFO(">>>> ASYNC STARTS"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
sem_wait(&(ctx->semAsyncWait)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
DEBUG_INFO("<<<< ASYNC COMPLETED"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
349 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
350 |
else |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
351 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
352 |
DEBUG_INFO("<> async completed already"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
353 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
354 |
/*cancel timer*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
355 |
if (ctx->asynctimer) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
356 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
357 |
g_source_remove(ctx->asynctimer); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
358 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
359 |
ctx->waitingasyncop = XA_BOOLEAN_FALSE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
360 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
361 |
DEBUG_API("<-XAAdaptationGst_StartAsyncWait"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
362 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
363 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
364 |
/* async operation timeout callback*/ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
gboolean XAAdaptationGst_CancelAsyncWait(gpointer ctx) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
366 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
367 |
XAAdaptationGstCtx* bCtx = (XAAdaptationGstCtx*) ctx; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
368 |
DEBUG_API("->XAAdaptationGst_CancelAsyncWait"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
369 |
if (bCtx->waitingasyncop) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
370 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
371 |
DEBUG_ERR_A3("ASYNC TIMED OUT : current %d, gsttarget %d, wanted %d", |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
372 |
GST_STATE(bCtx->bin), GST_STATE_TARGET(bCtx->bin), bCtx->binWantedState); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
373 |
bCtx->waitingasyncop = XA_BOOLEAN_FALSE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
374 |
sem_post(&(bCtx->semAsyncWait)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
375 |
}DEBUG_API("<-XAAdaptationGst_CancelAsyncWait"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
376 |
/* return false to remove timer */ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
377 |
return FALSE; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
378 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
379 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
380 |
void XAAdaptationGst_CompleteAsyncWait(XAAdaptationGstCtx* ctx) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
381 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
382 |
DEBUG_API("->XAAdaptationGst_CompleteAsyncWait"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
383 |
if (ctx->waitingasyncop) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
384 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
385 |
int i; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
386 |
ctx->waitingasyncop = XA_BOOLEAN_FALSE; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
387 |
sem_getvalue(&(ctx->semAsyncWait), &i); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
388 |
DEBUG_INFO_A1("Asynch operation succeeded, sem value %d",i); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
389 |
if (i <= 0) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
390 |
{ /* only post if locked */ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
391 |
sem_post(&(ctx->semAsyncWait)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
392 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
393 |
else if (i > 0) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
394 |
{ /* should not be, reset semaphore */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
395 |
sem_init(&(ctx->semAsyncWait), 0, 0); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
396 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
397 |
}DEBUG_API("<-XAAdaptationGst_CompleteAsyncWait"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
398 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
399 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
400 |
/** |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
401 |
* GstElement* XAAdaptationGst_CreateGstSource( XADataSource* xaSrc, const XAchar *name ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
402 |
* @param XADataSource* xaSnk - XADataSource defining gst source to create |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
* @param const XAchar *name - string for naming the gst element |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
* @param XAboolean *isobj - (out param) is source another XA object? |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
* @return GstElement* - return newly created gst source element |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
406 |
* Description: Create gst source element corresponding to XA source structure |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
407 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
408 |
GstElement* XAAdaptationGst_CreateGstSource(XADataSource* xaSrc, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
409 |
const char *name, XAboolean *isobj, XAboolean *isPCM, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
410 |
XAboolean *isRawImage) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
411 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
412 |
XAuint32 locType = 0; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
413 |
GstElement* gstSrc = NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
414 |
char* fname = NULL; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
415 |
XADataLocator_URI* uri = NULL; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
416 |
XADataLocator_IODevice* ioDevice = NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
417 |
#ifdef OMAX_CAMERABIN |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
XACameraDeviceImpl* cameraDevice = NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
419 |
XAObjectItfImpl* pObj = NULL; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
420 |
#endif |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
421 |
XARadioDeviceImpl* radioDevice = NULL; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
422 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
423 |
DEBUG_API("->XAAdaptationGst_CreateGstSource"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
424 |
if (!xaSrc || !xaSrc->pLocator || !isobj) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
425 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
426 |
return NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
427 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
428 |
*isobj = XA_BOOLEAN_FALSE; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
429 |
if (xaSrc && xaSrc->pFormat && *((XAuint32*) (xaSrc->pFormat)) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
430 |
==XA_DATAFORMAT_PCM && isPCM) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
431 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
432 |
*isPCM = XA_BOOLEAN_TRUE; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
433 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
434 |
if (xaSrc && xaSrc->pFormat && *((XAuint32*) (xaSrc->pFormat)) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
435 |
==XA_DATAFORMAT_RAWIMAGE && isRawImage) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
436 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
437 |
*isRawImage = XA_BOOLEAN_TRUE; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
438 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
439 |
locType = *((XAuint32*) (xaSrc->pLocator)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
440 |
switch (locType) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
441 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
442 |
case XA_DATALOCATOR_URI: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
443 |
DEBUG_INFO("XA_DATALOCATOR_URI") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
444 |
; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
445 |
uri = (XADataLocator_URI*) xaSrc->pLocator; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
446 |
gstSrc = gst_element_factory_make("filesrc", name); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
447 |
if (uri->URI != NULL) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
448 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
449 |
DEBUG_INFO_A1("URI: %s", uri->URI); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
450 |
if (strncmp((char *) uri->URI, "file:///", 8) == 0) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
451 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
452 |
fname = (char *) &((uri->URI)[8]); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
453 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
454 |
else |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
455 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
456 |
fname = (char *) uri->URI; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
457 |
}DEBUG_INFO_A1("->filesystem path %s", fname); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
458 |
g_object_set(G_OBJECT(gstSrc), "location", fname, NULL); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
459 |
/*check for pcm - decodebin does not know how to handle raw PCM files */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
460 |
if (isPCM && strstr(fname, ".pcm")) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
461 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
462 |
DEBUG_INFO("PCM file detected"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
463 |
*isPCM = XA_BOOLEAN_TRUE; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
464 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
465 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
466 |
else |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
467 |
{ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
468 |
DEBUG_ERR("No uri specified."); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
469 |
return NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
470 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
471 |
break; /* XA_DATALOCATOR_URI */ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
472 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
473 |
case XA_DATALOCATOR_IODEVICE: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
474 |
DEBUG_INFO("XA_DATALOCATOR_IODEVICE") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
475 |
; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
476 |
ioDevice = (XADataLocator_IODevice*) (xaSrc->pLocator); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
477 |
switch (ioDevice->deviceType) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
478 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
479 |
case XA_IODEVICE_AUDIOINPUT: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
480 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
481 |
DEBUG_INFO("XA_IODEVICE_AUDIOINPUT"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
482 |
DEBUG_INFO_A1("ioDevice->deviceID: %x", ioDevice->deviceID); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
483 |
switch (ioDevice->deviceID) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
484 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
485 |
//case XA_ADAPTID_ALSASRC: //Krishna |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
486 |
case XA_ADAPTID_DEVSOUNDSRC: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
487 |
//DEBUG_INFO("alsasrc"); //Krishna |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
488 |
DEBUG_INFO("devsoundsrc") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
489 |
; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
490 |
gstSrc = gst_element_factory_make("devsoundsrc", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
491 |
name); //Krishna - changed to devsoundsrc |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
492 |
g_object_set(G_OBJECT (gstSrc), "num-buffers", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
493 |
80, NULL); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
494 |
break; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
495 |
case XA_ADAPTID_AUDIOTESTSRC: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
496 |
/*fall through*/ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
497 |
default: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
498 |
DEBUG_INFO("audiotestsrc") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
499 |
; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
500 |
gstSrc = gst_element_factory_make("audiotestsrc", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
501 |
name); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
502 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
503 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
504 |
break; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
505 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
506 |
#ifdef OMAX_CAMERABIN |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
507 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
508 |
case XA_IODEVICE_CAMERA: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
509 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
510 |
DEBUG_INFO("XA_IODEVICE_CAMERA"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
511 |
if ( ioDevice->device ) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
512 |
{ /*source is camera object*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
513 |
DEBUG_INFO("Use camerabin as source."); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
514 |
/* Get camerabin from source object */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
515 |
pObj = (XAObjectItfImpl*)(*ioDevice->device); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
516 |
cameraDevice = (XACameraDeviceImpl*)(pObj); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
517 |
/*TODO we had to remove this line below since adaptationCtx |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
518 |
* was not a member of structure*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
519 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
520 |
gstSrc = GST_ELEMENT(((XAAdaptationGstCtx*)(cameraDevice->adaptationCtx))->bin); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
521 |
/* refcount increase is needed to keep this not being deleted after use */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
522 |
gst_object_ref(GST_OBJECT(gstSrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
523 |
*isobj = XA_BOOLEAN_TRUE; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
524 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
525 |
else |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
526 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
527 |
DEBUG_INFO_A1("ioDevice->deviceID: %x", ioDevice->deviceID); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
528 |
switch (ioDevice->deviceID ) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
529 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
530 |
case XA_ADAPTID_V4L2SRC: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
531 |
DEBUG_INFO("Camera deviceID: v4l2src "); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
532 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
533 |
break; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
534 |
case XA_ADAPTID_VIDEOTESTSRC: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
535 |
DEBUG_INFO("Camera deviceID: videotestsrc"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
536 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
537 |
break; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
538 |
default: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
539 |
case XA_DEFAULTDEVICEID_CAMERA: |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
540 |
DEBUG_INFO("Camera deviceID:Default"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
541 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
542 |
break; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
543 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
544 |
if ( cameraCtx ) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
545 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
546 |
gstSrc = GST_ELEMENT(cameraCtx->baseObj.bin); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
547 |
gst_object_ref(GST_OBJECT(gstSrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
548 |
*isobj = XA_BOOLEAN_TRUE; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
549 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
550 |
else |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
551 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
552 |
DEBUG_ERR("No camera object created!"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
553 |
return NULL; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
554 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
555 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
556 |
break; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
557 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
558 |
#endif |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
559 |
case XA_IODEVICE_RADIO: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
560 |
DEBUG_INFO("XA_IODEVICE_RADIO") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
561 |
; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
562 |
if (ioDevice->device) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
563 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
564 |
DEBUG_INFO("Use radio pipeline as source."); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
565 |
/* Get radio_pipeline and set it to base context */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
566 |
radioDevice = (XARadioDeviceImpl*) (*ioDevice->device); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
567 |
/* radio does not have actual bin, only source element*/ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
568 |
gstSrc = GST_ELEMENT(((XAAdaptationGstCtx*)radioDevice->adaptationCtx)->bin); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
569 |
/* refcount increase is needed to keep this not being deleted after use */ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
570 |
gst_object_ref(GST_OBJECT(gstSrc)); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
571 |
/**isobj = XA_BOOLEAN_TRUE;*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
572 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
573 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
574 |
default: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
575 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
576 |
DEBUG_ERR("Unsupported IODevice."); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
577 |
break; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
578 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
579 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
580 |
break; /* XA_DATALOCATOR_IODEVICE */ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
581 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
582 |
case XA_DATALOCATOR_ADDRESS: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
583 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
584 |
XADataLocator_Address* address = |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
585 |
(XADataLocator_Address*) (xaSrc->pLocator); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
586 |
gstSrc = gst_element_factory_make("appsrc", name); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
587 |
/* init gst buffer from datalocator */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
588 |
if (gstSrc) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
589 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
590 |
/* init GST buffer from XADataLocator*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
591 |
GstBuffer* userBuf = gst_buffer_new(); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
592 |
if (userBuf) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
593 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
594 |
userBuf->size = address->length; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
595 |
userBuf->data = address->pAddress; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
596 |
/* push the whole buffer to appsrc so it is ready for preroll */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
597 |
DEBUG_INFO("Pushing buffer"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
598 |
gst_app_src_push_buffer(GST_APP_SRC(gstSrc), userBuf); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
599 |
DEBUG_INFO_A1("Sent buffer at 0x%x to appsrc", userBuf ); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
600 |
gst_app_src_end_of_stream(GST_APP_SRC(gstSrc)); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
601 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
602 |
else |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
603 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
604 |
DEBUG_ERR("Failure allocating buffer!"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
605 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
606 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
607 |
else |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
608 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
609 |
DEBUG_ERR("Failure creating appsrc!"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
610 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
611 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
612 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
613 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
614 |
default: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
615 |
DEBUG_ERR("Incorrect data locator for source.") |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
616 |
break; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
617 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
618 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
619 |
if (gstSrc) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
620 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
621 |
DEBUG_INFO_A1("Created gstreamer source element at %x", gstSrc); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
622 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
623 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
624 |
DEBUG_API("<-XAAdaptationGst_CreateGstSource"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
625 |
return gstSrc; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
626 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
627 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
628 |
/** |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
629 |
* GstElement* XAAdaptationGst_CreateGstSink( XADataSink* xaSnk, const XAchar *name ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
630 |
* @param XADataSink* xaSnk - XADataSink defining gst sink to create |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
631 |
* @param const XAchar *name - string for naming the gst element |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
632 |
* @return GstElement* - return newly created gst sink element |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
633 |
* Description: Create gst sink element corresponding to XA sink structure |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
634 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
635 |
GstElement* XAAdaptationGst_CreateGstSink(XADataSink* xaSnk, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
636 |
const char *name, XAboolean *isobj) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
637 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
638 |
XAuint32 locType = 0; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
639 |
GstElement* gstSnk = NULL; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
640 |
XADataLocator_URI* uri = NULL; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
641 |
DEBUG_API("->XAAdaptationGst_CreateGstSink"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
642 |
if (!xaSnk || !xaSnk->pLocator) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
643 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
644 |
DEBUG_INFO("Warning! No sink specified, use fakesink"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
645 |
gstSnk = gst_element_factory_make("fakesink", name); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
646 |
if (!gstSnk) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
647 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
648 |
DEBUG_ERR("Cannot create sink!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
649 |
return NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
650 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
651 |
g_object_set(G_OBJECT(gstSnk), "async", FALSE, NULL); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
652 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
653 |
else |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
654 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
655 |
locType = *((XAuint32*) (xaSnk->pLocator)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
656 |
switch (locType) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
657 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
658 |
case XA_DATALOCATOR_URI: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
659 |
DEBUG_INFO("XA_DATALOCATOR_URI") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
660 |
; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
661 |
uri = (XADataLocator_URI*) xaSnk->pLocator; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
662 |
gstSnk = gst_element_factory_make("filesink", name); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
663 |
if (!gstSnk) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
664 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
665 |
DEBUG_ERR("Cannot create sink!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
666 |
return NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
667 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
668 |
if (uri->URI != NULL) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
669 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
670 |
XAchar *fname; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
671 |
DEBUG_INFO_A1("URI: %s", uri->URI); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
672 |
if (strncmp((char *) uri->URI, "file:///", 8) == 0) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
673 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
674 |
fname = &((uri->URI)[8]); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
675 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
676 |
else |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
677 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
678 |
fname = uri->URI; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
679 |
}DEBUG_INFO_A1("->filesystem path %s", fname); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
680 |
g_object_set(G_OBJECT(gstSnk), "location", fname, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
681 |
"async", FALSE, "qos", FALSE, "max-lateness", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
682 |
(gint64) (-1), NULL); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
683 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
684 |
else |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
685 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
686 |
DEBUG_ERR("No recording output uri specified."); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
687 |
return NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
688 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
689 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
690 |
case XA_DATALOCATOR_NATIVEDISPLAY: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
691 |
DEBUG_INFO("Sink locator type - XA_DATALOCATOR_NATIVEDISPLAY") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
692 |
; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
693 |
#ifdef USE_NGA_SURFACES |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
694 |
gstSnk = gst_element_factory_make("devvideosink", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
695 |
"devvideosink"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
696 |
#else |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
697 |
gstSnk = gst_element_factory_make("ximagesink",name); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
698 |
#endif /*USE_NGA_SURFACES*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
699 |
if (!gstSnk) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
700 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
701 |
DEBUG_ERR("Cannot create sink!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
702 |
return NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
703 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
704 |
g_object_set(G_OBJECT(gstSnk), "force-aspect-ratio", TRUE, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
705 |
"async", FALSE, "qos", FALSE, "handle-events", TRUE, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
706 |
"handle-expose", TRUE, "max-lateness", (gint64) (-1), |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
707 |
NULL); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
708 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
709 |
case XA_DATALOCATOR_OUTPUTMIX: |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
710 |
DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX") |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
711 |
; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
712 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
713 |
/* Get OutputMix adaptation from data locator */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
714 |
XADataLocator_OutputMix* omix = |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
715 |
(XADataLocator_OutputMix*) (xaSnk->pLocator); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
716 |
if (omix->outputMix) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
717 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
718 |
XAOMixImpl* omixDevice = |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
719 |
(XAOMixImpl*) (*omix->outputMix); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
720 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
721 |
if (omixDevice) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
722 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
723 |
/*TODO we had to remove this line below since adaptationCtx |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
724 |
* was not a member of structure*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
725 |
|
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
726 |
/*gstSnk = XAOutputMixAdapt_GetSink(omixDevice->adaptationCtx);*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
727 |
if (!gstSnk) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
728 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
729 |
DEBUG_ERR("Cannot create sink!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
730 |
return NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
731 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
732 |
*isobj = XA_BOOLEAN_TRUE; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
733 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
734 |
else |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
735 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
736 |
DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
737 |
gstSnk = gst_element_factory_make("alsasink", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
738 |
name); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
739 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
740 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
741 |
else |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
742 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
743 |
DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
744 |
gstSnk = gst_element_factory_make("alsasink", name); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
745 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
746 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
747 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
748 |
break; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
749 |
|
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
750 |
case XA_DATALOCATOR_ADDRESS: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
751 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
752 |
gstSnk = gst_element_factory_make("appsink", name); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
753 |
/* Not actually object sink, but attribute used to notify recorder |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
754 |
* about appsink (no object sinks applicable in this use case) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
755 |
**/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
756 |
*isobj = TRUE; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
757 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
758 |
break; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
759 |
case XA_DATALOCATOR_IODEVICE: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
760 |
/* when only valid IOdevice sinks vibra and LED sinks implemented |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
761 |
* at adaptation level, add handling here (in this implementation, |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
762 |
* no handling needed as only dummy implementations for those) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
763 |
**/ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
764 |
default: |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
765 |
DEBUG_ERR("Incorrect data locator for sink.") |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
766 |
break; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
767 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
768 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
769 |
if (gstSnk) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
770 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
771 |
DEBUG_INFO_A1("Created gstreamer sink element at %x", gstSnk); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
772 |
}DEBUG_API("<-XAAdaptationGst_CreateGstSink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
773 |
return gstSnk; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
774 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
775 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
776 |
/** |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
777 |
* GstElement* XAAdaptationGst_CreateVideoPP( ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
778 |
* @return GstElement* - return newly created gst pipeline element |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
779 |
* Description: Create video processing pipeline |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
780 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
781 |
GstElement* XAAdaptationGst_CreateVideoPP() |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
782 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
783 |
GstElement *vpp; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
784 |
DEBUG_API("->XAAdaptationGst_CreateVideoPP"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
785 |
vpp = gst_pipeline_new("videopp"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
786 |
if (vpp) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
787 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
788 |
GstPad *ghostsink, *ghostsrc; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
789 |
GstElement *col1, *col2, *rotate, *mirror, *box, *crop, *gamma, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
790 |
*balance, *scale, *scale2, |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
791 |
#ifdef USE_NGA_SURFACES |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
792 |
*identity, |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
793 |
#endif /*USE_NGA_SURFACES*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
794 |
*queue; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
795 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
796 |
/* Crete ffmpegcolorspace to convert stream to correct format */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
797 |
col1 = gst_element_factory_make("ffmpegcolorspace", "pp_colsp1"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
798 |
if (col1) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
799 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
800 |
DEBUG_INFO("Created ffmpegcolorspace element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
801 |
gst_bin_add(GST_BIN(vpp), col1); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
802 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
803 |
ghostsink = gst_element_get_static_pad(col1, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
804 |
if (ghostsink) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
805 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
806 |
gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
807 |
ghostsink)); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
808 |
gst_object_unref(GST_OBJECT(ghostsink)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
809 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
810 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
811 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
812 |
/* create video crop, this will be sink for videoPP pipeline */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
813 |
crop = gst_element_factory_make("videocrop", "pp_crop"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
814 |
if (crop) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
815 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
816 |
DEBUG_INFO("Created crop element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
817 |
gst_bin_add(GST_BIN(vpp), crop); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
818 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
819 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
820 |
/* create video rotate */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
821 |
rotate = gst_element_factory_make("videoflip", "pp_rotate"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
822 |
if (rotate) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
823 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
824 |
DEBUG_INFO("Created rotate element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
825 |
g_object_set(G_OBJECT(rotate), "method", FLIP_NONE, NULL); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
826 |
gst_bin_add(GST_BIN(vpp), rotate); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
827 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
828 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
829 |
/* create video mirror */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
830 |
mirror = gst_element_factory_make("videoflip", "pp_mirror"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
831 |
if (mirror) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
832 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
833 |
DEBUG_INFO("Created mirror element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
834 |
g_object_set(G_OBJECT(mirror), "method", FLIP_NONE, NULL); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
835 |
gst_bin_add(GST_BIN(vpp), mirror); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
836 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
837 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
838 |
/* create video box */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
839 |
box = gst_element_factory_make("videobox", "pp_box"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
840 |
if (box) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
841 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
842 |
DEBUG_INFO("Created videobox element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
843 |
gst_bin_add(GST_BIN(vpp), box); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
844 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
845 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
846 |
/* create video balance */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
847 |
balance = gst_element_factory_make("videobalance", "pp_balance"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
848 |
if (balance) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
849 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
850 |
DEBUG_INFO("Created balance element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
851 |
gst_bin_add(GST_BIN(vpp), balance); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
852 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
853 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
854 |
/* create video gamma */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
855 |
gamma = gst_element_factory_make("gamma", "pp_gamma"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
856 |
if (gamma) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
857 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
858 |
DEBUG_INFO("Created gamma element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
859 |
gst_bin_add(GST_BIN(vpp), gamma); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
860 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
861 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
862 |
/* Create videoscale element to scale postprocessed output to correct size */ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
863 |
scale = gst_element_factory_make("videoscale", "pp_scale"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
864 |
if (scale) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
865 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
866 |
DEBUG_INFO("Created videoscale element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
867 |
gst_bin_add(GST_BIN(vpp), scale); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
868 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
869 |
scale2 = gst_element_factory_make("videoscale", "pp_scale2"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
870 |
if (scale2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
871 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
872 |
GstPad *pad = NULL; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
873 |
GstCaps *caps = NULL; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
874 |
DEBUG_INFO("Created videoscale element"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
875 |
pad = gst_element_get_static_pad(scale2, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
876 |
caps = gst_caps_new_simple("video/x-raw-yuv", "width", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
877 |
G_TYPE_INT, 0, "height", G_TYPE_INT, 0, NULL); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
878 |
gst_pad_set_caps(pad, caps); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
879 |
gst_bin_add(GST_BIN(vpp), scale2); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
880 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
881 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
882 |
/* create video queue */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
883 |
queue = gst_element_factory_make("queue", "vpp_queue"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
884 |
if (queue) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
885 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
886 |
DEBUG_INFO("Created queue element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
887 |
gst_bin_add(GST_BIN(vpp), queue); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
888 |
#ifdef USE_NGA_SURFACES |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
889 |
/* make this bin link point*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
890 |
ghostsink = gst_element_get_static_pad(queue, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
891 |
if (ghostsink) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
892 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
893 |
gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
894 |
ghostsink)); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
895 |
gst_object_unref(GST_OBJECT(ghostsink)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
896 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
897 |
#endif /*USE_NGA_SURFACES*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
898 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
899 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
900 |
/* Crete ffmpegcolorspace to convert stream to correct format */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
901 |
col2 = gst_element_factory_make("ffmpegcolorspace", "pp_colsp2"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
902 |
if (col2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
903 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
904 |
DEBUG_INFO("Created ffmpegcolorspace element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
905 |
gst_bin_add(GST_BIN(vpp), col2); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
906 |
/* make this bin link point*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
907 |
ghostsrc = gst_element_get_static_pad(col2, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
908 |
if (ghostsrc) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
909 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
910 |
gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
911 |
ghostsrc)); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
912 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
913 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
914 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
915 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
916 |
#ifdef USE_NGA_SURFACES |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
917 |
//shyward |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
918 |
/* create identity element */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
919 |
identity = gst_element_factory_make("identity", "identity"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
920 |
if (identity) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
921 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
922 |
DEBUG_INFO("Created identity element"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
923 |
gst_bin_add(GST_BIN(vpp), identity); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
924 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
925 |
ghostsrc = gst_element_get_static_pad(identity, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
926 |
if (ghostsrc) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
927 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
928 |
gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
929 |
ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
930 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
931 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
932 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
933 |
if (!(gst_element_link_many(queue, identity, NULL))) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
934 |
#else |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
935 |
//shyward - thins code assumes all the elements will have been created, which is not true |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
936 |
if( !(gst_element_link_many(col1, |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
937 |
scale, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
938 |
crop, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
939 |
rotate, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
940 |
mirror, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
941 |
box, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
942 |
balance, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
943 |
gamma, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
944 |
queue, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
945 |
scale2, |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
946 |
#ifdef USE_NGA_SURFACES |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
947 |
identity, |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
948 |
#endif /*USE_NGA_SURFACES*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
949 |
col2, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
950 |
NULL) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
951 |
) ) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
952 |
#endif /*USE_NGA_SURFACES*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
953 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
954 |
DEBUG_ERR("Could not link videopp elements!!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
955 |
gst_object_unref(vpp); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
956 |
vpp = NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
957 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
958 |
}DEBUG_API("<-XAAdaptationGst_CreateVideoPP"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
959 |
return vpp; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
960 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
961 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
962 |
/** |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
963 |
* GstElement* XAAdaptationGst_CreateFixedSizeRecordVideoPP( ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
964 |
* @return GstElement* - return newly created gst pipeline element |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
965 |
* Description: Create video processing pipeline with fixed output size |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
966 |
* to TEST_VIDEO_WIDTH x TEST_VIDEO_HEIGHT |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
967 |
* experimental implementation for changing recorder output size |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
968 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
969 |
GstElement* XAAdaptationGst_CreateFixedSizeVideoPP() |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
970 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
971 |
GstElement *vpp; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
972 |
DEBUG_API("->XAAdaptationGst_CreateFixedSizeVideoPP"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
973 |
vpp = gst_pipeline_new("videopp"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
974 |
if (vpp) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
975 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
976 |
GstPad *ghostsink, *ghostsrc; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
977 |
GstElement *col1, *col2, *rotate, *mirror, *box, *crop, *gamma, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
978 |
*balance, *scale, *scale2, *filter, *queue; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
979 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
980 |
/* Crete ffmpegcolorspace to convert stream to correct format */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
981 |
col1 = gst_element_factory_make("ffmpegcolorspace", "pp_colsp1"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
982 |
if (col1) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
983 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
984 |
DEBUG_INFO("Created ffmpegcolorspace element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
985 |
gst_bin_add(GST_BIN(vpp), col1); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
986 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
987 |
ghostsink = gst_element_get_static_pad(col1, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
988 |
if (ghostsink) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
989 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
990 |
gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
991 |
ghostsink)); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
992 |
gst_object_unref(GST_OBJECT(ghostsink)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
993 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
994 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
995 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
996 |
/* create video crop, this will be sink for videoPP pipeline */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
997 |
crop = gst_element_factory_make("videocrop", "pp_crop"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
998 |
if (crop) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
999 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1000 |
DEBUG_INFO("Created crop element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1001 |
gst_bin_add(GST_BIN(vpp), crop); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1002 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1003 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1004 |
/* create video rotate */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1005 |
rotate = gst_element_factory_make("videoflip", "pp_rotate"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1006 |
if (rotate) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1007 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1008 |
DEBUG_INFO("Created rotate element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1009 |
g_object_set(G_OBJECT(rotate), "method", FLIP_NONE, NULL); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1010 |
gst_bin_add(GST_BIN(vpp), rotate); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1011 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1012 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1013 |
/* create video mirror */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1014 |
mirror = gst_element_factory_make("videoflip", "pp_mirror"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1015 |
if (mirror) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1016 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1017 |
DEBUG_INFO("Created mirror element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1018 |
g_object_set(G_OBJECT(mirror), "method", FLIP_NONE, NULL); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1019 |
gst_bin_add(GST_BIN(vpp), mirror); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1020 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1021 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1022 |
/* create video box */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1023 |
box = gst_element_factory_make("videobox", "pp_box"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1024 |
if (box) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1025 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1026 |
DEBUG_INFO("Created videobox element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1027 |
gst_bin_add(GST_BIN(vpp), box); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1028 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1029 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1030 |
/* create video balance */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1031 |
balance = gst_element_factory_make("videobalance", "pp_balance"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1032 |
if (balance) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1033 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1034 |
DEBUG_INFO("Created balance element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1035 |
gst_bin_add(GST_BIN(vpp), balance); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1036 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1037 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1038 |
/* create video gamma */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1039 |
gamma = gst_element_factory_make("gamma", "pp_gamma"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1040 |
if (gamma) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1041 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1042 |
DEBUG_INFO("Created gamma element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1043 |
gst_bin_add(GST_BIN(vpp), gamma); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1044 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1045 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1046 |
/* Create videoscale element to scale postprocessed output to correct size */ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1047 |
scale = gst_element_factory_make("videoscale", "pp_scale"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1048 |
if (scale) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1049 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1050 |
DEBUG_INFO("Created videoscale element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1051 |
gst_bin_add(GST_BIN(vpp), scale); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1052 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1053 |
scale2 = gst_element_factory_make("videoscale", "pp_scale2"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1054 |
if (scale2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1055 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1056 |
GstPad *pad = NULL; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1057 |
GstCaps *caps = NULL; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1058 |
DEBUG_INFO("Created videoscale element"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1059 |
pad = gst_element_get_static_pad(scale2, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1060 |
caps = gst_caps_new_simple("video/x-raw-yuv", "width", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1061 |
G_TYPE_INT, 0, "height", G_TYPE_INT, 0, NULL); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1062 |
gst_pad_set_caps(pad, caps); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1063 |
gst_bin_add(GST_BIN(vpp), scale2); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1064 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1065 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1066 |
/* create capsfilter for fixed video size */ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1067 |
filter = gst_element_factory_make("capsfilter", "pp_filter"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1068 |
if (filter) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1069 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1070 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1071 |
g_object_set(G_OBJECT(filter), "caps", gst_caps_new_simple( |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1072 |
"video/x-raw-yuv", "width", G_TYPE_INT, TEST_VIDEO_WIDTH, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1073 |
"height", G_TYPE_INT, TEST_VIDEO_HEIGHT, NULL), NULL); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1074 |
gst_bin_add(GST_BIN(vpp), filter); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1075 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1076 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1077 |
/* create video queue */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1078 |
queue = gst_element_factory_make("queue", "vpp_queue"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1079 |
if (queue) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1080 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1081 |
gst_bin_add(GST_BIN(vpp), queue); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1082 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1083 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1084 |
/* Crete ffmpegcolorspace to convert stream to correct format */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1085 |
col2 = gst_element_factory_make("ffmpegcolorspace", "pp_colsp2"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1086 |
if (col2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1087 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1088 |
DEBUG_INFO("Created ffmpegcolorspace element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1089 |
gst_bin_add(GST_BIN(vpp), col2); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1090 |
/* make this bin link point*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1091 |
ghostsrc = gst_element_get_static_pad(col2, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1092 |
if (ghostsrc) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1093 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1094 |
gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1095 |
ghostsrc)); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1096 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1097 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1098 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1099 |
if (!(gst_element_link_many(col1, scale, crop, rotate, mirror, box, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1100 |
balance, gamma, queue, scale2, filter, col2, NULL))) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1101 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1102 |
DEBUG_ERR("Could not link videopp elements!!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1103 |
gst_object_unref(vpp); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1104 |
vpp = NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1105 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1106 |
}DEBUG_API("<-XAAdaptationGst_CreateFixedSizeVideoPP"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1107 |
return vpp; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1108 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1109 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1110 |
/** |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1111 |
* GstElement* XAAdaptationGst_CreateVideoPPBlackScr( ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1112 |
* @return GstElement* - return newly created gst pipeline element |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1113 |
* Description: Create video processing pipeline for black screen |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1114 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1115 |
GstElement* XAAdaptationGst_CreateVideoPPBlackScr() |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1116 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1117 |
GstElement *vppBScr; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1118 |
DEBUG_API("->XAAdaptationGst_CreateVideoPPBlackScr"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1119 |
vppBScr = gst_pipeline_new("videoppBScr"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1120 |
if (vppBScr) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1121 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1122 |
GstPad *ghostsrc = NULL; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1123 |
GstElement *testVideo = NULL, *scale = NULL; |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1124 |
GstElement *ffmpegcolorspace = NULL; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1125 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1126 |
testVideo = gst_element_factory_make("videotestsrc", "videotest"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1127 |
if (testVideo) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1128 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1129 |
DEBUG_INFO("Created videotestsrc element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1130 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1131 |
g_object_set(G_OBJECT(testVideo), "pattern", (gint) 2, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1132 |
"num-buffers", (gint) 1, NULL); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1133 |
gst_bin_add(GST_BIN(vppBScr), testVideo); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1134 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1135 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1136 |
scale = gst_element_factory_make("videoscale", "BSrc_scale"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1137 |
if (scale) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1138 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1139 |
DEBUG_INFO("Created videoscale element"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1140 |
gst_bin_add(GST_BIN(vppBScr), scale); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1141 |
/* make this bin link point*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1142 |
ghostsrc = gst_element_get_static_pad(scale, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1143 |
if (ghostsrc) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1144 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1145 |
gst_element_add_pad(vppBScr, gst_ghost_pad_new( |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1146 |
"videoppBSrc_src", ghostsrc)); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1147 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1148 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1149 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1150 |
ffmpegcolorspace = gst_element_factory_make("ffmpegcolorspace", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1151 |
"BlackScrFfmpeg"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1152 |
gst_bin_add(GST_BIN(vppBScr), ffmpegcolorspace); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1153 |
if (!(gst_element_link_many(testVideo, ffmpegcolorspace, scale, NULL))) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1154 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1155 |
DEBUG_ERR("Could not link videoppBSrc elements!!"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1156 |
gst_object_unref(vppBScr); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1157 |
vppBScr = NULL; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1158 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1159 |
}DEBUG_API("<-XAAdaptationGst_CreateVideoPPBlackScr"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1160 |
return vppBScr; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1161 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1162 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1163 |
/** |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1164 |
* GstElement* XAAdaptationGst_CreateInputSelector( ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1165 |
* @return GstElement* - return newly created input selector |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1166 |
* Description: Create input selector to processing between black screen and video screen |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1167 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1168 |
GstElement* XAAdaptationGst_CreateInputSelector() |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1169 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1170 |
GstElement *inputSelector; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1171 |
DEBUG_API("->XAAdaptationGst_CreateInputSelector"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1172 |
inputSelector = gst_element_factory_make("input-selector", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1173 |
"input-selector"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1174 |
if (inputSelector) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1175 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1176 |
g_object_set(G_OBJECT(inputSelector), "select-all", TRUE, NULL); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1177 |
}DEBUG_API("<-XAAdaptationGst_CreateInputSelector"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1178 |
return inputSelector; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1179 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1180 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1181 |
/** |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1182 |
* GstElement* XAAdaptationGst_CreateAudioPP( ) |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1183 |
* @return GstElement* - return newly created gst pipeline element |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1184 |
* Description: Create video processing pipeline |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1185 |
*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1186 |
GstElement* XAAdaptationGst_CreateAudioPP() |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1187 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1188 |
GstElement *app; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1189 |
gboolean ok = TRUE; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1190 |
DEBUG_API("->XAAdaptationGst_CreateAudioPP"); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1191 |
app = gst_pipeline_new("audiopp"); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1192 |
if (app) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1193 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1194 |
GstPad *ghostsink, *ghostsrc; |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1195 |
GstElement *ac, *vol, *eq, *queue, *pan, *ac2; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1196 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1197 |
/* first and last elements should be audioconverts to |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1198 |
* match sink and encoder formats */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1199 |
ac = gst_element_factory_make("audioconvert", "pp_ac"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1200 |
if (ac) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1201 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1202 |
ok = gst_bin_add(GST_BIN(app), ac); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1203 |
/* make this bin link point*/ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1204 |
if (ok) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1205 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1206 |
ghostsink = gst_element_get_static_pad(ac, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1207 |
ok = gst_element_add_pad(app, gst_ghost_pad_new("sink", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1208 |
ghostsink)); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1209 |
gst_object_unref(GST_OBJECT(ghostsink)); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1210 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1211 |
} |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1212 |
ac2 = gst_element_factory_make("audioconvert", "pp_ac2"); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1213 |
if (ac2 && ok) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1214 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1215 |
ok = gst_bin_add(GST_BIN(app), ac2); |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1216 |
/* make this bin link point*/ |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1217 |
if (ok) |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1218 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1219 |
ghostsrc = gst_element_get_static_pad(ac2, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1220 |
ok = gst_element_add_pad(app, gst_ghost_pad_new("src", |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1221 |
ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1222 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1223 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1224 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1225 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1226 |
vol = gst_element_factory_make("volume", "pp_vol"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1227 |
/* create volume controller */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1228 |
if (vol && ok) |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1229 |
{ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1230 |
ok = gst_bin_add(GST_BIN(app), vol); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1231 |
g_object_set(G_OBJECT(vol), "volume", (gdouble) 1, NULL); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1232 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1233 |
/* create 10-band equalizer */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1234 |
eq = gst_element_factory_make("equalizer-10bands", "pp_equ"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1235 |
if (eq && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1236 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1237 |
ok = gst_bin_add(GST_BIN(app), eq); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1238 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1239 |
/* create audio queue */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1240 |
queue = gst_element_factory_make("queue", "app_queue"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1241 |
if (queue && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1242 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1243 |
ok = gst_bin_add(GST_BIN(app), queue); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1244 |
g_object_set(G_OBJECT (queue), "max-size-buffers", 2, NULL); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1245 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1246 |
/* create audio pan effect */ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1247 |
pan = gst_element_factory_make("audiopanorama", "pp_pan"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1248 |
if (pan && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1249 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1250 |
ok = gst_bin_add(GST_BIN(app), pan); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1251 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1252 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1253 |
if (ac && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1254 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1255 |
if (queue) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1256 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1257 |
ok = gst_element_link(ac, queue); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1258 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1259 |
else if (vol) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1260 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1261 |
ok = gst_element_link(ac, vol); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1262 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1263 |
else if (pan) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1264 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1265 |
ok = gst_element_link(ac, pan); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1266 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1267 |
else if (eq) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1268 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1269 |
ok = gst_element_link(ac, eq); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1270 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1271 |
else if (ac2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1272 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1273 |
ok = gst_element_link(ac, ac2); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1274 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1275 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1276 |
if (queue && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1277 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1278 |
if (vol) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1279 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1280 |
ok = gst_element_link(queue, vol); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1281 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1282 |
else if (pan) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1283 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1284 |
ok = gst_element_link(queue, pan); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1285 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1286 |
else if (eq) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1287 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1288 |
ok = gst_element_link(queue, eq); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1289 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1290 |
else if (ac2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1291 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1292 |
ok = gst_element_link(queue, ac2); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1293 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1294 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1295 |
if (vol && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1296 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1297 |
if (pan) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1298 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1299 |
ok = gst_element_link(vol, pan); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1300 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1301 |
else if (eq) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1302 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1303 |
ok = gst_element_link(vol, eq); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1304 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1305 |
else if (ac2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1306 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1307 |
ok = gst_element_link(vol, ac2); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1308 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1309 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1310 |
if (pan && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1311 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1312 |
if (eq) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1313 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1314 |
ok = gst_element_link(pan, eq); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1315 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1316 |
else if (ac2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1317 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1318 |
ok = gst_element_link(pan, ac2); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1319 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1320 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1321 |
if (eq && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1322 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1323 |
if (ac2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1324 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1325 |
ok = gst_element_link(eq, ac2); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1326 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1327 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1328 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1329 |
if (ac) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1330 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1331 |
// ghost sink above |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1332 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1333 |
else if (queue && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1334 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1335 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1336 |
ghostsink = gst_element_get_static_pad(queue, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1337 |
ok = gst_element_add_pad(app, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1338 |
gst_ghost_pad_new("sink", ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1339 |
gst_object_unref(GST_OBJECT(ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1340 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1341 |
else if (vol && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1342 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1343 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1344 |
ghostsink = gst_element_get_static_pad(vol, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1345 |
ok = gst_element_add_pad(app, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1346 |
gst_ghost_pad_new("sink", ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1347 |
gst_object_unref(GST_OBJECT(ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1348 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1349 |
else if (pan && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1350 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1351 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1352 |
ghostsink = gst_element_get_static_pad(pan, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1353 |
ok = gst_element_add_pad(app, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1354 |
gst_ghost_pad_new("sink", ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1355 |
gst_object_unref(GST_OBJECT(ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1356 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1357 |
else if (eq && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1358 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1359 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1360 |
ghostsink = gst_element_get_static_pad(eq, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1361 |
ok = gst_element_add_pad(app, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1362 |
gst_ghost_pad_new("sink", ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1363 |
gst_object_unref(GST_OBJECT(ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1364 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1365 |
else if (ac2 && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1366 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1367 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1368 |
ghostsink = gst_element_get_static_pad(ac2, "sink"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1369 |
ok = gst_element_add_pad(app, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1370 |
gst_ghost_pad_new("sink", ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1371 |
gst_object_unref(GST_OBJECT(ghostsink)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1372 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1373 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1374 |
if (ac2) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1375 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1376 |
// ghost src above |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1377 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1378 |
else if (eq && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1379 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1380 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1381 |
ghostsrc = gst_element_get_static_pad(eq, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1382 |
ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1383 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1384 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1385 |
else if (pan && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1386 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1387 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1388 |
ghostsrc = gst_element_get_static_pad(pan, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1389 |
ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1390 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1391 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1392 |
else if (vol && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1393 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1394 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1395 |
ghostsrc = gst_element_get_static_pad(vol, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1396 |
ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1397 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1398 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1399 |
else if (queue && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1400 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1401 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1402 |
ghostsrc = gst_element_get_static_pad(queue, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1403 |
ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1404 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1405 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1406 |
else if (ac && ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1407 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1408 |
/* make this bin link point*/ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1409 |
ghostsrc = gst_element_get_static_pad(ac, "src"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1410 |
ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1411 |
gst_object_unref(GST_OBJECT(ghostsrc)); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1412 |
} |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1413 |
|
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1414 |
// if( !(gst_element_link_many(ac, queue, vol, ac2, NULL)) ) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1415 |
// if( !(gst_element_link_many(ac, queue, vol, pan, eq, ac2, NULL)) ) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1416 |
if (!ok) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1417 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1418 |
DEBUG_ERR("Could not link audiopp elements!!"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1419 |
gst_object_unref(app); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1420 |
app = NULL; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1421 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1422 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1423 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1424 |
DEBUG_API("<-XAAdaptationGst_CreateAudioPP"); |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1425 |
return app; |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1426 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1427 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1428 |
/* called when pad is actually blocking/ gets unblocked*/ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1429 |
void XAAdaptationGst_PadBlockCb(GstPad *pad, gboolean blocked, |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1430 |
gpointer user_data) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1431 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1432 |
DEBUG_API_A2("->XAAdaptationGst_PadBlockCb pad \"%s\" of \"%s\" ", |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1433 |
GST_OBJECT_NAME(pad), |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1434 |
GST_OBJECT_NAME(gst_pad_get_parent_element(pad)) ); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1435 |
DEBUG_API_A1("<-XAAdaptationGst_PadBlockCb blocked:%d",blocked); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1436 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1437 |
|
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1438 |
/* utility to set same fields for all media types in caps */ |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1439 |
void XAAdaptationGst_SetAllCaps(GstCaps * caps, char *field, ...) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1440 |
{ |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1441 |
GstStructure *structure; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1442 |
va_list var_args; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1443 |
int i; |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1444 |
|
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1445 |
for (i = 0; i < gst_caps_get_size(caps); i++) |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1446 |
{ |
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1447 |
structure = gst_caps_get_structure(caps, i); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1448 |
va_start (var_args, field); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1449 |
gst_structure_set_valist(structure, field, var_args); |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1450 |
va_end (var_args); |
31
8dfd592727cb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
1451 |
} |
16
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1452 |
} |
43d09473c595
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1453 |