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 Intel’s 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_VIDEOFORMAT_H__ 10 #define __MIX_VIDEOFORMAT_H__ 11 12 #include <va/va.h> 13 #include <glib-object.h> 14 #include "vbp_loader.h" 15 #include "mixvideodef.h" 16 #include "mixdrmparams.h" 17 #include "mixvideoconfigparamsdec.h" 18 #include "mixvideodecodeparams.h" 19 #include "mixvideoframe.h" 20 #include "mixframemanager.h" 21 #include "mixsurfacepool.h" 22 #include "mixbuffer.h" 23 #include "mixbufferpool.h" 24 #include "mixvideoformatqueue.h" 25 26 // Redefine the Handle defined in vbp_loader.h 27 #define VBPhandle Handle 28 29 /* 30 * Type macros. 31 */ 32 #define MIX_TYPE_VIDEOFORMAT (mix_videoformat_get_type ()) 33 #define MIX_VIDEOFORMAT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_VIDEOFORMAT, MixVideoFormat)) 34 #define MIX_IS_VIDEOFORMAT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_VIDEOFORMAT)) 35 #define MIX_VIDEOFORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_VIDEOFORMAT, MixVideoFormatClass)) 36 #define MIX_IS_VIDEOFORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_VIDEOFORMAT)) 37 #define MIX_VIDEOFORMAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_VIDEOFORMAT, MixVideoFormatClass)) 38 39 typedef struct _MixVideoFormat MixVideoFormat; 40 typedef struct _MixVideoFormatClass MixVideoFormatClass; 41 42 /* vmethods typedef */ 43 44 typedef MIX_RESULT (*MixVideoFmtGetCapsFunc)(MixVideoFormat *mix, GString *msg); 45 typedef MIX_RESULT (*MixVideoFmtInitializeFunc)(MixVideoFormat *mix, 46 MixVideoConfigParamsDec * config_params, 47 MixFrameManager * frame_mgr, 48 MixBufferPool * input_buf_pool, 49 MixSurfacePool ** surface_pool, 50 VADisplay va_display); 51 typedef MIX_RESULT (*MixVideoFmtDecodeFunc)(MixVideoFormat *mix, 52 MixBuffer * bufin[], gint bufincnt, 53 MixVideoDecodeParams * decode_params); 54 typedef MIX_RESULT (*MixVideoFmtFlushFunc)(MixVideoFormat *mix); 55 typedef MIX_RESULT (*MixVideoFmtEndOfStreamFunc)(MixVideoFormat *mix); 56 typedef MIX_RESULT (*MixVideoFmtDeinitializeFunc)(MixVideoFormat *mix); 57 58 struct _MixVideoFormat { 59 /*< public > */ 60 GObject parent; 61 62 /*< public > */ 63 64 /*< private > */ 65 GMutex *objectlock; 66 gboolean initialized; 67 MixFrameManager *framemgr; 68 MixSurfacePool *surfacepool; 69 VADisplay va_display; 70 VAContextID va_context; 71 VAConfigID va_config; 72 VASurfaceID *va_surfaces; 73 guint va_num_surfaces; 74 VBPhandle parser_handle; 75 GString *mime_type; 76 guint frame_rate_num; 77 guint frame_rate_denom; 78 guint picture_width; 79 guint picture_height; 80 gboolean parse_in_progress; 81 gboolean discontinuity_frame_in_progress; 82 guint64 current_timestamp; 83 MixBufferPool *inputbufpool; 84 GQueue *inputbufqueue; 85 }; 86 87 /** 88 * MixVideoFormatClass: 89 * 90 * MI-X Video object class 91 */ 92 struct _MixVideoFormatClass { 93 /*< public > */ 94 GObjectClass parent_class; 95 96 /* class members */ 97 98 /*< public > */ 99 MixVideoFmtGetCapsFunc getcaps; 100 MixVideoFmtInitializeFunc initialize; 101 MixVideoFmtDecodeFunc decode; 102 MixVideoFmtFlushFunc flush; 103 MixVideoFmtEndOfStreamFunc eos; 104 MixVideoFmtDeinitializeFunc deinitialize; 105 }; 106 107 /** 108 * mix_videoformat_get_type: 109 * @returns: type 110 * 111 * Get the type of object. 112 */ 113 GType mix_videoformat_get_type(void); 114 115 /** 116 * mix_videoformat_new: 117 * @returns: A newly allocated instance of #MixVideoFormat 118 * 119 * Use this method to create new instance of #MixVideoFormat 120 */ 121 MixVideoFormat *mix_videoformat_new(void); 122 123 /** 124 * mix_videoformat_ref: 125 * @mix: object to add reference 126 * @returns: the MixVideoFormat instance where reference count has been increased. 127 * 128 * Add reference count. 129 */ 130 MixVideoFormat *mix_videoformat_ref(MixVideoFormat * mix); 131 132 /** 133 * mix_videoformat_unref: 134 * @obj: object to unref. 135 * 136 * Decrement reference count of the object. 137 */ 138 #define mix_videoformat_unref(obj) g_object_unref (G_OBJECT(obj)) 139 140 /* Class Methods */ 141 142 MIX_RESULT mix_videofmt_getcaps(MixVideoFormat *mix, GString *msg); 143 144 MIX_RESULT mix_videofmt_initialize(MixVideoFormat *mix, 145 MixVideoConfigParamsDec * config_params, 146 MixFrameManager * frame_mgr, 147 MixBufferPool * input_buf_pool, 148 MixSurfacePool ** surface_pool, 149 VADisplay va_display); 150 151 MIX_RESULT mix_videofmt_decode(MixVideoFormat *mix, MixBuffer * bufin[], 152 gint bufincnt, MixVideoDecodeParams * decode_params); 153 154 MIX_RESULT mix_videofmt_flush(MixVideoFormat *mix); 155 156 MIX_RESULT mix_videofmt_eos(MixVideoFormat *mix); 157 158 MIX_RESULT mix_videofmt_deinitialize(MixVideoFormat *mix); 159 160 #endif /* __MIX_VIDEOFORMAT_H__ */ 161