1 /* 2 * Copyright 2016, Dario Casalinuovo 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <MediaFile.h> 8 #include <Url.h> 9 10 #include <stdio.h> 11 12 13 int main(int argc, char *argv[]) 14 { 15 if (argv[1] == NULL) { 16 printf("Specify an URL or a PATH\n"); 17 return 0; 18 } 19 20 printf("Instantiating the BMediaFile\n"); 21 22 BUrl url = BUrl(argv[1]); 23 if (!url.IsValid()) { 24 printf("Invalid URL\n"); 25 return 0; 26 } 27 28 BMediaFile* mediaFile = new BMediaFile(url); 29 if (mediaFile->InitCheck() != B_OK) { 30 printf("Failed creation of BMediaFile!\n"); 31 printf("Error: %s\n", strerror(mediaFile->InitCheck())); 32 } else { 33 printf("Sniffing Success!\n"); 34 35 printf("Tracks Detected: %d\n", mediaFile->CountTracks()); 36 37 sleep(5); 38 } 39 delete mediaFile; 40 return 0; 41 } 42