• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*--------------------------------------------------------------------------
2 Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
3 
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6     * Redistributions of source code must retain the above copyright
7       notice, this list of conditions and the following disclaimer.
8     * Redistributions in binary form must reproduce the above copyright
9       notice, this list of conditions and the following disclaimer in the
10       documentation and/or other materials provided with the distribution.
11     * Neither the name of The Linux Foundation nor
12       the names of its contributors may be used to endorse or promote
13       products derived from this software without specific prior written
14       permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 --------------------------------------------------------------------------*/
28 #ifndef __DTSPARSER_H
29 #define __DTSPARSER_H
30 
31 #include "OMX_Core.h"
32 #include "OMX_QCOMExtns.h"
33 #include "qc_omx_component.h"
34 
35 #include<stdlib.h>
36 
37 #include <stdio.h>
38 #include <inttypes.h>
39 
40 #ifdef _ANDROID_
41 extern "C" {
42 #include<utils/Log.h>
43 }
44 #else
45 #define ALOGE(fmt, args...) fprintf(stderr, fmt, ##args)
46 #endif /* _ANDROID_ */
47 
48 class omx_time_stamp_reorder
49 {
50     public:
51         omx_time_stamp_reorder();
52         ~omx_time_stamp_reorder();
53         void set_timestamp_reorder_mode(bool flag);
54         void enable_debug_print(bool flag);
55         bool insert_timestamp(OMX_BUFFERHEADERTYPE *header);
56         bool get_next_timestamp(OMX_BUFFERHEADERTYPE *header, bool is_interlaced);
57         bool remove_time_stamp(OMX_TICKS ts, bool is_interlaced);
58         void flush_timestamp();
59 
60     private:
61 #define TIME_SZ 64
62         typedef struct timestamp {
63             OMX_TICKS timestamps;
64             bool in_use;
65         } timestamp;
66         typedef struct time_stamp_list {
67             timestamp input_timestamps[TIME_SZ];
68             time_stamp_list *next;
69             time_stamp_list *prev;
70             unsigned int entries_filled;
71         } time_stamp_list;
72         bool error;
73         time_stamp_list *phead,*pcurrent;
74         bool get_current_list();
75         bool add_new_list();
76         bool update_head();
77         void delete_list();
handle_error()78         void handle_error() {
79             ALOGE("Error handler called for TS Parser");
80 
81             if (error)
82                 return;
83 
84             error = true;
85             delete_list();
86         }
87         bool reorder_ts;
88         bool print_debug;
89 };
90 #endif
91