khronosfws/openmax_al/src/common/xastreaminformationitf.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:
25
hgs
parents: 19
diff changeset
     1
/*
hgs
parents: 19
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents: 19
diff changeset
     3
 * All rights reserved.
hgs
parents: 19
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents: 19
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents: 19
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents: 19
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
19
hgs
parents:
diff changeset
     8
 *
25
hgs
parents: 19
diff changeset
     9
 * Initial Contributors:
hgs
parents: 19
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents: 19
diff changeset
    11
 *
hgs
parents: 19
diff changeset
    12
 * Contributors:
hgs
parents: 19
diff changeset
    13
 *
hgs
parents: 19
diff changeset
    14
 * Description: Stream Information Interface Implementation
hgs
parents: 19
diff changeset
    15
 *
hgs
parents: 19
diff changeset
    16
 */
19
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#include <assert.h>
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#include "xastreaminformationitf.h"
hgs
parents:
diff changeset
    21
#include "xastreaminformationitfadaptation.h"
hgs
parents:
diff changeset
    22
#include "xastreaminformationitfadaptationmmf.h"
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
/* XAStreamInformationItfImpl* GetImpl
hgs
parents:
diff changeset
    25
 * Description: Validate interface pointer and cast it to implementation pointer.
hgs
parents:
diff changeset
    26
 */
hgs
parents:
diff changeset
    27
static XAStreamInformationItfImpl* GetImpl(XAStreamInformationItf self)
hgs
parents:
diff changeset
    28
    {
25
hgs
parents: 19
diff changeset
    29
    if (self)
19
hgs
parents:
diff changeset
    30
        {
25
hgs
parents: 19
diff changeset
    31
        XAStreamInformationItfImpl* impl =
hgs
parents: 19
diff changeset
    32
                (XAStreamInformationItfImpl*) (*self);
hgs
parents: 19
diff changeset
    33
        if (impl && impl == impl->self)
hgs
parents: 19
diff changeset
    34
            {
19
hgs
parents:
diff changeset
    35
            return impl;
25
hgs
parents: 19
diff changeset
    36
            }
19
hgs
parents:
diff changeset
    37
        }
25
hgs
parents: 19
diff changeset
    38
    return NULL;
19
hgs
parents:
diff changeset
    39
    }
hgs
parents:
diff changeset
    40
hgs
parents:
diff changeset
    41
/**
hgs
parents:
diff changeset
    42
 * Base interface XAPlayItf implementation
hgs
parents:
diff changeset
    43
 */
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
XAresult XAStreamInformationItfImpl_QueryMediaContainerInformation(
25
hgs
parents: 19
diff changeset
    46
        XAStreamInformationItf self, XAMediaContainerInformation * info)
