mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 16:18:16 +00:00
added timecache testing code
Original commit message from CVS: added timecache testing code
This commit is contained in:
parent
c6127f065d
commit
7adfdaf6dc
2 changed files with 67 additions and 1 deletions
|
@ -3,7 +3,7 @@ SUBDIRS = sched eos nego muxing
|
|||
noinst_PROGRAMS = init loadall simplefake states caps queue registry \
|
||||
paranoia rip mp3encode autoplug props case4 markup load tee autoplug2 autoplug3 \
|
||||
capsconnect padfactory autoplug4 incsched reaping threadlock mp1vid reconnect \
|
||||
faketest events
|
||||
faketest events timecache
|
||||
|
||||
# we have nothing but apps here, we can do this safely
|
||||
LIBS += $(GST_LIBS)
|
||||
|
|
66
tests/timecache.c
Normal file
66
tests/timecache.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
int main(int argc,char *argv[]) {
|
||||
GstTimeCache *tc;
|
||||
gint64 timestamp;
|
||||
guint64 location;
|
||||
gint group;
|
||||
GstTimeCacheCertainty certain;
|
||||
|
||||
gst_init(&argc,&argv);
|
||||
|
||||
tc = gst_timecache_new();
|
||||
g_return_if_fail(tc != NULL);
|
||||
|
||||
fprintf(stderr,"current group in timecache is %d\n",gst_timecache_get_group(tc));
|
||||
|
||||
// add an entry
|
||||
gst_timecache_add_entry(tc,0LL,0LL);
|
||||
|
||||
// test for new entry
|
||||
if (gst_timecache_find_location(tc,0LL,×tamp))
|
||||
fprintf(stderr,"found timestamp %Ld for location 0\n",timestamp);
|
||||
else
|
||||
fprintf(stderr,"ERROR: couldn't find timestamp for newly added entry at 0\n");
|
||||
|
||||
// test for entry not there
|
||||
if (gst_timecache_find_location(tc,1024LL,×tamp))
|
||||
fprintf(stderr,"ERROR: found timestamp %Ld for location 1024\n",timestamp);
|
||||
else
|
||||
fprintf(stderr,"no timestamp found at 1024\n");
|
||||
|
||||
// add another entry
|
||||
gst_timecache_add_entry(tc,1024LL,1000000LL);
|
||||
|
||||
// test for new entry
|
||||
if (gst_timecache_find_location(tc,1024LL,×tamp))
|
||||
fprintf(stderr,"found timestamp %Ld for location 1024\n",timestamp);
|
||||
else
|
||||
fprintf(stderr,"ERROR: couldn't find timestamp for newly added entry at 1024\n");
|
||||
|
||||
// test for new entry
|
||||
if (gst_timecache_find_timestamp(tc,1000000LL,&location))
|
||||
fprintf(stderr,"found location %Ld for location 1000000\n",location);
|
||||
else
|
||||
fprintf(stderr,"ERROR: couldn't find location for newly added entry at 1000000\n");
|
||||
|
||||
|
||||
// create a new group
|
||||
group = gst_timecache_new_group(tc);
|
||||
|
||||
// add a couple entries
|
||||
gst_timecache_add_entry(tc, 2048LL,2000000LL);
|
||||
gst_timecache_add_entry(tc, 3072LL,3000000LL);
|
||||
|
||||
// first test for an existing entry
|
||||
if (gst_timecache_find_timestamp(tc,1000000LL,&location))
|
||||
fprintf(stderr,"found location %Ld for location 1000000\n",location);
|
||||
else
|
||||
fprintf(stderr,"ERROR: couldn't find location for old entry at 1000000\n");
|
||||
|
||||
// then test for an new entry in the current group
|
||||
if (gst_timecache_find_timestamp(tc,3000000LL,&location))
|
||||
fprintf(stderr,"found location %Ld for location 3000000\n",location);
|
||||
else
|
||||
fprintf(stderr,"ERROR: couldn't find location for old entry at 3000000\n");
|
||||
}
|
Loading…
Reference in a new issue