check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* unit test for data protocol
|
|
|
|
*
|
|
|
|
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2006-08-08 09:07:34 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2005-08-20 12:14:28 +00:00
|
|
|
#include <gst/check/gstcheck.h>
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
2006-08-11 15:26:33 +00:00
|
|
|
#ifndef GST_REMOVE_DEPRECATED
|
|
|
|
#undef GST_DISABLE_DEPRECATED
|
|
|
|
#endif
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
#include <gst/dataprotocol/dataprotocol.h>
|
|
|
|
#include "libs/gst/dataprotocol/dp-private.h" /* private header */
|
|
|
|
|
|
|
|
/* test our method of reading and writing headers using TO/FROM_BE */
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_conversion)
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
{
|
|
|
|
guint8 array[9];
|
|
|
|
guint8 write_array[9];
|
|
|
|
guint16 read_two, expect_two;
|
|
|
|
guint32 read_four, expect_four;
|
|
|
|
guint64 read_eight, expect_eight;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 9; ++i) {
|
|
|
|
array[i] = i * 0x10;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read 8 16 bits */
|
|
|
|
for (i = 0; i < 8; ++i) {
|
|
|
|
read_two = GST_READ_UINT16_BE (array + i);
|
|
|
|
expect_two = array[i] * (1 << 8) + array[i + 1];
|
|
|
|
fail_unless (read_two == expect_two,
|
|
|
|
"GST_READ_UINT16_BE %d: read %d != %d\n", i, read_two, expect_two);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write 8 16 bits */
|
|
|
|
for (i = 0; i < 8; ++i) {
|
|
|
|
GST_WRITE_UINT16_BE (&write_array[i], read_two);
|
|
|
|
fail_unless (memcmp (array + 7, write_array + i, 2) == 0,
|
|
|
|
"GST_WRITE_UINT16_BE %d: memcmp failed", i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read 5 32 bits */
|
|
|
|
for (i = 0; i < 5; ++i) {
|
|
|
|
read_four = GST_READ_UINT32_BE (array + i);
|
|
|
|
expect_four = array[i] * (1 << 24) + array[i + 1] * (1 << 16)
|
|
|
|
+ array[i + 2] * (1 << 8) + array[i + 3];
|
|
|
|
fail_unless (read_four == expect_four,
|
|
|
|
"GST_READ_UINT32_BE %d: read %d != %d\n", i, read_four, expect_four);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read 2 64 bits */
|
|
|
|
for (i = 0; i < 2; ++i) {
|
|
|
|
read_eight = GST_READ_UINT64_BE (array + i);
|
|
|
|
expect_eight = array[i] * (1LL << 56) + array[i + 1] * (1LL << 48)
|
|
|
|
+ array[i + 2] * (1LL << 40) + array[i + 3] * (1LL << 32)
|
|
|
|
+ array[i + 4] * (1 << 24) + array[i + 5] * (1 << 16)
|
|
|
|
+ array[i + 6] * (1 << 8) + array[i + 7];
|
|
|
|
fail_unless (read_eight == expect_eight,
|
|
|
|
"GST_READ_UINT64_BE %d: read %" G_GUINT64_FORMAT
|
|
|
|
" != %" G_GUINT64_FORMAT "\n", i, read_eight, expect_eight);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write 1 64 bit */
|
|
|
|
GST_WRITE_UINT64_BE (&write_array[0], read_eight);
|
|
|
|
fail_unless (memcmp (array + 1, write_array, 8) == 0,
|
|
|
|
"GST_WRITE_UINT64_BE: memcmp failed");
|
|
|
|
}
|
|
|
|
|
2005-07-12 12:20:01 +00:00
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-08-11 15:26:33 +00:00
|
|
|
#ifndef GST_REMOVE_DEPRECATED /* these tests use deprecated API, that we disable by default */
|
2006-08-10 20:05:30 +00:00
|
|
|
|
2006-08-08 09:56:45 +00:00
|
|
|
#ifndef HAVE_CPU_PPC64 /* this test doesn't work on PPC64. See #348114 */
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
/* test creation of header from buffer and back again */
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_buffer)
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
{
|
|
|
|
GstBuffer *buffer;
|
|
|
|
GstBuffer *newbuffer;
|
|
|
|
|
|
|
|
guint header_length;
|
|
|
|
guint8 *header;
|
|
|
|
|
|
|
|
/* create buffer */
|
|
|
|
g_message ("Creating a new 8-byte buffer with ts 0.5 sec, dur 1 sec\n");
|
|
|
|
buffer = gst_buffer_new_and_alloc (8);
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = (GstClockTime) (GST_SECOND * 0.5);
|
|
|
|
GST_BUFFER_DURATION (buffer) = (GstClockTime) GST_SECOND;
|
|
|
|
GST_BUFFER_OFFSET (buffer) = (guint64) 10;
|
|
|
|
GST_BUFFER_OFFSET_END (buffer) = (guint64) 19;
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
memmove (GST_BUFFER_DATA (buffer), "a buffer", 8);
|
|
|
|
|
|
|
|
/* create a buffer with CRC checking */
|
|
|
|
fail_unless (gst_dp_header_from_buffer (buffer, GST_DP_HEADER_FLAG_CRC,
|
|
|
|
&header_length, &header), "Could not create header from buffer.");
|
|
|
|
|
|
|
|
/* validate the header */
|
|
|
|
fail_unless (gst_dp_validate_header (header_length, header),
|
|
|
|
"Could not validate header");
|
|
|
|
/* create a new, empty buffer with the right size */
|
|
|
|
newbuffer = gst_dp_buffer_from_header (header_length, header);
|
|
|
|
fail_unless (newbuffer != NULL, "Could not create a new buffer from header");
|
|
|
|
fail_unless (GST_IS_BUFFER (newbuffer), "Created buffer is not a GstBuffer");
|
|
|
|
/* read/copy the data */
|
|
|
|
memmove (GST_BUFFER_DATA (newbuffer), GST_BUFFER_DATA (buffer),
|
|
|
|
GST_BUFFER_SIZE (buffer));
|
|
|
|
/* validate the buffer */
|
|
|
|
fail_unless (gst_dp_validate_payload (header_length, header,
|
|
|
|
GST_BUFFER_DATA (newbuffer)), "Could not validate payload");
|
|
|
|
|
|
|
|
g_message ("new buffer timestamp: %" GST_TIME_FORMAT "\n",
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (newbuffer)));
|
|
|
|
g_message ("new buffer duration: %" GST_TIME_FORMAT "\n",
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (newbuffer)));
|
|
|
|
g_message ("new buffer offset: %" G_GUINT64_FORMAT "\n",
|
|
|
|
GST_BUFFER_OFFSET (newbuffer));
|
|
|
|
g_message ("new buffer offset_end: %" G_GUINT64_FORMAT "\n",
|
|
|
|
GST_BUFFER_OFFSET_END (newbuffer));
|
|
|
|
fail_unless (GST_BUFFER_TIMESTAMP (newbuffer) ==
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer), "Timestamps don't match !");
|
|
|
|
fail_unless (GST_BUFFER_DURATION (newbuffer) == GST_BUFFER_DURATION (buffer),
|
|
|
|
"Durations don't match !");
|
|
|
|
fail_unless (GST_BUFFER_OFFSET (newbuffer) == GST_BUFFER_OFFSET (buffer),
|
|
|
|
"Offsets don't match !");
|
|
|
|
fail_unless (GST_BUFFER_OFFSET_END (newbuffer) ==
|
|
|
|
GST_BUFFER_OFFSET_END (buffer), "Offset ends don't match !");
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
fail_unless (GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_FLAG_IN_CAPS),
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
"GST_BUFFER_IN_CAPS flag should have been copied !");
|
|
|
|
|
2005-07-12 12:20:01 +00:00
|
|
|
/* clean up */
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
gst_buffer_unref (newbuffer);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
g_free (header);
|
|
|
|
}
|
|
|
|
|
2005-07-12 12:20:01 +00:00
|
|
|
GST_END_TEST;
|
2006-08-08 09:56:45 +00:00
|
|
|
#endif
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_caps)
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
{
|
|
|
|
gchar *string, *newstring;
|
|
|
|
GstCaps *caps, *newcaps;
|
|
|
|
|
|
|
|
guint header_length;
|
|
|
|
guint8 *header, *payload;
|
|
|
|
|
|
|
|
caps = gst_caps_from_string ("audio/x-raw-float, "
|
|
|
|
"rate = (int) [ 11025, 48000 ], "
|
|
|
|
"channels = (int) [ 1, 2 ], " "endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) 32, " "buffer-frames = (int) 0");
|
|
|
|
string = gst_caps_to_string (caps);
|
|
|
|
g_message ("Created caps: %s\n", string);
|
|
|
|
fail_unless (gst_dp_packet_from_caps (caps, 0, &header_length, &header,
|
|
|
|
&payload), "Could not create packet from caps.");
|
|
|
|
|
|
|
|
/* validate the packet */
|
|
|
|
fail_unless (gst_dp_validate_packet (header_length, header, payload),
|
|
|
|
"Could not validate packet");
|
|
|
|
newcaps = gst_dp_caps_from_packet (header_length, header, payload);
|
|
|
|
fail_unless (newcaps != NULL, "Could not create caps from packet");
|
2005-07-12 12:20:01 +00:00
|
|
|
fail_unless (GST_IS_CAPS (newcaps));
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
newstring = gst_caps_to_string (newcaps);
|
|
|
|
g_message ("Received caps: %s\n", newstring);
|
|
|
|
fail_unless (strcmp (string, newstring) == 0,
|
|
|
|
"Created caps do not match original caps");
|
2005-07-12 12:20:01 +00:00
|
|
|
|
|
|
|
/* cleanup */
|
2005-10-10 23:55:39 +00:00
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_caps_unref (newcaps);
|
2005-07-12 12:20:01 +00:00
|
|
|
g_free (header);
|
|
|
|
g_free (payload);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
g_free (string);
|
|
|
|
g_free (newstring);
|
|
|
|
}
|
|
|
|
|
2005-07-12 12:20:01 +00:00
|
|
|
GST_END_TEST;
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_event)
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
{
|
|
|
|
GstEvent *send;
|
|
|
|
GstEvent *receive;
|
|
|
|
guint header_length;
|
|
|
|
guint8 *header, *payload;
|
|
|
|
|
|
|
|
g_message ("Testing EOS event at 1s\n");
|
2005-07-27 18:47:48 +00:00
|
|
|
send = gst_event_new_eos ();
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
GST_EVENT_TIMESTAMP (send) = GST_SECOND;
|
|
|
|
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
|
|
|
|
&header_length, &header, &payload),
|
|
|
|
"Could not create packet from eos event");
|
|
|
|
|
|
|
|
receive = gst_dp_event_from_packet (header_length, header, payload);
|
|
|
|
|
|
|
|
g_message ("EOS, timestamp %" GST_TIME_FORMAT "\n",
|
|
|
|
GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)));
|
|
|
|
fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_EOS,
|
|
|
|
"Received event is not EOS");
|
|
|
|
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND,
|
|
|
|
"EOS timestamp is not 1.0 sec");
|
2005-07-12 12:20:01 +00:00
|
|
|
|
|
|
|
/* clean up */
|
|
|
|
g_free (header);
|
|
|
|
g_free (payload);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gst_event_unref (send);
|
|
|
|
gst_event_unref (receive);
|
|
|
|
|
|
|
|
g_message ("Testing FLUSH event at 2s\n");
|
2005-07-27 18:47:48 +00:00
|
|
|
send = gst_event_new_flush_start ();
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
GST_EVENT_TIMESTAMP (send) = GST_SECOND * 2;
|
|
|
|
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
|
|
|
|
&header_length, &header, &payload),
|
|
|
|
"Could not create packet from flush event");
|
|
|
|
|
|
|
|
receive = gst_dp_event_from_packet (header_length, header, payload);
|
|
|
|
|
|
|
|
g_message ("Flush, timestamp %" GST_TIME_FORMAT "\n",
|
|
|
|
GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)));
|
2005-07-27 18:47:48 +00:00
|
|
|
fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_FLUSH_START,
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
"Received event is not flush");
|
|
|
|
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 2,
|
|
|
|
"Flush timestamp is not 2.0 sec");
|
2005-07-12 12:20:01 +00:00
|
|
|
|
|
|
|
/* clean up */
|
|
|
|
g_free (header);
|
|
|
|
g_free (payload);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gst_event_unref (send);
|
|
|
|
gst_event_unref (receive);
|
|
|
|
|
|
|
|
g_message ("Testing SEEK event with 1 second at 3 seconds\n");
|
2005-07-27 18:47:48 +00:00
|
|
|
send =
|
|
|
|
gst_event_new_seek (1.0, GST_FORMAT_TIME, 0, GST_SEEK_TYPE_SET,
|
|
|
|
GST_SECOND, GST_SEEK_TYPE_NONE, 0);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
GST_EVENT_TIMESTAMP (send) = GST_SECOND * 3;
|
|
|
|
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
|
|
|
|
&header_length, &header, &payload),
|
|
|
|
"Could not create packet from seek event");
|
|
|
|
|
|
|
|
receive = gst_dp_event_from_packet (header_length, header, payload);
|
|
|
|
|
2005-07-27 18:47:48 +00:00
|
|
|
{
|
|
|
|
gdouble rate;
|
|
|
|
GstFormat format;
|
|
|
|
GstSeekFlags flags;
|
|
|
|
GstSeekType cur_type, stop_type;
|
|
|
|
gint64 cur, stop;
|
|
|
|
|
|
|
|
gst_event_parse_seek (receive, &rate, &format, &flags,
|
|
|
|
&cur_type, &cur, &stop_type, &stop);
|
|
|
|
|
|
|
|
g_message ("Seek, timestamp %" GST_TIME_FORMAT ", to %" GST_TIME_FORMAT
|
|
|
|
"\n", GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)),
|
|
|
|
GST_TIME_ARGS (cur));
|
|
|
|
fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_SEEK,
|
|
|
|
"Returned event is not seek");
|
|
|
|
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 3,
|
|
|
|
"Seek timestamp is not 3.0 sec");
|
|
|
|
fail_unless (format == GST_FORMAT_TIME, "Seek format is not time");
|
|
|
|
fail_unless (cur == GST_SECOND, "Seek cur is not 1.0 sec");
|
|
|
|
}
|
2005-07-12 12:20:01 +00:00
|
|
|
|
|
|
|
/* clean up */
|
|
|
|
g_free (header);
|
|
|
|
g_free (payload);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gst_event_unref (send);
|
|
|
|
gst_event_unref (receive);
|
|
|
|
}
|
2005-07-12 12:20:01 +00:00
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
libs/gst/dataprotocol/dataprotocol.c: Make debug category static
Original commit message from CVS:
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer_any), (gst_dp_packet_from_caps_any),
(gst_dp_crc), (gst_dp_header_payload_length),
(gst_dp_header_payload_type), (gst_dp_packet_from_event),
(gst_dp_packet_from_event_1_0), (gst_dp_buffer_from_header),
(gst_dp_caps_from_packet), (gst_dp_event_from_packet_0_2),
(gst_dp_event_from_packet), (gst_dp_validate_header),
(gst_dp_validate_payload):
Make debug category static
Constify the crc table.
Do some more arg checking in public functions.
Fix some docs and do some small cleanups.
* tests/check/libs/gdp.c: (GST_START_TEST), (gst_dp_suite):
Add some more checks to see if GDP deals with bogus input.
2006-08-02 15:19:30 +00:00
|
|
|
/* try to segfault the thing by passing NULLs, short headers, etc.. */
|
|
|
|
GST_START_TEST (test_memory)
|
|
|
|
{
|
|
|
|
guint8 foo[5];
|
|
|
|
GstBuffer *buffer;
|
|
|
|
GstCaps *caps;
|
|
|
|
GstEvent *event;
|
|
|
|
guint length;
|
|
|
|
guint8 *header;
|
|
|
|
guint8 *payload;
|
|
|
|
|
|
|
|
/* check 0 sized input, data pointer can be NULL or anything. CRC is always 0,
|
|
|
|
* though. */
|
|
|
|
fail_if (gst_dp_crc (NULL, 0) != 0);
|
|
|
|
fail_if (gst_dp_crc (foo, 0) != 0);
|
|
|
|
|
|
|
|
/* this is very invalid input and gives a warning. */
|
|
|
|
ASSERT_CRITICAL (gst_dp_crc (NULL, 1));
|
|
|
|
ASSERT_CRITICAL (gst_dp_header_payload_length (NULL));
|
|
|
|
ASSERT_CRITICAL (gst_dp_header_payload_type (NULL));
|
|
|
|
|
|
|
|
/* wrong */
|
|
|
|
ASSERT_CRITICAL (gst_dp_header_from_buffer (NULL, 0, NULL, NULL));
|
|
|
|
|
|
|
|
/* empty buffer has NULL as data pointer */
|
|
|
|
buffer = gst_buffer_new_and_alloc (0);
|
|
|
|
|
|
|
|
/* no place to store the length and/or header data */
|
|
|
|
ASSERT_CRITICAL (gst_dp_header_from_buffer (buffer, 0, NULL, NULL));
|
|
|
|
ASSERT_CRITICAL (gst_dp_header_from_buffer (buffer, 0, &length, NULL));
|
|
|
|
|
|
|
|
/* this should work fine */
|
|
|
|
fail_if (gst_dp_header_from_buffer (buffer, 0, &length, &header) != TRUE);
|
|
|
|
fail_unless (length != 0);
|
|
|
|
fail_unless (header != NULL);
|
|
|
|
|
|
|
|
/* this should validate */
|
|
|
|
fail_if (gst_dp_validate_header (length, header) == FALSE);
|
|
|
|
|
|
|
|
/* NULL header pointer */
|
|
|
|
ASSERT_CRITICAL (gst_dp_validate_header (length, NULL));
|
|
|
|
/* short header */
|
|
|
|
ASSERT_CRITICAL (gst_dp_validate_header (5, header));
|
|
|
|
|
|
|
|
g_free (header);
|
|
|
|
|
|
|
|
/* this should work and not crash trying to calc a CRC on a 0 sized buffer */
|
|
|
|
fail_if (gst_dp_header_from_buffer (buffer,
|
|
|
|
GST_DP_HEADER_FLAG_CRC_HEADER | GST_DP_HEADER_FLAG_CRC_PAYLOAD,
|
|
|
|
&length, &header) != TRUE);
|
|
|
|
|
|
|
|
/* this should validate */
|
|
|
|
fail_if (gst_dp_validate_header (length, header) == FALSE);
|
|
|
|
|
|
|
|
/* there was no payload, NULL as payload data should validate the CRC
|
|
|
|
* checks and all. */
|
|
|
|
fail_if (gst_dp_validate_payload (length, header, NULL) == FALSE);
|
|
|
|
|
|
|
|
/* and the whole packet as well */
|
|
|
|
fail_if (gst_dp_validate_packet (length, header, NULL) == FALSE);
|
|
|
|
|
|
|
|
/* some bogus length */
|
|
|
|
ASSERT_CRITICAL (gst_dp_validate_packet (5, header, NULL));
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
/* create buffer from header data, integrity tested elsewhere */
|
|
|
|
buffer = gst_dp_buffer_from_header (length, header);
|
|
|
|
fail_if (buffer == NULL);
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
g_free (header);
|
|
|
|
|
|
|
|
ASSERT_CRITICAL (gst_dp_packet_from_caps (NULL, 0, NULL, NULL, NULL));
|
|
|
|
|
|
|
|
/* some caps stuff */
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
ASSERT_CRITICAL (gst_dp_packet_from_caps (caps, 0, NULL, NULL, NULL));
|
|
|
|
ASSERT_CRITICAL (gst_dp_packet_from_caps (caps, 0, &length, NULL, NULL));
|
|
|
|
ASSERT_CRITICAL (gst_dp_packet_from_caps (caps, 0, &length, &header, NULL));
|
|
|
|
|
|
|
|
fail_if (gst_dp_packet_from_caps (caps, 0, &length, &header,
|
|
|
|
&payload) != TRUE);
|
|
|
|
fail_if (strcmp ((const gchar *) payload, "EMPTY") != 0);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
caps = gst_dp_caps_from_packet (length, header, payload);
|
|
|
|
fail_if (caps == NULL);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
g_free (header);
|
|
|
|
g_free (payload);
|
|
|
|
|
|
|
|
/* some event stuff */
|
|
|
|
event = gst_event_new_eos ();
|
|
|
|
ASSERT_CRITICAL (gst_dp_packet_from_event (event, 0, NULL, NULL, NULL));
|
|
|
|
ASSERT_CRITICAL (gst_dp_packet_from_event (event, 0, &length, NULL, NULL));
|
|
|
|
ASSERT_CRITICAL (gst_dp_packet_from_event (event, 0, &length, &header, NULL));
|
|
|
|
|
|
|
|
/* payload is not NULL from previous test and points to freed memory, very
|
|
|
|
* invalid. */
|
|
|
|
fail_if (payload == NULL);
|
|
|
|
fail_if (gst_dp_packet_from_event (event, 0, &length, &header,
|
|
|
|
&payload) != TRUE);
|
|
|
|
|
|
|
|
/* the EOS event has no payload */
|
|
|
|
fail_if (payload != NULL);
|
|
|
|
gst_event_unref (event);
|
|
|
|
|
|
|
|
event = gst_dp_event_from_packet (length, header, payload);
|
|
|
|
fail_if (event == NULL);
|
|
|
|
fail_if (GST_EVENT_TYPE (event) != GST_EVENT_EOS);
|
|
|
|
gst_event_unref (event);
|
|
|
|
|
|
|
|
g_free (header);
|
|
|
|
g_free (payload);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-08-10 20:05:30 +00:00
|
|
|
#endif
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static Suite *
|
2006-07-01 20:56:56 +00:00
|
|
|
gst_dp_suite (void)
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
{
|
|
|
|
Suite *s = suite_create ("data protocol");
|
|
|
|
TCase *tc_chain = tcase_create ("general");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
|
|
|
tcase_add_test (tc_chain, test_conversion);
|
2006-08-11 15:26:33 +00:00
|
|
|
#ifndef GST_REMOVE_DEPRECATED
|
2006-08-08 09:07:34 +00:00
|
|
|
#ifndef HAVE_CPU_PPC64
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
tcase_add_test (tc_chain, test_buffer);
|
2006-07-20 10:25:28 +00:00
|
|
|
#endif
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
tcase_add_test (tc_chain, test_caps);
|
|
|
|
tcase_add_test (tc_chain, test_event);
|
libs/gst/dataprotocol/dataprotocol.c: Make debug category static
Original commit message from CVS:
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer_any), (gst_dp_packet_from_caps_any),
(gst_dp_crc), (gst_dp_header_payload_length),
(gst_dp_header_payload_type), (gst_dp_packet_from_event),
(gst_dp_packet_from_event_1_0), (gst_dp_buffer_from_header),
(gst_dp_caps_from_packet), (gst_dp_event_from_packet_0_2),
(gst_dp_event_from_packet), (gst_dp_validate_header),
(gst_dp_validate_payload):
Make debug category static
Constify the crc table.
Do some more arg checking in public functions.
Fix some docs and do some small cleanups.
* tests/check/libs/gdp.c: (GST_START_TEST), (gst_dp_suite):
Add some more checks to see if GDP deals with bogus input.
2006-08-02 15:19:30 +00:00
|
|
|
tcase_add_test (tc_chain, test_memory);
|
2006-08-10 20:05:30 +00:00
|
|
|
#endif
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2006-07-01 20:56:56 +00:00
|
|
|
GST_CHECK_MAIN (gst_dp);
|