mirror of
https://github.com/mpv-player/mpv
synced 2024-10-18 10:25:02 +02:00
Simplify code by using separate variables for large common expressions.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22222 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
8ddb341bb7
commit
a2d923c273
@ -786,6 +786,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
|||||||
ifo_handle_t *vmg_file;
|
ifo_handle_t *vmg_file;
|
||||||
tt_srpt_t *tt_srpt;
|
tt_srpt_t *tt_srpt;
|
||||||
ifo_handle_t *vts_file;
|
ifo_handle_t *vts_file;
|
||||||
|
pgc_t *pgc;
|
||||||
/**
|
/**
|
||||||
* Open the disc.
|
* Open the disc.
|
||||||
*/
|
*/
|
||||||
@ -954,6 +955,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
|||||||
d->vts_file=vts_file;
|
d->vts_file=vts_file;
|
||||||
d->cur_title = dvd_title+1;
|
d->cur_title = dvd_title+1;
|
||||||
|
|
||||||
|
pgc = vts_file->vts_pgcit ? vts_file->vts_pgcit->pgci_srp[ttn].pgc : NULL;
|
||||||
/**
|
/**
|
||||||
* Check number of audio channels and types
|
* Check number of audio channels and types
|
||||||
*/
|
*/
|
||||||
@ -963,13 +965,14 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
|||||||
int i;
|
int i;
|
||||||
for(i=0;i<8;i++)
|
for(i=0;i<8;i++)
|
||||||
#ifdef USE_DVDREAD_INTERNAL
|
#ifdef USE_DVDREAD_INTERNAL
|
||||||
if(vts_file->vts_pgcit->pgci_srp[ttn].pgc->audio_control[i].present) {
|
if(pgc->audio_control[i].present) {
|
||||||
#else
|
#else
|
||||||
if(vts_file->vts_pgcit->pgci_srp[ttn].pgc->audio_control[i] & 0x8000) {
|
if(pgc->audio_control[i] & 0x8000) {
|
||||||
#endif
|
#endif
|
||||||
audio_attr_t * audio = &vts_file->vtsi_mat->vts_audio_attr[i];
|
audio_attr_t * audio = &vts_file->vtsi_mat->vts_audio_attr[i];
|
||||||
int language = 0;
|
int language = 0;
|
||||||
char tmp[] = "unknown";
|
char tmp[] = "unknown";
|
||||||
|
stream_language_t *audio_stream = &d->audio_streams[d->nr_of_channels];
|
||||||
|
|
||||||
if(audio->lang_type == 1) {
|
if(audio->lang_type == 1) {
|
||||||
language=audio->lang_code;
|
language=audio->lang_code;
|
||||||
@ -978,43 +981,43 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
|||||||
tmp[2]=0;
|
tmp[2]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->audio_streams[d->nr_of_channels].language=language;
|
audio_stream->language=language;
|
||||||
#ifdef USE_DVDREAD_INTERNAL
|
#ifdef USE_DVDREAD_INTERNAL
|
||||||
d->audio_streams[d->nr_of_channels].id=vts_file->vts_pgcit->pgci_srp[ttn].pgc->audio_control[i].s_audio;
|
audio_stream->id=pgc->audio_control[i].s_audio;
|
||||||
#else
|
#else
|
||||||
d->audio_streams[d->nr_of_channels].id=vts_file->vts_pgcit->pgci_srp[ttn].pgc->audio_control[i] >> 8 & 7;
|
audio_stream->id=pgc->audio_control[i] >> 8 & 7;
|
||||||
#endif
|
#endif
|
||||||
switch(audio->audio_format) {
|
switch(audio->audio_format) {
|
||||||
case 0: // ac3
|
case 0: // ac3
|
||||||
d->audio_streams[d->nr_of_channels].id+=FIRST_AC3_AID;
|
audio_stream->id+=FIRST_AC3_AID;
|
||||||
break;
|
break;
|
||||||
case 6: // dts
|
case 6: // dts
|
||||||
d->audio_streams[d->nr_of_channels].id+=FIRST_DTS_AID;
|
audio_stream->id+=FIRST_DTS_AID;
|
||||||
break;
|
break;
|
||||||
case 2: // mpeg layer 1/2/3
|
case 2: // mpeg layer 1/2/3
|
||||||
case 3: // mpeg2 ext
|
case 3: // mpeg2 ext
|
||||||
d->audio_streams[d->nr_of_channels].id+=FIRST_MPG_AID;
|
audio_stream->id+=FIRST_MPG_AID;
|
||||||
break;
|
break;
|
||||||
case 4: // lpcm
|
case 4: // lpcm
|
||||||
d->audio_streams[d->nr_of_channels].id+=FIRST_PCM_AID;
|
audio_stream->id+=FIRST_PCM_AID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->audio_streams[d->nr_of_channels].type=audio->audio_format;
|
audio_stream->type=audio->audio_format;
|
||||||
// Pontscho: to my mind, tha channels:
|
// Pontscho: to my mind, tha channels:
|
||||||
// 1 - stereo
|
// 1 - stereo
|
||||||
// 5 - 5.1
|
// 5 - 5.1
|
||||||
d->audio_streams[d->nr_of_channels].channels=audio->channels;
|
audio_stream->channels=audio->channels;
|
||||||
mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDaudioStreamInfo,
|
mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDaudioStreamInfo,
|
||||||
d->nr_of_channels,
|
d->nr_of_channels,
|
||||||
dvd_audio_stream_types[ audio->audio_format ],
|
dvd_audio_stream_types[ audio->audio_format ],
|
||||||
dvd_audio_stream_channels[ audio->channels ],
|
dvd_audio_stream_channels[ audio->channels ],
|
||||||
tmp,
|
tmp,
|
||||||
d->audio_streams[d->nr_of_channels].id
|
audio_stream->id
|
||||||
);
|
);
|
||||||
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_ID=%d\n", d->audio_streams[d->nr_of_channels].id);
|
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_ID=%d\n", audio_stream->id);
|
||||||
if(language && tmp[0])
|
if(language && tmp[0])
|
||||||
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", d->audio_streams[d->nr_of_channels].id, tmp);
|
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", audio_stream->id, tmp);
|
||||||
|
|
||||||
d->nr_of_channels++;
|
d->nr_of_channels++;
|
||||||
}
|
}
|
||||||
@ -1031,14 +1034,15 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
|||||||
d->nr_of_subtitles=0;
|
d->nr_of_subtitles=0;
|
||||||
for(i=0;i<32;i++)
|
for(i=0;i<32;i++)
|
||||||
#ifdef USE_DVDREAD_INTERNAL
|
#ifdef USE_DVDREAD_INTERNAL
|
||||||
if(vts_file->vts_pgcit->pgci_srp[ttn].pgc->subp_control[i].present) {
|
if(pgc->subp_control[i].present) {
|
||||||
#else
|
#else
|
||||||
if(vts_file->vts_pgcit->pgci_srp[ttn].pgc->subp_control[i] & 0x80000000) {
|
if(pgc->subp_control[i] & 0x80000000) {
|
||||||
#endif
|
#endif
|
||||||
subp_attr_t * subtitle = &vts_file->vtsi_mat->vts_subp_attr[i];
|
subp_attr_t * subtitle = &vts_file->vtsi_mat->vts_subp_attr[i];
|
||||||
video_attr_t *video = &vts_file->vtsi_mat->vts_video_attr;
|
video_attr_t *video = &vts_file->vtsi_mat->vts_video_attr;
|
||||||
int language = 0;
|
int language = 0;
|
||||||
char tmp[] = "unknown";
|
char tmp[] = "unknown";
|
||||||
|
stream_language_t *sub_stream = &d->subtitles[d->nr_of_subtitles];
|
||||||
|
|
||||||
if(subtitle->type == 1) {
|
if(subtitle->type == 1) {
|
||||||
language=subtitle->lang_code;
|
language=subtitle->lang_code;
|
||||||
@ -1047,19 +1051,19 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
|||||||
tmp[2]=0;
|
tmp[2]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->subtitles[ d->nr_of_subtitles ].language=language;
|
sub_stream->language=language;
|
||||||
d->subtitles[ d->nr_of_subtitles ].id=d->nr_of_subtitles;
|
sub_stream->id=d->nr_of_subtitles;
|
||||||
if(video->display_aspect_ratio == 0) /* 4:3 */
|
if(video->display_aspect_ratio == 0) /* 4:3 */
|
||||||
#ifdef USE_DVDREAD_INTERNAL
|
#ifdef USE_DVDREAD_INTERNAL
|
||||||
d->subtitles[d->nr_of_subtitles].id = vts_file->vts_pgcit->pgci_srp[ttn].pgc->subp_control[i].s_4p3;
|
sub_stream->id = pgc->subp_control[i].s_4p3;
|
||||||
#else
|
#else
|
||||||
d->subtitles[d->nr_of_subtitles].id = vts_file->vts_pgcit->pgci_srp[ttn].pgc->subp_control[i] >> 24 & 31;
|
sub_stream->id = pgc->subp_control[i] >> 24 & 31;
|
||||||
#endif
|
#endif
|
||||||
else if(video->display_aspect_ratio == 3) /* 16:9 */
|
else if(video->display_aspect_ratio == 3) /* 16:9 */
|
||||||
#ifdef USE_DVDREAD_INTERNAL
|
#ifdef USE_DVDREAD_INTERNAL
|
||||||
d->subtitles[d->nr_of_subtitles].id = vts_file->vts_pgcit->pgci_srp[ttn].pgc->subp_control[i].s_lbox;
|
sub_stream->id = pgc->subp_control[i].s_lbox;
|
||||||
#else
|
#else
|
||||||
d->subtitles[d->nr_of_subtitles].id = vts_file->vts_pgcit->pgci_srp[ttn].pgc->subp_control[i] >> 8 & 31;
|
sub_stream->id = pgc->subp_control[i] >> 8 & 31;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, d->nr_of_subtitles, tmp);
|
mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, d->nr_of_subtitles, tmp);
|
||||||
|
Loading…
Reference in New Issue
Block a user