summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorgb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>2010-05-03 16:41:13 +0000
committerGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2010-09-20 12:55:43 +0200
commit3ed565553517954893c7062e6e199b04fe7b6e38 (patch)
treebad3de12ad76815a7bcaf96b99704170b86bf822 /tests
parent24d918b7a371994455470b2bd90c04c6e1ee7d24 (diff)
Simplify tests info.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-decode.c23
-rw-r--r--tests/test-decode.h35
-rw-r--r--tests/test-h264.c9
-rw-r--r--tests/test-h264.h3
-rw-r--r--tests/test-mpeg2.c9
-rw-r--r--tests/test-mpeg2.h3
-rw-r--r--tests/test-vc1.c11
-rw-r--r--tests/test-vc1.h3
8 files changed, 72 insertions, 24 deletions
diff --git a/tests/test-decode.c b/tests/test-decode.c
index f4b56b92..0fea7501 100644
--- a/tests/test-decode.c
+++ b/tests/test-decode.c
@@ -28,19 +28,20 @@
#include "test-h264.h"
#include "test-vc1.h"
-typedef void (*GetVideoDataFunc)(const guchar **data, guint *size);
+typedef void (*GetVideoInfoFunc)(VideoDecodeInfo *info);
typedef struct _CodecDefs CodecDefs;
struct _CodecDefs {
const gchar *codec_str;
- GstVaapiCodec codec;
- GetVideoDataFunc get_video_data;
+ GetVideoInfoFunc get_video_info;
};
static const CodecDefs g_codec_defs[] = {
- { "mpeg2", GST_VAAPI_CODEC_MPEG2, mpeg2_get_video_data },
- { "h264", GST_VAAPI_CODEC_H264, h264_get_video_data },
- { "vc1", GST_VAAPI_CODEC_VC1, vc1_get_video_data },
+#define INIT_FUNCS(CODEC) { #CODEC, CODEC##_get_video_info }
+ INIT_FUNCS(mpeg2),
+ INIT_FUNCS(h264),
+ INIT_FUNCS(vc1),
+#undef INIT_FUNCS
{ NULL, }
};
@@ -77,11 +78,11 @@ main(int argc, char *argv[])
GstVaapiDisplay *display;
GstVaapiWindow *window;
GstVaapiDecoder *decoder;
+ GstCaps *decoder_caps;
GstVaapiDecoderStatus status;
const CodecDefs *codec;
GstVaapiSurfaceProxy *proxy;
- const guchar *vdata;
- guint vdata_size;
+ VideoDecodeInfo info;
static const guint win_width = 640;
static const guint win_height = 480;
@@ -109,12 +110,12 @@ main(int argc, char *argv[])
if (!window)
g_error("could not create window");
- codec->get_video_data(&vdata, &vdata_size);
- decoder = gst_vaapi_decoder_ffmpeg_new(display, codec->codec, NULL);
+ codec->get_video_info(&info);
+ decoder = gst_vaapi_decoder_ffmpeg_new(display, gst_vaapi_profile_get_codec(info.profile), NULL);
if (!decoder)
g_error("could not create FFmpeg decoder");
- if (!gst_vaapi_decoder_put_buffer_data(decoder, vdata, vdata_size))
+ if (!gst_vaapi_decoder_put_buffer_data(decoder, info.data, info.data_size))
g_error("could not send video data to the decoder");
if (!gst_vaapi_decoder_put_buffer(decoder, NULL))
g_error("could not send EOS to the decoder");
diff --git a/tests/test-decode.h b/tests/test-decode.h
new file mode 100644
index 00000000..0ef55cca
--- /dev/null
+++ b/tests/test-decode.h
@@ -0,0 +1,35 @@
+/*
+ * test-decode.h - Test GstVaapiDecoder
+ *
+ * gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef TEST_DECODE_H
+#define TEST_DECODE_H
+
+#include <gst/vaapi/gstvaapiprofile.h>
+
+typedef struct _VideoDecodeInfo VideoDecodeInfo;
+struct _VideoDecodeInfo {
+ GstVaapiProfile profile;
+ guint width;
+ guint height;
+ const guchar *data;
+ guint data_size;
+};
+
+#endif /* TEST_DECODE_H */
diff --git a/tests/test-h264.c b/tests/test-h264.c
index e4c0f37e..c00c275f 100644
--- a/tests/test-h264.c
+++ b/tests/test-h264.c
@@ -1038,8 +1038,11 @@ static const guchar h264_clip[H264_CLIP_DATA_SIZE] = {
0x00, 0x01, 0x0a
};
-void h264_get_video_data(const guchar **data, guint *size)
+void h264_get_video_info(VideoDecodeInfo *info)
{
- *data = h264_clip;
- *size = H264_CLIP_DATA_SIZE;
+ info->profile = GST_VAAPI_PROFILE_H264_MAIN;
+ info->width = H264_CLIP_WIDTH;
+ info->height = H264_CLIP_HEIGHT;
+ info->data = h264_clip;
+ info->data_size = H264_CLIP_DATA_SIZE;
}
diff --git a/tests/test-h264.h b/tests/test-h264.h
index ee022985..ae94bcd0 100644
--- a/tests/test-h264.h
+++ b/tests/test-h264.h
@@ -22,7 +22,8 @@
#define TEST_H264_H
#include <glib.h>
+#include "test-decode.h"
-void h264_get_video_data(const guchar **data, guint *size);
+void h264_get_video_info(VideoDecodeInfo *info);
#endif /* TEST_H264_H */
diff --git a/tests/test-mpeg2.c b/tests/test-mpeg2.c
index 2817b300..e12b2596 100644
--- a/tests/test-mpeg2.c
+++ b/tests/test-mpeg2.c
@@ -1638,8 +1638,11 @@ static const guchar mpeg2_clip[MPEG2_CLIP_DATA_SIZE] = {
0x00, 0x01, 0xb7
};
-void mpeg2_get_video_data(const guchar **data, guint *size)
+void mpeg2_get_video_info(VideoDecodeInfo *info)
{
- *data = mpeg2_clip;
- *size = MPEG2_CLIP_DATA_SIZE;
+ info->profile = GST_VAAPI_PROFILE_MPEG2_SIMPLE;
+ info->width = MPEG2_CLIP_WIDTH;
+ info->height = MPEG2_CLIP_HEIGHT;
+ info->data = mpeg2_clip;
+ info->data_size = MPEG2_CLIP_DATA_SIZE;
}
diff --git a/tests/test-mpeg2.h b/tests/test-mpeg2.h
index 8b3e43e6..08251550 100644
--- a/tests/test-mpeg2.h
+++ b/tests/test-mpeg2.h
@@ -22,7 +22,8 @@
#define TEST_MPEG2_H
#include <glib.h>
+#include "test-decode.h"
-void mpeg2_get_video_data(const guchar **data, guint *size);
+void mpeg2_get_video_info(VideoDecodeInfo *info);
#endif /* TEST_MPEG2_H */
diff --git a/tests/test-vc1.c b/tests/test-vc1.c
index 80a56fcb..79e2ccaa 100644
--- a/tests/test-vc1.c
+++ b/tests/test-vc1.c
@@ -20,7 +20,7 @@
#include "test-vc1.h"
-#define VC1_CLIP_WIDTH 320
+#define VC1_CLIP_WIDTH 293
#define VC1_CLIP_HEIGHT 240
#define VC1_CLIP_DATA_SIZE 20864
@@ -1767,8 +1767,11 @@ static const guchar vc1_clip[VC1_CLIP_DATA_SIZE] = {
0x0f, 0x55, 0xbf, 0x40, 0x00, 0x00, 0x01, 0x0a
};
-void vc1_get_video_data(const guchar **data, guint *size)
+void vc1_get_video_info(VideoDecodeInfo *info)
{
- *data = vc1_clip;
- *size = VC1_CLIP_DATA_SIZE;
+ info->profile = GST_VAAPI_PROFILE_VC1_ADVANCED;
+ info->width = VC1_CLIP_WIDTH;
+ info->height = VC1_CLIP_HEIGHT;
+ info->data = vc1_clip;
+ info->data_size = VC1_CLIP_DATA_SIZE;
}
diff --git a/tests/test-vc1.h b/tests/test-vc1.h
index ac35d2b3..05927b60 100644
--- a/tests/test-vc1.h
+++ b/tests/test-vc1.h
@@ -22,7 +22,8 @@
#define TEST_VC1_H
#include <glib.h>
+#include "test-decode.h"
-void vc1_get_video_data(const guchar **data, guint *size);
+void vc1_get_video_info(VideoDecodeInfo *info);
#endif /* TEST_VC1_H */