• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * priority_buffer_queue.h - priority buffer queue
3  *
4  *  Copyright (c) 2015 Intel Corporation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Author: Wind Yuan <feng.yuan@intel.com>
19  */
20 
21 #ifndef XCAM_PRIORITY_BUFFER_QUEUE_H
22 #define XCAM_PRIORITY_BUFFER_QUEUE_H
23 
24 #include <xcam_std.h>
25 #include <safe_list.h>
26 #include <ocl/cl_image_handler.h>
27 
28 namespace XCam {
29 
30 struct PriorityBuffer
31 {
32     SmartPtr<VideoBuffer>     data;
33     SmartPtr<CLImageHandler>  handler;
34     uint32_t                  rank;
35     uint32_t                  seq_num;
36 
37 public:
PriorityBufferPriorityBuffer38     PriorityBuffer ()
39         : rank (0)
40         , seq_num (0)
41     {}
42 
set_seq_numPriorityBuffer43     void set_seq_num (const uint32_t value) {
44         seq_num = value;
45     }
get_seq_numPriorityBuffer46     uint32_t get_seq_num () const {
47         return seq_num;
48     }
49 
50     // when change to next rank
down_rankPriorityBuffer51     void down_rank () {
52         ++rank;
53     }
54 
55     bool priority_greater_than (const PriorityBuffer& buf) const;
56 };
57 
58 class PriorityBufferQueue
59     : public SafeList<PriorityBuffer>
60 {
61 public:
62 
PriorityBufferQueue()63     PriorityBufferQueue () {}
~PriorityBufferQueue()64     ~PriorityBufferQueue () {}
65 
66     bool push_priority_buf (const SmartPtr<PriorityBuffer> &buf);
67 
68 private:
69     XCAM_DEAD_COPY (PriorityBufferQueue);
70 };
71 
72 };
73 
74 #endif //XCAM_PRIORITY_BUFFER_QUEUE_H
75