stream_dvd: minor cleanups

We don't need a separate stream_dvd.h header file anymore. Some dead
functions become apparent; remove them.
This commit is contained in:
wm4 2014-06-10 22:14:23 +02:00
parent 35e6d1abe0
commit 2fc3be582c
3 changed files with 44 additions and 141 deletions

View File

@ -24,15 +24,20 @@
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <libgen.h>
#include <errno.h>
#include <stdint.h>
#include <dvdread/dvd_reader.h>
#include <dvdread/ifo_types.h>
#include <dvdread/ifo_read.h>
#include <dvdread/nav_read.h>
#include "config.h"
#include "talloc.h"
#include "common/common.h"
#include "common/msg.h"
#include <libgen.h>
#include <errno.h>
#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;i<d->nr_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;i<d->nr_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;

View File

@ -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 <stdint.h>
#include <dvdread/dvd_reader.h>
#include <dvdread/ifo_types.h>
#include <dvdread/ifo_read.h>
#include <dvdread/nav_read.h>
#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 */

View File

@ -19,7 +19,6 @@
#ifndef MPLAYER_STREAM_DVD_COMMON_H
#define MPLAYER_STREAM_DVD_COMMON_H
#include "config.h"
#include <inttypes.h>
#include <dvdread/ifo_types.h>
#include "stream.h"