xine-lib 1.2.13-20230125hg15249
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <basedir.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/input_plugin.h>
#include "../xine-engine/bswap.h"
#include "media_helper.h"
Data Structures | |
struct | cdrom_toc_entry_t |
struct | cdrom_toc_t |
struct | sha160_t |
struct | trackinfo_t |
struct | cdda_input_plugin_t |
struct | cdda_input_class_t |
Macros | |
#define | LOG_MODULE "input_cdda" |
#define | LOG_VERBOSE |
#define | DEFAULT_CDDA_DEVICE "/dev/cdrom" |
#define | CDDB_SERVER "gnudb.gnudb.org" |
#define | CDDB_PORT 8880 |
#define | CDDB_PROTOCOL 6 |
#define | CDDB_TIMEOUT 5000 |
#define | CD_SECONDS_PER_MINUTE 60 |
#define | CD_FRAMES_PER_SECOND 75 |
#define | CD_RAW_FRAME_SIZE 2352 |
#define | CD_LEADOUT_TRACK 0xAA |
#define | CD_BLOCK_OFFSET 150 |
#define | sha160_digest_len 20 |
#define | MAX_TRACKS 99 |
#define | CACHED_FRAMES 90 /* be a multiple of 3, see read_block () */ |
#define | _BUFSIZ 300 |
Functions | |
static void | sha160_init (sha160_t *s) |
static void | sha160_trans (sha160_t *s) |
static void | sha160_update (sha160_t *s, const uint8_t *data, size_t len) |
static void | sha160_final (sha160_t *s, uint8_t *dest) |
static void | print_cdrom_toc (xine_t *xine, cdrom_toc_t *toc) |
static void | free_cdrom_toc (cdrom_toc_t *toc) |
static cdrom_toc_t * | read_cdrom_toc (int fd) |
static int | read_cdrom_frames (cdda_input_plugin_t *this_gen, int frame, int num_frames, unsigned char *data) |
static int | parse_url (char *urlbuf, char **host, int *port) |
static int | XINE_FORMAT_PRINTF (4, 5) |
static int | network_connect (xine_stream_t *stream, const char *got_url) |
static cdrom_toc_t * | network_read_cdrom_toc (xine_stream_t *stream, int fd) |
static int | network_read_cdrom_frames (xine_stream_t *stream, int fd, int first_frame, int num_frames, unsigned char data[2352]) |
static void | cdda_device_cb (void *data, xine_cfg_entry_t *cfg) |
static void | enable_cddb_changed_cb (void *data, xine_cfg_entry_t *cfg) |
static void | server_changed_cb (void *data, xine_cfg_entry_t *cfg) |
static void | port_changed_cb (void *data, xine_cfg_entry_t *cfg) |
static int | _cdda_is_cd_changed (cdda_input_plugin_t *this) |
static void | _cdda_mkdir_safe (xine_t *xine, char *path) |
static void | _cdda_mkdir_recursive_safe (xine_t *xine, char *path) |
static int | _cdda_cddb_socket_read (cdda_input_plugin_t *this, char *str, int size) |
static int | _cdda_cddb_send_command (cdda_input_plugin_t *this, char *cmd) |
static int | _cdda_cddb_handle_code (char *buf) |
static char * | _cdda_append (char *first, const char *second) |
static void | _cdda_parse_cddb_info (cdda_input_plugin_t *this, char *buffer, char **dtitle) |
static int | _cdda_load_cached_cddb_infos (cdda_input_plugin_t *this) |
static void | _cdda_save_cached_cddb_infos (cdda_input_plugin_t *this, char *filecontent) |
static int | _cdda_cddb_socket_open (cdda_input_plugin_t *this) |
static void | _cdda_cddb_socket_close (cdda_input_plugin_t *this) |
static int | _cdda_cddb_retrieve (cdda_input_plugin_t *this) |
static unsigned int | _cdda_cddb_sum (int n) |
static uint32_t | _cdda_calc_cddb_id (cdda_input_plugin_t *this) |
static void | _cdda_cdindex (cdda_input_plugin_t *this, cdrom_toc_t *toc) |
static uint32_t | _cdda_get_cddb_id (cdda_input_plugin_t *this) |
static void | _cdda_free_cddb_info (cdda_input_plugin_t *this) |
static int | cdda_open (cdda_input_plugin_t *this_gen, const char *cdda_device, int *fdd) |
static int | cdda_close (cdda_input_plugin_t *this_gen) |
static uint32_t | cdda_plugin_get_capabilities (input_plugin_t *this_gen) |
static off_t | cdda_plugin_read (input_plugin_t *this_gen, void *buf, off_t len) |
static buf_element_t * | cdda_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t nlen) |
static off_t | cdda_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) |
static off_t | cdda_plugin_get_current_pos (input_plugin_t *this_gen) |
static off_t | cdda_plugin_get_length (input_plugin_t *this_gen) |
static uint32_t | cdda_plugin_get_blocksize (input_plugin_t *this_gen) |
static const char * | cdda_plugin_get_mrl (input_plugin_t *this_gen) |
static int | cdda_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) |
static void | cdda_plugin_dispose (input_plugin_t *this_gen) |
static int | cdda_plugin_open (input_plugin_t *this_gen) |
static void | free_autoplay_list (cdda_input_class_t *this) |
static const char *const * | cdda_class_get_autoplay_list (input_class_t *this_gen, int *num_files) |
static input_plugin_t * | cdda_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *mrl) |
static void | cdda_class_dispose (input_class_t *this_gen) |
static int | cdda_class_eject_media (input_class_t *this_gen) |
static void * | init_plugin (xine_t *xine, const void *data) |
Variables | |
const plugin_info_t xine_plugin_info[] | EXPORTED |
#define _BUFSIZ 300 |
Referenced by network_read_cdrom_toc(), and XINE_FORMAT_PRINTF().
#define CACHED_FRAMES 90 /* be a multiple of 3, see read_block () */ |
Referenced by cdda_plugin_read().
#define CD_BLOCK_OFFSET 150 |
#define CD_FRAMES_PER_SECOND 75 |
Referenced by _cdda_calc_cddb_id(), cdda_plugin_open(), and network_read_cdrom_toc().
#define CD_LEADOUT_TRACK 0xAA |
Referenced by network_read_cdrom_toc().
#define CD_RAW_FRAME_SIZE 2352 |
Referenced by cdda_plugin_get_current_pos(), cdda_plugin_get_length(), cdda_plugin_read(), and cdda_plugin_seek().
#define CD_SECONDS_PER_MINUTE 60 |
Referenced by cdda_plugin_open(), and network_read_cdrom_toc().
#define CDDB_PORT 8880 |
Referenced by init_plugin().
#define CDDB_PROTOCOL 6 |
Referenced by _cdda_cddb_retrieve().
#define CDDB_SERVER "gnudb.gnudb.org" |
Referenced by init_plugin().
#define CDDB_TIMEOUT 5000 |
Referenced by _cdda_cddb_socket_open().
#define DEFAULT_CDDA_DEVICE "/dev/cdrom" |
Referenced by init_plugin().
#define LOG_MODULE "input_cdda" |
Referenced by _cdda_cddb_socket_open().
#define LOG_VERBOSE |
#define MAX_TRACKS 99 |
Referenced by network_read_cdrom_toc().
#define sha160_digest_len 20 |
|
inlinestatic |
Referenced by _cdda_parse_cddb_info().
|
static |
References _cdda_cddb_sum(), CD_FRAMES_PER_SECOND, and NULL.
Referenced by _cdda_get_cddb_id().
|
static |
Referenced by _cdda_cddb_retrieve().
|
static |
References _, _cdda_cddb_handle_code(), _cdda_cddb_send_command(), _cdda_cddb_socket_close(), _cdda_cddb_socket_open(), _cdda_cddb_socket_read(), _cdda_load_cached_cddb_infos(), _cdda_parse_cddb_info(), _cdda_save_cached_cddb_infos(), CDDB_PROTOCOL, cdda_input_class_t::input_class, NULL, VERSION, xine_strsep, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.
Referenced by cdda_plugin_open().
|
static |
References _x_io_tcp_write(), NULL, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by _cdda_cddb_retrieve().
|
static |
References _x_io_tcp_close(), and NULL.
Referenced by _cdda_cddb_retrieve().
|
static |
References _, _x_io_tcp_connect(), _x_io_tcp_connect_finish(), CDDB_TIMEOUT, cdda_input_class_t::input_class, LOG_MODULE, lprintf, xine_log(), XINE_LOG_MSG, and XIO_READY.
Referenced by _cdda_cddb_retrieve().
|
static |
References _x_io_tcp_read_line(), XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by _cdda_cddb_retrieve().
|
static |
Referenced by _cdda_calc_cddb_id().
|
static |
References _x_meta_info_set_utf8(), cdrom_toc_entry_t::first_frame, cdrom_toc_t::first_track, cdrom_toc_t::ignore_last_track, cdrom_toc_t::last_track, sha160_final(), sha160_init(), sha160_update(), cdrom_toc_t::toc_entries, cdrom_toc_t::total_tracks, xine_base64_encode(), and XINE_META_INFO_CDINDEX_DISCID.
Referenced by cdda_plugin_open().
|
static |
References _x_freep().
Referenced by cdda_plugin_dispose(), and cdda_plugin_open().
|
static |
References _cdda_calc_cddb_id(), and NULL.
Referenced by cdda_plugin_open().
|
static |
References NULL, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by cdda_plugin_open().
|
static |
References _cdda_parse_cddb_info(), NULL, PACKAGE, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by _cdda_cddb_retrieve().
|
static |
References _cdda_mkdir_safe().
Referenced by _cdda_save_cached_cddb_infos().
|
static |
References NULL, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by _cdda_mkdir_recursive_safe().
|
static |
References _cdda_append(), and _x_asprintf().
Referenced by _cdda_cddb_retrieve(), and _cdda_load_cached_cddb_infos().
|
static |
References _cdda_mkdir_recursive_safe(), NULL, PACKAGE, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by _cdda_cddb_retrieve().
|
static |
|
static |
References cdda_input_class_t::cdda_device, media_eject_media(), cdda_input_class_t::mutex, and cdda_input_class_t::xine.
Referenced by init_plugin().
|
static |
References cdda_input_class_t::autoplaylist, cdda_close(), cdda_input_class_t::cdda_device, cdda_open(), cdda_input_plugin_t::fd, cdrom_toc_t::first_track, free_autoplay_list(), free_cdrom_toc(), cdrom_toc_t::ignore_last_track, input_plugin_s::input_class, cdda_input_plugin_t::input_plugin, cdda_input_class_t::last_toc, cdrom_toc_t::last_track, lprintf, cdda_input_class_t::mutex, cdda_input_plugin_t::net_fd, network_connect(), network_read_cdrom_toc(), NULL, print_cdrom_toc(), read_cdrom_toc(), cdda_input_plugin_t::stream, and cdda_input_class_t::xine.
Referenced by init_plugin().
|
static |
References cdda_plugin_dispose(), cdda_plugin_get_blocksize(), cdda_plugin_get_capabilities(), cdda_plugin_get_current_pos(), cdda_plugin_get_length(), cdda_plugin_get_mrl(), cdda_plugin_get_optional_data(), cdda_plugin_open(), cdda_plugin_read(), cdda_plugin_read_block(), cdda_plugin_seek(), cdda_input_class_t::last_read_time, lprintf, NULL, and z.
Referenced by init_plugin().
|
static |
References cdda_input_plugin_t::fd, FreeLibrary(), input_plugin_s::input_class, cdda_input_plugin_t::input_plugin, cdda_input_plugin_t::net_fd, NULL, cdda_input_class_t::speed, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by cdda_class_get_autoplay_list(), cdda_plugin_dispose(), and cdda_plugin_open().
|
static |
References xine_cfg_entry_s::str_value.
Referenced by init_plugin().
|
static |
References cdda_input_class_t::cdda_device, cdda_input_plugin_t::fd, FreeLibrary(), GetProcAddress(), input_plugin_s::input_class, cdda_input_plugin_t::input_plugin, lprintf, NULL, cdda_input_class_t::speed, xine_open_cloexec(), XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by cdda_class_get_autoplay_list(), and cdda_plugin_open().
|
static |
References _cdda_free_cddb_info(), cdda_close(), cdda_input_class_t::input_class, and cdda_input_class_t::last_read_time.
Referenced by cdda_class_get_instance().
|
static |
Referenced by cdda_class_get_instance().
|
static |
References INPUT_CAP_SEEKABLE.
Referenced by cdda_class_get_instance().
|
static |
References CD_RAW_FRAME_SIZE.
Referenced by cdda_class_get_instance().
|
static |
References CD_RAW_FRAME_SIZE.
Referenced by cdda_class_get_instance().
|
static |
Referenced by cdda_class_get_instance().
|
static |
Referenced by cdda_class_get_instance().
|
static |
References _cdda_cddb_retrieve(), _cdda_cdindex(), _cdda_free_cddb_info(), _cdda_get_cddb_id(), _cdda_is_cd_changed(), _x_meta_info_set_utf8(), CD_FRAMES_PER_SECOND, CD_SECONDS_PER_MINUTE, cdda_close(), cdda_input_class_t::cdda_device, cdda_open(), cdrom_toc_entry_t::first_frame, cdrom_toc_entry_t::first_frame_frame, cdrom_toc_entry_t::first_frame_minute, cdrom_toc_entry_t::first_frame_second, cdrom_toc_t::first_track, free_cdrom_toc(), input_plugin_s::input_class, cdda_input_class_t::last_read_time, cdrom_toc_t::last_track, lprintf, network_connect(), network_read_cdrom_toc(), now(), NULL, print_cdrom_toc(), read_cdrom_toc(), cdrom_toc_t::toc_entries, cdrom_toc_t::total_tracks, XINE_META_INFO_ALBUM, XINE_META_INFO_ARTIST, XINE_META_INFO_GENRE, XINE_META_INFO_TITLE, XINE_META_INFO_TRACK_NUMBER, and XINE_META_INFO_YEAR.
Referenced by cdda_class_get_instance().
|
static |
References CACHED_FRAMES, CD_RAW_FRAME_SIZE, cdda_input_class_t::last_read_time, network_read_cdrom_frames(), NULL, and read_cdrom_frames().
Referenced by cdda_class_get_instance(), and cdda_plugin_read_block().
|
static |
|
static |
References CD_RAW_FRAME_SIZE, cdda_input_class_t::last_read_time, now(), and NULL.
Referenced by cdda_class_get_instance().
|
static |
References xine_cfg_entry_s::num_value.
Referenced by init_plugin().
|
static |
References _x_freep(), and cdda_input_class_t::autoplaylist.
Referenced by cdda_class_dispose(), and cdda_class_get_autoplay_list().
|
static |
Referenced by cdda_class_dispose(), cdda_class_get_autoplay_list(), and cdda_plugin_open().
|
static |
References _, cdda_input_class_t::autoplaylist, cdda_class_dispose(), cdda_class_eject_media(), cdda_class_get_autoplay_list(), cdda_class_get_instance(), cdda_input_class_t::cdda_device, cdda_device_cb(), cdda_input_class_t::cddb_enable, cdda_input_class_t::cddb_error, CDDB_PORT, cdda_input_class_t::cddb_port, CDDB_SERVER, cdda_input_class_t::cddb_server, xine_s::config, cdda_input_class_t::config, DEFAULT_CDDA_DEVICE, input_class_s::description, input_class_s::dispose, input_class_s::eject_media, enable_cddb_changed_cb(), input_class_s::get_autoplay_list, input_class_s::get_dir, input_class_s::get_instance, input_class_s::identifier, cdda_input_class_t::input_class, cdda_input_class_t::last_read_time, cdda_input_class_t::last_toc, cdda_input_class_t::mutex, N_, NULL, port_changed_cb(), config_values_s::register_bool, config_values_s::register_filename, config_values_s::register_num, config_values_s::register_string, server_changed_cb(), cdda_input_class_t::speed, cdda_input_class_t::xine, XINE_CONFIG_SECURITY, and XINE_CONFIG_STRING_IS_DEVICE_NAME.
|
static |
References _x_io_tcp_connect(), lprintf, NULL, parse_url(), xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by cdda_class_get_autoplay_list(), and cdda_plugin_open().
|
static |
Referenced by cdda_plugin_read().
|
static |
References _BUFSIZ, CD_FRAMES_PER_SECOND, CD_LEADOUT_TRACK, CD_SECONDS_PER_MINUTE, cdrom_toc_entry_t::first_frame, cdrom_toc_entry_t::first_frame_frame, cdrom_toc_entry_t::first_frame_minute, cdrom_toc_entry_t::first_frame_second, cdrom_toc_t::first_track, cdrom_toc_t::last_track, MAX_TRACKS, NULL, cdrom_toc_t::toc_entries, cdrom_toc_t::total_tracks, cdrom_toc_entry_t::track_mode, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by cdda_class_get_autoplay_list(), and cdda_plugin_open().
|
static |
References NULL.
Referenced by network_connect().
|
static |
References xine_cfg_entry_s::num_value.
Referenced by init_plugin().
|
static |
References cdrom_toc_entry_t::first_frame, cdrom_toc_entry_t::first_frame_frame, cdrom_toc_entry_t::first_frame_minute, cdrom_toc_entry_t::first_frame_second, cdrom_toc_t::first_track, cdrom_toc_t::last_track, cdrom_toc_t::toc_entries, cdrom_toc_t::total_tracks, cdrom_toc_entry_t::track_mode, xine_s::verbosity, XINE_VERBOSITY_DEBUG, and xprintf.
Referenced by cdda_class_get_autoplay_list(), and cdda_plugin_open().
|
static |
Referenced by cdda_plugin_read().
|
static |
References NULL.
Referenced by cdda_class_get_autoplay_list(), and cdda_plugin_open().
|
static |
References xine_cfg_entry_s::str_value.
Referenced by init_plugin().
|
static |
References sha160_t::buf, sha160_t::n, sha160_trans(), sha160_t::state, and v.
Referenced by _cdda_cdindex().
|
static |
References sha160_t::n, and sha160_t::state.
Referenced by _cdda_cdindex().
|
static |
References _X_BE_32, sha160_t::buf, and sha160_t::state.
Referenced by sha160_final(), and sha160_update().
|
static |
References sha160_t::buf, sha160_t::n, and sha160_trans().
Referenced by _cdda_cdindex().
|
static |
References _BUFSIZ, _x_io_tcp_read(), _x_io_tcp_read_line(), _x_io_tcp_write(), XINE_VERBOSITY_DEBUG, and xprintf.
const plugin_info_t xine_plugin_info [] EXPORTED |