libcamera/test/gstreamer/gstreamer_single_stream_test.cpp
Vedant Paranjape 31403b0f2a test: gstreamer: Remove unnecessary header file includes
Remove header files which were not being used in the test code.
The following headers were removed from the gstreamer_single_stream_test:
- libcamera/base/utils.h
- libcamera/internal/source_paths.h

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2021-10-04 12:55:08 +05:30

78 lines
1.5 KiB
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2021, Vedant Paranjape
*
* gstreamer_single_stream_test.cpp - GStreamer single stream capture test
*/
#include <iostream>
#include <unistd.h>
#include <gst/gst.h>
#include "gstreamer_test.h"
#include "test.h"
using namespace std;
class GstreamerSingleStreamTest : public GstreamerTest, public Test
{
public:
GstreamerSingleStreamTest()
: GstreamerTest()
{
}
protected:
int init() override
{
if (status_ != TestPass)
return status_;
const gchar *streamDescription = "videoconvert ! fakesink";
g_autoptr(GError) error0 = NULL;
stream0_ = gst_parse_bin_from_description_full(streamDescription, TRUE,
NULL,
GST_PARSE_FLAG_FATAL_ERRORS,
&error0);
if (!stream0_) {
g_printerr("Bin could not be created (%s)\n", error0->message);
return TestFail;
}
g_object_ref_sink(stream0_);
if (createPipeline() != TestPass)
return TestFail;
return TestPass;
}
int run() override
{
/* Build the pipeline */
gst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, stream0_, NULL);
if (gst_element_link(libcameraSrc_, stream0_) != TRUE) {
g_printerr("Elements could not be linked.\n");
return TestFail;
}
if (startPipeline() != TestPass)
return TestFail;
if (processEvent() != TestPass)
return TestFail;
return TestPass;
}
void cleanup() override
{
g_clear_object(&stream0_);
}
private:
GstElement *stream0_;
};
TEST_REGISTER(GstreamerSingleStreamTest)