From e7a7cd4eda64b1c6c6695b2e7cea06235ac08b1b Mon Sep 17 00:00:00 2001 From: Dario Casalinuovo Date: Thu, 19 May 2016 02:08:39 +0200 Subject: [PATCH] Add streamer_sniff_test * This is a simple test that open an url for streaming using BMediaFile, the purpose is to test if streamers sniffing work well. --- src/tests/kits/media/Jamfile | 3 +- .../kits/media/streamer_sniff_test/Jamfile | 9 +++++ .../kits/media/streamer_sniff_test/main.cpp | 37 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/tests/kits/media/streamer_sniff_test/Jamfile create mode 100644 src/tests/kits/media/streamer_sniff_test/main.cpp diff --git a/src/tests/kits/media/Jamfile b/src/tests/kits/media/Jamfile index d7ed90698e..f33c30815a 100644 --- a/src/tests/kits/media/Jamfile +++ b/src/tests/kits/media/Jamfile @@ -21,10 +21,11 @@ UnitTestLib libmediatest.so : SubInclude HAIKU_TOP src tests kits media media_decoder ; SubInclude HAIKU_TOP src tests kits media mpeg2_decoder_test ; SubInclude HAIKU_TOP src tests kits media mp3_decoder_test ; +SubInclude HAIKU_TOP src tests kits media mp3_reader_test ; SubInclude HAIKU_TOP src tests kits media notificationtest ; SubInclude HAIKU_TOP src tests kits media nodetest ; SubInclude HAIKU_TOP src tests kits media playwav ; -SubInclude HAIKU_TOP src tests kits media mp3_reader_test ; SubInclude HAIKU_TOP src tests kits media soundplayer ; +SubInclude HAIKU_TOP src tests kits media streamer_sniff_test ; SubInclude HAIKU_TOP src tests kits media wav_reader_test ; diff --git a/src/tests/kits/media/streamer_sniff_test/Jamfile b/src/tests/kits/media/streamer_sniff_test/Jamfile new file mode 100644 index 0000000000..7b27a40464 --- /dev/null +++ b/src/tests/kits/media/streamer_sniff_test/Jamfile @@ -0,0 +1,9 @@ +SubDir HAIKU_TOP src tests kits media streamer_sniff_test ; + +UsePrivateHeaders media ; + +SimpleTest streamer_sniff_test + : + main.cpp + : media be bnetapi [ TargetLibsupc++ ] +; diff --git a/src/tests/kits/media/streamer_sniff_test/main.cpp b/src/tests/kits/media/streamer_sniff_test/main.cpp new file mode 100644 index 0000000000..6d40713bb8 --- /dev/null +++ b/src/tests/kits/media/streamer_sniff_test/main.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2016, Dario Casalinuovo + * Distributed under the terms of the MIT License. + */ + + +#include +#include + +#include + + +int main(int argc, char *argv[]) +{ + if (argv[1] == NULL) { + printf("Specify an URL or a PATH\n"); + return 0; + } + + printf("Instantiating the BMediaFile\n"); + + BUrl* url = new BUrl(argv[1]); + if (!url->IsValid()) { + printf("Invalid URL\n"); + return 0; + } + + BMediaFile* mediaFile = new BMediaFile(url); + if (mediaFile->InitCheck() != B_OK) { + printf("Failed creation of BMediaFile!\n"); + printf("Error: %s\n", strerror(mediaFile->InitCheck())); + return 0; + } + + printf("Success!\n"); + sleep(5); +}