khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c
author hgs
Fri, 25 Jun 2010 17:36:03 -0500
changeset 28 ebf79c79991a
parent 25 6f7ceef7b1d1
child 33 5e8b14bae8c3
permissions -rw-r--r--
201025
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
25
hgs
parents: 21
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents: 21
diff changeset
     3
 * All rights reserved.
hgs
parents: 21
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents: 21
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents: 21
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents: 21
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents: 21
diff changeset
     8
 *
hgs
parents: 21
diff changeset
     9
 * Initial Contributors:
hgs
parents: 21
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents: 21
diff changeset
    11
 *
hgs
parents: 21
diff changeset
    12
 * Contributors:
hgs
parents: 21
diff changeset
    13
 *
hgs
parents: 21
diff changeset
    14
 * Description: Play Itf Adapt MMF
hgs
parents: 21
diff changeset
    15
 *
hgs
parents: 21
diff changeset
    16
 */
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include "unistd.h"
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include "xamediaplayeradaptctxmmf.h"
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include "xaplayitfadaptationmmf.h"
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include "xaadaptationmmf.h"
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include "cmmfbackendengine.h"
21
hgs
parents: 19
diff changeset
    23
#include "cmmfradiobackendengine.h"
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <glib.h>
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
extern XAboolean cameraRealized;
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
/*forward declaration of position updater callback*/
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
gboolean XAPlayItfAdapt_PositionUpdate(gpointer ctx);
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
/*
19
hgs
parents: 12
diff changeset
    32
 * XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state)
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
 * Sets play state to GStreamer.
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
 * XAuint32 state - Play state to be set
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
 * @return XAresult ret - Success value
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
 */
25
hgs
parents: 21
diff changeset
    38
XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
    39
        XAuint32 state)
hgs
parents: 21
diff changeset
    40
    {
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
    42
    XAMediaPlayerAdaptationMMFCtx* mCtx;
hgs
parents: 21
diff changeset
    43
    if (!bCtx)
hgs
parents: 21
diff changeset
    44
        {
hgs
parents: 21
diff changeset
    45
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
    46
        return ret;
hgs
parents: 21
diff changeset
    47
        }
hgs
parents: 21
diff changeset
    48
hgs
parents: 21
diff changeset
    49
    mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
hgs
parents: 21
diff changeset
    50
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
19
hgs
parents: 12
diff changeset
    52
    DEBUG_API_A1("->XAPlayItfAdaptMMF_SetPlayState %s",PLAYSTATENAME(state));
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
19
hgs
parents: 12
diff changeset
    54
    /* bCtx and parameter pointer validation happens in the calling function.
hgs
parents: 12
diff changeset
    55
     * We don't need to repeat it here*/
25
hgs
parents: 21
diff changeset
    56
    switch (state)
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
        {
25
hgs
parents: 21
diff changeset
    58
        case XA_PLAYSTATE_STOPPED:
hgs
parents: 21
diff changeset
    59
            {
hgs
parents: 21
diff changeset
    60
            if (bCtx->ctxId == XARadioAdaptation)
hgs
parents: 21
diff changeset
    61
                {
hgs
parents: 21
diff changeset
    62
                mmf_set_player_adapt_context(cmmfradiobackendengine_init(),
hgs
parents: 21
diff changeset
    63
                        bCtx);
hgs
parents: 21
diff changeset
    64
                stop_radio(cmmfradiobackendengine_init());
hgs
parents: 21
diff changeset
    65
                }
hgs
parents: 21
diff changeset
    66
            else
hgs
parents: 21
diff changeset
    67
                {
hgs
parents: 21
diff changeset
    68
                ret = mmf_playitf_stop_playback(mCtx->mmfContext);
hgs
parents: 21
diff changeset
    69
                }
hgs
parents: 21
diff changeset
    70
            break;
hgs
parents: 21
diff changeset
    71
            }
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
        case XA_PLAYSTATE_PAUSED:
19
hgs
parents: 12
diff changeset
    73
            ret = mmf_playitf_pause_playback(mCtx->mmfContext);
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
            break;
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
        case XA_PLAYSTATE_PLAYING:
25
hgs
parents: 21
diff changeset
    76
            {
hgs
parents: 21
diff changeset
    77
            if (bCtx->ctxId == XARadioAdaptation)
hgs
parents: 21
diff changeset
    78
                {
hgs
parents: 21
diff changeset
    79
                mmf_set_player_adapt_context(cmmfradiobackendengine_init(),
hgs
parents: 21
diff changeset
    80
                        bCtx);
hgs
parents: 21
diff changeset
    81
                play_radio(cmmfradiobackendengine_init());
hgs
parents: 21
diff changeset
    82
                }
hgs
parents: 21
diff changeset
    83
            else
hgs
parents: 21
diff changeset
    84
                {
hgs
parents: 21
diff changeset
    85
                ret = mmf_playitf_resume_playback(mCtx->mmfContext);
hgs
parents: 21
diff changeset
    86
                }
hgs
parents: 21
diff changeset
    87
            break;
hgs
parents: 21
diff changeset
    88
            }
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
        default:
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
            ret = XA_RESULT_PARAMETER_INVALID;
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
            break;
25
hgs
parents: 21
diff changeset
    92
        }
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
19
hgs
parents: 12
diff changeset
    94
    DEBUG_API("<-XAPlayItfAdaptMMF_SetPlayState");
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    return ret;
25
hgs
parents: 21
diff changeset
    96
    }
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
/*
19
hgs
parents: 12
diff changeset
    99
 * XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 *pState)
hgs
parents: 12
diff changeset
   100
 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID
hgs
parents: 12
diff changeset
   101
 * XAuint32 *state - XAmillisecond *pMsec - Pointer where to store play state
hgs
parents: 12
diff changeset
   102
 * @return XAresult ret - Success value
hgs
parents: 12
diff changeset
   103
 */
25
hgs
parents: 21
diff changeset
   104
XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
   105
        XAuint32 *pState)
19
hgs
parents: 12
diff changeset
   106
    {
hgs
parents: 12
diff changeset
   107
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
   108
    XAMediaPlayerAdaptationMMFCtx* pSelf;
hgs
parents: 21
diff changeset
   109
    if (!bCtx || !pState)
hgs
parents: 21
diff changeset
   110
        {
hgs
parents: 21
diff changeset
   111
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   112
        return ret;
hgs
parents: 21
diff changeset
   113
        }
hgs
parents: 21
diff changeset
   114
hgs
parents: 21
diff changeset
   115
    pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
19
hgs
parents: 12
diff changeset
   116
hgs
parents: 12
diff changeset
   117
    DEBUG_API("->XAPlayItfAdaptMMF_GetPlayState");
hgs
parents: 12
diff changeset
   118
hgs
parents: 12
diff changeset
   119
    /* If playhead reaches eof, state will transition to paused.
hgs
parents: 12
diff changeset
   120
     * This object does not have visibility to callback*/
25
hgs
parents: 21
diff changeset
   121
    ret = mmf_playitf_get_play_state(pSelf->mmfContext, pState);
19
hgs
parents: 12
diff changeset
   122
hgs
parents: 12
diff changeset
   123
    DEBUG_API("<-XAPlayItfAdaptMMF_GetPlayState");
hgs
parents: 12
diff changeset
   124
    return ret;
hgs
parents: 12
diff changeset
   125
hgs
parents: 12
diff changeset
   126
    }
hgs
parents: 12
diff changeset
   127
hgs
parents: 12
diff changeset
   128
/*
hgs
parents: 12
diff changeset
   129
 * XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec)
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
 * XAmillisecond *pMsec - Pointer where to store duration of stream.
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
 * @return XAresult ret - Success value
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
 */
25
hgs
parents: 21
diff changeset
   134
XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
   135
        XAmillisecond *pMsec)