hgs
parents: 19
diff changeset
    47
    {
19
hgs
parents:
diff changeset
    48
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
    49
    XAStreamInformationItfImpl* impl = GetImpl(self);
hgs
parents:
diff changeset
    50
    DEBUG_API("->XAStreamInformationItfImpl_QueryMediaContainerInformation");
25
hgs
parents: 19
diff changeset
    51
    if (!impl || !info || !impl->adapCtx)
hgs
parents: 19
diff changeset
    52
        {
19
hgs
parents:
diff changeset
    53
        /* invalid parameter */
hgs
parents:
diff changeset
    54
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
    55
        DEBUG_API("-<XAStreamInformationItfImpl_QueryMediaContainerInformation");
hgs
parents:
diff changeset
    56
        return XA_RESULT_PARAMETER_INVALID;
25
hgs
parents: 19
diff changeset
    57
        }
19
hgs
parents:
diff changeset
    58
25
hgs
parents: 19
diff changeset
    59
    if (impl->adapCtx->fwtype == FWMgrFWGST)
19
hgs
parents:
diff changeset
    60
        {
hgs
parents:
diff changeset
    61
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
    62
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
    63
            {
19
hgs
parents:
diff changeset
    64
            DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation");
hgs
parents:
diff changeset
    65
            return ret;
25
hgs
parents: 19
diff changeset
    66
            }
19
hgs
parents:
diff changeset
    67
        ret = XAStreamInformationItfAdapt_QueryMediaContainerInformation(
25
hgs
parents: 19
diff changeset
    68
                impl->adapCtx, &(info->containerType),
hgs
parents: 19
diff changeset
    69
                &(info->mediaDuration), &(info->numStreams));
19
hgs
parents:
diff changeset
    70
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents:
diff changeset
    71
        }
hgs
parents:
diff changeset
    72
    else
hgs
parents:
diff changeset
    73
        {
hgs
parents:
diff changeset
    74
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
    75
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
    76
            {
19
hgs
parents:
diff changeset
    77
            DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation");
hgs
parents:
diff changeset
    78
            return ret;
25
hgs
parents: 19
diff changeset
    79
            }
19
hgs
parents:
diff changeset
    80
        ret = XAStreamInformationItfAdaptMMF_QueryMediaContainerInformation(
25
hgs
parents: 19
diff changeset
    81
                impl->adapCtx, &(info->containerType),
hgs
parents: 19
diff changeset
    82
                &(info->mediaDuration), &(info->numStreams));
hgs
parents: 19
diff changeset
    83
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents: 19
diff changeset
    84
        ;
19
hgs
parents:
diff changeset
    85
        }
hgs
parents:
diff changeset
    86
hgs
parents:
diff changeset
    87
    DEBUG_API("-<XAStreamInformationItfImpl_QueryMediaContainerInformation");
hgs
parents:
diff changeset
    88
    return ret;
25
hgs
parents: 19
diff changeset
    89
    }
19
hgs
parents:
diff changeset
    90
hgs
parents:
diff changeset
    91
XAresult XAStreamInformationItfImpl_QueryStreamType(
25
hgs
parents: 19
diff changeset
    92
        XAStreamInformationItf self, XAuint32 streamIndex, XAuint32 *domain)
hgs
parents: 19
diff changeset
    93
    {
19
hgs
parents:
diff changeset
    94
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
    95
    XAStreamInformationItfImpl* impl = GetImpl(self);
hgs
parents:
diff changeset
    96
    DEBUG_API("->XAStreamInformationItfImpl_QueryStreamType");
25
hgs
parents: 19
diff changeset
    97
    if (!impl || !domain || (streamIndex == 0) || !impl->adapCtx)
hgs
parents: 19
diff changeset
    98
        {
19
hgs
parents:
diff changeset
    99
        /* invalid parameter */
hgs
parents:
diff changeset
   100
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
   101
        DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamType");
hgs
parents:
diff changeset
   102
        return XA_RESULT_PARAMETER_INVALID;
25
hgs
parents: 19
diff changeset
   103
        }
hgs
parents: 19
diff changeset
   104
    if (impl->adapCtx->fwtype == FWMgrFWGST)
19
hgs
parents:
diff changeset
   105
        {
hgs
parents:
diff changeset
   106
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   107
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   108
            {
19
hgs
parents:
diff changeset
   109
            DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType");
hgs
parents:
diff changeset
   110
            return ret;
25
hgs
parents: 19
diff changeset
   111
            }
hgs
parents: 19
diff changeset
   112
hgs
parents: 19
diff changeset
   113
        ret = XAStreamInformationItfAdapt_QueryStreamType(impl->adapCtx,
hgs
parents: 19
diff changeset
   114
                streamIndex, domain);
hgs
parents: 19
diff changeset
   115
19
hgs
parents:
diff changeset
   116
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents:
diff changeset
   117
        }
hgs
parents:
diff changeset
   118
    else
hgs
parents:
diff changeset
   119
        {
hgs
parents:
diff changeset
   120
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   121
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   122
            {
19
hgs
parents:
diff changeset
   123
            DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType");
hgs
parents:
diff changeset
   124
            return ret;
25
hgs
parents: 19
diff changeset
   125
            }
hgs
parents: 19
diff changeset
   126
hgs
parents: 19
diff changeset
   127
        ret = XAStreamInformationItfAdaptMMF_QueryStreamType(impl->adapCtx,
hgs
parents: 19
diff changeset
   128
                streamIndex, domain);
hgs
parents: 19
diff changeset
   129
hgs
parents: 19
diff changeset
   130
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents: 19
diff changeset
   131
        ;
hgs
parents: 19
diff changeset
   132
        }DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamType");
19
hgs
parents:
diff changeset
   133
    return ret;
25
hgs
parents: 19
diff changeset
   134
    }
