1 /* 2 INTEL CONFIDENTIAL 3 Copyright 2009 Intel Corporation All Rights Reserved. 4 The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material contains trade secrets and proprietary and confidential information of Intel or its suppliers and licensors. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intels prior express written permission. 5 6 No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing. 7 */ 8 9 #ifndef __MIX_FRAMEMANAGER_H__ 10 #define __MIX_FRAMEMANAGER_H__ 11 12 #include <glib-object.h> 13 #include "mixvideodef.h" 14 #include "mixvideoframe.h" 15 16 /* 17 * Type macros. 18 */ 19 #define MIX_TYPE_FRAMEMANAGER (mix_framemanager_get_type ()) 20 #define MIX_FRAMEMANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_FRAMEMANAGER, MixFrameManager)) 21 #define MIX_IS_FRAMEMANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_FRAMEMANAGER)) 22 #define MIX_FRAMEMANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_FRAMEMANAGER, MixFrameManagerClass)) 23 #define MIX_IS_FRAMEMANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_FRAMEMANAGER)) 24 #define MIX_FRAMEMANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_FRAMEMANAGER, MixFrameManagerClass)) 25 26 typedef struct _MixFrameManager MixFrameManager; 27 typedef struct _MixFrameManagerClass MixFrameManagerClass; 28 29 struct _MixFrameManager { 30 /*< public > */ 31 GObject parent; 32 33 /*< public > */ 34 35 /*< private > */ 36 gboolean initialized; 37 gboolean flushing; 38 gboolean eos; 39 40 GMutex *lock; 41 GPtrArray *frame_array; 42 GQueue *frame_queue; 43 44 gint framerate_numerator; 45 gint framerate_denominator; 46 guint64 frame_timestamp_delta; 47 48 MixFrameOrderMode mode; 49 50 gboolean is_first_frame; 51 guint64 next_frame_timestamp; 52 53 /* 54 * For VC-1 in ASF. 55 */ 56 57 MixVideoFrame *p_frame; 58 guint64 prev_timestamp; 59 60 gboolean timebased_ordering; 61 }; 62 63 /** 64 * MixFrameManagerClass: 65 * 66 * MI-X Video object class 67 */ 68 struct _MixFrameManagerClass { 69 /*< public > */ 70 GObjectClass parent_class; 71 72 /* class members */ 73 74 /*< public > */ 75 }; 76 77 /** 78 * mix_framemanager_get_type: 79 * @returns: type 80 * 81 * Get the type of object. 82 */ 83 GType mix_framemanager_get_type(void); 84 85 /** 86 * mix_framemanager_new: 87 * @returns: A newly allocated instance of #MixFrameManager 88 * 89 * Use this method to create new instance of #MixFrameManager 90 */ 91 MixFrameManager *mix_framemanager_new(void); 92 93 /** 94 * mix_framemanager_ref: 95 * @mix: object to add reference 96 * @returns: the MixFrameManager instance where reference count has been increased. 97 * 98 * Add reference count. 99 */ 100 MixFrameManager *mix_framemanager_ref(MixFrameManager * mix); 101 102 /** 103 * mix_framemanager_unref: 104 * @obj: object to unref. 105 * 106 * Decrement reference count of the object. 107 */ 108 #define mix_framemanager_unref(obj) g_object_unref (G_OBJECT(obj)) 109 110 /* Class Methods */ 111 112 /* 113 * Initialize FM 114 */ 115 MIX_RESULT mix_framemanager_initialize(MixFrameManager *fm, 116 MixFrameOrderMode mode, gint framerate_numerator, 117 gint framerate_denominator, gboolean timebased_ordering); 118 /* 119 * Deinitialize FM 120 */ 121 MIX_RESULT mix_framemanager_deinitialize(MixFrameManager *fm); 122 123 /* 124 * Set new framerate 125 */ 126 MIX_RESULT mix_framemanager_set_framerate(MixFrameManager *fm, 127 gint framerate_numerator, gint framerate_denominator); 128 129 /* 130 * Get framerate 131 */ 132 MIX_RESULT mix_framemanager_get_framerate(MixFrameManager *fm, 133 gint *framerate_numerator, gint *framerate_denominator); 134 135 136 /* 137 * Get Frame Order Mode 138 */ 139 MIX_RESULT mix_framemanager_get_frame_order_mode(MixFrameManager *fm, 140 MixFrameOrderMode *mode); 141 142 /* 143 * For discontiunity, reset FM 144 */ 145 MIX_RESULT mix_framemanager_flush(MixFrameManager *fm); 146 147 /* 148 * Enqueue MixVideoFrame 149 */ 150 MIX_RESULT mix_framemanager_enqueue(MixFrameManager *fm, MixVideoFrame *mvf); 151 152 /* 153 * Dequeue MixVideoFrame in proper order depends on MixFrameOrderMode value 154 * during initialization. 155 */ 156 MIX_RESULT mix_framemanager_dequeue(MixFrameManager *fm, MixVideoFrame **mvf); 157 158 /* 159 * End of stream. 160 */ 161 MIX_RESULT mix_framemanager_eos(MixFrameManager *fm); 162 163 164 #endif /* __MIX_FRAMEMANAGER_H__ */ 165