mirror of
https://review.haiku-os.org/haiku
synced 2025-02-06 22:05:27 +01:00
2a2eb31535
for the third time. :P - Implement CDDBServer class. - Include relevant CDDB commands. - Initial processing of CDDB data. Change device name. This is close to be complete but I hit some cdda-fs bugs that need to be fixed before I will finish this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30703 a95241bf-73f2-0310-859d-f6bbb57e9c96
74 lines
1.3 KiB
C++
74 lines
1.3 KiB
C++
/*
|
|
* Copyright 2008-2009, Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* Bruno Albuquerque, bga@bug-br.org.br
|
|
*/
|
|
|
|
#ifndef _CDDB_SERVER_H
|
|
#define _CDDB_SERVER_H
|
|
|
|
#include <List.h>
|
|
#include <NetAddress.h>
|
|
#include <NetEndpoint.h>
|
|
#include <String.h>
|
|
|
|
#include <scsi_cmds.h>
|
|
|
|
|
|
// CD track specific data.
|
|
struct TrackData {
|
|
uint32 trackNumber;
|
|
BString title;
|
|
BString artist;
|
|
};
|
|
|
|
|
|
// Query command response.
|
|
struct QueryResponseData {
|
|
BString category;
|
|
BString cddbId;
|
|
BString artist;
|
|
BString title;
|
|
};
|
|
|
|
|
|
// Read command response.
|
|
struct ReadResponseData {
|
|
BString title;
|
|
BString artist;
|
|
BString genre;
|
|
uint32 year;
|
|
BList tracks; // TrackData items.
|
|
};
|
|
|
|
|
|
class CDDBServer {
|
|
public:
|
|
CDDBServer(const BString& cddbServer);
|
|
|
|
// CDDB commands interface.
|
|
status_t Query(uint32 cddbId, const scsi_toc_toc* toc,
|
|
BList* queryResponse);
|
|
status_t Read(QueryResponseData* diskData,
|
|
ReadResponseData* readResponse);
|
|
|
|
private:
|
|
status_t _ParseAddress(const BString& cddbServer);
|
|
|
|
status_t _OpenConnection();
|
|
void _CloseConnection();
|
|
|
|
status_t _SendCddbCommand(const BString& command, BString* output);
|
|
|
|
BString fLocalHostName;
|
|
BString fLocalUserName;
|
|
BNetAddress fCddbServerAddr;
|
|
BNetEndpoint fConnection;
|
|
bool fInitialized;
|
|
bool fConnected;
|
|
};
|
|
|
|
#endif // _CDDB_SERVER_H
|