19
hgs
parents:
diff changeset
   135
hgs
parents:
diff changeset
   136
XAresult XAStreamInformationItfImpl_QueryStreamInformation(
25
hgs
parents: 19
diff changeset
   137
        XAStreamInformationItf self, XAuint32 streamIndex, void * info)
hgs
parents: 19
diff changeset
   138
    {
19
hgs
parents:
diff changeset
   139
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
   140
    XAStreamInformationItfImpl* impl = GetImpl(self);
hgs
parents:
diff changeset
   141
    DEBUG_API("->XAStreamInformationItfImpl_QueryStreamInformation");
25
hgs
parents: 19
diff changeset
   142
    if (!impl || !info || (streamIndex == 0) || !impl->adapCtx)
hgs
parents: 19
diff changeset
   143
        {
19
hgs
parents:
diff changeset
   144
        /* invalid parameter */
hgs
parents:
diff changeset
   145
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
   146
        DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamInformation");
hgs
parents:
diff changeset
   147
        return XA_RESULT_PARAMETER_INVALID;
25
hgs
parents: 19
diff changeset
   148
        }
19
hgs
parents:
diff changeset
   149
25
hgs
parents: 19
diff changeset
   150
    if (impl->adapCtx->fwtype == FWMgrFWGST)
19
hgs
parents:
diff changeset
   151
        {
hgs
parents:
diff changeset
   152
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   153
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   154
            {
19
hgs
parents:
diff changeset
   155
            DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation");
hgs
parents:
diff changeset
   156
            return ret;
25
hgs
parents: 19
diff changeset
   157
            }
hgs
parents: 19
diff changeset
   158
19
hgs
parents:
diff changeset
   159
        ret = XAStreamInformationItfAdapt_QueryStreamInformation(
25
hgs
parents: 19
diff changeset
   160
                impl->adapCtx, streamIndex, info);
hgs
parents: 19
diff changeset
   161
19
hgs
parents:
diff changeset
   162
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents:
diff changeset
   163
        }
hgs
parents:
diff changeset
   164
    else
hgs
parents:
diff changeset
   165
        {
hgs
parents:
diff changeset
   166
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   167
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   168
            {
19
hgs
parents:
diff changeset
   169
            DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation");
hgs
parents:
diff changeset
   170
            return ret;
25
hgs
parents: 19
diff changeset
   171
            }
hgs
parents: 19
diff changeset
   172
19
hgs
parents:
diff changeset
   173
        ret = XAStreamInformationItfAdaptMMF_QueryStreamInformation(
25
hgs
parents: 19
diff changeset
   174
                impl->adapCtx, streamIndex, info);
hgs
parents: 19
diff changeset
   175
hgs
parents: 19
diff changeset
   176
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents: 19
diff changeset
   177
        ;
19
hgs
parents:
diff changeset
   178
        }
hgs
parents:
diff changeset
   179
hgs
parents:
diff changeset
   180
    DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamInformation");
hgs
parents:
diff changeset
   181
    return ret;
25
hgs
parents: 19
diff changeset
   182
    }
19
hgs
parents:
diff changeset
   183
hgs
parents:
diff changeset
   184
XAresult XAStreamInformationItfImpl_QueryStreamName(
25
hgs
parents: 19
diff changeset
   185
        XAStreamInformationItf self, XAuint32 streamIndex,
hgs
parents: 19
diff changeset
   186
        XAuint16 * pNameSize, XAchar * pName)
