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