Commit 2fc112a1 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

libvlc: Test preparsing.

parent 8d6ec464
...@@ -15,6 +15,7 @@ extra_check_verbose__0 = $(extra_check_verbose_0) ...@@ -15,6 +15,7 @@ extra_check_verbose__0 = $(extra_check_verbose_0)
check_PROGRAMS = \ check_PROGRAMS = \
test_libvlc_core \ test_libvlc_core \
test_libvlc_events \ test_libvlc_events \
test_libvlc_media \
test_libvlc_media_list \ test_libvlc_media_list \
test_libvlc_media_player \ test_libvlc_media_player \
test_src_misc_variables \ test_src_misc_variables \
...@@ -60,6 +61,11 @@ test_libvlc_events_LDADD = $(top_builddir)/src/libvlc.la ...@@ -60,6 +61,11 @@ test_libvlc_events_LDADD = $(top_builddir)/src/libvlc.la
test_libvlc_events_CFLAGS = $(CFLAGS_tests) test_libvlc_events_CFLAGS = $(CFLAGS_tests)
test_libvlc_events_LDFLAGS = $(LDFLAGS_tests) test_libvlc_events_LDFLAGS = $(LDFLAGS_tests)
test_libvlc_media_SOURCES = libvlc/media.c
test_libvlc_media_LDADD = $(top_builddir)/src/libvlc.la
test_libvlc_media_CFLAGS = $(CFLAGS_tests)
test_libvlc_media_LDFLAGS = $(LDFLAGS_tests)
test_libvlc_media_list_player_SOURCES = libvlc/media_list_player.c test_libvlc_media_list_player_SOURCES = libvlc/media_list_player.c
test_libvlc_media_list_player_LDADD = $(top_builddir)/src/libvlc.la test_libvlc_media_list_player_LDADD = $(top_builddir)/src/libvlc.la
test_libvlc_media_list_player_CFLAGS = $(CFLAGS_tests) test_libvlc_media_list_player_CFLAGS = $(CFLAGS_tests)
......
/*
* media_player.c - libvlc smoke test
*
* $Id$
*/
/**********************************************************************
* Copyright (C) 2007 Rémi Denis-Courmont. *
* This program is free software; you can redistribute and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation; 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, you can get it from: *
* http://www.gnu.org/copyleft/gpl.html *
**********************************************************************/
#include "test.h"
static void preparsed_changed(const libvlc_event_t *event, void *user_data)
{
(void)event;
int *received = user_data;
*received = true;
}
static void test_media_preparsed(const char** argv, int argc)
{
const char * file = test_default_sample;
log ("Testing set_media\n");
libvlc_instance_t *vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
libvlc_media_t *media = libvlc_media_new_path (vlc, file);
assert (media != NULL);
int received = false;
// Force preparsing. FIXME - Expose a better API for that.
libvlc_media_es_t *es;
int num = libvlc_media_get_es(media, &es);
free(es);
libvlc_event_manager_t *em = libvlc_media_event_manager (media);
libvlc_event_attach (em, libvlc_MediaPreparsedChanged, preparsed_changed, &received);
// Wait to see if we properly receive preparsed.
while (!received);
// We are good, now check Elementary Stream info.
num = libvlc_media_get_es(media, &es);
assert(num > 0);
free(es);
libvlc_media_release (media);
libvlc_release (vlc);
}
int main (void)
{
test_init();
test_media_preparsed (test_defaults_args, test_defaults_nargs);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment