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.
This commit is contained in:
Dario Casalinuovo 2016-05-19 02:08:39 +02:00
parent 51c8ec34d0
commit e7a7cd4eda
3 changed files with 48 additions and 1 deletions

View File

@ -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 ;

View File

@ -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++ ]
;

View File

@ -0,0 +1,37 @@
/*
* Copyright 2016, Dario Casalinuovo
* Distributed under the terms of the MIT License.
*/
#include <MediaFile.h>
#include <Url.h>
#include <stdio.h>
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);
}