2002-07-28 22:45:45 +00:00
|
|
|
/* gstcdplay
|
|
|
|
* Copyright (c) 2002 Charles Schmidt <cbschmid@uiuc.edu>
|
|
|
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* THIS DOES NOT WORK YET */
|
|
|
|
|
|
|
|
#define CDPLAYER(x) ((CDPlayer *)x)
|
|
|
|
#define FD(x) ((int)x)
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
gboolean cd_init(struct cd *cd,const gchar *device)
|
2002-07-28 22:45:45 +00:00
|
|
|
{
|
2004-03-15 16:32:54 +00:00
|
|
|
CDPLAYER *cdplayer;
|
|
|
|
CDSTATUS status;
|
|
|
|
CDTRACKINFO info;
|
|
|
|
guint i;
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
cdplayer = CDOpen(device,"r");
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
if (cdplayer == NULL) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
cd->fd = FD(cdplayer);
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
if (CDgetstatus(cdplayer,&status) == 0) {
|
|
|
|
CDclose(cdplayer);
|
|
|
|
cd->fd = 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
for (i = 1; i < status.last; i++) {
|
|
|
|
if (CDgettrackinfo(cdplayer,i,&info) == 0) {
|
|
|
|
CDclose(cdplayer);
|
|
|
|
cd->fd = 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
cd->tracks[i].minute = info.start_min;
|
|
|
|
cd->tracks[i].second = info.start_sec;
|
|
|
|
cd->tracks[i].frame = info.start_frame;
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
}
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
/* there is no leadout information */
|
|
|
|
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
cd->num_tracks = status.last;
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
return TRUE;
|
2002-07-28 22:45:45 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
gboolean cd_start(struct cd *cd,gint start_track,gint end_track)
|
2002-07-28 22:45:45 +00:00
|
|
|
{
|
2004-03-15 16:32:54 +00:00
|
|
|
if (cd->fd == 0) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
cd_fix_track_range(cd,&start_track,&end_track);
|
2002-07-28 22:45:45 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
|
2002-07-28 22:45:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
gboolean cd_pause(struct cd *cd)
|
2002-07-28 22:45:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
gboolean cd_resume(struct cd *cd)
|
2002-07-28 22:45:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
gboolean cd_stop(struct cd *cd)
|
2002-07-28 22:45:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -1 for error, 0 for not playing, 1 for playing */
|
2004-03-15 16:32:54 +00:00
|
|
|
CDStatus cd_status(struct cd *cd)
|
2002-07-28 22:45:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
gint cd_current_track(struct cd *cd)
|
2002-07-28 22:45:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
gboolean cd_close(struct cd *cd)
|
2002-07-28 22:45:45 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2004-03-15 16:32:54 +00:00
|
|
|
|