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_MP42_H__
10#define __MIX_VIDEOFORMAT_MP42_H__
11
12#include "mixvideoformat.h"
13#include "mixvideoframe_private.h"
14
15//Note: this is only a max limit.  Real number of surfaces allocated is calculated in mix_videoformat_mp42_initialize()
16#define MIX_VIDEO_MP42_SURFACE_NUM	8
17
18/*
19 * Type macros.
20 */
21#define MIX_TYPE_VIDEOFORMAT_MP42                  (mix_videoformat_mp42_get_type ())
22#define MIX_VIDEOFORMAT_MP42(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_VIDEOFORMAT_MP42, MixVideoFormat_MP42))
23#define MIX_IS_VIDEOFORMAT_MP42(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_VIDEOFORMAT_MP42))
24#define MIX_VIDEOFORMAT_MP42_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_VIDEOFORMAT_MP42, MixVideoFormat_MP42Class))
25#define MIX_IS_VIDEOFORMAT_MP42_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_VIDEOFORMAT_MP42))
26#define MIX_VIDEOFORMAT_MP42_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_VIDEOFORMAT_MP42, MixVideoFormat_MP42Class))
27
28typedef struct _MixVideoFormat_MP42 MixVideoFormat_MP42;
29typedef struct _MixVideoFormat_MP42Class MixVideoFormat_MP42Class;
30
31struct _MixVideoFormat_MP42 {
32	/*< public > */
33	MixVideoFormat parent;
34
35	/*< public > */
36
37	/*< private > */
38	MixVideoFrame * reference_frames[2];
39	MixVideoFrame * last_frame;
40	gint last_vop_coding_type;
41
42	GQueue *packed_stream_queue;
43};
44
45/**
46 * MixVideoFormat_MP42Class:
47 *
48 * MI-X Video object class
49 */
50struct _MixVideoFormat_MP42Class {
51	/*< public > */
52	MixVideoFormatClass parent_class;
53
54/* class members */
55
56/*< public > */
57};
58
59/**
60 * mix_videoformat_mp42_get_type:
61 * @returns: type
62 *
63 * Get the type of object.
64 */
65GType mix_videoformat_mp42_get_type(void);
66
67/**
68 * mix_videoformat_mp42_new:
69 * @returns: A newly allocated instance of #MixVideoFormat_MP42
70 *
71 * Use this method to create new instance of #MixVideoFormat_MP42
72 */
73MixVideoFormat_MP42 *mix_videoformat_mp42_new(void);
74
75/**
76 * mix_videoformat_mp42_ref:
77 * @mix: object to add reference
78 * @returns: the MixVideoFormat_MP42 instance where reference count has been increased.
79 *
80 * Add reference count.
81 */
82MixVideoFormat_MP42 *mix_videoformat_mp42_ref(MixVideoFormat_MP42 * mix);
83
84/**
85 * mix_videoformat_mp42_unref:
86 * @obj: object to unref.
87 *
88 * Decrement reference count of the object.
89 */
90#define mix_videoformat_mp42_unref(obj) g_object_unref (G_OBJECT(obj))
91
92/* Class Methods */
93
94/* MP42 vmethods */
95MIX_RESULT mix_videofmt_mp42_getcaps(MixVideoFormat *mix, GString *msg);
96MIX_RESULT mix_videofmt_mp42_initialize(MixVideoFormat *mix,
97		MixVideoConfigParamsDec * config_params, MixFrameManager * frame_mgr,
98		MixBufferPool * input_buf_pool, MixSurfacePool ** surface_pool,
99		VADisplay va_display);
100MIX_RESULT mix_videofmt_mp42_decode(MixVideoFormat *mix, MixBuffer * bufin[],
101		gint bufincnt, MixVideoDecodeParams * decode_params);
102MIX_RESULT mix_videofmt_mp42_flush(MixVideoFormat *mix);
103MIX_RESULT mix_videofmt_mp42_eos(MixVideoFormat *mix);
104MIX_RESULT mix_videofmt_mp42_deinitialize(MixVideoFormat *mix);
105
106/* Local Methods */
107
108MIX_RESULT mix_videofmt_mp42_handle_ref_frames(MixVideoFormat *mix,
109		enum _picture_type frame_type, MixVideoFrame * current_frame);
110
111MIX_RESULT mix_videofmt_mp42_process_decode(MixVideoFormat *mix,
112		vbp_data_mp42 *data, guint64 timestamp, gboolean discontinuity);
113
114MIX_RESULT mix_videofmt_mp42_release_input_buffers(MixVideoFormat *mix,
115		guint64 timestamp);
116
117#endif /* __MIX_VIDEOFORMAT_MP42_H__ */
118