• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
19 /*******************
20  * Implementation of a FIFO structure for queueing OMX buffers and commands.
21 ********************/
22 
23 
24 #ifndef PV_OMX_QUEUE_H_INCLUDED
25 #define PV_OMX_QUEUE_H_INCLUDED
26 
27 #ifndef OSCL_MEM_H_INCLUDED
28 #include "oscl_mem.h"
29 #endif
30 
31 #ifndef OMX_Types_h
32 #include "OMX_Types.h"
33 #endif
34 
35 #ifndef OMX_Core_h
36 #include "OMX_Core.h"
37 #endif
38 
39 /* Queue Depth i.e maximum number of elements */
40 #define MAX_QUEUE_ELEMENTS 12
41 
42 
43 /* Queue Element Type */
44 struct QueueElement
45 {
46     QueueElement* pQueueNext;
47     void* pData;
48 };
49 
50 typedef struct QueueType
51 {
52     QueueElement* pFirst;   /** Queue Front */
53     QueueElement* pLast;    /** Queue Rear (last filled element of queue) */
54     OMX_S32 NumElem;        /** Number of elements currently in the queue */
55     OMX_S32 NumElemAdded;   /** Number of elements added extra at run time*/
56 } QueueType;
57 
58 
59 
60 //QUEUE OPERATIONS
61 
62 /* Queue initialization routine */
63 OSCL_IMPORT_REF OMX_ERRORTYPE QueueInit(QueueType* aQueue);
64 
65 /* Queue deinitialization routine */
66 OSCL_IMPORT_REF void QueueDeinit(QueueType* aQueue);
67 
68 /* Function to queue an element in the given queue*/
69 OSCL_IMPORT_REF OMX_ERRORTYPE Queue(QueueType* aQueue, void* aData);
70 
71 /* Function to dequeue an element from the given queue
72  * Returns NULL if the queue is empty */
73 OSCL_IMPORT_REF void* DeQueue(QueueType* aQueue);
74 
75 /* Function to get number of elements currently in the queue */
76 OSCL_IMPORT_REF OMX_S32 GetQueueNumElem(QueueType* aQueue);
77 
78 /* Add new element in the queue if required */
79 OSCL_IMPORT_REF OMX_BOOL AddQueueElem(QueueType* aQueue);
80 
81 #endif      //#ifndef PV_OMX_QUEUE_H_INCLUDED
82