diff options
author | Johan Dahlin <johan@gnome.org> | 2004-03-15 16:32:54 +0000 |
---|---|---|
committer | Johan Dahlin <johan@gnome.org> | 2004-03-15 16:32:54 +0000 |
commit | 39fd8a2dbd436cbabe5e336d1145b62c2a885ed5 (patch) | |
tree | 61df7da4a9d2b8bdb853af50a27219a8921bf5e4 /sys/cdrom | |
parent | 1633bd8693c54cbc5f6648703a7ecf01548ec55f (diff) | |
download | gstreamer-plugins-bad-39fd8a2dbd436cbabe5e336d1145b62c2a885ed5.tar.gz |
*.h: Revert indenting
Original commit message from CVS:
* *.h: Revert indenting
Diffstat (limited to 'sys/cdrom')
-rw-r--r-- | sys/cdrom/gstcdplayer.h | 41 | ||||
-rw-r--r-- | sys/cdrom/gstcdplayer_ioctl.h | 47 | ||||
-rw-r--r-- | sys/cdrom/gstcdplayer_ioctl_bsd.h | 556 | ||||
-rw-r--r-- | sys/cdrom/gstcdplayer_ioctl_irix.h | 91 | ||||
-rw-r--r-- | sys/cdrom/gstcdplayer_ioctl_solaris.h | 289 |
5 files changed, 499 insertions, 525 deletions
diff --git a/sys/cdrom/gstcdplayer.h b/sys/cdrom/gstcdplayer.h index 60d0b606f..7c6c4bf94 100644 --- a/sys/cdrom/gstcdplayer.h +++ b/sys/cdrom/gstcdplayer.h @@ -35,31 +35,30 @@ typedef struct _CDPlayer CDPlayer; typedef struct _CDPlayerClass CDPlayerClass; -struct _CDPlayer -{ - GstBin element; +struct _CDPlayer { + GstBin element; + + /* properties */ + gchar *device; + gint num_tracks; + gint start_track; + gint end_track; + gint current_track; + guint32 cddb_discid; - /* properties */ - gchar *device; - gint num_tracks; - gint start_track; - gint end_track; - gint current_track; - guint32 cddb_discid; - - /* private */ - struct cd cd; - gboolean paused; + /* private */ + struct cd cd; + gboolean paused; }; -struct _CDPlayerClass -{ - GstBinClass parent_class; +struct _CDPlayerClass { + GstBinClass parent_class; - /* signal callbacks */ - void (*track_change) (GstElement * element, guint track); + /* signal callbacks */ + void (*track_change) (GstElement *element,guint track); }; -GType cdplayer_get_type (void); +GType cdplayer_get_type(void); + +#endif -#endif diff --git a/sys/cdrom/gstcdplayer_ioctl.h b/sys/cdrom/gstcdplayer_ioctl.h index 5998276ed..65bc2c66f 100644 --- a/sys/cdrom/gstcdplayer_ioctl.h +++ b/sys/cdrom/gstcdplayer_ioctl.h @@ -28,40 +28,37 @@ #define CDPLAYER_MAX_TRACKS 128 -typedef enum -{ - CD_PLAYING, - CD_COMPLETED, - CD_ERROR +typedef enum { + CD_PLAYING, + CD_COMPLETED, + CD_ERROR } CDStatus; -struct cd_msf -{ - guint8 minute; - guint8 second; - guint8 frame; +struct cd_msf { + guint8 minute; + guint8 second; + guint8 frame; - gboolean data_track; + gboolean data_track; }; -struct cd -{ - gint fd; - gint num_tracks; - struct cd_msf tracks[CDPLAYER_MAX_TRACKS]; +struct cd { + gint fd; + gint num_tracks; + struct cd_msf tracks[CDPLAYER_MAX_TRACKS]; }; /* these are defined by the different cdrom type header files */ -gboolean cd_init (struct cd *cd, const gchar * device); -gboolean cd_start (struct cd *cd, gint start_track, gint end_track); -gboolean cd_pause (struct cd *cd); -gboolean cd_resume (struct cd *cd); -gboolean cd_stop (struct cd *cd); -CDStatus cd_status (struct cd *cd); -gint cd_current_track (struct cd *cd); -gboolean cd_close (struct cd *cd); +gboolean cd_init(struct cd *cd,const gchar *device); +gboolean cd_start(struct cd *cd,gint start_track,gint end_track); +gboolean cd_pause(struct cd *cd); +gboolean cd_resume(struct cd *cd); +gboolean cd_stop(struct cd *cd); +CDStatus cd_status(struct cd *cd); +gint cd_current_track(struct cd *cd); +gboolean cd_close(struct cd *cd); -guint32 cd_cddb_discid (struct cd *cd); +guint32 cd_cddb_discid(struct cd *cd); #endif diff --git a/sys/cdrom/gstcdplayer_ioctl_bsd.h b/sys/cdrom/gstcdplayer_ioctl_bsd.h index 34c2d9aaa..f8a94cd7e 100644 --- a/sys/cdrom/gstcdplayer_ioctl_bsd.h +++ b/sys/cdrom/gstcdplayer_ioctl_bsd.h @@ -17,337 +17,329 @@ * Boston, MA 02111-1307, USA. */ -#ifdef HAVE_CDROM_BSD_NETBSD /* net & open */ +#ifdef HAVE_CDROM_BSD_NETBSD /* net & open */ #ifndef CDIOREADTOCHDR #define CDIOREADTOCHDR CDIOREADTOCHEADER #endif -gboolean -cd_init (struct cd *cd, const gchar * device) +gboolean cd_init(struct cd *cd,const gchar *device) { - struct ioc_toc_header toc_header; - struct ioc_read_toc_entry toc_entry; - struct cd_toc_entry toc_entry_data; - guint i; - - cd->fd = open (device, O_RDONLY | O_NONBLOCK); - - if (cd->fd == -1) { - return FALSE; - } - - /* get the toc header information */ - if (ioctl (cd->fd, CDIOREADTOCHDR, &toc_header) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - /* read each entry in the toc header */ - for (i = 1; i <= toc_header.ending_track; i++) { - toc_entry.address_format = CD_MSF_FORMAT; - toc_entry.starting_track = i; - toc_entry.data = &toc_entry_data; - toc_entry.data_len = sizeof (toc_entry_data); - - if (ioctl (cd->fd, CDIOREADTOCENTRYS, &toc_entry) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - cd->tracks[i].minute = toc_entry.data->addr.msf.minute; - cd->tracks[i].second = toc_entry.data->addr.msf.second; - cd->tracks[i].frame = toc_entry.data->addr.msf.frame; - cd->tracks[i].data_track = (toc_entry.data->control & 4) == 4; - } - - /* read the leadout */ - toc_entry.address_format = CD_MSF_FORMAT; - toc_entry.starting_track = 0xAA; /* leadout */ - toc_entry.data = &toc_entry_data; - toc_entry.data_len = sizeof (toc_entry_data); - - if (ioctl (cd->fd, CDIOREADTOCENTRYS, &toc_entry) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - cd->tracks[LEADOUT].minute = toc_entry.data->addr.msf.minute; - cd->tracks[LEADOUT].second = toc_entry.data->addr.msf.second; - cd->tracks[LEADOUT].frame = toc_entry.data->addr.msf.frame; - - cd->num_tracks = toc_header.ending_track; - - return TRUE; + struct ioc_toc_header toc_header; + struct ioc_read_toc_entry toc_entry; + struct cd_toc_entry toc_entry_data; + guint i; + + cd->fd = open(device,O_RDONLY | O_NONBLOCK); + + if (cd->fd == -1) { + return FALSE; + } + + /* get the toc header information */ + if (ioctl(cd->fd,CDIOREADTOCHDR,&toc_header) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + /* read each entry in the toc header */ + for (i = 1; i <= toc_header.ending_track; i++) { + toc_entry.address_format = CD_MSF_FORMAT; + toc_entry.starting_track = i; + toc_entry.data = &toc_entry_data; + toc_entry.data_len = sizeof(toc_entry_data); + + if (ioctl(cd->fd,CDIOREADTOCENTRYS,&toc_entry) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + cd->tracks[i].minute = toc_entry.data->addr.msf.minute; + cd->tracks[i].second = toc_entry.data->addr.msf.second; + cd->tracks[i].frame = toc_entry.data->addr.msf.frame; + cd->tracks[i].data_track = (toc_entry.data->control & 4) == 4; + } + + /* read the leadout */ + toc_entry.address_format = CD_MSF_FORMAT; + toc_entry.starting_track = 0xAA; /* leadout */ + toc_entry.data = &toc_entry_data; + toc_entry.data_len = sizeof(toc_entry_data); + + if (ioctl(cd->fd,CDIOREADTOCENTRYS,&toc_entry) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + cd->tracks[LEADOUT].minute = toc_entry.data->addr.msf.minute; + cd->tracks[LEADOUT].second = toc_entry.data->addr.msf.second; + cd->tracks[LEADOUT].frame = toc_entry.data->addr.msf.frame; + + cd->num_tracks = toc_header.ending_track; + + return TRUE; } #elif defined HAVE_CDROM_BSD_DARWIN -gboolean -cd_init (struct cd *cd, const gchar * device) +gboolean cd_init(struct cd *cd,const gchar *device) { - struct ioc_toc_header toc_header; - struct ioc_read_toc_entry toc_entry; - guint i; - - cd->fd = open (device, O_RDONLY | O_NONBLOCK); - - if (cd->fd == -1) { - return FALSE; - } - - /* get the toc header information */ - if (ioctl (cd->fd, CDIOREADTOCHDR, &toc_header) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - /* read each entry in the toc header */ - for (i = 1; i <= toc_header.ending_track; i++) { - toc_entry.address_format = CD_MSF_FORMAT; - toc_entry.starting_track = i; - - if (ioctl (cd->fd, CDIOREADTOCENTRYS, &toc_entry) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - cd->tracks[i].minute = toc_entry.data->addr[1]; - cd->tracks[i].second = toc_entry.data->addr[2]; - cd->tracks[i].frame = toc_entry.data->addr[3]; - cd->tracks[i].data_track = (toc_entry.data->control & 4) == 4; - } - - /* read the leadout */ - toc_entry.address_format = CD_MSF_FORMAT; - toc_entry.starting_track = 0xAA; /* leadout */ - toc_entry.data = &toc_entry_data; - toc_entry.data_len = sizeof (toc_entry_data); - - if (ioctl (cd->fd, CDIOREADTOCENTRYS, &toc_entry) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - cd->tracks[LEADOUT].minute = toc_entry.data->addr[1]; - cd->tracks[LEADOUT].second = toc_entry.data->addr[2]; - cd->tracks[LEADOUT].frame = toc_entry.data->addr[3]; - - cd->num_tracks = toc_header.ending_track; - - return TRUE; + struct ioc_toc_header toc_header; + struct ioc_read_toc_entry toc_entry; + guint i; + + cd->fd = open(device,O_RDONLY | O_NONBLOCK); + + if (cd->fd == -1) { + return FALSE; + } + + /* get the toc header information */ + if (ioctl(cd->fd,CDIOREADTOCHDR,&toc_header) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + /* read each entry in the toc header */ + for (i = 1; i <= toc_header.ending_track; i++) { + toc_entry.address_format = CD_MSF_FORMAT; + toc_entry.starting_track = i; + + if (ioctl(cd->fd,CDIOREADTOCENTRYS,&toc_entry) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + cd->tracks[i].minute = toc_entry.data->addr[1]; + cd->tracks[i].second = toc_entry.data->addr[2]; + cd->tracks[i].frame = toc_entry.data->addr[3]; + cd->tracks[i].data_track = (toc_entry.data->control & 4) == 4; + } + + /* read the leadout */ + toc_entry.address_format = CD_MSF_FORMAT; + toc_entry.starting_track = 0xAA; /* leadout */ + toc_entry.data = &toc_entry_data; + toc_entry.data_len = sizeof(toc_entry_data); + + if (ioctl(cd->fd,CDIOREADTOCENTRYS,&toc_entry) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + cd->tracks[LEADOUT].minute = toc_entry.data->addr[1]; + cd->tracks[LEADOUT].second = toc_entry.data->addr[2]; + cd->tracks[LEADOUT].frame = toc_entry.data->addr[3]; + + cd->num_tracks = toc_header.ending_track; + + return TRUE; } #else /* free */ -gboolean -cd_init (struct cd *cd, const gchar * device) +gboolean cd_init(struct cd *cd,const gchar *device) { - struct ioc_toc_header toc_header; - struct ioc_read_toc_entry toc_entry; - guint i; - - cd->fd = open (device, O_RDONLY | O_NONBLOCK); - - if (cd->fd == -1) { - return FALSE; - } - - /* get the toc header information */ - if (ioctl (cd->fd, CDIOREADTOCHDR, &toc_header) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - /* read each entry in the toc header */ - for (i = 1; i <= toc_header.ending_track; i++) { - toc_entry.address_format = CD_MSF_FORMAT; - toc_entry.starting_track = i; - - if (ioctl (cd->fd, CDIOREADTOCENTRYS, &toc_entry) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - cd->tracks[i].minute = toc_entry.entry.addr.msf.minute; - cd->tracks[i].second = toc_entry.entry.addr.msf.second; - cd->tracks[i].frame = toc_entry.entry.addr.msf.frame; - cd->tracks[i].data_track = (toc_entry.data->control & 4) == 4; - } - - /* read the leadout */ - toc_entry.address_format = CD_MSF_FORMAT; - toc_entry.starting_track = 0xAA; /* leadout */ - toc_entry.data = &toc_entry_data; - toc_entry.data_len = sizeof (toc_entry_data); - - if (ioctl (cd->fd, CDIOREADTOCENTRYS, &toc_entry) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - cd->tracks[LEADOUT].minute = toc_entry.entry.addr.msf.minute; - cd->tracks[LEADOUT].second = toc_entry.entry.addr.msf.second; - cd->tracks[LEADOUT].frame = toc_entry.entry.addr.msf.frame; - - cd->num_tracks = toc_header.ending_track; - - return TRUE; + struct ioc_toc_header toc_header; + struct ioc_read_toc_entry toc_entry; + guint i; + + cd->fd = open(device,O_RDONLY | O_NONBLOCK); + + if (cd->fd == -1) { + return FALSE; + } + + /* get the toc header information */ + if (ioctl(cd->fd,CDIOREADTOCHDR,&toc_header) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + /* read each entry in the toc header */ + for (i = 1; i <= toc_header.ending_track; i++) { + toc_entry.address_format = CD_MSF_FORMAT; + toc_entry.starting_track = i; + + if (ioctl(cd->fd,CDIOREADTOCENTRYS,&toc_entry) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + cd->tracks[i].minute = toc_entry.entry.addr.msf.minute; + cd->tracks[i].second = toc_entry.entry.addr.msf.second; + cd->tracks[i].frame = toc_entry.entry.addr.msf.frame; + cd->tracks[i].data_track = (toc_entry.data->control & 4) == 4; + } + + /* read the leadout */ + toc_entry.address_format = CD_MSF_FORMAT; + toc_entry.starting_track = 0xAA; /* leadout */ + toc_entry.data = &toc_entry_data; + toc_entry.data_len = sizeof(toc_entry_data); + + if (ioctl(cd->fd,CDIOREADTOCENTRYS,&toc_entry) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + cd->tracks[LEADOUT].minute = toc_entry.entry.addr.msf.minute; + cd->tracks[LEADOUT].second = toc_entry.entry.addr.msf.second; + cd->tracks[LEADOUT].frame = toc_entry.entry.addr.msf.frame; + + cd->num_tracks = toc_header.ending_track; + + return TRUE; } #endif -gboolean -cd_start (struct cd * cd, gint start_track, gint end_track) +gboolean cd_start(struct cd *cd,gint start_track,gint end_track) { - struct ioc_play_msf msf; + struct ioc_play_msf msf; - if (cd->fd == -1) { - return FALSE; - } + if (cd->fd == -1) { + return FALSE; + } - cd_fix_track_range (cd, &start_track, &end_track); + cd_fix_track_range(cd,&start_track,&end_track); - msf.start_m = cd->tracks[start_track].minute; - msf.start_s = cd->tracks[start_track].second; - msf.start_f = cd->tracks[start_track].frame; + msf.start_m = cd->tracks[start_track].minute; + msf.start_s = cd->tracks[start_track].second; + msf.start_f = cd->tracks[start_track].frame; - if (end_track == LEADOUT) { - msf.end_m = cd->tracks[end_track].minute; - msf.end_s = cd->tracks[end_track].second; - msf.end_f = cd->tracks[end_track].frame; - } else { - msf.end_m = cd->tracks[end_track + 1].minute; - msf.end_s = cd->tracks[end_track + 1].second; - msf.end_f = cd->tracks[end_track + 1].frame; - } + if (end_track == LEADOUT) { + msf.end_m = cd->tracks[end_track].minute; + msf.end_s = cd->tracks[end_track].second; + msf.end_f = cd->tracks[end_track].frame; + } else { + msf.end_m = cd->tracks[end_track+1].minute; + msf.end_s = cd->tracks[end_track+1].second; + msf.end_f = cd->tracks[end_track+1].frame; + } - if (ioctl (cd->fd, CDIOCPLAYMSF, &msf) != 0) { - return FALSE; - } + if (ioctl(cd->fd,CDIOCPLAYMSF,&msf) != 0) { + return FALSE; + } } -gboolean -cd_pause (struct cd * cd) +gboolean cd_pause(struct cd *cd) { - if (cd->fd == -1) { - return FALSE; - } + if (cd->fd == -1) { + return FALSE; + } - if (ioctl (cd->fd, CDIOCPAUSE, NULL) != 0) { - return FALSE; - } + if (ioctl(cd->fd,CDIOCPAUSE,NULL) != 0) { + return FALSE; + } - return TRUE; + return TRUE; } -gboolean -cd_resume (struct cd * cd) +gboolean cd_resume(struct cd *cd) { - if (cd->fd == -1) { - return FALSE; - } + if (cd->fd == -1) { + return FALSE; + } - if (ioctl (cd->fd, CDIOCRESUME, NULL) != 0) { - return FALSE; - } + if (ioctl(cd->fd,CDIOCRESUME,NULL) != 0) { + return FALSE; + } - return TRUE; + return TRUE; } -gboolean -cd_stop (struct cd * cd) +gboolean cd_stop(struct cd *cd) { - if (cd->fd == -1) { - return FALSE; - } + if (cd->fd == -1) { + return FALSE; + } - if (ioctl (cd->fd, CDIOCSTOP, NULL) != 0) { - return FALSE; - } + if (ioctl(cd->fd,CDIOCSTOP,NULL) != 0) { + return FALSE; + } - return TRUE; + return TRUE; } /* -1 for error, 0 for not playing, 1 for playing */ -CDStatus -cd_status (struct cd * cd) +CDStatus cd_status(struct cd *cd) { - struct ioc_read_subchannel sub_channel; - struct cd_sub_channel_info sub_channel_info; - - if (cd->fd == -1) { - return -1; - } - - sub_channel.address_format = CD_MSF_FORMAT; - sub_channel.data_format = CD_CURRENT_POSITION; - sub_channel.track = 0; - sub_channel.data = &sub_channel_info; - sub_channel.data_len = sizeof (sub_channel_info); - - if (ioctl (cd->fd, CDIOCREADSUBCHANNEL, &sub_channel) != 0) { - return FALSE; - } - - switch (sub_channel.data->header.audio_status) { - case CD_AS_PLAY_IN_PROGRESS: - case CD_AS_PLAY_PAUSED: - return CD_PLAYING; - break; - case CD_AS_PLAY_COMPLETED: - return CD_COMPLETED; - break; - case CD_AS_AUDIO_INVALID: - case CD_AS_PLAY_ERROR: - default: - return CD_ERROR; - break; - - } + struct ioc_read_subchannel sub_channel; + struct cd_sub_channel_info sub_channel_info; + + if (cd->fd == -1) { + return -1; + } + + sub_channel.address_format = CD_MSF_FORMAT; + sub_channel.data_format = CD_CURRENT_POSITION; + sub_channel.track = 0; + sub_channel.data = &sub_channel_info; + sub_channel.data_len = sizeof(sub_channel_info); + + if (ioctl(cd->fd,CDIOCREADSUBCHANNEL,&sub_channel) != 0) { + return FALSE; + } + + switch (sub_channel.data->header.audio_status) { + case CD_AS_PLAY_IN_PROGRESS: + case CD_AS_PLAY_PAUSED: + return CD_PLAYING; + break; + case CD_AS_PLAY_COMPLETED: + return CD_COMPLETED; + break; + case CD_AS_AUDIO_INVALID: + case CD_AS_PLAY_ERROR: + default: + return CD_ERROR; + break; + + } } -gint -cd_current_track (struct cd *cd) +gint cd_current_track(struct cd *cd) { - struct ioc_read_subchannel sub_channel; - struct cd_sub_channel_info sub_channel_info; - - if (cd->fd == -1) { - return -1; - } - - sub_channel.address_format = CD_MSF_FORMAT; - sub_channel.data_format = CD_TRACK_INFO; - sub_channel.track = 0; - sub_channel.data = &sub_channel_info; - sub_channel.data_len = sizeof (sub_channel_info); - - if (ioctl (cd->fd, CDIOCREADSUBCHANNEL, &sub_channel) != 0) { - return -1; - } + struct ioc_read_subchannel sub_channel; + struct cd_sub_channel_info sub_channel_info; + + if (cd->fd == -1) { + return -1; + } + + sub_channel.address_format = CD_MSF_FORMAT; + sub_channel.data_format = CD_TRACK_INFO; + sub_channel.track = 0; + sub_channel.data = &sub_channel_info; + sub_channel.data_len = sizeof(sub_channel_info); + + if (ioctl(cd->fd,CDIOCREADSUBCHANNEL,&sub_channel) != 0) { + return -1; + } + #ifdef __NetBSD__ - return sub_channel.data->what.track_info.track_number; + return sub_channel.data->what.track_info.track_number; #else - return sub_channel.data->track_number; + return sub_channel.data->track_number; #endif } -gboolean -cd_close (struct cd * cd) +gboolean cd_close(struct cd *cd) { - if (cd->fd == -1) { - return TRUE; - } + if (cd->fd == -1) { + return TRUE; + } - if (close (cd->fd) != 0) { - return FALSE; - } + if (close(cd->fd) != 0) { + return FALSE; + } - cd->fd = -1; + cd->fd = -1; - return TRUE; + return TRUE; } + diff --git a/sys/cdrom/gstcdplayer_ioctl_irix.h b/sys/cdrom/gstcdplayer_ioctl_irix.h index fb18c489d..2f6be35cd 100644 --- a/sys/cdrom/gstcdplayer_ioctl_irix.h +++ b/sys/cdrom/gstcdplayer_ioctl_irix.h @@ -22,95 +22,88 @@ #define CDPLAYER(x) ((CDPlayer *)x) #define FD(x) ((int)x) -gboolean -cd_init (struct cd *cd, const gchar * device) +gboolean cd_init(struct cd *cd,const gchar *device) { - CDPLAYER *cdplayer; - CDSTATUS status; - CDTRACKINFO info; - guint i; + CDPLAYER *cdplayer; + CDSTATUS status; + CDTRACKINFO info; + guint i; - cdplayer = CDOpen (device, "r"); + cdplayer = CDOpen(device,"r"); - if (cdplayer == NULL) { - return FALSE; - } + if (cdplayer == NULL) { + return FALSE; + } - cd->fd = FD (cdplayer); + cd->fd = FD(cdplayer); - if (CDgetstatus (cdplayer, &status) == 0) { - CDclose (cdplayer); - cd->fd = 0; - return FALSE; - } + if (CDgetstatus(cdplayer,&status) == 0) { + CDclose(cdplayer); + cd->fd = 0; + return FALSE; + } - for (i = 1; i < status.last; i++) { - if (CDgettrackinfo (cdplayer, i, &info) == 0) { - CDclose (cdplayer); - cd->fd = 0; - return FALSE; - } + for (i = 1; i < status.last; i++) { + if (CDgettrackinfo(cdplayer,i,&info) == 0) { + CDclose(cdplayer); + cd->fd = 0; + return FALSE; + } - cd->tracks[i].minute = info.start_min; - cd->tracks[i].second = info.start_sec; - cd->tracks[i].frame = info.start_frame; + cd->tracks[i].minute = info.start_min; + cd->tracks[i].second = info.start_sec; + cd->tracks[i].frame = info.start_frame; - } + } - /* there is no leadout information */ + /* there is no leadout information */ + + cd->num_tracks = status.last; - cd->num_tracks = status.last; - - return TRUE; + return TRUE; } -gboolean -cd_start (struct cd * cd, gint start_track, gint end_track) +gboolean cd_start(struct cd *cd,gint start_track,gint end_track) { - if (cd->fd == 0) { - return FALSE; - } - - cd_fix_track_range (cd, &start_track, &end_track); + if (cd->fd == 0) { + return FALSE; + } + cd_fix_track_range(cd,&start_track,&end_track); + } -gboolean -cd_pause (struct cd * cd) +gboolean cd_pause(struct cd *cd) { } -gboolean -cd_resume (struct cd *cd) +gboolean cd_resume(struct cd *cd) { } -gboolean -cd_stop (struct cd *cd) +gboolean cd_stop(struct cd *cd) { } /* -1 for error, 0 for not playing, 1 for playing */ -CDStatus -cd_status (struct cd *cd) +CDStatus cd_status(struct cd *cd) { } -gint -cd_current_track (struct cd *cd) +gint cd_current_track(struct cd *cd) { } -gboolean -cd_close (struct cd *cd) +gboolean cd_close(struct cd *cd) { } + diff --git a/sys/cdrom/gstcdplayer_ioctl_solaris.h b/sys/cdrom/gstcdplayer_ioctl_solaris.h index dd91e127d..868fb251f 100644 --- a/sys/cdrom/gstcdplayer_ioctl_solaris.h +++ b/sys/cdrom/gstcdplayer_ioctl_solaris.h @@ -17,195 +17,188 @@ * Boston, MA 02111-1307, USA. */ -gboolean -cd_init (struct cd *cd, const gchar * device) +gboolean cd_init(struct cd *cd,const gchar *device) { - struct cdrom_tochdr toc_header; - struct cdrom_tocentry toc_entry; - guint i; - - cd->fd = open (device, O_RDONLY | O_NONBLOCK); - - if (cd->fd == -1) { - return FALSE; - } - - /* get the toc header information */ - if (ioctl (cd->fd, CDROMREADTOCHDR, &toc_header) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - /* read each entry in the toc header */ - for (i = 1; i <= toc_header.cdth_trk1; i++) { - toc_entry.cdte_format = CDROM_MSF; - toc_entry.cdte_track = i; - - if (ioctl (cd->fd, CDROMREADTOCENTRY, &toc_entry) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - - cd->tracks[i].minute = toc_entry.cdte_addr.msf.minute; - cd->tracks[i].second = toc_entry.cdte_addr.msf.second; - cd->tracks[i].frame = toc_entry.cdte_addr.msf.frame; - cd->tracks[i].data_track = (toc_entry.cdte_ctrl == CDROM_DATA_TRACK); - } - - /* read the leadout */ - toc_entry.cdte_track = CDROM_LEADOUT; - toc_entry.cdte_format = CDROM_MSF; - if (ioctl (cd->fd, CDROMREADTOCENTRY, &toc_entry) != 0) { - close (cd->fd); - cd->fd = -1; - return FALSE; - } - cd->tracks[LEADOUT].minute = toc_entry.cdte_addr.msf.minute; - cd->tracks[LEADOUT].second = toc_entry.cdte_addr.msf.second; - cd->tracks[LEADOUT].frame = toc_entry.cdte_addr.msf.frame; - - cd->num_tracks = toc_header.cdth_trk1; - - return TRUE; + struct cdrom_tochdr toc_header; + struct cdrom_tocentry toc_entry; + guint i; + + cd->fd = open(device,O_RDONLY | O_NONBLOCK); + + if (cd->fd == -1) { + return FALSE; + } + + /* get the toc header information */ + if (ioctl(cd->fd,CDROMREADTOCHDR,&toc_header) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + /* read each entry in the toc header */ + for (i = 1; i <= toc_header.cdth_trk1; i++) { + toc_entry.cdte_format = CDROM_MSF; + toc_entry.cdte_track = i; + + if (ioctl(cd->fd,CDROMREADTOCENTRY,&toc_entry) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + + cd->tracks[i].minute = toc_entry.cdte_addr.msf.minute; + cd->tracks[i].second = toc_entry.cdte_addr.msf.second; + cd->tracks[i].frame = toc_entry.cdte_addr.msf.frame; + cd->tracks[i].data_track = (toc_entry.cdte_ctrl == CDROM_DATA_TRACK); + } + + /* read the leadout */ + toc_entry.cdte_track = CDROM_LEADOUT; + toc_entry.cdte_format = CDROM_MSF; + if (ioctl(cd->fd,CDROMREADTOCENTRY,&toc_entry) != 0) { + close(cd->fd); + cd->fd = -1; + return FALSE; + } + cd->tracks[LEADOUT].minute = toc_entry.cdte_addr.msf.minute; + cd->tracks[LEADOUT].second = toc_entry.cdte_addr.msf.second; + cd->tracks[LEADOUT].frame = toc_entry.cdte_addr.msf.frame; + + cd->num_tracks = toc_header.cdth_trk1; + + return TRUE; } -gboolean -cd_start (struct cd * cd, gint start_track, gint end_track) +gboolean cd_start(struct cd *cd,gint start_track,gint end_track) { - struct cdrom_msf msf; + struct cdrom_msf msf; - if (cd->fd == -1) { - return FALSE; - } + if (cd->fd == -1) { + return FALSE; + } - cd_fix_track_range (cd, &start_track, &end_track); + cd_fix_track_range(cd,&start_track,&end_track); - msf.cdmsf_min0 = cd->tracks[start_track].minute; - msf.cdmsf_sec0 = cd->tracks[start_track].second; - msf.cdmsf_frame0 = cd->tracks[start_track].frame; + msf.cdmsf_min0 = cd->tracks[start_track].minute; + msf.cdmsf_sec0 = cd->tracks[start_track].second; + msf.cdmsf_frame0 = cd->tracks[start_track].frame; - if (end_track == LEADOUT) { - msf.cdmsf_min1 = cd->tracks[end_track].minute; - msf.cdmsf_sec1 = cd->tracks[end_track].second; - msf.cdmsf_frame1 = cd->tracks[end_track].frame; - } else { - msf.cdmsf_min1 = cd->tracks[end_track + 1].minute; - msf.cdmsf_sec1 = cd->tracks[end_track + 1].second; - msf.cdmsf_frame1 = cd->tracks[end_track + 1].frame; - } + if (end_track == LEADOUT) { + msf.cdmsf_min1 = cd->tracks[end_track].minute; + msf.cdmsf_sec1 = cd->tracks[end_track].second; + msf.cdmsf_frame1 = cd->tracks[end_track].frame; + } else { + msf.cdmsf_min1 = cd->tracks[end_track+1].minute; + msf.cdmsf_sec1 = cd->tracks[end_track+1].second; + msf.cdmsf_frame1 = cd->tracks[end_track+1].frame; + } - if (ioctl (cd->fd, CDROMPLAYMSF, &msf) != 0) { - return FALSE; - } + if (ioctl(cd->fd,CDROMPLAYMSF,&msf) != 0) { + return FALSE; + } - return TRUE; + return TRUE; } -gboolean -cd_pause (struct cd * cd) +gboolean cd_pause(struct cd *cd) { - if (cd->fd == -1) { - return FALSE; - } + if (cd->fd == -1) { + return FALSE; + } - if (ioctl (cd->fd, CDROMPAUSE, NULL) != 0) { - return FALSE; - } + if (ioctl(cd->fd,CDROMPAUSE,NULL) != 0) { + return FALSE; + } - return TRUE; + return TRUE; } -gboolean -cd_resume (struct cd * cd) +gboolean cd_resume(struct cd *cd) { - if (cd->fd == -1) { - return FALSE; - } + if (cd->fd == -1) { + return FALSE; + } - if (ioctl (cd->fd, CDROMRESUME, NULL) != 0) { - return FALSE; - } + if (ioctl(cd->fd,CDROMRESUME,NULL) != 0) { + return FALSE; + } - return TRUE; + return TRUE; } -gboolean -cd_stop (struct cd * cd) +gboolean cd_stop(struct cd *cd) { - if (cd->fd == -1) { - return FALSE; - } + if (cd->fd == -1) { + return FALSE; + } - if (ioctl (cd->fd, CDROMSTOP, NULL) != 0) { - return FALSE; - } + if (ioctl(cd->fd,CDROMSTOP,NULL) != 0) { + return FALSE; + } - return TRUE; + return TRUE; } /* -1 for error, 0 for not playing, 1 for playing */ -CDStatus -cd_status (struct cd * cd) +CDStatus cd_status(struct cd *cd) { - struct cdrom_subchnl sub_channel; - - if (cd->fd == -1) { - return -1; - } - - sub_channel.cdsc_format = CDROM_MSF; - - if (ioctl (cd->fd, CDROMSUBCHNL, &sub_channel) != 0) { - return -1; - } - - switch (sub_channel.cdsc_audiostatus) { - case CDROM_AUDIO_COMPLETED: - return CD_COMPLETED; - break; - case CDROM_AUDIO_PLAY: - case CDROM_AUDIO_PAUSED: - return CD_PLAYING; - break; - case CDROM_AUDIO_ERROR: - default: - return CD_ERROR; - } + struct cdrom_subchnl sub_channel; + + if (cd->fd == -1) { + return -1; + } + + sub_channel.cdsc_format = CDROM_MSF; + + if (ioctl(cd->fd,CDROMSUBCHNL,&sub_channel) != 0) { + return -1; + } + + switch (sub_channel.cdsc_audiostatus) { + case CDROM_AUDIO_COMPLETED: + return CD_COMPLETED; + break; + case CDROM_AUDIO_PLAY: + case CDROM_AUDIO_PAUSED: + return CD_PLAYING; + break; + case CDROM_AUDIO_ERROR: + default: + return CD_ERROR; + } } -gint -cd_current_track (struct cd * cd) +gint cd_current_track(struct cd *cd) { - struct cdrom_subchnl sub_channel; + struct cdrom_subchnl sub_channel; - if (cd->fd == -1) { - return -1; - } + if (cd->fd == -1) { + return -1; + } - sub_channel.cdsc_format = CDROM_MSF; + sub_channel.cdsc_format = CDROM_MSF; - if (ioctl (cd->fd, CDROMSUBCHNL, &sub_channel) != 0) { - return -1; - } + if (ioctl(cd->fd,CDROMSUBCHNL,&sub_channel) != 0) { + return -1; + } - return sub_channel.cdsc_trk; + return sub_channel.cdsc_trk; } -gboolean -cd_close (struct cd * cd) +gboolean cd_close(struct cd *cd) { - if (cd->fd == -1) { - return TRUE; - } + if (cd->fd == -1) { + return TRUE; + } - if (close (cd->fd) != 0) { - return FALSE; - } + if (close(cd->fd) != 0) { + return FALSE; + } - cd->fd = -1; + cd->fd = -1; - return TRUE; + return TRUE; } + |