hgs
parents: 19
diff changeset
   187
    {
19
hgs
parents:
diff changeset
   188
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
   189
    XAStreamInformationItfImpl* impl = GetImpl(self);
hgs
parents:
diff changeset
   190
    DEBUG_API("->XAStreamInformationItfImpl_QueryStreamName");
25
hgs
parents: 19
diff changeset
   191
    if (!impl || (streamIndex == 0) || !pNameSize || !impl->adapCtx)
hgs
parents: 19
diff changeset
   192
        {
19
hgs
parents:
diff changeset
   193
        /* invalid parameter */
hgs
parents:
diff changeset
   194
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
   195
        DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamName");
hgs
parents:
diff changeset
   196
        return XA_RESULT_PARAMETER_INVALID;
25
hgs
parents: 19
diff changeset
   197
        }
19
hgs
parents:
diff changeset
   198
25
hgs
parents: 19
diff changeset
   199
    if (impl->adapCtx->fwtype == FWMgrFWGST)
19
hgs
parents:
diff changeset
   200
        {
hgs
parents:
diff changeset
   201
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   202
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   203
            {
19
hgs
parents:
diff changeset
   204
            DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName");
hgs
parents:
diff changeset
   205
            return ret;
25
hgs
parents: 19
diff changeset
   206
            }
hgs
parents: 19
diff changeset
   207
hgs
parents: 19
diff changeset
   208
        ret = XAStreamInformationItfAdapt_QueryStreamName(impl->adapCtx,
hgs
parents: 19
diff changeset
   209
                streamIndex, pNameSize, pName);
hgs
parents: 19
diff changeset
   210
19
hgs
parents:
diff changeset
   211
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents:
diff changeset
   212
        }
hgs
parents:
diff changeset
   213
    else
hgs
parents:
diff changeset
   214
        {
hgs
parents:
diff changeset
   215
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   216
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   217
            {
19
hgs
parents:
diff changeset
   218
            DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName");
hgs
parents:
diff changeset
   219
            return ret;
25
hgs
parents: 19
diff changeset
   220
            }
hgs
parents: 19
diff changeset
   221
hgs
parents: 19
diff changeset
   222
        ret = XAStreamInformationItfAdaptMMF_QueryStreamName(impl->adapCtx,
hgs
parents: 19
diff changeset
   223
                streamIndex, pNameSize, pName);
hgs
parents: 19
diff changeset
   224
hgs
parents: 19
diff changeset
   225
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents: 19
diff changeset
   226
        ;
hgs
parents: 19
diff changeset
   227
        }DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamName");
19
hgs
parents:
diff changeset
   228
    return ret;
25
hgs
parents: 19
diff changeset
   229
    }
19
hgs
parents:
diff changeset
   230
hgs
parents:
diff changeset
   231
XAresult XAStreamInformationItfImpl_RegisterStreamChangeCallback(
25
hgs
parents: 19
diff changeset
   232
        XAStreamInformationItf self, xaStreamEventChangeCallback callback,
hgs
parents: 19
diff changeset
   233
        void * pContext)
hgs
parents: 19
diff changeset
   234
    {
19
hgs
parents:
diff changeset
   235
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
   236
    XAStreamInformationItfImpl* impl = GetImpl(self);
hgs
parents:
diff changeset
   237
    DEBUG_API("->XAStreamInformationItfImpl_RegisterStreamChangeCallback");
25
hgs
parents: 19
diff changeset
   238
    if (!impl)
hgs
parents: 19
diff changeset
   239
        {
19
hgs
parents:
diff changeset
   240
        /* invalid parameter */
hgs
parents:
diff changeset
   241
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
   242
        DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
hgs
parents:
diff changeset
   243
        return XA_RESULT_PARAMETER_INVALID;
25
hgs
parents: 19
diff changeset
   244
        }
19
hgs
parents:
diff changeset
   245
hgs
parents:
diff changeset
   246
    /* callback may be NULL (to remove callback) */
hgs
parents:
diff changeset
   247
    impl->callback = callback;
hgs
parents:
diff changeset
   248
    impl->cbcontext = pContext;
hgs
parents:
diff changeset
   249
    impl->cbPtrToSelf = self;
hgs
parents:
diff changeset
   250
hgs
parents:
diff changeset
   251
    DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
hgs
parents:
diff changeset
   252
    return ret;
25
hgs
parents: 19
diff changeset
   253
    }
