check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* unit test for fdsrc
|
|
|
|
*
|
|
|
|
* Copyright (C) <2005> Jan Schmidt <thaytan at mad dot scientist dot com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#include <gst/check/gstcheck.h>
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static gboolean have_eos = FALSE;
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static GstPad *mysinkpad;
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static gboolean
|
2011-11-17 11:40:45 +00:00
|
|
|
event_func (GstPad * pad, GstObject * parent, GstEvent * event)
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
{
|
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
|
|
|
have_eos = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_event_unref (event);
|
2011-11-28 12:52:00 +00:00
|
|
|
return TRUE;
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
}
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static GstElement *
|
|
|
|
setup_fdsrc (void)
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
{
|
|
|
|
GstElement *fdsrc;
|
|
|
|
|
|
|
|
GST_DEBUG ("setup_fdsrc");
|
|
|
|
fdsrc = gst_check_setup_element ("fdsrc");
|
2011-11-24 20:36:12 +00:00
|
|
|
mysinkpad = gst_check_setup_sink_pad (fdsrc, &sinktemplate);
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
gst_pad_set_event_function (mysinkpad, event_func);
|
|
|
|
gst_pad_set_active (mysinkpad, TRUE);
|
|
|
|
return fdsrc;
|
|
|
|
}
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static void
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
cleanup_fdsrc (GstElement * fdsrc)
|
|
|
|
{
|
libs/gst/check/gstcheck.c: do not automatically (de)activate pads
Original commit message from CVS:
* libs/gst/check/gstcheck.c: (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
do not automatically (de)activate pads
* tests/check/Makefile.am:
* tests/check/elements/queue.c: (queue_overrun), (queue_underrun),
(setup_queue), (cleanup_queue), (GST_START_TEST), (queue_suite):
add new, yet simple tests for queue
* tests/check/elements/fakesrc.c: (cleanup_fakesrc):
* tests/check/elements/fdsrc.c: (cleanup_fdsrc):
* tests/check/elements/filesrc.c: (cleanup_filesrc),
(GST_START_TEST):
* tests/check/elements/identity.c: (cleanup_identity):
consistent pad (de)activation
2006-12-21 08:12:28 +00:00
|
|
|
gst_pad_set_active (mysinkpad, FALSE);
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
gst_check_teardown_sink_pad (fdsrc);
|
|
|
|
gst_check_teardown_element (fdsrc);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_num_buffers)
|
|
|
|
{
|
|
|
|
GstElement *src;
|
|
|
|
gint pipe_fd[2];
|
|
|
|
gchar data[4096];
|
|
|
|
|
2010-03-11 19:29:29 +00:00
|
|
|
#ifndef G_OS_WIN32
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
fail_if (pipe (pipe_fd) < 0);
|
2010-03-11 19:29:29 +00:00
|
|
|
#else
|
|
|
|
fail_if (_pipe (pipe_fd, 2048, _O_BINARY) < 0);
|
|
|
|
#endif
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
|
|
|
|
src = setup_fdsrc ();
|
|
|
|
g_object_set (G_OBJECT (src), "num-buffers", 3, NULL);
|
|
|
|
g_object_set (G_OBJECT (src), "fd", pipe_fd[0], NULL);
|
|
|
|
fail_unless (gst_element_set_state (src,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to playing");
|
|
|
|
|
|
|
|
memset (data, 0, 4096);
|
|
|
|
while (!have_eos) {
|
|
|
|
fail_if (write (pipe_fd[1], data, 4096) < 0);
|
|
|
|
g_usleep (100);
|
|
|
|
}
|
|
|
|
|
|
|
|
fail_unless (g_list_length (buffers) == 3);
|
|
|
|
fail_unless (gst_element_set_state (src,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
cleanup_fdsrc (src);
|
|
|
|
close (pipe_fd[0]);
|
|
|
|
close (pipe_fd[1]);
|
|
|
|
g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
|
|
|
|
g_list_free (buffers);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_nonseeking)
|
|
|
|
{
|
|
|
|
GstElement *src;
|
|
|
|
GstQuery *seeking_query;
|
|
|
|
gint pipe_fd[2];
|
|
|
|
gchar data[4096];
|
|
|
|
gboolean seekable;
|
|
|
|
|
2010-03-11 19:29:29 +00:00
|
|
|
#ifndef G_OS_WIN32
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
fail_if (pipe (pipe_fd) < 0);
|
2010-03-11 19:29:29 +00:00
|
|
|
#else
|
|
|
|
fail_if (_pipe (pipe_fd, 2048, _O_BINARY) < 0);
|
|
|
|
#endif
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
|
|
|
|
src = setup_fdsrc ();
|
|
|
|
g_object_set (G_OBJECT (src), "num-buffers", 3, NULL);
|
|
|
|
g_object_set (G_OBJECT (src), "fd", pipe_fd[0], NULL);
|
|
|
|
fail_unless (gst_element_set_state (src,
|
|
|
|
GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to paused");
|
|
|
|
|
|
|
|
memset (data, 0, 4096);
|
|
|
|
fail_if (write (pipe_fd[1], data, 4096) < 0);
|
|
|
|
|
|
|
|
/* Test that fdsrc is non-seekable with a pipe */
|
|
|
|
fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES))
|
|
|
|
!= NULL);
|
2011-05-17 09:20:05 +00:00
|
|
|
fail_unless (gst_element_query (src, seeking_query) == TRUE);
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL);
|
|
|
|
fail_unless (seekable == FALSE);
|
|
|
|
gst_query_unref (seeking_query);
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (src,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
cleanup_fdsrc (src);
|
|
|
|
close (pipe_fd[0]);
|
|
|
|
close (pipe_fd[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_seeking)
|
|
|
|
{
|
|
|
|
GstElement *src;
|
|
|
|
gint in_fd;
|
|
|
|
GstQuery *seeking_query;
|
|
|
|
gboolean seekable;
|
|
|
|
|
2005-11-28 10:07:38 +00:00
|
|
|
#ifndef TESTFILE
|
|
|
|
#error TESTFILE not defined
|
|
|
|
#endif
|
|
|
|
fail_if ((in_fd = open (TESTFILE, O_RDONLY)) < 0);
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
src = setup_fdsrc ();
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (src), "fd", in_fd, NULL);
|
|
|
|
fail_unless (gst_element_set_state (src,
|
|
|
|
GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to paused");
|
|
|
|
|
|
|
|
/* Test that fdsrc is seekable with a file fd */
|
|
|
|
fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES))
|
|
|
|
!= NULL);
|
2011-05-17 09:20:05 +00:00
|
|
|
fail_unless (gst_element_query (src, seeking_query) == TRUE);
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL);
|
|
|
|
fail_unless (seekable == TRUE);
|
|
|
|
gst_query_unref (seeking_query);
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (src,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
cleanup_fdsrc (src);
|
|
|
|
close (in_fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static Suite *
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
fdsrc_suite (void)
|
|
|
|
{
|
|
|
|
Suite *s = suite_create ("fdsrc");
|
|
|
|
TCase *tc_chain = tcase_create ("general");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
|
|
|
tcase_add_test (tc_chain, test_num_buffers);
|
|
|
|
tcase_add_test (tc_chain, test_nonseeking);
|
|
|
|
tcase_add_test (tc_chain, test_seeking);
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2006-07-01 20:56:56 +00:00
|
|
|
GST_CHECK_MAIN (fdsrc);
|