static av_cold int read_close(AVFormatContext *ctx) { CDIOContext *s = ctx->priv_data; cdio_paranoia_free(s->paranoia); cdio_cddap_close(s->drive); return 0; }
static void CDDAReader_dealloc_device(cdio_CDDAReader *self) { if (self->_.drive.paranoia) { cdio_paranoia_free(self->_.drive.paranoia); } if (self->_.drive.drive) { cdio_cddap_close(self->_.drive.drive); } }
static void CDDA_dealloc(cdio_CDDAObject* self) { if (self->paranoia != NULL) cdio_paranoia_free(self->paranoia); if (self->cdrom_drive != NULL) cdio_cddap_close(self->cdrom_drive); Py_XDECREF(self->pcm_module); if (self != NULL) self->ob_type->tp_free((PyObject*)self); }
void CdParanoia::free() { if (paranoia) { #ifdef CDIOPARANOIA_FOUND cdio_paranoia_free(paranoia); #else paranoia_free(paranoia); #endif paranoia = 0; } if (drive) { #ifdef CDIOPARANOIA_FOUND cdio_cddap_close(drive); #else cdda_close(drive); #endif drive = 0; } }
static void cdpa_close(rnc_dev_t *dev) { cdpa_t *cdpa = dev->data; mrp_debug("closing device"); if (cdpa == NULL) return; /* Hmm... what is the opposite of cdio_open ? */ if (cdpa->cdpa) cdio_paranoia_free(cdpa->cdpa); if (cdpa->cdio) cdio_cddap_close(cdpa->cdda); mrp_free(cdpa->errmsg); mrp_free(cdpa); }
// private void CdDecoder::deinit() { setCDSpeed(-1); QMutexLocker lock(&getCdioMutex()); if (m_paranoia) cdio_paranoia_free(m_paranoia), m_paranoia = 0; if (m_device) cdio_cddap_close(m_device), m_device = 0, m_cdio = 0; if (m_cdio) cdio_destroy(m_cdio), m_cdio = 0; if (m_output_buf) ::av_free(m_output_buf), m_output_buf = NULL; m_inited = m_user_stop = m_finish = false; m_freq = m_bitrate = 0L; m_stat = DecoderEvent::Finished; m_chan = 0; setOutput(0); }
~cdio() { if (d) cdio_cddap_close(d); }
int main(int argc, const char *argv[]) { cdrom_drive_t *d = NULL; /* Place to store handle given by cd-parapnioa. */ driver_id_t driver_id; char **ppsz_cd_drives; /* List of all drives with a loaded CDDA in it. */ int i_rc=0; /* See if we can find a device with a loaded CD-DA in it. If successful drive_id will be set. */ ppsz_cd_drives = cdio_get_devices_with_cap_ret(NULL, CDIO_FS_AUDIO, false, &driver_id); if (ppsz_cd_drives && *ppsz_cd_drives) { /* Found such a CD-ROM with a CD-DA loaded. Use the first drive in the list. */ d=cdda_identify(*ppsz_cd_drives, 1, NULL); } else { printf("Unable find or access a CD-ROM drive with an audio CD in it.\n"); exit(SKIP_TEST_RC); } /** We had a bug in is_device when driver_id == DRIVER_UNKNOWN or DRIVER_DEVICE. Let's make sure we've fixed that problem. **/ if (!cdio_is_device(*ppsz_cd_drives, DRIVER_UNKNOWN) || !cdio_is_device(*ppsz_cd_drives, DRIVER_DEVICE)) exit(99); /* Don't need a list of CD's with CD-DA's any more. */ cdio_free_device_list(ppsz_cd_drives); /* We'll set for verbose paranoia messages. */ cdda_verbose_set(d, CDDA_MESSAGE_PRINTIT, CDDA_MESSAGE_PRINTIT); if ( 0 != cdio_cddap_open(d) ) { printf("Unable to open disc.\n"); exit(SKIP_TEST_RC); } /* Okay now set up to read up to the first 300 frames of the first audio track of the Audio CD. */ { cdrom_paranoia_t *p = paranoia_init(d); lsn_t i_first_lsn = cdda_disc_firstsector(d); if ( -1 == i_first_lsn ) { printf("Trouble getting starting LSN\n"); } else { lsn_t i_lsn; /* Current LSN to read */ lsn_t i_last_lsn = cdda_disc_lastsector(d); unsigned int i_sectors = i_last_lsn - i_first_lsn + 1; unsigned int j; unsigned int i_good = 0; unsigned int i_bad = 0; /* Set reading mode for full paranoia, but allow skipping sectors. */ paranoia_modeset(p, PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP); for ( j=0; j<10; j++ ) { /* Pick a place to start reading. */ i_lsn = i_first_lsn + (rand() % i_sectors); paranoia_seek(p, i_lsn, SEEK_SET); printf("Testing %d sectors starting at %ld\n", MAX_SECTORS, (long int) i_lsn); for ( i = 0; i < MAX_SECTORS && i_lsn <= i_last_lsn; i++, i_lsn++ ) { /* read a sector */ int16_t *p_readbuf = paranoia_read(p, callback); char *psz_err=cdio_cddap_errors(d); char *psz_mes=cdio_cddap_messages(d); memcpy(audio_buf[i], p_readbuf, CDIO_CD_FRAMESIZE_RAW); if (psz_mes || psz_err) printf("%s%s\n", psz_mes ? psz_mes: "", psz_err ? psz_err: ""); if (psz_err) free(psz_err); if (psz_mes) free(psz_mes); if( !p_readbuf ) { printf("paranoia read error. Stopping.\n"); goto out; } } /* Compare with the sectors from paranoia. */ i_lsn -= MAX_SECTORS; for ( i = 0; i < MAX_SECTORS; i++, i_lsn++ ) { uint8_t readbuf[CDIO_CD_FRAMESIZE_RAW] = {0,}; if ( PARANOIA_CB_READ == audio_status[i] || PARANOIA_CB_VERIFY == audio_status[i] ) { /* We read the block via paranoia without an error. */ if ( 0 == cdio_read_audio_sector(d->p_cdio, readbuf, i_lsn) ) { if ( BIGENDIAN != d->bigendianp ) { /* We will compare in the slow, pedantic way*/ int j; for (j=0; j < CDIO_CD_FRAMESIZE_RAW ; j +=2) { if (audio_buf[i][j] != readbuf[j+1] && audio_buf[i][j+1] != readbuf[j] ) { printf("LSN %ld doesn't match\n", (long int) i_lsn); i_bad++; } else { i_good++; } } } else { if ( 0 != memcmp(audio_buf[i], readbuf, CDIO_CD_FRAMESIZE_RAW) ) { printf("LSN %ld doesn't match\n", (long int) i_lsn); i_bad++; } else { i_good++; } } } } else { printf("Skipping LSN %ld because of status: %s\n", (long int) i_lsn, paranoia_cb_mode2str[audio_status[i]]); } } } printf("%u sectors compared okay %u sectors were different\n", i_good, i_bad); if (i_bad > i_good) i_rc = 1; } out: paranoia_free(p); } cdio_cddap_close(d); exit(i_rc); }
/* FIXME: Cleanup track refs */ void common_cleanup(struct con_win *cwin) { CDEBUG(DBG_INFO, "Cleaning up"); if ((cwin->cstate->state == ST_STOPPED) && (cwin->cstate->curr_mobj_clear)) delete_musicobject(cwin->cstate->curr_mobj); if ((cwin->cstate->state == ST_PLAYING) || (cwin->cstate->state == ST_PAUSED)) stop_playback(cwin); save_preferences(cwin); g_object_unref(cwin->library_store); g_object_unref(cwin->pixbuf->image_play); g_object_unref(cwin->pixbuf->image_pause); if (cwin->pixbuf->pixbuf_app) g_object_unref(cwin->pixbuf->pixbuf_app); if (cwin->pixbuf->pixbuf_dir) g_object_unref(cwin->pixbuf->pixbuf_dir); if (cwin->pixbuf->pixbuf_artist) g_object_unref(cwin->pixbuf->pixbuf_artist); if (cwin->pixbuf->pixbuf_album) g_object_unref(cwin->pixbuf->pixbuf_album); if (cwin->pixbuf->pixbuf_track) g_object_unref(cwin->pixbuf->pixbuf_track); if (cwin->pixbuf->pixbuf_genre) g_object_unref(cwin->pixbuf->pixbuf_genre); g_slice_free(struct pixbuf, cwin->pixbuf); if (cwin->album_art) gtk_widget_destroy(cwin->album_art); if (cwin->cstate->cdda_drive) cdio_cddap_close(cwin->cstate->cdda_drive); if (cwin->cstate->cddb_disc) cddb_disc_destroy(cwin->cstate->cddb_disc); if (cwin->cstate->cddb_conn) { cddb_destroy(cwin->cstate->cddb_conn); libcddb_shutdown(); } g_free(cwin->cpref->lw.lastfm_user); g_free(cwin->cpref->lw.lastfm_pass); #ifdef HAVE_LIBGLYR g_free(cwin->cpref->cache_folder); #endif g_free(cwin->cpref->configrc_file); g_free(cwin->cpref->installed_version); g_free(cwin->cpref->audio_sink); g_free(cwin->cpref->audio_alsa_device); g_free(cwin->cpref->audio_oss_device); g_free(cwin->cpref->album_art_pattern); g_free(cwin->cpref->audio_cd_device); g_free(cwin->cpref->start_mode); g_free(cwin->cpref->sidebar_pane); g_key_file_free(cwin->cpref->configrc_keyfile); free_str_list(cwin->cpref->library_dir); free_str_list(cwin->cpref->lib_add); free_str_list(cwin->cpref->lib_delete); free_str_list(cwin->cpref->library_tree_nodes); free_str_list(cwin->cpref->playlist_columns); g_slist_free(cwin->cpref->playlist_column_widths); g_slice_free(struct con_pref, cwin->cpref); g_rand_free(cwin->cstate->rand); g_free(cwin->cstate->last_folder); g_mutex_free(cwin->cstate->c_mutex); /* Hack, hack */ if (g_mutex_trylock(cwin->cstate->l_mutex) == TRUE) { g_mutex_unlock(cwin->cstate->l_mutex); g_mutex_free(cwin->cstate->l_mutex); } g_cond_free(cwin->cstate->c_cond); g_slice_free(struct con_state, cwin->cstate); #ifdef HAVE_LIBGLYR uninit_glyr_related (cwin); #endif g_free(cwin->cdbase->db_file); sqlite3_close(cwin->cdbase->db); g_slice_free(struct con_dbase, cwin->cdbase); if (cwin->cstate->audio_init && cwin->cmixer) cwin->cmixer->deinit_mixer(cwin); if (cwin->clibao->ao_dev) { CDEBUG(DBG_INFO, "Freeing ao dev"); ao_close(cwin->clibao->ao_dev); } ao_shutdown(); g_slice_free(struct con_mixer, cwin->cmixer); g_slice_free(struct con_libao, cwin->clibao); g_free(cwin->clastfm->session_id); g_free(cwin->clastfm->submission_url); if (cwin->clastfm->curl_handle) curl_easy_cleanup(cwin->clastfm->curl_handle); curl_global_cleanup(); g_slice_free(struct con_lastfm, cwin->clastfm); dbus_connection_remove_filter(cwin->con_dbus, dbus_filter_handler, cwin); dbus_bus_remove_match(cwin->con_dbus, "type='signal',path='/org/pragha/DBus'", NULL); dbus_connection_unref(cwin->con_dbus); #if HAVE_GLIB_2_26 mpris_cleanup(cwin); #endif if (notify_is_initted()) notify_uninit(); #ifdef HAVE_LIBKEYBINDER keybinder_unbind("XF86AudioPlay", (KeybinderHandler) keybind_play_handler); keybinder_unbind("XF86AudioStop", (KeybinderHandler) keybind_stop_handler); keybinder_unbind("XF86AudioPrev", (KeybinderHandler) keybind_prev_handler); keybinder_unbind("XF86AudioNext", (KeybinderHandler) keybind_next_handler); keybinder_unbind("XF86AudioMedia", (KeybinderHandler) keybind_media_handler); #endif g_option_context_free(cwin->cmd_context); g_slice_free(struct con_win, cwin); }