19
hgs
parents:
diff changeset
   254
hgs
parents:
diff changeset
   255
XAresult XAStreamInformationItfImpl_QueryActiveStreams(
25
hgs
parents: 19
diff changeset
   256
        XAStreamInformationItf self, XAuint32 *numStreams,
hgs
parents: 19
diff changeset
   257
        XAboolean *activeStreams)
hgs
parents: 19
diff changeset
   258
    {
19
hgs
parents:
diff changeset
   259
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
   260
    XAStreamInformationItfImpl* impl = GetImpl(self);
hgs
parents:
diff changeset
   261
    DEBUG_API("->XAStreamInformationItfImpl_QueryActiveStreams");
25
hgs
parents: 19
diff changeset
   262
    if (!impl || !numStreams || !impl->adapCtx)
hgs
parents: 19
diff changeset
   263
        {
19
hgs
parents:
diff changeset
   264
        /* invalid parameter */
hgs
parents:
diff changeset
   265
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
   266
        DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
hgs
parents:
diff changeset
   267
        return XA_RESULT_PARAMETER_INVALID;
25
hgs
parents: 19
diff changeset
   268
        }
19
hgs
parents:
diff changeset
   269
25
hgs
parents: 19
diff changeset
   270
    if (impl->adapCtx->fwtype == FWMgrFWGST)
hgs
parents: 19
diff changeset
   271
        {
19
hgs
parents:
diff changeset
   272
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   273
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   274
            {
19
hgs
parents:
diff changeset
   275
            DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams");
hgs
parents:
diff changeset
   276
            return ret;
25
hgs
parents: 19
diff changeset
   277
            }
hgs
parents: 19
diff changeset
   278
hgs
parents: 19
diff changeset
   279
        ret = XAStreamInformationItfAdapt_QueryActiveStreams(impl->adapCtx,
hgs
parents: 19
diff changeset
   280
                numStreams, activeStreams);
hgs
parents: 19
diff changeset
   281
19
hgs
parents:
diff changeset
   282
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents:
diff changeset
   283
        }
hgs
parents:
diff changeset
   284
    else
hgs
parents:
diff changeset
   285
        {
hgs
parents:
diff changeset
   286
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   287
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   288
            {
19
hgs
parents:
diff changeset
   289
            DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams");
hgs
parents:
diff changeset
   290
            return ret;
25
hgs
parents: 19
diff changeset
   291
            }
hgs
parents: 19
diff changeset
   292
19
hgs
parents:
diff changeset
   293
        ret = XAStreamInformationItfAdaptMMF_QueryActiveStreams(
25
hgs
parents: 19
diff changeset
   294
                impl->adapCtx, numStreams, activeStreams);
hgs
parents: 19
diff changeset
   295
hgs
parents: 19
diff changeset
   296
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents: 19
diff changeset
   297
        ;
19
hgs
parents:
diff changeset
   298
        }
hgs
parents:
diff changeset
   299
hgs
parents:
diff changeset
   300
    DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
hgs
parents:
diff changeset
   301
    return ret;
25
hgs
parents: 19
diff changeset
   302
    }
19
hgs
parents:
diff changeset
   303
hgs
parents:
diff changeset
   304
XAresult XAStreamInformationItfImpl_SetActiveStream(
25
hgs
parents: 19
diff changeset
   305
        XAStreamInformationItf self, XAuint32 streamNum, XAboolean active,
hgs
parents: 19
diff changeset
   306
        XAboolean commitNow)
