mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 09:32:40 +00:00
Add option -last-chapter for DVD playing/encoding
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4292 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
1f2d4faa6d
commit
f4acdd0f5e
@ -17,6 +17,7 @@
|
|||||||
{"dvd", &dvd_title, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
{"dvd", &dvd_title, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
||||||
{"dvdangle", &dvd_angle, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
{"dvdangle", &dvd_angle, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
||||||
{"chapter", &dvd_chapter, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
{"chapter", &dvd_chapter, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
||||||
|
{"last-chapter", &dvd_last_chapter, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
||||||
#else
|
#else
|
||||||
{"dvd", "MPlayer was compiled WITHOUT libdvdread support!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
{"dvd", "MPlayer was compiled WITHOUT libdvdread support!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,6 +24,7 @@ static URL_t* url;
|
|||||||
|
|
||||||
int dvd_title=0;
|
int dvd_title=0;
|
||||||
int dvd_chapter=1;
|
int dvd_chapter=1;
|
||||||
|
int dvd_last_chapter=0;
|
||||||
int dvd_angle=1;
|
int dvd_angle=1;
|
||||||
char* dvd_device=NULL;
|
char* dvd_device=NULL;
|
||||||
char* cdrom_device=NULL;
|
char* cdrom_device=NULL;
|
||||||
@ -162,7 +163,16 @@ if(dvd_title){
|
|||||||
DVDClose( dvd );
|
DVDClose( dvd );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if( dvd_last_chapter>0 ) {
|
||||||
|
if ( dvd_last_chapter<dvd_chapter || dvd_last_chapter>tt_srpt->title[dvd_title].nr_of_ptts ) {
|
||||||
|
mp_msg(MSGT_OPEN,MSGL_ERR, "Invalid DVD last chapter number: %d\n", dvd_last_chapter);
|
||||||
|
ifoClose( vmg_file );
|
||||||
|
DVDClose( dvd );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
--dvd_chapter; // remap 1.. -> 0..
|
--dvd_chapter; // remap 1.. -> 0..
|
||||||
|
/* XXX No need to remap dvd_last_chapter */
|
||||||
/**
|
/**
|
||||||
* Make sure the angle number is valid for this title.
|
* Make sure the angle number is valid for this title.
|
||||||
*/
|
*/
|
||||||
@ -315,6 +325,13 @@ if(dvd_title){
|
|||||||
d->cur_cell = d->cur_pgc->program_map[pgn-1] - 1; // start playback here
|
d->cur_cell = d->cur_pgc->program_map[pgn-1] - 1; // start playback here
|
||||||
d->packs_left=-1; // for Navi stuff
|
d->packs_left=-1; // for Navi stuff
|
||||||
d->angle_seek=0;
|
d->angle_seek=0;
|
||||||
|
/* XXX dvd_last_chapter is in the range 1..nr_of_ptts */
|
||||||
|
if ( dvd_last_chapter > 0 && dvd_last_chapter < tt_srpt->title[ttn-1].nr_of_ptts ) {
|
||||||
|
pgn=vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_last_chapter].pgn;
|
||||||
|
d->last_cell=d->cur_pgc->program_map[pgn-1] - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
d->last_cell=d->cur_pgc->nr_of_cells;
|
||||||
|
|
||||||
if( d->cur_pgc->cell_playback[d->cur_cell].block_type
|
if( d->cur_pgc->cell_playback[d->cur_cell].block_type
|
||||||
== BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle;
|
== BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle;
|
||||||
@ -450,7 +467,7 @@ static int dvd_next_cell(dvd_priv_t *d){
|
|||||||
|
|
||||||
if( d->cur_pgc->cell_playback[ next_cell ].block_type
|
if( d->cur_pgc->cell_playback[ next_cell ].block_type
|
||||||
== BLOCK_TYPE_ANGLE_BLOCK ) {
|
== BLOCK_TYPE_ANGLE_BLOCK ) {
|
||||||
while(next_cell<d->cur_pgc->nr_of_cells){
|
while(next_cell<d->last_cell){
|
||||||
if( d->cur_pgc->cell_playback[next_cell].block_mode
|
if( d->cur_pgc->cell_playback[next_cell].block_mode
|
||||||
== BLOCK_MODE_LAST_CELL ) break;
|
== BLOCK_MODE_LAST_CELL ) break;
|
||||||
++next_cell;
|
++next_cell;
|
||||||
@ -459,10 +476,10 @@ static int dvd_next_cell(dvd_priv_t *d){
|
|||||||
mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next2=0x%X \n",next_cell);
|
mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next2=0x%X \n",next_cell);
|
||||||
|
|
||||||
++next_cell;
|
++next_cell;
|
||||||
if(next_cell>=d->cur_pgc->nr_of_cells) return -1; // EOF
|
if(next_cell>=d->last_cell) return -1; // EOF
|
||||||
if( d->cur_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ){
|
if( d->cur_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ){
|
||||||
next_cell+=dvd_angle;
|
next_cell+=dvd_angle;
|
||||||
if(next_cell>=d->cur_pgc->nr_of_cells) return -1; // EOF
|
if(next_cell>=d->last_cell) return -1; // EOF
|
||||||
}
|
}
|
||||||
mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next3=0x%X \n",next_cell);
|
mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next3=0x%X \n",next_cell);
|
||||||
return next_cell;
|
return next_cell;
|
||||||
|
@ -182,6 +182,7 @@ stream_t* open_stream(char* filename,int vcd_track,int* file_format);
|
|||||||
//#ifdef USE_DVDREAD
|
//#ifdef USE_DVDREAD
|
||||||
extern int dvd_title;
|
extern int dvd_title;
|
||||||
extern int dvd_chapter;
|
extern int dvd_chapter;
|
||||||
|
extern int dvd_last_chapter;
|
||||||
extern int dvd_angle;
|
extern int dvd_angle;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
@ -207,6 +208,7 @@ typedef struct {
|
|||||||
pgc_t *cur_pgc;
|
pgc_t *cur_pgc;
|
||||||
//
|
//
|
||||||
int cur_cell;
|
int cur_cell;
|
||||||
|
int last_cell;
|
||||||
int cur_pack;
|
int cur_pack;
|
||||||
int cell_last_pack;
|
int cell_last_pack;
|
||||||
// Navi:
|
// Navi:
|
||||||
|
Loading…
Reference in New Issue
Block a user