Commit d8965c30 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

Const-ify GEnumValue and GFlagsValue arrays. Use

Original commit message from CVS:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type):
* ext/theora/theoradec.c: (theora_handle_type_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(theora_enc_sink_setcaps), (theora_enc_chain):
* gst-libs/gst/cdda/gstcddabasesrc.c:
(gst_cdda_base_src_mode_get_type):
* gst/audiotestsrc/gstaudiotestsrc.c:
(gst_audiostestsrc_wave_get_type):
* gst/playback/gststreaminfo.c: (gst_stream_type_get_type):
* gst/tcp/gstfdset.c: (gst_fdset_mode_get_type):
* gst/tcp/gstmultifdsink.c: (gst_recover_policy_get_type),
(gst_sync_method_get_type), (gst_unit_type_get_type),
(gst_client_status_get_type):
* gst/videoscale/gstvideoscale.c:
(gst_video_scale_method_get_type):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type):
* gst/videotestsrc/videotestsrc.c: (paint_setup_I420),
(paint_setup_YV12), (paint_setup_YUY2), (paint_setup_UYVY),
(paint_setup_YVYU), (paint_setup_IYU2), (paint_setup_Y41B),
(paint_setup_Y42B), (paint_setup_Y800), (paint_setup_YVU9),
(paint_setup_YUV9), (paint_setup_RGB888), (paint_setup_BGR888),
(paint_setup_RGB565), (paint_setup_xRGB1555):
Const-ify GEnumValue and GFlagsValue arrays. Use
GST_ROUND_UP_* macros instead of home-made ones.
parent 1093c2f5
2006-05-09 Tim-Philipp Müller <tim at centricular dot net>
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type):
* ext/theora/theoradec.c: (theora_handle_type_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(theora_enc_sink_setcaps), (theora_enc_chain):
* gst-libs/gst/cdda/gstcddabasesrc.c:
(gst_cdda_base_src_mode_get_type):
* gst/audiotestsrc/gstaudiotestsrc.c:
(gst_audiostestsrc_wave_get_type):
* gst/playback/gststreaminfo.c: (gst_stream_type_get_type):
* gst/tcp/gstfdset.c: (gst_fdset_mode_get_type):
* gst/tcp/gstmultifdsink.c: (gst_recover_policy_get_type),
(gst_sync_method_get_type), (gst_unit_type_get_type),
(gst_client_status_get_type):
* gst/videoscale/gstvideoscale.c:
(gst_video_scale_method_get_type):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type):
* gst/videotestsrc/videotestsrc.c: (paint_setup_I420),
(paint_setup_YV12), (paint_setup_YUY2), (paint_setup_UYVY),
(paint_setup_YVYU), (paint_setup_IYU2), (paint_setup_Y41B),
(paint_setup_Y42B), (paint_setup_Y800), (paint_setup_YVU9),
(paint_setup_YUV9), (paint_setup_RGB888), (paint_setup_BGR888),
(paint_setup_RGB565), (paint_setup_xRGB1555):
Const-ify GEnumValue and GFlagsValue arrays. Use
GST_ROUND_UP_* macros instead of home-made ones.
2006-05-09 Tim-Philipp Müller <tim at centricular dot net>
 