hgs
parents: 19
diff changeset
   307
    {
19
hgs
parents:
diff changeset
   308
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
   309
    XAStreamInformationItfImpl* impl = GetImpl(self);
hgs
parents:
diff changeset
   310
    DEBUG_API("->XAStreamInformationItfImpl_SetActiveStream");
25
hgs
parents: 19
diff changeset
   311
    if (!impl || !impl->adapCtx)
hgs
parents: 19
diff changeset
   312
        {
19
hgs
parents:
diff changeset
   313
        /* invalid parameter */
hgs
parents:
diff changeset
   314
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
   315
        DEBUG_API("-<XAStreamInformationItfImpl_SetActiveStream");
hgs
parents:
diff changeset
   316
        return XA_RESULT_PARAMETER_INVALID;
25
hgs
parents: 19
diff changeset
   317
        }
19
hgs
parents:
diff changeset
   318
25
hgs
parents: 19
diff changeset
   319
    if (impl->adapCtx->fwtype == FWMgrFWGST)
hgs
parents: 19
diff changeset
   320
        {
19
hgs
parents:
diff changeset
   321
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   322
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   323
            {
19
hgs
parents:
diff changeset
   324
            DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream");
hgs
parents:
diff changeset
   325
            return ret;
25
hgs
parents: 19
diff changeset
   326
            }
hgs
parents: 19
diff changeset
   327
hgs
parents: 19
diff changeset
   328
        ret = XAStreamInformationItfAdapt_SetActiveStream(impl->adapCtx,
hgs
parents: 19
diff changeset
   329
                streamNum, active, commitNow);
hgs
parents: 19
diff changeset
   330
19
hgs
parents:
diff changeset
   331
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents:
diff changeset
   332
        }
hgs
parents:
diff changeset
   333
    else
hgs
parents:
diff changeset
   334
        {
hgs
parents:
diff changeset
   335
        ret = XAAdaptationBase_ThreadEntry(impl->adapCtx);
25
hgs
parents: 19
diff changeset
   336
        if (ret == XA_RESULT_PARAMETER_INVALID)
hgs
parents: 19
diff changeset
   337
            {
19
hgs
parents:
diff changeset
   338
            DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream");
hgs
parents:
diff changeset
   339
            return ret;
25
hgs
parents: 19
diff changeset
   340
            }
hgs
parents: 19
diff changeset
   341
hgs
parents: 19
diff changeset
   342
        ret = XAStreamInformationItfAdaptMMF_SetActiveStream(impl->adapCtx,
hgs
parents: 19
diff changeset
   343
                streamNum, active, commitNow);
hgs
parents: 19
diff changeset
   344
hgs
parents: 19
diff changeset
   345
        XAAdaptationBase_ThreadExit(impl->adapCtx);
hgs
parents: 19
diff changeset
   346
        ;
19
hgs
parents:
diff changeset
   347
        }
hgs
parents:
diff changeset
   348
hgs
parents:
diff changeset
   349
    DEBUG_API("-<XAStreamInformationItfImpl_SetActiveStream");
hgs
parents:
diff changeset
   350
    return ret;
25
hgs
parents: 19
diff changeset
   351
    }
19
hgs
parents:
diff changeset
   352
hgs
parents:
diff changeset
   353
/**
hgs
parents:
diff changeset
   354
 * XAStreamInformationItfImpl -specific methods
hgs
parents:
diff changeset
   355
 **/
hgs
parents:
diff changeset
   356
hgs
parents:
diff changeset
   357
/**
hgs
parents:
diff changeset
   358
 * XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create()
hgs
parents:
diff changeset
   359
 * Description: Allocate and initialize PlayItfImpl
hgs
parents:
diff changeset
   360
 **/
25
hgs
parents: 19
diff changeset
   361
XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create(
hgs
parents: 19
diff changeset
   362
        XAAdaptationBaseCtx *adapCtx)
