summaryrefslogtreecommitdiff
path: root/gst/h263parse/h263parse.h
blob: 81dbed329952d399a1ce22814a128a161deeb376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* GStreamer H.263 Parser
 * Copyright (C) <2010> Arun Raghavan <arun.raghavan@collabora.co.uk>
 * Copyright (C) <2010> Edward Hervey <edward.hervey@collabora.co.uk>
 * Copyright (C) <2010> Collabora Multimedia
 * Copyright (C) <2010> Nokia Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GST_H263_PARAMS_H__
#define __GST_H263_PARAMS_H__

#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include <gstbaseparse.h>

G_BEGIN_DECLS

typedef enum
{
  PARSING = 0,
  GOT_HEADER,
  PASSTHROUGH
} H263ParseState;

/* H263 Optional Features */
typedef enum
{
  /* Optional Unrestricted Motion Vector (UMV) mode (see Annex D) */
  H263_OPTION_UMV_MODE = 1 << 0,
  /* Optional Syntax-based Arithmetic Coding (SAC) mode (see Annex E) */
  H263_OPTION_SAC_MODE = 1 << 1,
  /* Optional Advanced Prediction mode (AP) (see Annex F) */
  H263_OPTION_AP_MODE = 1 << 2,
  /* Optional PB-frames mode (see Annex G) */
  H263_OPTION_PB_MODE = 1 << 3,
  /* Optional Advanced INTRA Coding (AIC) mode (see Annex I) */
  H263_OPTION_AIC_MODE = 1 << 4,
  /* Optional Deblocking Filter (DF) mode (see Annex J) */
  H263_OPTION_DF_MODE = 1 << 5,
  /* Optional Slice Structured (SS) mode (see Annex K) */
  H263_OPTION_SS_MODE = 1 << 6,
  /* Optional Reference Picture Selection (RPS) mode (see Annex N) */
  H263_OPTION_RPS_MODE = 1 << 7,
  /* Optional Independent Segment Decoding (ISD) mode (see Annex R) */
  H263_OPTION_ISD_MODE = 1 << 8,
  /* Optional Alternative INTER VLC (AIV) mode (see Annex S) */
  H263_OPTION_AIV_MODE = 1 << 9,
  /* Optional Modified Quantization (MQ) mode (see Annex T) */
  H263_OPTION_MQ_MODE = 1 << 10,
  /* Optional Reference Picture Resampling (RPR) mode (see Annex P) */
  H263_OPTION_RPR_MODE = 1 << 11,
  /* Optional Reduced-Resolution Update (RRU) mode (see Annex Q) */
  H263_OPTION_RRU_MODE = 1 << 12,
  /* Optional Enhanced Reference Picture Selection (ERPS) mode (see Annex U) */
  H263_OPTION_ERPS_MODE = 1 << 13,
  /* Optional Data Partitioned Slices (DPS) mode (see Annex V) */
  H263_OPTION_DPS_MODE = 1 << 14
} H263OptionalFeatures;

/* H263 Picture Types */
typedef enum
{
  PICTURE_I = 0,                /* I-picture (INTRA) Baseline */
  PICTURE_P,                    /* P-picture (INTER) Baseline */
  PICTURE_IMPROVED_PB,          /* Improved PB-frame (Annex M) */
  PICTURE_B,                    /* B-picture (Annex O) */
  PICTURE_EI,                   /* EI-picture (Annex O) */
  PICTURE_EP,                   /* EP-picture (Annex O) */
  PICTURE_RESERVED1,
  PICTURE_RESERVED2,
  PICTURE_PB                    /* PB-frame (See Annex G) */
} H263PictureType;

/* H263 Picture Format */
typedef enum
{
  PICTURE_FMT_FORBIDDEN_0 = 0,
  PICTURE_FMT_SUB_QCIF,
  PICTURE_FMT_QCIF,
  PICTURE_FMT_CIF,
  PICTURE_FMT_4CIF,
  PICTURE_FMT_16CIF,
  PICTURE_FMT_RESERVED1,
  PICTURE_FMT_EXTENDEDPTYPE
} H263PictureFormat;

typedef enum
{
  UUI_ABSENT = 0,
  UUI_IS_1,
  UUI_IS_01,
} H263UUI;


typedef struct _H263Params H263Params;

struct _H263Params
{
  guint32 temporal_ref;

  H263OptionalFeatures features;

  gboolean splitscreen;
  gboolean documentcamera;
  gboolean fullpicturefreezerelease;
  gboolean custompcfpresent;
  H263UUI uui;
  guint8 sss;

  H263PictureFormat format;

  H263PictureType type;

  guint32 width;
  guint32 height;
  guint8 parnum, pardenom;
  gint32 pcfnum, pcfdenom;
};

gboolean      gst_h263_parse_is_delta_unit (H263Params * params);
GstFlowReturn gst_h263_parse_get_params (H263Params ** params_p,
                  GstBuffer * buffer, gboolean fast, H263ParseState * state);
void          gst_h263_parse_get_framerate (H263Params * params,
                  gint * num, gint * denom);
gint          gst_h263_parse_get_profile (H263Params * params);
gint          gst_h263_parse_get_level (H263Params * params, gint profile,
                  guint bitrate, gint fps_num, gint fps_denom);

G_END_DECLS
#endif