* configure.ac:
......
......@@ -161,7 +161,7 @@ static GType
gst_text_overlay_valign_get_type (void)
{
static GType text_overlay_valign_type = 0;
static GEnumValue text_overlay_valign[] = {
static const GEnumValue text_overlay_valign[] = {
{GST_TEXT_OVERLAY_VALIGN_BASELINE, "baseline", "baseline"},
{GST_TEXT_OVERLAY_VALIGN_BOTTOM, "bottom", "bottom"},
{GST_TEXT_OVERLAY_VALIGN_TOP, "top", "top"},
......@@ -180,7 +180,7 @@ static GType
gst_text_overlay_halign_get_type (void)
{
static GType text_overlay_halign_type = 0;
static GEnumValue text_overlay_halign[] = {
static const GEnumValue text_overlay_halign[] = {
{GST_TEXT_OVERLAY_HALIGN_LEFT, "left", "left"},
{GST_TEXT_OVERLAY_HALIGN_CENTER, "center", "center"},
{GST_TEXT_OVERLAY_HALIGN_RIGHT, "right", "right"},
......@@ -200,7 +200,7 @@ static GType
gst_text_overlay_wrap_mode_get_type (void)
{
static GType text_overlay_wrap_mode_type = 0;
static GEnumValue text_overlay_wrap_mode[] = {
static const GEnumValue text_overlay_wrap_mode[] = {
{GST_TEXT_OVERLAY_WRAP_MODE_NONE, "none", "none"},
{GST_TEXT_OVERLAY_WRAP_MODE_WORD, "word", "word"},
{GST_TEXT_OVERLAY_WRAP_MODE_CHAR, "char", "char"},
......
......@@ -699,10 +699,6 @@ newseg_wrong_rate:
}
}
#define ROUND_UP_2(x) (((x) + 1) & ~1)
#define ROUND_UP_4(x) (((x) + 3) & ~3)
#define ROUND_UP_8(x) (((x) + 7) & ~7)
static GstFlowReturn
theora_handle_comment_packet (GstTheoraDec * dec, ogg_packet * packet)
{
......@@ -778,9 +774,10 @@ theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
if (dec->crop) {
/* add black borders to make width/height/offsets even. we need this because
* we cannot express an offset to the peer plugin. */
dec->width = ROUND_UP_2 (dec->info.frame_width + (dec->info.offset_x & 1));
dec->width =
GST_ROUND_UP_2 (dec->info.frame_width + (dec->info.offset_x & 1));
dec->height =
ROUND_UP_2 (dec->info.frame_height + (dec->info.offset_y & 1));
GST_ROUND_UP_2 (dec->info.frame_height + (dec->info.offset_y & 1));
dec->offset_x = dec->info.offset_x & ~1;
dec->offset_y = dec->info.offset_y & ~1;
} else {
......@@ -971,8 +968,8 @@ theora_handle_data_packet (GstTheoraDec * dec, ogg_packet * packet,
/* should get the stride from the caps, for now we round up to the nearest
* multiple of 4 because some element needs it. chroma needs special
* treatment, see videotestsrc. */
stride_y = ROUND_UP_4 (width);
stride_uv = ROUND_UP_8 (width) / 2;
stride_y = GST_ROUND_UP_4 (width);
stride_uv = GST_ROUND_UP_8 (width) / 2;
out_size = stride_y * height + stride_uv * cheight * 2;
......
......@@ -74,7 +74,7 @@ static GType
gst_border_mode_get_type (void)
{
static GType border_mode_type = 0;
static GEnumValue border_mode[] = {
static const GEnumValue border_mode[] = {
{BORDER_NONE, "No Border", "none"},
{BORDER_BLACK, "Black Border", "black"},
{BORDER_MIRROR, "Mirror image in borders", "mirror"},
......@@ -88,10 +88,6 @@ gst_border_mode_get_type (void)
return border_mode_type;
}
#define ROUND_UP_2(x) (((x) + 1) & ~1)
#define ROUND_UP_4(x) (((x) + 3) & ~3)
#define ROUND_UP_8(x) (((x) + 7) & ~7)
/* taken from theora/lib/toplevel.c */
static int
_ilog (unsigned int v)
......@@ -336,8 +332,8 @@ theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
/* center image if needed */
if (enc->center) {
/* make sure offset is even, for easier decoding */
enc->offset_x = ROUND_UP_2 ((enc->info_width - enc->width) / 2);
enc->offset_y = ROUND_UP_2 ((enc->info_height - enc->height) / 2);
enc->offset_x = GST_ROUND_UP_2 ((enc->info_width - enc->width) / 2);
enc->offset_y = GST_ROUND_UP_2 ((enc->info_height - enc->height) / 2);
} else {
enc->offset_x = 0;
enc->offset_y = 0;
......@@ -686,8 +682,8 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
cheight = height / 2;
/* source strides as defined in videotestsrc */
src_y_stride = ROUND_UP_4 (width);
src_uv_stride = ROUND_UP_8 (width) / 2;
src_y_stride = GST_ROUND_UP_4 (width);
src_uv_stride = GST_ROUND_UP_8 (width) / 2;
/* destination strides from the real picture width */
dst_y_stride = enc->info_width;
......@@ -704,8 +700,8 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
dest_v = yuv.v = yuv.u + y_size / 4;
src_y = GST_BUFFER_DATA (buffer);
src_u = src_y + src_y_stride * ROUND_UP_2 (height);
src_v = src_u + src_uv_stride * ROUND_UP_2 (height) / 2;
src_u = src_y + src_y_stride * GST_ROUND_UP_2 (height);
src_v = src_u + src_uv_stride * GST_ROUND_UP_2 (height) / 2;
if (enc->border != BORDER_NONE) {
/* fill top border */
......
......@@ -156,7 +156,7 @@ static GType
gst_cdda_base_src_mode_get_type (void)
{
static GType mode_type; /* 0 */
static GEnumValue modes[] = {
static const GEnumValue modes[] = {
{GST_CDDA_BASE_SRC_MODE_NORMAL, "Stream consists of a single track",
"normal"},
{GST_CDDA_BASE_SRC_MODE_CONTINUOUS, "Stream consists of the whole disc",
......
......@@ -103,7 +103,7 @@ static GType
gst_audiostestsrc_wave_get_type (void)
{
static GType audiostestsrc_wave_type = 0;
static GEnumValue audiostestsrc_waves[] = {
static const GEnumValue audiostestsrc_waves[] = {
{GST_AUDIO_TEST_SRC_WAVE_SINE, "Sine", "sine"},
{GST_AUDIO_TEST_SRC_WAVE_SQUARE, "Square", "square"},
{GST_AUDIO_TEST_SRC_WAVE_SAW, "Saw", "saw"},
......
......@@ -55,7 +55,7 @@ static GType
gst_stream_type_get_type (void)
{
static GType stream_type_type = 0;
static GEnumValue stream_type[] = {
static const GEnumValue stream_type[] = {
{GST_STREAM_TYPE_UNKNOWN, "Unknown stream", "unknown"},
{GST_STREAM_TYPE_AUDIO, "Audio stream", "audio"},
{GST_STREAM_TYPE_VIDEO, "Video stream", "video"},
......
......@@ -36,7 +36,7 @@ GType
gst_fdset_mode_get_type (void)
{
static GType fdset_mode_type = 0;
static GEnumValue fdset_mode[] = {
static const GEnumValue fdset_mode[] = {
{GST_FDSET_MODE_SELECT, "Select", "select"},
{GST_FDSET_MODE_POLL, "Poll", "poll"},
{GST_FDSET_MODE_EPOLL, "EPoll", "epoll"},
......
......@@ -207,7 +207,7 @@ static GType
gst_recover_policy_get_type (void)
{
static GType recover_policy_type = 0;
static GEnumValue recover_policy[] = {
static const GEnumValue recover_policy[] = {
{GST_RECOVER_POLICY_NONE,
"Do not try to recover", "none"},
{GST_RECOVER_POLICY_RESYNC_LATEST,
......@@ -231,7 +231,7 @@ static GType
gst_sync_method_get_type (void)
{
static GType sync_method_type = 0;
static GEnumValue sync_method[] = {
static const GEnumValue sync_method[] = {
{GST_SYNC_METHOD_LATEST,
"Serve starting from the latest buffer", "latest"},
{GST_SYNC_METHOD_NEXT_KEYFRAME,
......@@ -254,7 +254,7 @@ static GType
gst_unit_type_get_type (void)
{
static GType unit_type_type = 0;
static GEnumValue unit_type[] = {
static const GEnumValue unit_type[] = {
{GST_UNIT_TYPE_BUFFERS, "Buffers", "buffers"},
{GST_UNIT_TYPE_BYTES, "Bytes", "bytes"},
{GST_UNIT_TYPE_TIME, "Time", "time"},
......@@ -273,7 +273,7 @@ static GType
gst_client_status_get_type (void)
{
static GType client_status_type = 0;
static GEnumValue client_status[] = {
static const GEnumValue client_status[] = {
{GST_CLIENT_STATUS_OK, "ok", "ok"},
{GST_CLIENT_STATUS_CLOSED, "Closed", "closed"},
{GST_CLIENT_STATUS_REMOVED, "Removed", "removed"},
......
......@@ -130,7 +130,7 @@ static GType
gst_video_scale_method_get_type (void)
{
static GType video_scale_method_type = 0;
static GEnumValue video_scale_methods[] = {
static const GEnumValue video_scale_methods[] = {
{GST_VIDEO_SCALE_NEAREST, "Nearest Neighbour", "nearest-neighbour"},
{GST_VIDEO_SCALE_BILINEAR, "Bilinear", "bilinear"},
{0, NULL, NULL},
......
......@@ -101,7 +101,7 @@ static GType
gst_video_test_src_pattern_get_type (void)
{
static GType video_test_src_pattern_type = 0;
static GEnumValue pattern_types[] = {
static const GEnumValue pattern_types[] = {
{GST_VIDEO_TEST_SRC_SMPTE, "SMPTE 100% color bars", "smpte"},
{GST_VIDEO_TEST_SRC_SNOW, "Random (television snow)", "snow"},
{GST_VIDEO_TEST_SRC_BLACK, "100% Black", "black"},
......
......@@ -681,20 +681,16 @@ gst_video_test_src_black (GstVideoTestSrc * v, unsigned char *dest, int w,
}
}
#define ROUND_UP_2(x) (((x)+1)&~1)
#define ROUND_UP_4(x) (((x)+3)&~3)
#define ROUND_UP_8(x) (((x)+7)&~7)
static void
paint_setup_I420 (paintinfo * p, unsigned char *dest)
{
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width);
p->up = p->yp + p->ystride * ROUND_UP_2 (p->height);
p->ustride = ROUND_UP_8 (p->width) / 2;
p->vp = p->up + p->ustride * ROUND_UP_2 (p->height) / 2;
p->vstride = ROUND_UP_8 (p->ystride) / 2;
p->endptr = p->vp + p->vstride * ROUND_UP_2 (p->height) / 2;
p->ystride = GST_ROUND_UP_4 (p->width);
p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
p->ustride = GST_ROUND_UP_8 (p->width) / 2;
p->vp = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
p->endptr = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
}
static void
......@@ -716,12 +712,12 @@ static void
paint_setup_YV12 (paintinfo * p, unsigned char *dest)
{
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width);
p->vp = p->yp + p->ystride * ROUND_UP_2 (p->height);
p->vstride = ROUND_UP_8 (p->ystride) / 2;
p->up = p->vp + p->vstride * ROUND_UP_2 (p->height) / 2;
p->ustride = ROUND_UP_8 (p->ystride) / 2;
p->endptr = p->up + p->ustride * ROUND_UP_2 (p->height) / 2;
p->ystride = GST_ROUND_UP_4 (p->width);
p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
p->up = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
p->ustride = GST_ROUND_UP_8 (p->ystride) / 2;
p->endptr = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
}
static void
......@@ -730,7 +726,7 @@ paint_setup_YUY2 (paintinfo * p, unsigned char *dest)
p->yp = dest;
p->up = dest + 1;
p->vp = dest + 3;
p->ystride = ROUND_UP_2 (p->width) * 2;
p->ystride = GST_ROUND_UP_2 (p->width) * 2;
p->endptr = dest + p->ystride * p->height;
}
......@@ -740,7 +736,7 @@ paint_setup_UYVY (paintinfo * p, unsigned char *dest)
p->yp = dest + 1;
p->up = dest;
p->vp = dest + 2;
p->ystride = ROUND_UP_2 (p->width) * 2;
p->ystride = GST_ROUND_UP_2 (p->width) * 2;
p->endptr = dest + p->ystride * p->height;
}
......@@ -750,7 +746,7 @@ paint_setup_YVYU (paintinfo * p, unsigned char *dest)
p->yp = dest;
p->up = dest + 3;
p->vp = dest + 1;
p->ystride = ROUND_UP_2 (p->width * 2);
p->ystride = GST_ROUND_UP_2 (p->width * 2);
p->endptr = dest + p->ystride * p->height;
}
......@@ -774,7 +770,7 @@ paint_setup_IYU2 (paintinfo * p, unsigned char *dest)
p->yp = dest + 1;
p->up = dest + 0;
p->vp = dest + 2;
p->ystride = ROUND_UP_4 (p->width * 3);
p->ystride = GST_ROUND_UP_4 (p->width * 3);
p->endptr = dest + p->ystride * p->height;
}
......@@ -793,11 +789,11 @@ static void
paint_setup_Y41B (paintinfo * p, unsigned char *dest)
{
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width);
p->ystride = GST_ROUND_UP_4 (p->width);
p->up = p->yp + p->ystride * p->height;
p->ustride = ROUND_UP_8 (p->width) / 4;
p->ustride = GST_ROUND_UP_8 (p->width) / 4;
p->vp = p->up + p->ustride * p->height;
p->vstride = ROUND_UP_8 (p->width) / 4;
p->vstride = GST_ROUND_UP_8 (p->width) / 4;
p->endptr = p->vp + p->vstride * p->height;
}
......@@ -820,11 +816,11 @@ static void
paint_setup_Y42B (paintinfo * p, unsigned char *dest)
{
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width);
p->ystride = GST_ROUND_UP_4 (p->width);
p->up = p->yp + p->ystride * p->height;
p->ustride = ROUND_UP_8 (p->width) / 2;
p->ustride = GST_ROUND_UP_8 (p->width) / 2;
p->vp = p->up + p->ustride * p->height;
p->vstride = ROUND_UP_8 (p->width) / 2;
p->vstride = GST_ROUND_UP_8 (p->width) / 2;
p->endptr = p->vp + p->vstride * p->height;
}
......@@ -848,7 +844,7 @@ paint_setup_Y800 (paintinfo * p, unsigned char *dest)
{
/* untested */
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width);
p->ystride = GST_ROUND_UP_4 (p->width);
p->endptr = dest + p->ystride * p->height;
}
......@@ -912,30 +908,30 @@ paint_hline_IMC1 (paintinfo * p, int x, int y, int w)
static void
paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
{
int h = ROUND_UP_4 (p->height);
int h = GST_ROUND_UP_4 (p->height);
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width);
p->vp = p->yp + p->ystride * ROUND_UP_4 (p->height);
p->vstride = ROUND_UP_4 (p->ystride / 4);
p->up = p->vp + p->vstride * ROUND_UP_4 (h / 4);
p->ustride = ROUND_UP_4 (p->ystride / 4);
p->endptr = p->up + p->ustride * ROUND_UP_4 (h / 4);
p->ystride = GST_ROUND_UP_4 (p->width);
p->vp = p->yp + p->ystride * GST_ROUND_UP_4 (p->height);
p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
p->up = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
p->endptr = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
}
static void
paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
{
/* untested */
int h = ROUND_UP_4 (p->height);
int h = GST_ROUND_UP_4 (p->height);
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width);
p->ystride = GST_ROUND_UP_4 (p->width);
p->up = p->yp + p->ystride * h;
p->ustride = ROUND_UP_4 (p->ystride / 4);
p->vp = p->up + p->ustride * ROUND_UP_4 (h / 4);
p->vstride = ROUND_UP_4 (p->ystride / 4);
p->endptr = p->vp + p->vstride * ROUND_UP_4 (h / 4);
p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
p->vp = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
p->endptr = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
}
static void
......@@ -999,7 +995,7 @@ paint_setup_RGB888 (paintinfo * p, unsigned char *dest)
p->yp = dest + 0;
p->up = dest + 1;
p->vp = dest + 2;
p->ystride = ROUND_UP_4 (p->width * 3);
p->ystride = GST_ROUND_UP_4 (p->width * 3);
p->endptr = p->dest + p->ystride * p->height;
}
......@@ -1009,7 +1005,7 @@ paint_setup_BGR888 (paintinfo * p, unsigned char *dest)
p->yp = dest + 2;
p->up = dest + 1;
p->vp = dest + 0;
p->ystride = ROUND_UP_4 (p->width * 3);
p->ystride = GST_ROUND_UP_4 (p->width * 3);
p->endptr = p->dest + p->ystride * p->height;
}
......@@ -1037,7 +1033,7 @@ static void
paint_setup_RGB565 (paintinfo * p, unsigned char *dest)
{
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width * 2);
p->ystride = GST_ROUND_UP_4 (p->width * 2);
p->endptr = p->dest + p->ystride * p->height;
}
......@@ -1063,7 +1059,7 @@ static void
paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest)
{
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width * 2);
p->ystride = GST_ROUND_UP_4 (p->width * 2);
p->endptr = p->dest + p->ystride * p->height;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment