From 2fc3be582c8c5aa510c92c7602ce72d5a1daa0ed Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Jun 2014 22:14:23 +0200 Subject: stream_dvd: minor cleanups We don't need a separate stream_dvd.h header file anymore. Some dead functions become apparent; remove them. --- stream/stream_dvd.c | 112 ++++++++++++++++++--------------------------- stream/stream_dvd.h | 72 ----------------------------- stream/stream_dvd_common.h | 1 - 3 files changed, 44 insertions(+), 141 deletions(-) delete mode 100644 stream/stream_dvd.h diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 6b370de114..3ab7149a46 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -24,15 +24,20 @@ #include #include #include +#include +#include +#include + +#include +#include +#include +#include #include "config.h" #include "talloc.h" #include "common/common.h" #include "common/msg.h" -#include -#include - #define FIRST_AC3_AID 128 #define FIRST_DTS_AID 136 #define FIRST_MPG_AID 0 @@ -42,7 +47,6 @@ #include "options/m_option.h" #include "options/options.h" -#include "stream_dvd.h" #include "stream_dvd_common.h" #define LIBDVDREAD_VERSION(maj,min,micro) ((maj)*10000 + (min)*100 + (micro)) @@ -60,6 +64,41 @@ #endif #endif +typedef struct { + dvd_reader_t *dvd; + dvd_file_t *title; + ifo_handle_t *vmg_file; + tt_srpt_t *tt_srpt; + ifo_handle_t *vts_file; + vts_ptt_srpt_t *vts_ptt_srpt; + pgc_t *cur_pgc; +// + int cur_title; + int cur_cell; + int last_cell; + int cur_pack; + int cell_last_pack; + int cur_pgc_idx; +// Navi: + int packs_left; + dsi_t dsi_pack; + int angle_seek; + unsigned int *cell_times_table; +// audio datas + int nr_of_channels; + stream_language_t audio_streams[32]; +// subtitles + int nr_of_subtitles; + stream_language_t subtitles[32]; + + int dvd_angle; + char *dvd_device_current; + int dvd_speed; + int dvd_title; + + int cfg_title; + char *cfg_device; +} dvd_priv_t; static const dvd_priv_t stream_priv_dflts = { .cfg_title = 0, @@ -73,35 +112,6 @@ static const m_option_t stream_opts_fields[] = { {0} }; -int dvd_chapter_from_cell(dvd_priv_t* dvd,int title,int cell) -{ - pgc_t * cur_pgc; - ptt_info_t* ptt; - int chapter = cell; - int pgc_id,pgn; - if(title < 0 || cell < 0){ - return 0; - } - /* for most DVD's chapter == cell */ - /* but there are more complecated cases... */ - if(chapter >= dvd->vmg_file->tt_srpt->title[title].nr_of_ptts) { - chapter = dvd->vmg_file->tt_srpt->title[title].nr_of_ptts-1; - } - title = dvd->tt_srpt->title[title].vts_ttn-1; - ptt = dvd->vts_file->vts_ptt_srpt->title[title].ptt; - while(chapter >= 0) { - pgc_id = ptt[chapter].pgcn; - pgn = ptt[chapter].pgn; - cur_pgc = dvd->vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc; - if(cell >= cur_pgc->program_map[pgn-1]-1) { - return chapter; - } - --chapter; - } - /* didn't find a chapter ??? */ - return chapter; -} - static int dvd_lang_from_aid(stream_t *stream, int id) { dvd_priv_t *d; int i; @@ -115,25 +125,7 @@ static int dvd_lang_from_aid(stream_t *stream, int id) { return 0; } -int dvd_aid_from_lang(stream_t *stream, char **lang) { - dvd_priv_t *d=stream->priv; - int code,i; - for (int n = 0; lang[n]; n++) { - code = lang[n][1] | (lang[n][0] << 8); - for(i=0;inr_of_channels;i++) { - if(d->audio_streams[i].language==code) { - MP_INFO(stream, "Selected DVD audio channel: %d language: %c%c\n", - d->audio_streams[i].id, lang[n][0], lang[n][1]); - return d->audio_streams[i].id; - } - //printf("%X != %X (%c%c)\n",code,d->audio_streams[i].language,lang[0],lang[1]); - } - } - MP_WARN(stream, "No matching DVD audio language found!\n"); - return -1; -} - -int dvd_number_of_subs(stream_t *stream) { +static int dvd_number_of_subs(stream_t *stream) { int i; int maxid = -1; dvd_priv_t *d; @@ -156,22 +148,6 @@ static int dvd_lang_from_sid(stream_t *stream, int id) { return 0; } -int dvd_sid_from_lang(stream_t *stream, char **lang) { - dvd_priv_t *d=stream->priv; - int code,i; - for (int n = 0; lang[n]; n++) { - code = lang[n][1] | (lang[n][0] << 8); - for(i=0;inr_of_subtitles;i++) { - if(d->subtitles[i].language==code) { - MP_INFO(stream, "Selected DVD subtitle channel: %d language: %c%c\n", i, lang[n][0], lang[n][1]); - return d->subtitles[i].id; - } - } - } - MP_WARN(stream, "No matching DVD subtitle language found!\n"); - return -1; -} - static int dvd_next_cell(stream_t *stream, dvd_priv_t *d) { int next_cell=d->cur_cell; diff --git a/stream/stream_dvd.h b/stream/stream_dvd.h deleted file mode 100644 index 0f509b3e35..0000000000 --- a/stream/stream_dvd.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_STREAM_DVD_H -#define MPLAYER_STREAM_DVD_H - -#include "config.h" -#include -#include -#include -#include -#include -#include "stream.h" -#include "options/m_option.h" - -typedef struct { - dvd_reader_t *dvd; - dvd_file_t *title; - ifo_handle_t *vmg_file; - tt_srpt_t *tt_srpt; - ifo_handle_t *vts_file; - vts_ptt_srpt_t *vts_ptt_srpt; - pgc_t *cur_pgc; -// - int cur_title; - int cur_cell; - int last_cell; - int cur_pack; - int cell_last_pack; - int cur_pgc_idx; -// Navi: - int packs_left; - dsi_t dsi_pack; - int angle_seek; - unsigned int *cell_times_table; -// audio datas - int nr_of_channels; - stream_language_t audio_streams[32]; -// subtitles - int nr_of_subtitles; - stream_language_t subtitles[32]; - - int dvd_angle; - char *dvd_device_current; - int dvd_speed; - int dvd_title; - - int cfg_title; - char *cfg_device; -} dvd_priv_t; - -int dvd_number_of_subs(stream_t *stream); -int dvd_aid_from_lang(stream_t *stream, char **lang); -int dvd_sid_from_lang(stream_t *stream, char **lang); -int dvd_chapter_from_cell(dvd_priv_t *dvd,int title,int cell); - -#endif /* MPLAYER_STREAM_DVD_H */ diff --git a/stream/stream_dvd_common.h b/stream/stream_dvd_common.h index 4a1aef9af0..a2b05e8b77 100644 --- a/stream/stream_dvd_common.h +++ b/stream/stream_dvd_common.h @@ -19,7 +19,6 @@ #ifndef MPLAYER_STREAM_DVD_COMMON_H #define MPLAYER_STREAM_DVD_COMMON_H -#include "config.h" #include #include #include "stream.h" -- cgit v1.2.3