khronosfws/openmax_al/src/common/xastreaminformationitf.c
changeset 53 eabc8c503852
parent 43 9894ed580e4a
equal deleted inserted replaced
48:a493a607b5bf 53:eabc8c503852
    13  *
    13  *
    14  * Description: Stream Information Interface Implementation
    14  * Description: Stream Information Interface Implementation
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 #include <assert.h>
       
    19 
       
    20 #include "xastreaminformationitf.h"
    18 #include "xastreaminformationitf.h"
    21 
       
    22 #include "xastreaminformationitfadaptationmmf.h"
    19 #include "xastreaminformationitfadaptationmmf.h"
    23 
    20 
    24 /* XAStreamInformationItfImpl* GetImpl
    21 /* XAStreamInformationItfImpl* GetImpl
    25  * Description: Validate interface pointer and cast it to implementation pointer.
    22  * Description: Validate interface pointer and cast it to implementation pointer.
    26  */
    23  */
   189     /* callback may be NULL (to remove callback) */
   186     /* callback may be NULL (to remove callback) */
   190     impl->callback = callback;
   187     impl->callback = callback;
   191     impl->cbcontext = pContext;
   188     impl->cbcontext = pContext;
   192     impl->cbPtrToSelf = self;
   189     impl->cbPtrToSelf = self;
   193 
   190 
       
   191 	
       
   192     if (impl->adapCtx->fwtype == FWMgrFWMMF)
       
   193     {
       
   194     	ret = XAStreamInformationItfAdaptMMF_RegisterCallback(impl->adapCtx, callback);
       
   195     }
       
   196 
   194     DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
   197     DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
   195     return ret;
   198     return ret;
   196     }
   199     }
   197 
   200 
   198 XAresult XAStreamInformationItfImpl_QueryActiveStreams(
   201 XAresult XAStreamInformationItfImpl_QueryActiveStreams(
   208         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   211         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   209         DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
   212         DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
   210         return XA_RESULT_PARAMETER_INVALID;
   213         return XA_RESULT_PARAMETER_INVALID;
   211         }
   214         }
   212 
   215 
   213     if (impl->adapCtx->fwtype == FWMgrFWGST)
   216     if (impl->adapCtx->fwtype == FWMgrFWMMF)
   214         {
   217         {
   215         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   218         ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
   216         if (ret == XA_RESULT_PARAMETER_INVALID)
   219         if (ret == XA_RESULT_PARAMETER_INVALID)
   217             {
   220             {
   218             DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams");
   221             DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams");
   270 /**
   273 /**
   271  * XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create()
   274  * XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create()
   272  * Description: Allocate and initialize PlayItfImpl
   275  * Description: Allocate and initialize PlayItfImpl
   273  **/
   276  **/
   274 XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create(
   277 XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create(
   275         XAAdaptationBaseCtx *adapCtx)
   278         XAMediaPlayerImpl* impl)
   276     {
   279     {
   277     XAStreamInformationItfImpl *self;
   280     XAStreamInformationItfImpl *self;
   278 
   281 
   279     DEBUG_API("->XAStreamInformationItfImpl_Create");
   282     DEBUG_API("->XAStreamInformationItfImpl_Create");
   280     self = (XAStreamInformationItfImpl*) calloc(1,
   283     self = (XAStreamInformationItfImpl*) calloc(1,
   299 
   302 
   300         /* init variables */
   303         /* init variables */
   301         self->cbPtrToSelf = NULL;
   304         self->cbPtrToSelf = NULL;
   302         self->callback = NULL;
   305         self->callback = NULL;
   303         self->cbcontext = NULL;
   306         self->cbcontext = NULL;
   304         self->adapCtx = adapCtx;
   307         self->adapCtx = impl->curAdaptCtx;
   305 
   308 
   306         self->self = self;
   309         self->self = self;
       
   310 		
       
   311         XAAdaptationBase_AddEventHandler( 	self->adapCtx, 
       
   312 											&XAStreamInformationItfImpl_AdaptCb, XA_STREAMINFOEVENTS, self );
   307         }
   313         }
   308 
   314 
   309     DEBUG_API("<-XAStreamInformationItfImpl_Create");
   315     DEBUG_API("<-XAStreamInformationItfImpl_Create");
   310     return self;
   316     return self;
   311     }
   317     }
   315  */
   321  */
   316 void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self)
   322 void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self)
   317     {
   323     {
   318     DEBUG_API("->XAStreamInformationItfImpl_Free");
   324     DEBUG_API("->XAStreamInformationItfImpl_Free");
   319     if(self)
   325     if(self)
   320         {
   326     {
   321         assert(self==self->self);
   327         XAAdaptationBase_RemoveEventHandler( (XAAdaptationBaseCtx*)self->adapCtx, &XAStreamInformationItfImpl_AdaptCb );
   322         free(self);
   328         free(self);
   323         }
   329     }
   324     DEBUG_API("<-XAStreamInformationItfImpl_Free");
   330     DEBUG_API("<-XAStreamInformationItfImpl_Free");
   325     }
   331     }
   326 
   332 
       
   333 void XAStreamInformationItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event )
       
   334 {
       
   335 	XAStreamInformationItfImpl* impl = (XAStreamInformationItfImpl*)pHandlerCtx;
       
   336 	DEBUG_API("->XAPrefetchStatusItfImpl_AdaptCb");
       
   337 	if(!impl)
       
   338 	{
       
   339 		DEBUG_ERR("XAPrefetchStatusItfImpl_AdaptCb, invalid context pointer!");
       
   340 		DEBUG_API("<-XAPrefetchStatusItfImpl_AdaptCb");
       
   341 		return;
       
   342 	}
       
   343 	
       
   344 	if (impl->adapCtx->fwtype == FWMgrFWMMF)
       
   345 	{
       
   346 		impl->callback(impl->cbPtrToSelf, XA_STREAMCBEVENT_PROPERTYCHANGE, event->eventid, NULL, impl->cbcontext);
       
   347 	}
       
   348 	
       
   349 	DEBUG_API("<-XAPrefetchStatusItfImpl_AdaptCb");
       
   350 	return;
       
   351 }
       
   352