hgs
parents: 19
diff changeset
   363
    {
19
hgs
parents:
diff changeset
   364
    XAStreamInformationItfImpl *self;
hgs
parents:
diff changeset
   365
hgs
parents:
diff changeset
   366
    DEBUG_API("->XAStreamInformationItfImpl_Create");
25
hgs
parents: 19
diff changeset
   367
    self = (XAStreamInformationItfImpl*) calloc(1,
hgs
parents: 19
diff changeset
   368
            sizeof(XAStreamInformationItfImpl));
hgs
parents: 19
diff changeset
   369
    if (self)
hgs
parents: 19
diff changeset
   370
        {
19
hgs
parents:
diff changeset
   371
        /* init itf default implementation */
25
hgs
parents: 19
diff changeset
   372
        self->itf.QueryMediaContainerInformation
hgs
parents: 19
diff changeset
   373
                = XAStreamInformationItfImpl_QueryMediaContainerInformation;
hgs
parents: 19
diff changeset
   374
        self->itf.QueryStreamType
hgs
parents: 19
diff changeset
   375
                = XAStreamInformationItfImpl_QueryStreamType;
hgs
parents: 19
diff changeset
   376
        self->itf.QueryStreamInformation
hgs
parents: 19
diff changeset
   377
                = XAStreamInformationItfImpl_QueryStreamInformation;
hgs
parents: 19
diff changeset
   378
        self->itf.QueryStreamName
hgs
parents: 19
diff changeset
   379
                = XAStreamInformationItfImpl_QueryStreamName;
hgs
parents: 19
diff changeset
   380
        self->itf.RegisterStreamChangeCallback
hgs
parents: 19
diff changeset
   381
                = XAStreamInformationItfImpl_RegisterStreamChangeCallback;
hgs
parents: 19
diff changeset
   382
        self->itf.QueryActiveStreams
hgs
parents: 19
diff changeset
   383
                = XAStreamInformationItfImpl_QueryActiveStreams;
hgs
parents: 19
diff changeset
   384
        self->itf.SetActiveStream
hgs
parents: 19
diff changeset
   385
                = XAStreamInformationItfImpl_SetActiveStream;
19
hgs
parents:
diff changeset
   386
hgs
parents:
diff changeset
   387
        /* init variables */
hgs
parents:
diff changeset
   388
        self->cbPtrToSelf = NULL;
hgs
parents:
diff changeset
   389
        self->callback = NULL;
hgs
parents:
diff changeset
   390
        self->cbcontext = NULL;
hgs
parents:
diff changeset
   391
        self->adapCtx = adapCtx;
hgs
parents:
diff changeset
   392
hgs
parents:
diff changeset
   393
        self->self = self;
25
hgs
parents: 19
diff changeset
   394
        }
19
hgs
parents:
diff changeset
   395
hgs
parents:
diff changeset
   396
    DEBUG_API("<-XAStreamInformationItfImpl_Create");
hgs
parents:
diff changeset
   397
    return self;
25
hgs
parents: 19
diff changeset
   398
    }
19
hgs
parents:
diff changeset
   399
hgs
parents:
diff changeset
   400
/* void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self)
hgs
parents:
diff changeset
   401
 * Description: Free all resources reserved at XAStreamInformationItfImpl_Create
hgs
parents:
diff changeset
   402
 */
hgs
parents:
diff changeset
   403
void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self)
25
hgs
parents: 19
diff changeset
   404
    {
19
hgs
parents:
diff changeset
   405
    DEBUG_API("->XAStreamInformationItfImpl_Free");
hgs
parents:
diff changeset
   406
    assert(self==self->self);
25
hgs
parents: 19
diff changeset
   407
    if(self)
hgs
parents: 19
diff changeset
   408
        {
hgs
parents: 19
diff changeset
   409
        free(self);
hgs
parents: 19
diff changeset
   410
        }
19
hgs
parents:
diff changeset
   411
    DEBUG_API("<-XAStreamInformationItfImpl_Free");
25
hgs
parents: 19
diff changeset
   412
    }
19
hgs
parents:
diff changeset
   413