1/* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18#ifndef PVMF_DURATION_INFOMESSAGE_H_INCLUDED
19#define PVMF_DURATION_INFOMESSAGE_H_INCLUDED
20
21#ifndef PVMF_DURATIONINFOMESSAGE_EXTENSION_H_INCLUDED
22#include "pvmf_durationinfomessage_extension.h"
23#endif
24
25/*
26 This class that provides basic implementation of PVMFDurationInfoMessageInterface.
27 This object can carry the code, UUID, and duration information associated with an
28 info event.
29 */
30class PVMFDurationInfoMessage : public PVMFDurationInfoMessageInterface
31{
32    public:
33        /*
34         Default constructor. Ref count is initialized to 1.
35         This object should always be created with OSCL_NEW.
36
37         Event code is initialized to 0.
38         Event UUId is initialized to 0.
39         Event data is NULL.
40         Next message pointer is NULL
41         */
42        OSCL_IMPORT_REF PVMFDurationInfoMessage();
43
44        /*
45         Constructor with initialization parameters. Ref count is initialized to 1
46         This object should always be created with OSCL_NEW.
47
48         @param aCode Event code value
49         @param aUuid UUID for the event code's group
50         @param aData Pointer to the event's opaque data (optional)
51         @param aNextMsg Pointer to the next message in the list (optional)
52         */
53        OSCL_IMPORT_REF PVMFDurationInfoMessage(uint32 aDuration, int32 aCode = 0, PVUuid aUuid = PVMFDurationInfoMessageInterfaceUUID);
54
55        /*
56         A derived class should override this in order to destroy itself
57         properly by calling OSCL_DELETE with its own type name.
58         */
59        OSCL_IMPORT_REF virtual void destroy();
60
61        /*
62         Method to set the event code and UUID
63
64         @param aCode Event code value
65         @param aUuid UUID for the event code's group
66         */
67        OSCL_IMPORT_REF void SetEventCodeUUID(int32 aCode, PVUuid aUuid);
68
69        // From PVMFDurationInfoMessageInterface
70        OSCL_IMPORT_REF void GetCodeUUID(int32& aCode, PVUuid& aUuid);
71        OSCL_IMPORT_REF uint32 GetDuration();
72
73        // From PVInterface
74        OSCL_IMPORT_REF virtual void addRef();
75        OSCL_IMPORT_REF virtual void removeRef();
76        OSCL_IMPORT_REF virtual bool queryInterface(const PVUuid& uuid, PVInterface*& iface);
77
78    protected:
79        /* Destructor
80        */
81        OSCL_IMPORT_REF virtual ~PVMFDurationInfoMessage();
82
83    private:
84        int32 iEventCode;
85        PVUuid iEventUuid;
86        uint32 iDuration;
87        int32 iRefCount;
88};
89
90#endif // PVMF_BASIC_ERRORINFOMESSAGE_H_INCLUDED
91
92
93