The example in this article describes the method that C + + implements to display MP3 file information. Share to everyone for your reference. The implementation method is as follows:
/** * This is small example you to use Libzplay the library to play files.
* This example are using OpenFile functions to open disk files and play. * #define Win32_lean_and_mean #include <windows.h> #include <olectl.h> #include <ole2.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #include <dos.h> # Include <conio.h> #include ".
/include/libzplay.h "using namespace Libzplay;
zplay* player; int __stdcall Callbackfunc (void* instance, void *user_data, tcallbackmessage message, unsigned int param1, unsigned int pa
RAM2);
int main (int argc, char **argv) {//Clear Screen system ("CLS");
Create class instance player = Createzplay (); Chek If we have class instance if (Player = 0) {printf (' Error:can ' t create class instance!npress key to exit
. N ");
Getch ();
return 0;
}//Get library version int ver = player->getversion ();
Check if we have version 2.00 and above if (ver <) {printf ("Error:need library version 2.00 and above!npress key to exit.\r\n");
Getch ();
Player->release ();
return 0; }//Display version Info printf ("Libzplay v.%i.%0
2i\r\n\r\n ", ver/100, ver% 100);
if (argc > 1) {tid3infoex id3_info; if (Player->loadfileid3ex (argv[1], Sfautodetect, &id3_info, 1))//loading ID3v2 {printf ("Title:%s\r\n" , Id3_info.
Title); printf ("Artist:%s\r\n", Id3_info.)
Artist); printf ("Album:%s\r\n", Id3_info.)
Album); printf ("Year:%s\r\n", Id3_info).
year);
printf ("Comment:%s\r\n", id3_info.comment); printf ("Genre:%s\r\n", Id3_info.)
genre); printf ("Track:%s\r\n\r\n", Id3_info.)
Tracknum); printf ("Artist1:%s\r\n", Id3_info.)
Albumartist);
printf ("Composer:%s\r\n", id3_info.composer); printf ("Original:%s\r\n", Id3_info.)
Originalartist); printf ("Copyright:%s\r\n", Id3_info).
Copyright); printf ("URL:%s\r\n", ID3_info.
URL); printf ("Encoder:%s\r\n", Id3_info.)
Encoder); printf ("Publisher:%s\r\n", Id3_info.)
Publisher); printf ("BPM:%u\r\n", Id3_info.)
BPM); printf ("MIME:%s\r\n", Id3_info.)
Picture.mimetype); printf ("TYPE:%u\r\n", Id3_info.)
Picture.picturetype); printf ("Desc:%s\r\n", Id3_info.)
Picture.description); printf ("Size:%u\r\n", Id3_info.)
Picture.picturedatasize); Draw picture on desktop window Player->drawbitmaptohwnd (NULL, 0, 0, 0, 0, Id3_info.)
PICTURE.HBITMAP);
else {printf ("No ID3 data\r\n\r\n"); } else {//no filename in argument player->release ();//delete Zplay class char *end = STRRCHR (
Argv[0], ' \ ');
if (End && * (end + 1)!= 0) end++;
else end = Argv[0];
printf ("Usage:%s filename\r\n\r\npress key to exit\r\n", end);
Getch ();
return 0;
} getch (); }
I hope this article will help you with your C + + programming.