hgs
parents: 21
diff changeset
   136
    {
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
   138
    XAMediaPlayerAdaptationMMFCtx* pSelf;
hgs
parents: 21
diff changeset
   139
    if (!bCtx || !pMsec)
hgs
parents: 21
diff changeset
   140
        {
hgs
parents: 21
diff changeset
   141
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   142
        return ret;
hgs
parents: 21
diff changeset
   143
        }
hgs
parents: 21
diff changeset
   144
hgs
parents: 21
diff changeset
   145
    pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
19
hgs
parents: 12
diff changeset
   147
    DEBUG_API("->XAPlayItfAdaptMMF_GetDuration");
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
25
hgs
parents: 21
diff changeset
   149
    ret = mmf_playitf_get_duration(pSelf->mmfContext, pMsec);
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
19
hgs
parents: 12
diff changeset
   151
    DEBUG_API("<-XAPlayItfAdaptMMF_GetDuration");
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
    return ret;
25
hgs
parents: 21
diff changeset
   153
    }
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
/*
19
hgs
parents: 12
diff changeset
   156
 * XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec)
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
 * XAmillisecond *pMsec - Pointer where to store current position in stream.
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
 * @return XAresult ret - Success value
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
 */
25
hgs
parents: 21
diff changeset
   161
XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
   162
        XAmillisecond *pMsec)
hgs
parents: 21
diff changeset
   163
    {
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
   165
    XAMediaPlayerAdaptationMMFCtx* pSelf;
hgs
parents: 21
diff changeset
   166
    if (!bCtx || !pMsec)
hgs
parents: 21
diff changeset
   167
        {
hgs
parents: 21
diff changeset
   168
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   169
        return ret;
hgs
parents: 21
diff changeset
   170
        }
hgs
parents: 21
diff changeset
   171
hgs
parents: 21
diff changeset
   172
    pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
19
hgs
parents: 12
diff changeset
   173
hgs
parents: 12
diff changeset
   174
    DEBUG_API("->XAPlayItfAdaptMMF_GetPosition");
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
25
hgs
parents: 21
diff changeset
   176
    ret = mmf_playitf_get_position(pSelf->mmfContext, pMsec);
19
hgs
parents: 12
diff changeset
   177
hgs
parents: 12
diff changeset
   178
    DEBUG_API("<-XAPlayItfAdaptMMF_GetPosition");
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
    return ret;
25
hgs
parents: 21
diff changeset
   180
    }
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
/*
19
hgs
parents: 12
diff changeset
   183
 * XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, xaPlayCallback callback)
hgs
parents: 12
diff changeset
   184
 * Description: Sets the playback callback function.
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
 */
25
hgs
parents: 21
diff changeset
   186
XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
   187
        xaPlayCallback callback)
hgs
parents: 21
diff changeset
   188
    {
19
hgs
parents: 12
diff changeset
   189
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
   190
    XAMediaPlayerAdaptationMMFCtx* pSelf;
hgs
parents: 21
diff changeset
   191
    if (!bCtx)
hgs
parents: 21
diff changeset
   192
        {
hgs
parents: 21
diff changeset
   193
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   194
        return ret;
hgs
parents: 21
diff changeset
   195
        }
hgs
parents: 21
diff changeset
   196
hgs
parents: 21
diff changeset
   197
    pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
19
hgs
parents: 12
diff changeset
   198
hgs
parents: 12
diff changeset
   199
    DEBUG_API("->XAPlayItfAdaptMMF_RegisterCallback");
hgs
parents: 12
diff changeset
   200
25
hgs
parents: 21
diff changeset
   201
    ret = mmf_playitf_register_callback(pSelf->mmfContext, callback);
19
hgs
parents: 12
diff changeset
   202
hgs
parents: 12
diff changeset
   203
    DEBUG_API("<-XAPlayItfAdaptMMF_RegisterCallback");
hgs
parents: 12
diff changeset
   204
    return ret;
25
hgs
parents: 21
diff changeset
   205
    }
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
19
hgs
parents: 12
diff changeset
   207
/**
hgs
parents: 12
diff changeset
   208
 * XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags)
hgs
parents: 12
diff changeset
   209
 * Description: Enables/disables notification of playback events.
hgs
parents: 12
diff changeset
   210
 **/
25
hgs
parents: 21
diff changeset
   211
XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
   212
        XAuint32 eventFlags)
