khronosfws/openmax_al/src/mediaplayer/xaseekitf.c
changeset 25 6f7ceef7b1d1
parent 19 4a629bc82c5e
child 33 5e8b14bae8c3
equal deleted inserted replaced
21:2ed61feeead6 25:6f7ceef7b1d1
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description: 
    14  * Description: Seek Itf Implementation
    15 *
    15  *
    16 */
    16  */
    17 
    17 
    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 
    21 
    29 /**
    29 /**
    30  * XASeekItfImpl* GetImpl(XASeekItf self)
    30  * XASeekItfImpl* GetImpl(XASeekItf self)
    31  * Description: Validate interface pointer and cast it to implementation pointer.
    31  * Description: Validate interface pointer and cast it to implementation pointer.
    32  */
    32  */
    33 static XASeekItfImpl* GetImpl(XASeekItf self)
    33 static XASeekItfImpl* GetImpl(XASeekItf self)
    34 {
    34     {
    35     if(self)
    35     if (self)
    36     {
    36         {
    37         XASeekItfImpl* impl = (XASeekItfImpl*)(*self);
    37         XASeekItfImpl* impl = (XASeekItfImpl*) (*self);
    38         if(impl && impl == impl->self)
    38         if (impl && impl == impl->self)
    39         {
    39             {
    40             return impl;
    40             return impl;
    41         }
    41             }
    42     }
    42         }
    43     return NULL;
    43     return NULL;
    44 }
    44     }
    45 
    45 
    46 /**
    46 /**
    47  * Base interface XASeekItf implementation
    47  * Base interface XASeekItf implementation
    48  */
    48  */
    49 
    49 
    51  * XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos,
    51  * XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos,
    52  *                                    XAuint32 seekMode)
    52  *                                    XAuint32 seekMode)
    53  * Description: Sets the position of the playback head.
    53  * Description: Sets the position of the playback head.
    54  **/
    54  **/
    55 XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos,
    55 XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos,
    56                                    XAuint32 seekMode)
    56         XAuint32 seekMode)
    57 {
    57     {
    58     XAresult ret = XA_RESULT_SUCCESS;
    58     XAresult ret = XA_RESULT_SUCCESS;
    59     XAmillisecond duration = 0;
    59     XAmillisecond duration = 0;
    60     XASeekItfImpl* impl = GetImpl(self);
    60     XASeekItfImpl* impl = GetImpl(self);
    61     DEBUG_API("->XASeekItfImpl_SetPosition");
    61     DEBUG_API("->XASeekItfImpl_SetPosition");
    62     XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer );
    62     XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer );
    63 
    63 
    64     if(!impl)
    64     if (!impl)
    65     {
    65         {
    66         /* invalid parameter */
    66         /* invalid parameter */
    67         XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
    67         XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
    68         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    68         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    69         DEBUG_API("<-XASeekItfImpl_SetPosition");
    69         DEBUG_API("<-XASeekItfImpl_SetPosition");
    70         return XA_RESULT_PARAMETER_INVALID;
    70         return XA_RESULT_PARAMETER_INVALID;
    71     }
    71         }
    72 
    72 
    73 
    73     if (impl->adapCtx->fwtype == FWMgrFWMMF)
    74     if(impl->adapCtx->fwtype == FWMgrFWMMF)
       
    75         {
    74         {
    76         /* Get duration of the content */
    75         /* Get duration of the content */
    77         if(XAPlayItfAdaptMMF_GetDuration((XAAdaptationBaseCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS)
    76         if (XAPlayItfAdaptMMF_GetDuration(
    78             {
    77                 (XAAdaptationBaseCtx*) impl->adapCtx, &duration)
    79             /* invalid parameter */
    78                 != XA_RESULT_SUCCESS)
    80             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
    79             {
    81             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    80             /* invalid parameter */
    82             DEBUG_API("<-XASeekItfImpl_SetPosition");
    81             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
    83             return XA_RESULT_PARAMETER_INVALID;
    82             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    84             }
    83             DEBUG_API("<-XASeekItfImpl_SetPosition");
    85         if(pos > duration)
    84             return XA_RESULT_PARAMETER_INVALID;
    86             {
    85             }
    87             /* invalid parameter */
    86         if (pos > duration)
    88             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
    87             {
    89             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    88             /* invalid parameter */
    90             DEBUG_API("<-XASeekItfImpl_SetPosition");
    89             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
    91             return XA_RESULT_PARAMETER_INVALID;
    90             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    92             }
    91             DEBUG_API("<-XASeekItfImpl_SetPosition");
    93     
    92             return XA_RESULT_PARAMETER_INVALID;
    94         if(seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE)
    93             }
       
    94 
       
    95         if (seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE)
    95             {
    96             {
    96             /* seek mode unsupported */
    97             /* seek mode unsupported */
    97             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
    98             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
    98             DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED");
    99             DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED");
    99             DEBUG_API("<-XASeekItfImpl_SetPosition");
   100             DEBUG_API("<-XASeekItfImpl_SetPosition");
   100             return XA_RESULT_FEATURE_UNSUPPORTED;
   101             return XA_RESULT_FEATURE_UNSUPPORTED;
   101             }
   102             }
   102     
   103 
   103         ret = XASeekItfAdaptMMF_SetPosition(impl->adapCtx, pos, seekMode);
   104         ret = XASeekItfAdaptMMF_SetPosition(impl->adapCtx, pos, seekMode);
   104         if(ret == XA_RESULT_SUCCESS)
   105         if (ret == XA_RESULT_SUCCESS)
   105             {
   106             {
   106             impl->playbackPosition = pos;
   107             impl->playbackPosition = pos;
   107             impl->seekMode = seekMode;
   108             impl->seekMode = seekMode;
   108             }
   109             }
   109         }
   110         }
   110     else
   111     else
   111         {
   112         {
   112         /* Get duration of the content */
   113         /* Get duration of the content */
   113         if(XAPlayItfAdaptGST_GetDuration((XAAdaptationGstCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS)
   114         if (XAPlayItfAdaptGST_GetDuration(
   114             {
   115                 (XAAdaptationGstCtx*) impl->adapCtx, &duration)
   115             /* invalid parameter */
   116                 != XA_RESULT_SUCCESS)
   116             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   117             {
   117             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   118             /* invalid parameter */
   118             DEBUG_API("<-XASeekItfImpl_SetPosition");
   119             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   119             return XA_RESULT_PARAMETER_INVALID;
   120             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   120             }
   121             DEBUG_API("<-XASeekItfImpl_SetPosition");
   121         if(pos > duration)
   122             return XA_RESULT_PARAMETER_INVALID;
   122             {
   123             }
   123             /* invalid parameter */
   124         if (pos > duration)
   124             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   125             {
   125             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   126             /* invalid parameter */
   126             DEBUG_API("<-XASeekItfImpl_SetPosition");
   127             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   127             return XA_RESULT_PARAMETER_INVALID;
   128             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   128             }
   129             DEBUG_API("<-XASeekItfImpl_SetPosition");
   129     
   130             return XA_RESULT_PARAMETER_INVALID;
   130         if(seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE)
   131             }
       
   132 
       
   133         if (seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE)
   131             {
   134             {
   132             /* seek mode unsupported */
   135             /* seek mode unsupported */
   133             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   136             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   134             DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED");
   137             DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED");
   135             DEBUG_API("<-XASeekItfImpl_SetPosition");
   138             DEBUG_API("<-XASeekItfImpl_SetPosition");
   136             return XA_RESULT_FEATURE_UNSUPPORTED;
   139             return XA_RESULT_FEATURE_UNSUPPORTED;
   137             }
   140             }
   138     
   141 
   139         ret = XASeekItfAdapt_SetPosition((XAAdaptationGstCtx*)impl->adapCtx, pos, seekMode);
   142         ret = XASeekItfAdapt_SetPosition((XAAdaptationGstCtx*) impl->adapCtx,
   140         if(ret == XA_RESULT_SUCCESS)
   143                 pos, seekMode);
       
   144         if (ret == XA_RESULT_SUCCESS)
   141             {
   145             {
   142             impl->playbackPosition = pos;
   146             impl->playbackPosition = pos;
   143             impl->seekMode = seekMode;
   147             impl->seekMode = seekMode;
   144             }
   148             }
   145     
   149 
   146         }
   150         }
   147 
   151 
   148     XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   152     XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   149     DEBUG_API("<-XASeekItfImpl_SetPosition");
   153     DEBUG_API("<-XASeekItfImpl_SetPosition");
   150     return ret;
   154     return ret;
   151 }
   155     }
   152 
   156 
   153 /**
   157 /**
   154  * XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable,
   158  * XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable,
   155  *                                XAmillisecond startPos, XAmillisecond endPos)
   159  *                                XAmillisecond startPos, XAmillisecond endPos)
   156  * Description: Enables or disables looping and sets the start and end points of looping.
   160  * Description: Enables or disables looping and sets the start and end points of looping.
   157  **/
   161  **/
   158 XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable,
   162 XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable,
   159                                XAmillisecond startPos, XAmillisecond endPos)
   163         XAmillisecond startPos, XAmillisecond endPos)
   160 {
   164     {
   161     XAresult ret = XA_RESULT_SUCCESS;
   165     XAresult ret = XA_RESULT_SUCCESS;
   162     XAmillisecond duration = 0;
   166     XAmillisecond duration = 0;
   163     XASeekItfImpl* impl = GetImpl(self);
   167     XASeekItfImpl* impl = GetImpl(self);
   164     DEBUG_API_A2("->XASeekItfImpl_SetLoop, startPos:%lu, endPos:%lu", startPos, endPos);
   168     DEBUG_API_A2("->XASeekItfImpl_SetLoop, startPos:%lu, endPos:%lu", startPos, endPos);
   165     XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer );
   169     XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer );
   166 
   170 
   167     if(!impl || (startPos > endPos))
   171     if (!impl || (startPos > endPos))
   168     {
   172         {
   169         /* invalid parameter */
   173         /* invalid parameter */
   170         XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   174         XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   171         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   175         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   172         DEBUG_API("<-XASeekItfImpl_SetLoop");
   176         DEBUG_API("<-XASeekItfImpl_SetLoop");
   173         return XA_RESULT_PARAMETER_INVALID;
   177         return XA_RESULT_PARAMETER_INVALID;
   174     }
   178         }
   175 
   179 
   176     if(impl->adapCtx->fwtype == FWMgrFWMMF)
   180     if (impl->adapCtx->fwtype == FWMgrFWMMF)
   177         {
   181         {
   178         /* Get duration of the content */
   182         /* Get duration of the content */
   179         if(XAPlayItfAdaptMMF_GetDuration((XAAdaptationBaseCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS)
   183         if (XAPlayItfAdaptMMF_GetDuration(
       
   184                 (XAAdaptationBaseCtx*) impl->adapCtx, &duration)
       
   185                 != XA_RESULT_SUCCESS)
   180             {
   186             {
   181             /* invalid parameter */
   187             /* invalid parameter */
   182             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   188             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   183             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   189             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   184             DEBUG_API("<-XASeekItfImpl_SetLoop");
   190             DEBUG_API("<-XASeekItfImpl_SetLoop");
   185             return XA_RESULT_PARAMETER_INVALID;
   191             return XA_RESULT_PARAMETER_INVALID;
   186             }
   192             }
   187         if(endPos > duration && endPos != XA_TIME_UNKNOWN)
   193         if (endPos > duration && endPos != XA_TIME_UNKNOWN)
   188             {
   194             {
   189             /* invalid parameter */
   195             /* invalid parameter */
   190             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   196             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   191             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   197             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   192             DEBUG_API("<-XASeekItfImpl_SetLoop");
   198             DEBUG_API("<-XASeekItfImpl_SetLoop");
   193             return XA_RESULT_PARAMETER_INVALID;
   199             return XA_RESULT_PARAMETER_INVALID;
   194             }
   200             }
   195     
   201 
   196         ret = XASeekItfAdaptMMF_SetLoop(impl->adapCtx, loopEnable, startPos, endPos);
   202         ret = XASeekItfAdaptMMF_SetLoop(impl->adapCtx, loopEnable, startPos,
   197         if(ret == XA_RESULT_SUCCESS)
   203                 endPos);
       
   204         if (ret == XA_RESULT_SUCCESS)
   198             {
   205             {
   199             impl->loopEnable = loopEnable;
   206             impl->loopEnable = loopEnable;
   200             impl->startPos = startPos;
   207             impl->startPos = startPos;
   201             impl->endPos = endPos;
   208             impl->endPos = endPos;
   202             }    
   209             }
   203         }
   210         }
   204     else
   211     else
   205         {
   212         {
   206         /* Get duration of the content */
   213         /* Get duration of the content */
   207         if(XAPlayItfAdaptGST_GetDuration((XAAdaptationGstCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS)
   214         if (XAPlayItfAdaptGST_GetDuration(
       
   215                 (XAAdaptationGstCtx*) impl->adapCtx, &duration)
       
   216                 != XA_RESULT_SUCCESS)
   208             {
   217             {
   209             /* invalid parameter */
   218             /* invalid parameter */
   210             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   219             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   211             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   220             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   212             DEBUG_API("<-XASeekItfImpl_SetLoop");
   221             DEBUG_API("<-XASeekItfImpl_SetLoop");
   213             return XA_RESULT_PARAMETER_INVALID;
   222             return XA_RESULT_PARAMETER_INVALID;
   214             }
   223             }
   215         if(endPos > duration && endPos != XA_TIME_UNKNOWN)
   224         if (endPos > duration && endPos != XA_TIME_UNKNOWN)
   216             {
   225             {
   217             /* invalid parameter */
   226             /* invalid parameter */
   218             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   227             XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   219             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   228             DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   220             DEBUG_API("<-XASeekItfImpl_SetLoop");
   229             DEBUG_API("<-XASeekItfImpl_SetLoop");
   221             return XA_RESULT_PARAMETER_INVALID;
   230             return XA_RESULT_PARAMETER_INVALID;
   222             }
   231             }
   223     
   232 
   224         ret = XASeekItfAdapt_SetLoop((XAAdaptationGstCtx*)impl->adapCtx, loopEnable, startPos, endPos);
   233         ret = XASeekItfAdapt_SetLoop((XAAdaptationGstCtx*) impl->adapCtx,
   225         if(ret == XA_RESULT_SUCCESS)
   234                 loopEnable, startPos, endPos);
       
   235         if (ret == XA_RESULT_SUCCESS)
   226             {
   236             {
   227             impl->loopEnable = loopEnable;
   237             impl->loopEnable = loopEnable;
   228             impl->startPos = startPos;
   238             impl->startPos = startPos;
   229             impl->endPos = endPos;
   239             impl->endPos = endPos;
   230             }
   240             }
   231     
   241 
   232         }
   242         }
   233 
   243 
   234     XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   244     XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer );
   235     DEBUG_API("<-XASeekItfImpl_SetLoop");
   245     DEBUG_API("<-XASeekItfImpl_SetLoop");
   236     return ret;
   246     return ret;
   237 }
   247     }
   238 
   248 
   239 /**
   249 /**
   240  * XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled,
   250  * XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled,
   241  *                                XAmillisecond *pStartPos,
   251  *                                XAmillisecond *pStartPos,
   242  *                                XAmillisecond *pEndPos)
   252  *                                XAmillisecond *pEndPos)
   243  * Description: Queries whether looping is enabled or disabled, and retrieves loop points.
   253  * Description: Queries whether looping is enabled or disabled, and retrieves loop points.
   244  **/
   254  **/
   245 XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled,
   255 XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled,
   246                                XAmillisecond *pStartPos,
   256         XAmillisecond *pStartPos, XAmillisecond *pEndPos)
   247                                XAmillisecond *pEndPos)
   257     {
   248 {
       
   249     XAresult ret = XA_RESULT_SUCCESS;
   258     XAresult ret = XA_RESULT_SUCCESS;
   250 
   259 
   251     XASeekItfImpl* impl = GetImpl(self);
   260     XASeekItfImpl* impl = GetImpl(self);
   252     DEBUG_API("->XASeekItfImpl_GetLoop");
   261     DEBUG_API("->XASeekItfImpl_GetLoop");
   253 
   262 
   254     if(!impl || !pLoopEnabled || !pStartPos || !pEndPos)
   263     if (!impl || !pLoopEnabled || !pStartPos || !pEndPos)
   255     {
   264         {
   256         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   265         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
   257         DEBUG_API("<-XASeekItfImpl_GetLoop");
   266         DEBUG_API("<-XASeekItfImpl_GetLoop");
   258         /* invalid parameter */
   267         /* invalid parameter */
   259         return XA_RESULT_PARAMETER_INVALID;
   268         return XA_RESULT_PARAMETER_INVALID;
   260     }
   269         }
   261 
   270 
   262     *pLoopEnabled = impl->loopEnable;
   271     *pLoopEnabled = impl->loopEnable;
   263     *pStartPos = impl->startPos;
   272     *pStartPos = impl->startPos;
   264     *pEndPos = impl->endPos;
   273     *pEndPos = impl->endPos;
   265 
   274 
   266     DEBUG_API("<-XASeekItfImpl_GetLoop");
   275     DEBUG_API("<-XASeekItfImpl_GetLoop");
   267     return ret;
   276     return ret;
   268 }
   277     }
   269 
   278 
   270 /**
   279 /**
   271  * XASeekItfImpl -specific methods
   280  * XASeekItfImpl -specific methods
   272  **/
   281  **/
   273 
   282 
   274 /**
   283 /**
   275  * XASeekItfImpl* XASeekItfImpl_Create()
   284  * XASeekItfImpl* XASeekItfImpl_Create()
   276  * Description: Allocate and initialize SeekItfImpl.
   285  * Description: Allocate and initialize SeekItfImpl.
   277  **/
   286  **/
   278 XASeekItfImpl* XASeekItfImpl_Create(  XAMediaPlayerImpl* impl )
   287 XASeekItfImpl* XASeekItfImpl_Create(XAMediaPlayerImpl* impl)
   279 {
   288     {
   280     XASeekItfImpl *self = (XASeekItfImpl*)
   289     XASeekItfImpl *self = (XASeekItfImpl*) calloc(1, sizeof(XASeekItfImpl));
   281         calloc(1,sizeof(XASeekItfImpl));
       
   282     DEBUG_API("->XASeekItfImpl_Create");
   290     DEBUG_API("->XASeekItfImpl_Create");
   283     if(self)
   291     if (self)
   284     {
   292         {
   285         /* init itf default implementation */
   293         /* init itf default implementation */
   286         self->itf.GetLoop = XASeekItfImpl_GetLoop;
   294         self->itf.GetLoop = XASeekItfImpl_GetLoop;
   287         self->itf.SetLoop = XASeekItfImpl_SetLoop;
   295         self->itf.SetLoop = XASeekItfImpl_SetLoop;
   288         self->itf.SetPosition = XASeekItfImpl_SetPosition;
   296         self->itf.SetPosition = XASeekItfImpl_SetPosition;
   289 
   297 
   295         self->endPos = 0;
   303         self->endPos = 0;
   296 
   304 
   297         self->adapCtx = impl->curAdaptCtx;
   305         self->adapCtx = impl->curAdaptCtx;
   298 
   306 
   299         self->self = self;
   307         self->self = self;
   300     }
   308         }DEBUG_API("<-XASeekItfImpl_Create");
   301     DEBUG_API("<-XASeekItfImpl_Create");
       
   302     return self;
   309     return self;
   303 }
   310     }
   304 
   311 
   305 /**
   312 /**
   306  * void XASeekItfImpl_Free(XASeekItfImpl* self)
   313  * void XASeekItfImpl_Free(XASeekItfImpl* self)
   307  * Description: Free all resources reserved at XASeekItfImpl_Create.
   314  * Description: Free all resources reserved at XASeekItfImpl_Create.
   308  **/
   315  **/
   309 void XASeekItfImpl_Free(XASeekItfImpl* self)
   316 void XASeekItfImpl_Free(XASeekItfImpl* self)
   310 {
   317     {
   311     DEBUG_API("->XASeekItfImpl_Free");
   318     DEBUG_API("->XASeekItfImpl_Free");
   312     assert(self==self->self);
   319     assert(self==self->self);
   313     free(self);
   320     if(self)
       
   321         {
       
   322         free(self);
       
   323         }
   314     DEBUG_API("<-XASeekItfImpl_Free");
   324     DEBUG_API("<-XASeekItfImpl_Free");
   315 }
   325     }