"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/cdda-player.c" between
libcdio-2.0.0.tar.bz2 and libcdio-2.1.0.tar.bz2

About: GNU libcdio is a library for CD-ROM and CD image access.

cdda-player.c  (libcdio-2.0.0.tar.bz2):cdda-player.c  (libcdio-2.1.0.tar.bz2)
/* /*
Copyright (C) 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2017 Copyright (C) 2005-2012, 2017, 2019
Rocky Bernstein <rocky@gnu.org> Rocky Bernstein <rocky@gnu.org>
Adapted from Gerd Knorr's player.c program <kraxel@bytesex.org> Adapted from Gerd Knorr's player.c program <kraxel@bytesex.org>
Copyright (C) 1997, 1998 Copyright (C) 1997, 1998
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
skipping to change at line 71 skipping to change at line 71
#include <ncurses.h> #include <ncurses.h>
# else # else
# ifdef HAVE_NCURSES_NCURSES_H # ifdef HAVE_NCURSES_NCURSES_H
# include <ncurses/ncurses.h> # include <ncurses/ncurses.h>
# else # else
# error "You need <curses.h> or <ncurses.h to build cdda-player" # error "You need <curses.h> or <ncurses.h to build cdda-player"
# endif # endif
# endif # endif
#endif #endif
#include <term.h>
extern TERMINAL *cur_term;
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/cd_types.h> #include <cdio/cd_types.h>
#include <cdio/logging.h> #include <cdio/logging.h>
#include "cddb.h" #include "cddb.h"
#include "getopt.h" #include "getopt.h"
static WINDOW * cur_window = NULL;
static void action(const char *psz_action); static void action(const char *psz_action);
static void display_cdinfo(CdIo_t *p_cdio, track_t i_tracks, static void display_cdinfo(CdIo_t *p_cdio, track_t i_tracks,
track_t i_first_track); track_t i_first_track);
static void display_tracks(void); static void display_tracks(void);
static void get_cddb_track_info(track_t i_track); static void get_cddb_track_info(track_t i_track);
static void get_cdtext_track_info(track_t i_track); static void get_cdtext_track_info(track_t i_track);
static void get_track_info(track_t i_track); static void get_track_info(track_t i_track);
static bool play_track(track_t t1, track_t t2); static bool play_track(track_t t1, track_t t2);
static CdIo_t *p_cdio_global; /* libcdio handle */ static CdIo_t *p_cdio_global; /* libcdio handle */
skipping to change at line 224 skipping to change at line 228
{ {
const unsigned int i_b_half=i_b/2; const unsigned int i_b_half=i_b/2;
return ((i_a)+i_b_half)/i_b; return ((i_a)+i_b_half)/i_b;
} }
/** Curses window initialization. */ /** Curses window initialization. */
static void static void
tty_raw(void) tty_raw(void)
{ {
if (!b_interactive) return; if (!b_interactive) return;
if (!cur_window) cur_window = initscr();
initscr();
cbreak(); cbreak();
clear(); clear();
noecho(); noecho();
#ifdef HAVE_KEYPAD #ifdef HAVE_KEYPAD
keypad(stdscr,1); keypad(stdscr,1);
#endif #endif
getmaxyx(stdscr, LINE_ACTION, COLS_LAST); getmaxyx(stdscr, LINE_ACTION, COLS_LAST);
LINE_ACTION--; LINE_ACTION--;
refresh(); refresh();
} }
skipping to change at line 271 skipping to change at line 275
} }
/* Timed wait on an event. */ /* Timed wait on an event. */
static int static int
select_wait(int sec) select_wait(int sec)
{ {
struct timeval tv; struct timeval tv;
fd_set se; fd_set se;
FD_ZERO(&se); FD_ZERO(&se);
FD_SET(STDIN_FILENO, &se);
tv.tv_sec = sec; tv.tv_sec = sec;
tv.tv_usec = 0; tv.tv_usec = 0;
return select(1,&se,NULL,NULL,&tv); return select(1,&se,NULL,NULL,&tv);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* Display the action line. */ /* Display the action line. */
static void static void
action(const char *psz_action) action(const char *psz_action)
skipping to change at line 337 skipping to change at line 342
finish(const char *psz_msg, int rc) finish(const char *psz_msg, int rc)
{ {
if (b_interactive) { if (b_interactive) {
attron(A_STANDOUT); attron(A_STANDOUT);
mvprintw(LINE_ACTION, 0, (char *) "%s, exiting...\n", psz_msg); mvprintw(LINE_ACTION, 0, (char *) "%s, exiting...\n", psz_msg);
attroff(A_STANDOUT); attroff(A_STANDOUT);
clrtoeol(); clrtoeol();
refresh(); refresh();
} }
tty_restore(); tty_restore();
if (cur_term) del_curterm(cur_term);
cur_window = NULL;
#ifdef HAVE_CDDB #ifdef HAVE_CDDB
if (p_conn) cddb_destroy(p_conn); if (p_conn) cddb_destroy(p_conn);
cddb_disc_destroy(p_cddb_disc); cddb_disc_destroy(p_cddb_disc);
libcddb_shutdown(); libcddb_shutdown();
#endif /*HAVE_CDDB*/ #endif /*HAVE_CDDB*/
cdio_destroy (p_cdio_global); cdio_destroy (p_cdio_global);
free (psz_device_global); free (psz_device_global);
exit (rc); exit (rc);
} }
skipping to change at line 929 skipping to change at line 937
"via CDDB.\n" "via CDDB.\n"
"\n" "\n"
"usage: %s [options] [device]\n" "usage: %s [options] [device]\n"
"\n" "\n"
"default for to search for a CD-ROM device with a CD-DA loaded\n" "default for to search for a CD-ROM device with a CD-DA loaded\n"
"\n" "\n"
"These command line options available:\n" "These command line options available:\n"
" -h print this help\n" " -h print this help\n"
" -k print key mapping\n" " -k print key mapping\n"
" -a start up in auto-mode\n" " -a start up in auto-mode\n"
" -d debug\n"
" -v verbose\n" " -v verbose\n"
"\n" "\n"
"for non-interactive use (only one) of these:\n" "for non-interactive use (only one) of these:\n"
" -l list tracks\n" " -l list tracks\n"
" -c print cover (PostScript to stdout)\n" " -c print cover (PostScript to stdout)\n"
" -C close CD-ROM tray. If you use this option,\n" " -C close CD-ROM tray. If you use this option,\n"
" a CD-ROM device name must be specified.\n" " a CD-ROM device name must be specified.\n"
" -p play the whole CD\n" " -p play the whole CD\n"
" -t n play track >n<\n" " -t n play track >n<\n"
" -t a-b play all tracks between a and b (inclusive)\n" " -t a-b play all tracks between a and b (inclusive)\n"
skipping to change at line 1414 skipping to change at line 1423
break; break;
switch (c) { switch (c) {
case 'v': case 'v':
b_verbose = true; b_verbose = true;
if (cdio_loglevel_default > CDIO_LOG_INFO) if (cdio_loglevel_default > CDIO_LOG_INFO)
cdio_loglevel_default = CDIO_LOG_INFO; cdio_loglevel_default = CDIO_LOG_INFO;
break; break;
case 'd': case 'd':
debug = 1; debug = 1;
if (cdio_loglevel_default > CDIO_LOG_DEBUG) if (cdio_loglevel_default > CDIO_LOG_DEBUG)
cdio_loglevel_default = CDIO_LOG_DEBUG; cdio_loglevel_default = CDIO_LOG_DEBUG;
break; break;
case 'a': case 'a':
auto_mode = 1; auto_mode = 1;
break; break;
case 'L': case 'L':
i_volume_level = atoi(optarg); i_volume_level = atoi(optarg);
cd_op = SET_VOLUME; cd_op = SET_VOLUME;
b_interactive = false; b_interactive = false;
break; break;
skipping to change at line 1540 skipping to change at line 1549
#ifdef HAVE_CDDB #ifdef HAVE_CDDB
cddb_log_set_handler (cddb_log_handler); cddb_log_set_handler (cddb_log_handler);
#else #else
; ;
#endif #endif
} else { } else {
b_sig = true; b_sig = true;
nostop=1; nostop=1;
if (EJECT_CD == cd_op) { if (EJECT_CD == cd_op) {
i_rc = cd_eject() ? 0 : 1; i_rc = cd_eject() ? 0 : 1;
} else if (STOP_PLAYING == cd_op) {
b_cd = true;
i_rc = cd_stop(p_cdio_global) ? 0 : 1;
goto done;
} else { } else {
switch (cd_op) { switch (cd_op) {
case PS_LIST_TRACKS: case PS_LIST_TRACKS:
case LIST_TRACKS: case LIST_TRACKS:
case PLAY_TRACK: case PLAY_TRACK:
read_toc(p_cdio_global); read_toc(p_cdio_global);
default: default:
break; break;
} }
if (p_cdio_global) if (p_cdio_global)
skipping to change at line 1749 skipping to change at line 1762
case KEY_F(18): case KEY_F(18):
case KEY_F(19): case KEY_F(19):
case KEY_F(20): case KEY_F(20):
play_track(key - KEY_F(1) + 11, CDIO_CDROM_LEADOUT_TRACK); play_track(key - KEY_F(1) + 11, CDIO_CDROM_LEADOUT_TRACK);
break; break;
} }
} }
} }
if (!nostop) cd_stop(p_cdio_global); if (!nostop) cd_stop(p_cdio_global);
tty_restore(); tty_restore();
done:
finish("bye", i_rc); finish("bye", i_rc);
return 0; /* keep compiler happy */ return 0; /* keep compiler happy */
} }
 End of changes. 11 change blocks. 
3 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)