khronosfws/openmax_al/src/engine/xadevicevolumeitf.c
changeset 16 43d09473c595
parent 12 5a06f39ad45b
equal deleted inserted replaced
14:80975da52420 16:43d09473c595
    18 #include <stdio.h>
    18 #include <stdio.h>
    19 #include <stdlib.h>
    19 #include <stdlib.h>
    20 #include <assert.h>
    20 #include <assert.h>
    21 #include "xaglobals.h"
    21 #include "xaglobals.h"
    22 #include "xadevicevolumeitf.h"
    22 #include "xadevicevolumeitf.h"
    23 #ifdef _GSTREAMER_BACKEND_  
    23   
    24 #include "XADeviceVolumeItfAdaptation.h"
    24 #include "xadevicevolumeitfadaptation.h"
    25 #endif
    25 
    26 
    26 
    27 static XADeviceVolumeItfImpl* GetImpl(XADeviceVolumeItf self)
    27 static XADeviceVolumeItfImpl* GetImpl(XADeviceVolumeItf self)
    28 {
    28 {
    29     if( self )
    29     if( self )
    30     {
    30     {
    63         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    63         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    64         DEBUG_API("<-XADeviceVolumeItfImpl_GetVolumeScale");
    64         DEBUG_API("<-XADeviceVolumeItfImpl_GetVolumeScale");
    65         return XA_RESULT_PARAMETER_INVALID;
    65         return XA_RESULT_PARAMETER_INVALID;
    66     }
    66     }
    67 
    67 
    68 #ifdef _GSTREAMER_BACKEND_  
    68   
    69     ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported(impl->adapCtx, deviceID, &supported);
    69     ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported((XAAdaptationGstCtx*)impl->adapCtx, deviceID, &supported);
    70 #endif
    70 
    71     if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE )
    71     if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE )
    72     {
    72     {
    73         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    73         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    74         DEBUG_API("<-XADeviceVolumeItfImpl_GetVolumeScale");
    74         DEBUG_API("<-XADeviceVolumeItfImpl_GetVolumeScale");
    75         return XA_RESULT_PARAMETER_INVALID;
    75         return XA_RESULT_PARAMETER_INVALID;
    92                                           XAuint32 deviceID,
    92                                           XAuint32 deviceID,
    93                                           XAint32 volume)
    93                                           XAint32 volume)
    94 {
    94 {
    95     XADeviceVolumeItfImpl* impl = GetImpl(self);
    95     XADeviceVolumeItfImpl* impl = GetImpl(self);
    96     XAresult ret = XA_RESULT_SUCCESS;
    96     XAresult ret = XA_RESULT_SUCCESS;
    97 #ifdef _GSTREAMER_BACKEND_  
    97   
    98     XAboolean supported = XA_BOOLEAN_FALSE;
    98     XAboolean supported = XA_BOOLEAN_FALSE;
    99 #endif
    99 
   100     DEBUG_API("->XADeviceVolumeItfImpl_SetVolume");
   100     DEBUG_API("->XADeviceVolumeItfImpl_SetVolume");
   101 
   101 
   102     if( !impl || volume < impl->minVolume || volume > impl->maxVolume )
   102     if( !impl || volume < impl->minVolume || volume > impl->maxVolume )
   103     {
   103     {
   104         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   104         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   105         DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume");
   105         DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume");
   106         return XA_RESULT_PARAMETER_INVALID;
   106         return XA_RESULT_PARAMETER_INVALID;
   107     }
   107     }
   108 
   108 
   109 #ifdef _GSTREAMER_BACKEND_  
   109   
   110     ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported(impl->adapCtx, deviceID, &supported);
   110     ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported((XAAdaptationGstCtx*)impl->adapCtx, deviceID, &supported);
   111     if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE )
   111     if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE )
   112     {
   112     {
   113         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   113         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   114         DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume");
   114         DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume");
   115         return XA_RESULT_PARAMETER_INVALID;
   115         return XA_RESULT_PARAMETER_INVALID;
   116     }
   116     }
   117 
   117 
   118     ret = XADeviceVolumeItfAdapt_SetVolume(impl->adapCtx, deviceID, volume);
   118     ret = XADeviceVolumeItfAdapt_SetVolume((XAAdaptationGstCtx*)impl->adapCtx, deviceID, volume);
   119 
   119 
   120     if( ret == XA_RESULT_SUCCESS )
   120     if( ret == XA_RESULT_SUCCESS )
   121     {
   121     {
   122         impl->curVolume = volume;
   122         impl->curVolume = volume;
   123     }
   123     }
   124 #endif
   124 
   125     DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume");
   125     DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume");
   126     return ret;
   126     return ret;
   127 }
   127 }
   128 
   128 
   129 /* XAresult XADeviceVolumeItfImpl_GetVolume( XADeviceVolumeItf self,
   129 /* XAresult XADeviceVolumeItfImpl_GetVolume( XADeviceVolumeItf self,
   145         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   145         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   146         DEBUG_API("<-XADeviceVolumeItfImpl_GetVolume");
   146         DEBUG_API("<-XADeviceVolumeItfImpl_GetVolume");
   147         return XA_RESULT_PARAMETER_INVALID;
   147         return XA_RESULT_PARAMETER_INVALID;
   148     }
   148     }
   149 
   149 
   150 #ifdef _GSTREAMER_BACKEND_  
   150   
   151     ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported(impl->adapCtx, deviceID, &supported);
   151     ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported((XAAdaptationGstCtx*)impl->adapCtx, deviceID, &supported);
   152 #endif
   152 
   153     if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE )
   153     if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE )
   154     {
   154     {
   155         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   155         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   156         DEBUG_API("<-XADeviceVolumeItfImpl_GetVolume");
   156         DEBUG_API("<-XADeviceVolumeItfImpl_GetVolume");
   157         return XA_RESULT_PARAMETER_INVALID;
   157         return XA_RESULT_PARAMETER_INVALID;
   162 }
   162 }
   163 
   163 
   164 /**
   164 /**
   165  * XADeviceVolumeItfImpl -specific methods
   165  * XADeviceVolumeItfImpl -specific methods
   166  **/
   166  **/
   167 #ifdef _GSTREAMER_BACKEND_  
   167   
   168 /**
   168 /**
   169  * XADeviceVolumeItfImpl* XADeviceVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx)
   169  * XADeviceVolumeItfImpl* XADeviceVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx)
   170  * Description: Allocate and initialize DeviceVolumeImpl
   170  * Description: Allocate and initialize DeviceVolumeImpl
   171  **/
   171  **/
   172 XADeviceVolumeItfImpl* XADeviceVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx)
   172 XADeviceVolumeItfImpl* XADeviceVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx)
   196         self->self = self;
   196         self->self = self;
   197     }
   197     }
   198     DEBUG_API("<-XADeviceVolumeItfImpl_Create");
   198     DEBUG_API("<-XADeviceVolumeItfImpl_Create");
   199     return self;
   199     return self;
   200 }
   200 }
   201 #endif
   201 
   202 /* void XADeviceVolumeItfImpl_Free(XADeviceVolumeItfImpl* self)
   202 /* void XADeviceVolumeItfImpl_Free(XADeviceVolumeItfImpl* self)
   203  * Description: Free all resources reserved at XADeviceVolumeItfImpl_Create
   203  * Description: Free all resources reserved at XADeviceVolumeItfImpl_Create
   204  */
   204  */
   205 void XADeviceVolumeItfImpl_Free(XADeviceVolumeItfImpl* self)
   205 void XADeviceVolumeItfImpl_Free(XADeviceVolumeItfImpl* self)
   206 {
   206 {