mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
Simplify tests info.
This commit is contained in:
parent
24d918b7a3
commit
3ed5655535
8 changed files with 72 additions and 24 deletions
|
@ -28,19 +28,20 @@
|
||||||
#include "test-h264.h"
|
#include "test-h264.h"
|
||||||
#include "test-vc1.h"
|
#include "test-vc1.h"
|
||||||
|
|
||||||
typedef void (*GetVideoDataFunc)(const guchar **data, guint *size);
|
typedef void (*GetVideoInfoFunc)(VideoDecodeInfo *info);
|
||||||
|
|
||||||
typedef struct _CodecDefs CodecDefs;
|
typedef struct _CodecDefs CodecDefs;
|
||||||
struct _CodecDefs {
|
struct _CodecDefs {
|
||||||
const gchar *codec_str;
|
const gchar *codec_str;
|
||||||
GstVaapiCodec codec;
|
GetVideoInfoFunc get_video_info;
|
||||||
GetVideoDataFunc get_video_data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const CodecDefs g_codec_defs[] = {
|
static const CodecDefs g_codec_defs[] = {
|
||||||
{ "mpeg2", GST_VAAPI_CODEC_MPEG2, mpeg2_get_video_data },
|
#define INIT_FUNCS(CODEC) { #CODEC, CODEC##_get_video_info }
|
||||||
{ "h264", GST_VAAPI_CODEC_H264, h264_get_video_data },
|
INIT_FUNCS(mpeg2),
|
||||||
{ "vc1", GST_VAAPI_CODEC_VC1, vc1_get_video_data },
|
INIT_FUNCS(h264),
|
||||||
|
INIT_FUNCS(vc1),
|
||||||
|
#undef INIT_FUNCS
|
||||||
{ NULL, }
|
{ NULL, }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,11 +78,11 @@ main(int argc, char *argv[])
|
||||||
GstVaapiDisplay *display;
|
GstVaapiDisplay *display;
|
||||||
GstVaapiWindow *window;
|
GstVaapiWindow *window;
|
||||||
GstVaapiDecoder *decoder;
|
GstVaapiDecoder *decoder;
|
||||||
|
GstCaps *decoder_caps;
|
||||||
GstVaapiDecoderStatus status;
|
GstVaapiDecoderStatus status;
|
||||||
const CodecDefs *codec;
|
const CodecDefs *codec;
|
||||||
GstVaapiSurfaceProxy *proxy;
|
GstVaapiSurfaceProxy *proxy;
|
||||||
const guchar *vdata;
|
VideoDecodeInfo info;
|
||||||
guint vdata_size;
|
|
||||||
|
|
||||||
static const guint win_width = 640;
|
static const guint win_width = 640;
|
||||||
static const guint win_height = 480;
|
static const guint win_height = 480;
|
||||||
|
@ -109,12 +110,12 @@ main(int argc, char *argv[])
|
||||||
if (!window)
|
if (!window)
|
||||||
g_error("could not create window");
|
g_error("could not create window");
|
||||||
|
|
||||||
codec->get_video_data(&vdata, &vdata_size);
|
codec->get_video_info(&info);
|
||||||
decoder = gst_vaapi_decoder_ffmpeg_new(display, codec->codec, NULL);
|
decoder = gst_vaapi_decoder_ffmpeg_new(display, gst_vaapi_profile_get_codec(info.profile), NULL);
|
||||||
if (!decoder)
|
if (!decoder)
|
||||||
g_error("could not create FFmpeg 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");
|
g_error("could not send video data to the decoder");
|
||||||
if (!gst_vaapi_decoder_put_buffer(decoder, NULL))
|
if (!gst_vaapi_decoder_put_buffer(decoder, NULL))
|
||||||
g_error("could not send EOS to the decoder");
|
g_error("could not send EOS to the decoder");
|
||||||
|
|
35
tests/test-decode.h
Normal file
35
tests/test-decode.h
Normal file
|
@ -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 */
|
|
@ -1038,8 +1038,11 @@ static const guchar h264_clip[H264_CLIP_DATA_SIZE] = {
|
||||||
0x00, 0x01, 0x0a
|
0x00, 0x01, 0x0a
|
||||||
};
|
};
|
||||||
|
|
||||||
void h264_get_video_data(const guchar **data, guint *size)
|
void h264_get_video_info(VideoDecodeInfo *info)
|
||||||
{
|
{
|
||||||
*data = h264_clip;
|
info->profile = GST_VAAPI_PROFILE_H264_MAIN;
|
||||||
*size = H264_CLIP_DATA_SIZE;
|
info->width = H264_CLIP_WIDTH;
|
||||||
|
info->height = H264_CLIP_HEIGHT;
|
||||||
|
info->data = h264_clip;
|
||||||
|
info->data_size = H264_CLIP_DATA_SIZE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#define TEST_H264_H
|
#define TEST_H264_H
|
||||||
|
|
||||||
#include <glib.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 */
|
#endif /* TEST_H264_H */
|
||||||
|
|
|
@ -1638,8 +1638,11 @@ static const guchar mpeg2_clip[MPEG2_CLIP_DATA_SIZE] = {
|
||||||
0x00, 0x01, 0xb7
|
0x00, 0x01, 0xb7
|
||||||
};
|
};
|
||||||
|
|
||||||
void mpeg2_get_video_data(const guchar **data, guint *size)
|
void mpeg2_get_video_info(VideoDecodeInfo *info)
|
||||||
{
|
{
|
||||||
*data = mpeg2_clip;
|
info->profile = GST_VAAPI_PROFILE_MPEG2_SIMPLE;
|
||||||
*size = MPEG2_CLIP_DATA_SIZE;
|
info->width = MPEG2_CLIP_WIDTH;
|
||||||
|
info->height = MPEG2_CLIP_HEIGHT;
|
||||||
|
info->data = mpeg2_clip;
|
||||||
|
info->data_size = MPEG2_CLIP_DATA_SIZE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#define TEST_MPEG2_H
|
#define TEST_MPEG2_H
|
||||||
|
|
||||||
#include <glib.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 */
|
#endif /* TEST_MPEG2_H */
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "test-vc1.h"
|
#include "test-vc1.h"
|
||||||
|
|
||||||
#define VC1_CLIP_WIDTH 320
|
#define VC1_CLIP_WIDTH 293
|
||||||
#define VC1_CLIP_HEIGHT 240
|
#define VC1_CLIP_HEIGHT 240
|
||||||
#define VC1_CLIP_DATA_SIZE 20864
|
#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
|
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;
|
info->profile = GST_VAAPI_PROFILE_VC1_ADVANCED;
|
||||||
*size = VC1_CLIP_DATA_SIZE;
|
info->width = VC1_CLIP_WIDTH;
|
||||||
|
info->height = VC1_CLIP_HEIGHT;
|
||||||
|
info->data = vc1_clip;
|
||||||
|
info->data_size = VC1_CLIP_DATA_SIZE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#define TEST_VC1_H
|
#define TEST_VC1_H
|
||||||
|
|
||||||
#include <glib.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 */
|
#endif /* TEST_VC1_H */
|
||||||
|
|
Loading…
Reference in a new issue