hgs
parents: 21
diff changeset
   213
    {
19
hgs
parents: 12
diff changeset
   214
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
   215
    XAMediaPlayerAdaptationMMFCtx* pSelf;
hgs
parents: 21
diff changeset
   216
    if (!bCtx)
hgs
parents: 21
diff changeset
   217
        {
hgs
parents: 21
diff changeset
   218
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   219
        return ret;
hgs
parents: 21
diff changeset
   220
        }
hgs
parents: 21
diff changeset
   221
hgs
parents: 21
diff changeset
   222
    pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
19
hgs
parents: 12
diff changeset
   223
hgs
parents: 12
diff changeset
   224
    DEBUG_API("->XAPlayItfAdaptMMF_SetCallbackEventsMask");
hgs
parents: 12
diff changeset
   225
25
hgs
parents: 21
diff changeset
   226
    ret = mmf_playitf_set_callback_events_mask(pSelf->mmfContext, eventFlags);
19
hgs
parents: 12
diff changeset
   227
hgs
parents: 12
diff changeset
   228
    DEBUG_API("<-XAPlayItfAdaptMMF_SetCallbackEventsMask");
hgs
parents: 12
diff changeset
   229
    return ret;
25
hgs
parents: 21
diff changeset
   230
    }
12
5a06f39ad45b Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
19
hgs
parents: 12
diff changeset
   232
/**
hgs
parents: 12
diff changeset
   233
 * XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec)
hgs
parents: 12
diff changeset
   234
 * Description: Sets marker position.
hgs
parents: 12
diff changeset
   235
 **/
25
hgs
parents: 21
diff changeset
   236
XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
   237
        XAmillisecond mSec)
hgs
parents: 21
diff changeset
   238
    {
19
hgs
parents: 12
diff changeset
   239
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
   240
    XAMediaPlayerAdaptationMMFCtx* pSelf;
hgs
parents: 21
diff changeset
   241
    if (!bCtx)
hgs
parents: 21
diff changeset
   242
        {
hgs
parents: 21
diff changeset
   243
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   244
        return ret;
hgs
parents: 21
diff changeset
   245
        }
hgs
parents: 21
diff changeset
   246
hgs
parents: 21
diff changeset
   247
    pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
19
hgs
parents: 12
diff changeset
   248
hgs
parents: 12
diff changeset
   249
    DEBUG_API("->XAPlayItfAdaptMMF_SetMarkerPosition");
hgs
parents: 12
diff changeset
   250
25
hgs
parents: 21
diff changeset
   251
    ret = mmf_playitf_set_marker_position(pSelf->mmfContext, mSec);
19
hgs
parents: 12
diff changeset
   252
hgs
parents: 12
diff changeset
   253
    DEBUG_API("<-XAPlayItfAdaptMMF_SetMarkerPosition");
hgs
parents: 12
diff changeset
   254
    return ret;
25
hgs
parents: 21
diff changeset
   255
    }
19
hgs
parents: 12
diff changeset
   256
hgs
parents: 12
diff changeset
   257
/**
hgs
parents: 12
diff changeset
   258
 * XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags)
hgs
parents: 12
diff changeset
   259
 * Description: Clears marker position.
hgs
parents: 12
diff changeset
   260
 **/
hgs
parents: 12
diff changeset
   261
XAresult XAPlayItfAdaptMMF_ClearMarkerPosition(XAAdaptationBaseCtx *bCtx)
25
hgs
parents: 21
diff changeset
   262
    {
19
hgs
parents: 12
diff changeset
   263
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
   264
    XAMediaPlayerAdaptationMMFCtx* pSelf;
hgs
parents: 21
diff changeset
   265
    if (!bCtx)
hgs
parents: 21
diff changeset
   266
        {
hgs
parents: 21
diff changeset
   267
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   268
        return ret;
hgs
parents: 21
diff changeset
   269
        }
hgs
parents: 21
diff changeset
   270
hgs
parents: 21
diff changeset
   271
    pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
19
hgs
parents: 12
diff changeset
   272
hgs
parents: 12
diff changeset
   273
    DEBUG_API("->XAPlayItfAdaptMMF_ClearMarkerPosition");
hgs
parents: 12
diff changeset
   274
25
hgs
parents: 21
diff changeset
   275
    ret = mmf_playitf_clear_marker_position(pSelf->mmfContext);
19
hgs
parents: 12
diff changeset
   276
hgs
parents: 12
diff changeset
   277
    DEBUG_API("<-XAPlayItfAdaptMMF_ClearMarkerPosition");
hgs
parents: 12
diff changeset
   278
    return ret;
25
hgs
parents: 21
diff changeset
   279
    }
19
hgs
parents: 12
diff changeset
   280
hgs
parents: 12
diff changeset
   281
/**
hgs
parents: 12
diff changeset
   282
 * XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec)
hgs
parents: 12
diff changeset
   283
 * Description: Sets position update period.
hgs
parents: 12
diff changeset
   284
 **/
25
hgs
parents: 21
diff changeset
   285
XAresult XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
   286
        XAmillisecond mSec)
hgs
parents: 21
diff changeset
   287
    {
19
hgs
parents: 12
diff changeset
   288
    XAresult ret = XA_RESULT_SUCCESS;
25
hgs
parents: 21
diff changeset
   289
    XAMediaPlayerAdaptationMMFCtx* pSelf;
hgs
parents: 21
diff changeset
   290
    if (!bCtx)
hgs
parents: 21
diff changeset
   291
        {
hgs
parents: 21
diff changeset
   292
        ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   293
        return ret;
hgs
parents: 21
diff changeset
   294
        }
hgs
parents: 21
diff changeset
   295
hgs
parents: 21
diff changeset
   296
    pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx;
19
hgs
parents: 12
diff changeset
   297
hgs
parents: 12
diff changeset
   298
    DEBUG_API("->XAPlayItfAdaptMMF_SetPositionUpdatePeriod");
hgs
parents: 12
diff changeset
   299
25
hgs
parents: 21
diff changeset
   300
    ret = mmf_playitf_set_position_update_period(pSelf->mmfContext, mSec);
19
hgs
parents: 12
diff changeset
   301
hgs
parents: 12
diff changeset
   302
    DEBUG_API("<-XAPlayItfAdaptMMF_SetPositionUpdatePeriod");
hgs
parents: 12
diff changeset
   303
    return ret;
25
hgs
parents: 21
diff changeset
   304
    }
21
hgs
parents: 19
diff changeset
   305
/*
hgs
parents: 19
diff changeset
   306
 * XAresult XAPlayItfAdapt_StateChange
hgs
parents: 19
diff changeset
   307
 * Handle callback from Radio utility 
hgs
parents: 19
diff changeset
   308
 */
25
hgs
parents: 21
diff changeset
   309
void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx,
hgs
parents: 21
diff changeset
   310
        XAboolean playing)
hgs
parents: 21
diff changeset
   311
    {
hgs
parents: 21
diff changeset
   312
    if (playing)
hgs
parents: 21
diff changeset
   313
        {
hgs
parents: 21
diff changeset
   314
        XAAdaptEvent event =
hgs
parents: 21
diff changeset
   315
            {
hgs
parents: 21
diff changeset
   316
            XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING, 1, 0
hgs
parents: 21
diff changeset
   317
            };
hgs
parents: 21
diff changeset
   318
        XAAdaptationBase_SendAdaptEvents(bCtx, &event);
hgs
parents: 21
diff changeset
   319
        }
hgs
parents: 21
diff changeset
   320
    else
hgs
parents: 21
diff changeset
   321
        {
hgs
parents: 21
diff changeset
   322
        XAAdaptEvent event =
hgs
parents: 21
diff changeset
   323
            {
hgs
parents: 21
diff changeset
   324
            XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADSTALLED, 1, 0
hgs
parents: 21
diff changeset
   325
            };
hgs
parents: 21
diff changeset
   326
        XAAdaptationBase_SendAdaptEvents(bCtx, &event);
hgs
parents: 21
diff changeset
   327
        }
21
hgs
parents: 19
diff changeset
   328
25
hgs
parents: 21
diff changeset
   329
    }