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