1 /******************************************************************************
2  *
3  * Copyright (C) 2015 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 /**
21 *******************************************************************************
22 * @file
23 *  impeg2_job_queue.h
24 *
25 * @brief
26 *  Contains functions for job queue
27 *
28 * @author
29 *  Harish
30 *
31 * @par List of Functions:
32 *
33 * @remarks
34 *  None
35 *
36 *******************************************************************************
37 */
38 
39 #ifndef _IMPEG2_JOB_QUEUE_H_
40 #define _IMPEG2_JOB_QUEUE_H_
41 
42 typedef struct
43 {
44     /** Pointer to buffer base which contains the jobs */
45     void *pv_buf_base;
46 
47     /** Pointer to current address where new job can be added */
48     void *pv_buf_wr;
49 
50     /** Pointer to current address from where next job can be obtained */
51     void *pv_buf_rd;
52 
53     /** Pointer to end of job buffer */
54     void *pv_buf_end;
55 
56     /** Mutex used to keep the functions thread-safe */
57     void *pv_mutex;
58 
59     /** Flag to indicate jobq has to be terminated */
60     WORD32 i4_terminate;
61 }jobq_t;
62 
63 WORD32 impeg2_jobq_ctxt_size(void);
64 void* impeg2_jobq_init(void *pv_buf, WORD32 buf_size);
65 IV_API_CALL_STATUS_T impeg2_jobq_free(jobq_t *ps_jobq);
66 IV_API_CALL_STATUS_T impeg2_jobq_reset(jobq_t *ps_jobq);
67 IV_API_CALL_STATUS_T impeg2_jobq_deinit(jobq_t *ps_jobq);
68 IV_API_CALL_STATUS_T impeg2_jobq_terminate(jobq_t *ps_jobq);
69 IV_API_CALL_STATUS_T impeg2_jobq_queue(jobq_t *ps_jobq, void *pv_job, WORD32 job_size, WORD32 blocking, WORD32 lock);
70 IV_API_CALL_STATUS_T impeg2_jobq_dequeue(jobq_t *ps_jobq, void *pv_job, WORD32 job_size, WORD32 blocking, WORD32 lock);
71 
72 #endif /* _IMPEG2_JOB_QUEUE_H_ */
73