1 /******************************************************************************
2 *
3 * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
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 /**
19 *******************************************************************************
20 * @file
21 *  ihevcd_job_queue.h
22 *
23 * @brief
24 *  Contains functions for job queue
25 *
26 * @author
27 *  Harish
28 *
29 * @par List of Functions:
30 *
31 * @remarks
32 *  None
33 *
34 *******************************************************************************
35 */
36 
37 #ifndef _IHEVCD_JOB_QUEUE_H_
38 #define _IHEVCD_JOB_QUEUE_H_
39 
40 typedef struct
41 {
42     /** Pointer to buffer base which contains the jobs */
43     void *pv_buf_base;
44 
45     /** Pointer to current address where new job can be added */
46     void *pv_buf_wr;
47 
48     /** Pointer to current address from where next job can be obtained */
49     void *pv_buf_rd;
50 
51     /** Pointer to end of job buffer */
52     void *pv_buf_end;
53 
54     /** Mutex used to keep the functions thread-safe */
55     void *pv_mutex;
56 
57     /** Flag to indicate jobq has to be terminated */
58     WORD32 i4_terminate;
59 }jobq_t;
60 
61 WORD32 ihevcd_jobq_ctxt_size(void);
62 void* ihevcd_jobq_init(void *pv_buf, WORD32 buf_size);
63 IHEVCD_ERROR_T ihevcd_jobq_free(jobq_t *ps_jobq);
64 IHEVCD_ERROR_T ihevcd_jobq_reset(jobq_t *ps_jobq);
65 IHEVCD_ERROR_T ihevcd_jobq_deinit(jobq_t *ps_jobq);
66 IHEVCD_ERROR_T ihevcd_jobq_terminate(jobq_t *ps_jobq);
67 IHEVCD_ERROR_T ihevcd_jobq_queue(jobq_t *ps_jobq, void *pv_job, WORD32 job_size, WORD32 blocking);
68 IHEVCD_ERROR_T ihevcd_jobq_dequeue(jobq_t *ps_jobq, void *pv_job, WORD32 job_size, WORD32 blocking);
69 
70 #endif /* _IHEVCD_PROCESS_SLICE_H_ */
71