Commit ab1d6024 authored by Stéphane Borel's avatar Stéphane Borel

*More cleanification in gtk interface: now to change the

title/chapter/audio/spu/angle, we tell the input to do intead of doing
it inside the interface. It results in fewer locks during the changes.

*The dvd plugin reads again blocks of 32 sectors to gain speed since
there are no more lock-ups during stream change. I've also created a new
file that contain function to described video and audio streams with ifo
datas.

The changes are made only for gtk. We should update the other interfaces
soon (beos at least).

There is a memory corruption somewhere that make the vlc crash. I've no
idea where to search.
parent 62b322c2
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* control the pace of reading. * control the pace of reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.36 2001/05/01 12:22:18 sam Exp $ * $Id: input_ext-intf.h,v 1.37 2001/05/19 00:39:29 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -196,6 +196,9 @@ typedef struct stream_descriptor_s ...@@ -196,6 +196,9 @@ typedef struct stream_descriptor_s
input_area_t ** pp_areas; /* list of areas in stream == offset input_area_t ** pp_areas; /* list of areas in stream == offset
* interval with own properties */ * interval with own properties */
input_area_t * p_selected_area; input_area_t * p_selected_area;
input_area_t * p_new_area; /* Newly selected area from
* the interface */
u32 i_mux_rate; /* the rate we read the stream (in u32 i_mux_rate; /* the rate we read the stream (in
* units of 50 bytes/s) ; 0 if undef */ * units of 50 bytes/s) ; 0 if undef */
...@@ -216,6 +219,10 @@ typedef struct stream_descriptor_s ...@@ -216,6 +219,10 @@ typedef struct stream_descriptor_s
es_descriptor_t ** pp_es; /* carried elementary streams */ es_descriptor_t ** pp_es; /* carried elementary streams */
int i_selected_es_number; int i_selected_es_number;
es_descriptor_t ** pp_selected_es; /* ES with a decoder */ es_descriptor_t ** pp_selected_es; /* ES with a decoder */
es_descriptor_t * p_newly_selected_es; /* ES selected from
* the interface */
es_descriptor_t * p_removed_es; /* ES removed from the interface */
/* Stream control */ /* Stream control */
stream_ctrl_t control; stream_ctrl_t control;
...@@ -346,3 +353,5 @@ int input_ChangeES ( struct input_thread_s *, struct es_descriptor_s *, u8 ); ...@@ -346,3 +353,5 @@ int input_ChangeES ( struct input_thread_s *, struct es_descriptor_s *, u8 );
int input_ToggleES ( struct input_thread_s *, int input_ToggleES ( struct input_thread_s *,
struct es_descriptor_s *, struct es_descriptor_s *,
boolean_t ); boolean_t );
int input_ChangeArea( input_thread_t *, input_area_t * );
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# Objects # Objects
# #
PLUGIN_C = dvd.o input_dvd.o dvd_netlist.o dvd_ioctl.o dvd_ifo.o dvd_udf.o dvd_css.o PLUGIN_C = dvd.o input_dvd.o dvd_netlist.o dvd_ioctl.o dvd_ifo.o dvd_udf.o dvd_css.o dvd_summary.o
BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o) BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C) ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling * dvd_css.c: Functions for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.28 2001/05/07 03:14:09 stef Exp $ * $Id: dvd_css.c,v 1.29 2001/05/19 00:39:29 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include "dvd_csstables.h" #include "dvd_csstables.h"
#endif /* HAVE_CSS */ #endif /* HAVE_CSS */
#include "dvd_ioctl.h" #include "dvd_ioctl.h"
#include "dvd_ifo.h"
#include "input_dvd.h" #include "input_dvd.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_css.h: Structures for DVD authentification and unscrambling * dvd_css.h: Structures for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.h,v 1.7 2001/04/11 04:31:59 sam Exp $ * $Id: dvd_css.h,v 1.8 2001/05/19 00:39:29 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -55,3 +55,12 @@ typedef struct css_s ...@@ -55,3 +55,12 @@ typedef struct css_s
dvd_key_t pi_title_key; dvd_key_t pi_title_key;
} css_t; } css_t;
/*****************************************************************************
* Prototypes in dvd_css.c
*****************************************************************************/
struct css_s;
int CSSTest ( int );
int CSSInit ( int, struct css_s * );
int CSSGetKey ( int, struct css_s * );
int CSSDescrambleSector ( u8 * , u8 * );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing * dvd_ifo.c: Functions for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.c,v 1.26 2001/05/07 04:42:42 sam Exp $ * $Id: dvd_ifo.c,v 1.27 2001/05/19 00:39:29 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include "intf_msg.h" #include "intf_msg.h"
#include "dvd_ifo.h" #include "dvd_ifo.h"
#include "dvd_udf.h" #include "dvd_udf.h"
#include "dvd_css.h"
#include "input_dvd.h" #include "input_dvd.h"
/* /*
...@@ -508,6 +507,7 @@ int IfoTitleSet( ifo_t * p_ifo ) ...@@ -508,6 +507,7 @@ int IfoTitleSet( ifo_t * p_ifo )
off_t i_off; off_t i_off;
off_t i_start; off_t i_start;
u64 i_temp; u64 i_temp;
u16 i_short;
int i, j; int i, j;
if( p_ifo->vts.b_initialized ) if( p_ifo->vts.b_initialized )
...@@ -570,8 +570,27 @@ DumpBits( p_ifo, pi_buffer, &p_current, 2 ); ...@@ -570,8 +570,27 @@ DumpBits( p_ifo, pi_buffer, &p_current, 2 );
/* FIXME : take care of endianness */ /* FIXME : take care of endianness */
} }
DumpBits( p_ifo, pi_buffer, &p_current, 2 ); DumpBits( p_ifo, pi_buffer, &p_current, 2 );
// GETS( &manager_inf.video_atrt );
DumpBits( p_ifo, pi_buffer, &p_current, 2 ); i_short = ReadWord( p_ifo, pi_buffer, &p_current );
i_short >>= 2;
manager_inf.video_attr.i_mode = i_short & 0x1;
i_short >>= 1;
manager_inf.video_attr.i_letterboxed = i_short & 0x1;
i_short >>= 1;
manager_inf.video_attr.i_source_res = i_short & 0x3;
i_short >>= 2;
manager_inf.video_attr.i_line21_2 = i_short & 0x1;
i_short >>= 1;
manager_inf.video_attr.i_line21_1 = i_short & 0x1;
i_short >>= 1;
manager_inf.video_attr.i_perm_displ = i_short & 0x3;
i_short >>= 2;
manager_inf.video_attr.i_ratio = i_short & 0x3;
i_short >>= 2;
manager_inf.video_attr.i_system = i_short & 0x3;
i_short >>= 2;
manager_inf.video_attr.i_compression = i_short & 0x3;
DumpBits( p_ifo, pi_buffer, &p_current, 1 ); DumpBits( p_ifo, pi_buffer, &p_current, 1 );
manager_inf.i_audio_nb = ReadByte( p_ifo, pi_buffer, &p_current ); manager_inf.i_audio_nb = ReadByte( p_ifo, pi_buffer, &p_current );
//fprintf( stderr, "vtsi audio nb : %d\n", manager_inf.i_audio_nb ); //fprintf( stderr, "vtsi audio nb : %d\n", manager_inf.i_audio_nb );
...@@ -613,7 +632,9 @@ DumpBits( p_ifo, pi_buffer, &p_current, 2 ); ...@@ -613,7 +632,9 @@ DumpBits( p_ifo, pi_buffer, &p_current, 2 );
i_temp = hton64( i_temp ) >> 16; i_temp = hton64( i_temp ) >> 16;
//fprintf( stderr, "Subpic %d: %llx\n", i, i_temp ); //fprintf( stderr, "Subpic %d: %llx\n", i, i_temp );
manager_inf.p_spu_attr[i].i_caption = i_temp & 0xff; manager_inf.p_spu_attr[i].i_caption = i_temp & 0xff;
i_temp >>= 16; i_temp >>= 8;
manager_inf.p_spu_attr[i].i_foo = i_temp & 0xff;
i_temp >>= 8;
manager_inf.p_spu_attr[i].i_lang_code = i_temp & 0xffff; manager_inf.p_spu_attr[i].i_lang_code = i_temp & 0xffff;
i_temp >>= 16; i_temp >>= 16;
manager_inf.p_spu_attr[i].i_prefix = i_temp & 0xffff; manager_inf.p_spu_attr[i].i_prefix = i_temp & 0xffff;
...@@ -929,6 +950,8 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos ) ...@@ -929,6 +950,8 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
u8 pi_buffer[DVD_LB_SIZE]; u8 pi_buffer[DVD_LB_SIZE];
u8 * p_current; u8 * p_current;
off_t i_start; off_t i_start;
u16 i_audio;
u32 i_spu;
int i; int i;
p_current = FillBuffer( p_ifo, pi_buffer, i_pos ); p_current = FillBuffer( p_ifo, pi_buffer, i_pos );
...@@ -945,11 +968,25 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos ) ...@@ -945,11 +968,25 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
p_title->i_prohibited_user_op = ReadDouble( p_ifo, pi_buffer, &p_current ); p_title->i_prohibited_user_op = ReadDouble( p_ifo, pi_buffer, &p_current );
for( i = 0 ; i < 8 ; i++ ) for( i = 0 ; i < 8 ; i++ )
{ {
p_title->pi_audio_status[i] = ReadWord( p_ifo, pi_buffer, &p_current ); i_audio = ReadWord( p_ifo, pi_buffer, &p_current );
p_title->pi_audio_status[i].i_foo = i_audio & 0xff;
i_audio >>= 8;
p_title->pi_audio_status[i].i_position = i_audio & 0x07;
i_audio >>= 7;
p_title->pi_audio_status[i].i_available = i_audio;
} }
for( i = 0 ; i < 32 ; i++ ) for( i = 0 ; i < 32 ; i++ )
{ {
p_title->pi_subpic_status[i] = ReadDouble( p_ifo, pi_buffer, &p_current ); i_spu = ReadDouble( p_ifo, pi_buffer, &p_current );
p_title->pi_spu_status[i].i_position_pan = i_spu & 0x1f;
i_spu >>= 8;
p_title->pi_spu_status[i].i_position_letter = i_spu & 0x1f;
i_spu >>= 8;
p_title->pi_spu_status[i].i_position_wide = i_spu & 0x1f;
i_spu >>= 8;
p_title->pi_spu_status[i].i_position_43 = i_spu & 0x1f;
i_spu >>= 7;
p_title->pi_spu_status[i].i_available = i_spu;
} }
p_title->i_next_title_num = ReadWord( p_ifo, pi_buffer, &p_current ); p_title->i_next_title_num = ReadWord( p_ifo, pi_buffer, &p_current );
p_title->i_prev_title_num = ReadWord( p_ifo, pi_buffer, &p_current ); p_title->i_prev_title_num = ReadWord( p_ifo, pi_buffer, &p_current );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ifo.h: Structures for ifo parsing * dvd_ifo.h: Structures for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.h,v 1.14 2001/04/22 00:08:25 stef Exp $ * $Id: dvd_ifo.h,v 1.15 2001/05/19 00:39:30 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -65,6 +65,14 @@ typedef struct ifo_audio_s ...@@ -65,6 +65,14 @@ typedef struct ifo_audio_s
u8 i_bar ;// 8; // 0x00000000 ? u8 i_bar ;// 8; // 0x00000000 ?
} ifo_audio_t; } ifo_audio_t;
/* Audio Status */
typedef struct audio_status_s
{
u8 i_available; // 1
u8 i_position; // 7
u8 i_foo; // 8
} audio_status_t;
typedef struct ifo_spu_t typedef struct ifo_spu_t
{ {
u16 i_prefix ;// 16; // 0x0100 ? u16 i_prefix ;// 16; // 0x0100 ?
...@@ -73,6 +81,15 @@ typedef struct ifo_spu_t ...@@ -73,6 +81,15 @@ typedef struct ifo_spu_t
u8 i_caption ;// 8; // 0x00 ? u8 i_caption ;// 8; // 0x00 ?
} ifo_spu_t; } ifo_spu_t;
/* Subpicture status */
typedef struct spu_status_s
{
u8 i_available; //1
u8 i_position_43; //7
u8 i_position_wide; //8
u8 i_position_letter; //8
u8 i_position_pan; //8
} spu_status_t;
/* Ifo vitual machine Commands */ /* Ifo vitual machine Commands */
...@@ -153,8 +170,8 @@ typedef struct title_s ...@@ -153,8 +170,8 @@ typedef struct title_s
u8 i_cell_nb; // 1 byte u8 i_cell_nb; // 1 byte
u32 i_play_time; // 4 bytes u32 i_play_time; // 4 bytes
u32 i_prohibited_user_op; // 4 bytes u32 i_prohibited_user_op; // 4 bytes
u16 pi_audio_status[8]; // 8*2 bytes audio_status_t pi_audio_status[8]; // 8*2 bytes
u32 pi_subpic_status[32]; // 32*4 bytes spu_status_t pi_spu_status[32]; // 32*4 bytes
u16 i_next_title_num; // 2 bytes u16 i_next_title_num; // 2 bytes
u16 i_prev_title_num; // 2 bytes u16 i_prev_title_num; // 2 bytes
u16 i_go_up_title_num; // 2 bytes u16 i_go_up_title_num; // 2 bytes
...@@ -530,3 +547,13 @@ typedef struct ifo_s ...@@ -530,3 +547,13 @@ typedef struct ifo_s
vts_t vts; /* Vts ifo for current title set */ vts_t vts; /* Vts ifo for current title set */
} ifo_t; } ifo_t;
/*****************************************************************************
* Prototypes in dvd_ifo.c
*****************************************************************************/
struct thread_dvd_data_s;
int IfoCreate ( struct thread_dvd_data_s * );
int IfoInit ( struct ifo_s * );
int IfoTitleSet ( struct ifo_s * );
void IfoDestroy ( struct ifo_s * );
/*****************************************************************************
* dvd_summary.c: set of functions to print options of selected title
* found in .ifo.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_summary.c,v 1.1 2001/05/19 00:39:30 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#ifdef HAVE_CSS
#define MODULE_NAME dvd
#else /* HAVE_CSS */
#define MODULE_NAME dvdnocss
#endif /* HAVE_CSS */
#include "modules_inner.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <string.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
#endif
#include <errno.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "intf_msg.h"
#include "main.h"
#include "dvd_ifo.h"
#include "input_dvd.h"
#include "debug.h"
#include "modules.h"
/*****************************************************************************
* Local tables
*****************************************************************************/
static struct
{
char p_code[3];
char p_lang_long[20];
}
lang_tbl[] =
{
/* The ISO 639 language codes.
* Language names with * prefix are not spelled in their own language
*/
{ " ", "Not Specified" },
{ "aa", "*Afar" },
{ "ab", "*Abkhazian" },
{ "af", "*Afrikaans" },
{ "am", "*Amharic" },
{ "ar", "*Arabic" },
{ "as", "*Assamese" },
{ "ay", "*Aymara" },
{ "az", "*Azerbaijani" },
{ "ba", "*Bashkir" },
{ "be", "*Byelorussian" },
{ "bg", "*Bulgarian" },
{ "bh", "*Bihari" },
{ "bi", "*Bislama" },
{ "bn", "*Bengali; Bangla" },
{ "bo", "*Tibetan" },
{ "br", "*Breton" },
{ "ca", "*Catalan" },
{ "co", "*Corsican" },
{ "cs", "*Czech(Ceske)" },
{ "cy", "*Welsh" },
{ "da", "Dansk" },
{ "de", "Deutsch" },
{ "dz", "*Bhutani" },
{ "el", "*Greek" },
{ "en", "English" },
{ "eo", "*Esperanto" },
{ "es", "Espanol" },
{ "et", "*Estonian" },
{ "eu", "*Basque" },
{ "fa", "*Persian" },
{ "fi", "Suomi" },
{ "fj", "*Fiji" },
{ "fo", "*Faroese" },
{ "fr", "Francais" },
{ "fy", "*Frisian" },
{ "ga", "*Irish" },
{ "gd", "*Scots Gaelic" },
{ "gl", "*Galician" },
{ "gn", "*Guarani" },
{ "gu", "*Gujarati" },
{ "ha", "*Hausa" },
{ "he", "*Hebrew" }, /* formerly iw */
{ "hi", "*Hindi" },
{ "hr", "Hrvatski" }, /* Croatian */
{ "hu", "Magyar" },
{ "hy", "*Armenian" },
{ "ia", "*Interlingua" },
{ "id", "*Indonesian" }, /* formerly in */
{ "ie", "*Interlingue" },
{ "ik", "*Inupiak" },
{ "in", "*Indonesian" }, /* replaced by id */
{ "is", "Islenska" },
{ "it", "Italiano" },
{ "iu", "*Inuktitut" },
{ "iw", "*Hebrew" }, /* replaced by he */
{ "ja", "*Japanese" },
{ "ji", "*Yiddish" }, /* replaced by yi */
{ "jw", "*Javanese" },
{ "ka", "*Georgian" },
{ "kk", "*Kazakh" },
{ "kl", "*Greenlandic" },
{ "km", "*Cambodian" },
{ "kn", "*Kannada" },
{ "ko", "*Korean" },
{ "ks", "*Kashmiri" },
{ "ku", "*Kurdish" },
{ "ky", "*Kirghiz" },
{ "la", "*Latin" },
{ "ln", "*Lingala" },
{ "lo", "*Laothian" },
{ "lt", "*Lithuanian" },
{ "lv", "*Latvian, Lettish" },
{ "mg", "*Malagasy" },
{ "mi", "*Maori" },
{ "mk", "*Macedonian" },
{ "ml", "*Malayalam" },
{ "mn", "*Mongolian" },
{ "mo", "*Moldavian" },
{ "mr", "*Marathi" },
{ "ms", "*Malay" },
{ "mt", "*Maltese" },
{ "my", "*Burmese" },
{ "na", "*Nauru" },
{ "ne", "*Nepali" },
{ "nl", "Nederlands" },
{ "no", "Norsk" },
{ "oc", "*Occitan" },
{ "om", "*(Afan) Oromo" },
{ "or", "*Oriya" },
{ "pa", "*Punjabi" },
{ "pl", "*Polish" },
{ "ps", "*Pashto, Pushto" },
{ "pt", "Portugues" },
{ "qu", "*Quechua" },
{ "rm", "*Rhaeto-Romance" },
{ "rn", "*Kirundi" },
{ "ro", "*Romanian" },
{ "ru", "*Russian" },
{ "rw", "*Kinyarwanda" },
{ "sa", "*Sanskrit" },
{ "sd", "*Sindhi" },
{ "sg", "*Sangho" },
{ "sh", "*Serbo-Croatian" },
{ "si", "*Sinhalese" },
{ "sk", "*Slovak" },
{ "sl", "*Slovenian" },
{ "sm", "*Samoan" },
{ "sn", "*Shona" },
{ "so", "*Somali" },
{ "sq", "*Albanian" },
{ "sr", "*Serbian" },
{ "ss", "*Siswati" },
{ "st", "*Sesotho" },
{ "su", "*Sundanese" },
{ "sv", "Svenska" },
{ "sw", "*Swahili" },
{ "ta", "*Tamil" },
{ "te", "*Telugu" },
{ "tg", "*Tajik" },
{ "th", "*Thai" },
{ "ti", "*Tigrinya" },
{ "tk", "*Turkmen" },
{ "tl", "*Tagalog" },
{ "tn", "*Setswana" },
{ "to", "*Tonga" },
{ "tr", "*Turkish" },
{ "ts", "*Tsonga" },
{ "tt", "*Tatar" },
{ "tw", "*Twi" },
{ "ug", "*Uighur" },
{ "uk", "*Ukrainian" },
{ "ur", "*Urdu" },
{ "uz", "*Uzbek" },
{ "vi", "*Vietnamese" },
{ "vo", "*Volapuk" },
{ "wo", "*Wolof" },
{ "xh", "*Xhosa" },
{ "yi", "*Yiddish" }, /* formerly ji */
{ "yo", "*Yoruba" },
{ "za", "*Zhuang" },
{ "zh", "*Chinese" },
{ "zu", "*Zulu" },
{ "\0", "" }
};
/*
* Local tools to decode some data in ifo
*/
/*****************************************************************************
* IfoLanguage: gives the long language name from the two-letters
* ISO-639 code
*****************************************************************************/
char * IfoLanguage( u16 i_code )
{
int i = 0;
while( memcmp( lang_tbl[i].p_code, &i_code, 2 ) &&
lang_tbl[i].p_lang_long[0] )
{
i++;
}
return lang_tbl[i].p_lang_long;
}
/****************************************************************************
* IfoPrintTitle
****************************************************************************/
void IfoPrintTitle( thread_dvd_data_t * p_dvd )
{
intf_WarnMsg( 5, "***************************************************" );
intf_WarnMsg( 5, "dvd info: title: %d", p_dvd->i_title );
intf_WarnMsg( 5, " vobstart at: %lld", p_dvd->i_start );
intf_WarnMsg( 5, " stream size: %lld", p_dvd->i_size );
intf_WarnMsg( 5, " number of chapters: %d", p_dvd->i_chapter_nb );
intf_WarnMsg( 5, " number of angles: %d", p_dvd->i_angle_nb );
intf_WarnMsg( 5, "***************************************************\n" );
}
/****************************************************************************
* IfoPrintVideo
****************************************************************************/
#define video p_dvd->p_ifo->vts.manager_inf.video_attr
void IfoPrintVideo( thread_dvd_data_t * p_dvd )
{
char psz_ratio[12];
char psz_perm_displ[4][23] =
{
"pan-scan & letterboxed",
"pan-scan",
"letterboxed",
"not specified"
};
char psz_source_res[4][28] =
{
"720x480 ntsc or 720x576 pal",
"704x480 ntsc or 704x576 pal",
"352x480 ntsc or 352x576 pal",
"352x240 ntsc or 352x288 pal"
};
switch( video.i_ratio )
{
case 0:
sprintf( psz_ratio, "4:3" );
break;
case 3:
sprintf( psz_ratio, "16:9" );
break;
default:
sprintf( psz_ratio, "undef" );
break;
}
intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: video" );
intf_WarnMsg( 5, " compression: mpeg-%d", video.i_compression+1 );
intf_WarnMsg( 5, " tv system: %s Hz",
video.i_system ? "pal 625/50" : "ntsc 525/60" );
intf_WarnMsg( 5, " aspect ratio: %s", psz_ratio );
intf_WarnMsg( 5, " display mode: %s",
psz_perm_displ[video.i_perm_displ] );
intf_WarnMsg( 5, " line21-1: %s",
video.i_line21_1 ? "data present in GOP" : "" );
intf_WarnMsg( 5, " line21-2: %s",
video.i_line21_2 ? "data present in GOP" : "" );
intf_WarnMsg( 5, " source res: %s",
psz_source_res[video.i_source_res] );
intf_WarnMsg( 5, " letterboxed: %s",
video.i_letterboxed ? "yes" : "no" );
intf_WarnMsg( 5, " mode: %s",
video.i_mode ? "film (625/50 only)" : "camera");
intf_WarnMsg( 5, "***********************************************\n" );
}
#undef video
/****************************************************************************
* IfoPrintAudio
****************************************************************************/
#define audio p_dvd->p_ifo->vts.manager_inf.p_audio_attr[i-1]
#define audio_status \
p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
{
if( audio_status.i_available )
{
char ppsz_mode[7][9] =
{ "ac3", "unknown", "mpeg-1", "mpeg-2", "lpcm", "sdds", "dts" };
char ppsz_appl_mode[3][15] =
{ "not specified", "karaoke", "surround sound" };
char psz_caption[25];
char ppsz_quant[4][10] =
{ "16 bits", "20 bits", "24 bits", "drc" };
intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: audio %d" , i );
intf_WarnMsg( 5, " language: %s",
IfoLanguage( hton16( audio.i_lang_code ) ) );
intf_WarnMsg( 5, " mode: %s", ppsz_mode[audio.i_coding_mode & 0x7] );
intf_WarnMsg( 5, " channel(s): %d %s",
audio.i_num_channels + 1,
audio.i_multichannel_extension ? "ext." : "" );
intf_WarnMsg( 5, " sampling: %d Hz",
audio.i_sample_freq ? 96000 : 48000 );
intf_WarnMsg( 5, " appl_mode: %s",
ppsz_appl_mode[audio.i_appl_mode & 0x2] );
switch( audio.i_caption )
{
case 1:
sprintf( psz_caption, "normal caption" );
break;
case 3:
sprintf( psz_caption, "directors comments" );
break;
default:
sprintf( psz_caption, " " );
break;
}
intf_WarnMsg( 5, " caption: %s", psz_caption );
intf_WarnMsg( 5, " quantization: %s",
ppsz_quant[audio.i_quantization & 0x3] );
intf_WarnMsg( 5, " status: %x", audio_status.i_position );
intf_WarnMsg( 5, "***********************************************\n" );
}
}
#undef audio_status
#undef audio
/****************************************************************************
* IfoPrintSpu
****************************************************************************/
#define spu p_dvd->p_ifo->vts.manager_inf.p_spu_attr[i-1]
#define spu_status \
p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_spu_status[i-1]
void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
{
if( spu_status.i_available )
{
intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: spu %d", i );
intf_WarnMsg( 5, " caption: %d", spu.i_caption );
intf_WarnMsg( 5, " language: %s",
IfoLanguage( hton16( spu.i_lang_code ) ) );
intf_WarnMsg( 5, " prefix: %x", spu.i_prefix );
intf_WarnMsg( 5, " status: 4:3 %x wide %x letter %x pan %x",
spu_status.i_position_43,
spu_status.i_position_wide,
spu_status.i_position_letter,
spu_status.i_position_pan );
intf_WarnMsg( 5, "***********************************************\n" );
}
}
#undef spu_status
#undef spu
/*****************************************************************************
* dvd_summary.h: prototype of functions that print out current options.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_summary.h,v 1.1 2001/05/19 00:39:30 stef Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
struct thread_dvd_data_s;
char * IfoLanguage( u16 );
void IfoPrintTitle( struct thread_dvd_data_s * );
void IfoPrintVideo( struct thread_dvd_data_s * );
void IfoPrintAudio( struct thread_dvd_data_s *, int );
void IfoPrintSpu ( struct thread_dvd_data_s *, int );
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.59 2001/05/15 14:49:47 stef Exp $ * $Id: input_dvd.c,v 1.60 2001/05/19 00:39:30 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#include "dvd_netlist.h" #include "dvd_netlist.h"
#include "dvd_ifo.h" #include "dvd_ifo.h"
#include "dvd_css.h" #include "dvd_css.h"
#include "dvd_summary.h"
#include "input_dvd.h" #include "input_dvd.h"
#include "mpeg_system.h" #include "mpeg_system.h"
...@@ -82,166 +83,6 @@ ...@@ -82,166 +83,6 @@
#include "modules.h" #include "modules.h"
/*****************************************************************************
* Local tables
*****************************************************************************/
static struct
{
char p_code[3];
char p_lang_long[20];
}
lang_tbl[] =
{
/* The ISO 639 language codes.
* Language names with * prefix are not spelled in their own language
*/
{ " ", "Not Specified" },
{ "aa", "*Afar" },
{ "ab", "*Abkhazian" },
{ "af", "*Afrikaans" },
{ "am", "*Amharic" },
{ "ar", "*Arabic" },
{ "as", "*Assamese" },
{ "ay", "*Aymara" },
{ "az", "*Azerbaijani" },
{ "ba", "*Bashkir" },
{ "be", "*Byelorussian" },
{ "bg", "*Bulgarian" },
{ "bh", "*Bihari" },
{ "bi", "*Bislama" },
{ "bn", "*Bengali; Bangla" },
{ "bo", "*Tibetan" },
{ "br", "*Breton" },
{ "ca", "*Catalan" },
{ "co", "*Corsican" },
{ "cs", "*Czech(Ceske)" },
{ "cy", "*Welsh" },
{ "da", "Dansk" },
{ "de", "Deutsch" },
{ "dz", "*Bhutani" },
{ "el", "*Greek" },
{ "en", "English" },
{ "eo", "*Esperanto" },
{ "es", "Espanol" },
{ "et", "*Estonian" },
{ "eu", "*Basque" },
{ "fa", "*Persian" },
{ "fi", "Suomi" },
{ "fj", "*Fiji" },
{ "fo", "*Faroese" },
{ "fr", "Francais" },
{ "fy", "*Frisian" },
{ "ga", "*Irish" },
{ "gd", "*Scots Gaelic" },
{ "gl", "*Galician" },
{ "gn", "*Guarani" },
{ "gu", "*Gujarati" },
{ "ha", "*Hausa" },
{ "he", "*Hebrew" }, /* formerly iw */
{ "hi", "*Hindi" },
{ "hr", "Hrvatski" }, /* Croatian */
{ "hu", "Magyar" },
{ "hy", "*Armenian" },
{ "ia", "*Interlingua" },
{ "id", "*Indonesian" }, /* formerly in */
{ "ie", "*Interlingue" },
{ "ik", "*Inupiak" },
{ "in", "*Indonesian" }, /* replaced by id */
{ "is", "Islenska" },
{ "it", "Italiano" },
{ "iu", "*Inuktitut" },
{ "iw", "*Hebrew" }, /* replaced by he */
{ "ja", "*Japanese" },
{ "ji", "*Yiddish" }, /* replaced by yi */
{ "jw", "*Javanese" },
{ "ka", "*Georgian" },
{ "kk", "*Kazakh" },
{ "kl", "*Greenlandic" },
{ "km", "*Cambodian" },
{ "kn", "*Kannada" },
{ "ko", "*Korean" },
{ "ks", "*Kashmiri" },
{ "ku", "*Kurdish" },
{ "ky", "*Kirghiz" },
{ "la", "*Latin" },
{ "ln", "*Lingala" },
{ "lo", "*Laothian" },
{ "lt", "*Lithuanian" },
{ "lv", "*Latvian, Lettish" },
{ "mg", "*Malagasy" },
{ "mi", "*Maori" },
{ "mk", "*Macedonian" },
{ "ml", "*Malayalam" },
{ "mn", "*Mongolian" },
{ "mo", "*Moldavian" },
{ "mr", "*Marathi" },
{ "ms", "*Malay" },
{ "mt", "*Maltese" },
{ "my", "*Burmese" },
{ "na", "*Nauru" },
{ "ne", "*Nepali" },
{ "nl", "Nederlands" },
{ "no", "Norsk" },
{ "oc", "*Occitan" },
{ "om", "*(Afan) Oromo" },
{ "or", "*Oriya" },
{ "pa", "*Punjabi" },
{ "pl", "*Polish" },
{ "ps", "*Pashto, Pushto" },
{ "pt", "Portugues" },
{ "qu", "*Quechua" },
{ "rm", "*Rhaeto-Romance" },
{ "rn", "*Kirundi" },
{ "ro", "*Romanian" },
{ "ru", "*Russian" },
{ "rw", "*Kinyarwanda" },
{ "sa", "*Sanskrit" },
{ "sd", "*Sindhi" },
{ "sg", "*Sangho" },
{ "sh", "*Serbo-Croatian" },
{ "si", "*Sinhalese" },
{ "sk", "*Slovak" },
{ "sl", "*Slovenian" },
{ "sm", "*Samoan" },
{ "sn", "*Shona" },
{ "so", "*Somali" },
{ "sq", "*Albanian" },
{ "sr", "*Serbian" },
{ "ss", "*Siswati" },
{ "st", "*Sesotho" },
{ "su", "*Sundanese" },
{ "sv", "Svenska" },
{ "sw", "*Swahili" },
{ "ta", "*Tamil" },
{ "te", "*Telugu" },
{ "tg", "*Tajik" },
{ "th", "*Thai" },
{ "ti", "*Tigrinya" },
{ "tk", "*Turkmen" },
{ "tl", "*Tagalog" },
{ "tn", "*Setswana" },
{ "to", "*Tonga" },
{ "tr", "*Turkish" },
{ "ts", "*Tsonga" },
{ "tt", "*Tatar" },
{ "tw", "*Twi" },
{ "ug", "*Uighur" },
{ "uk", "*Ukrainian" },
{ "ur", "*Urdu" },
{ "uz", "*Uzbek" },
{ "vi", "*Vietnamese" },
{ "vo", "*Volapuk" },
{ "wo", "*Wolof" },
{ "xh", "*Xhosa" },
{ "yi", "*Yiddish" }, /* formerly ji */
{ "yo", "*Yoruba" },
{ "za", "*Zhuang" },
{ "zh", "*Chinese" },
{ "zu", "*Zulu" },
{ "\0", "" }
};
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -255,7 +96,6 @@ static void DVDSeek ( struct input_thread_s *, off_t ); ...@@ -255,7 +96,6 @@ static void DVDSeek ( struct input_thread_s *, off_t );
static int DVDRewind ( struct input_thread_s * ); static int DVDRewind ( struct input_thread_s * );
/* called only inside */ /* called only inside */
static char * Language( u16 );
static int DVDChooseAngle( thread_dvd_data_t * ); static int DVDChooseAngle( thread_dvd_data_t * );
static int DVDFindCell( thread_dvd_data_t * ); static int DVDFindCell( thread_dvd_data_t * );
static int DVDFindSector( thread_dvd_data_t * ); static int DVDFindSector( thread_dvd_data_t * );
...@@ -285,26 +125,6 @@ void _M( input_getfunctions )( function_list_t * p_function_list ) ...@@ -285,26 +125,6 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
#undef input #undef input
} }
/*
* Local tools to decode some data in ifo
*/
/*****************************************************************************
* Language: gives the long language name from the two-letters ISO-639 code
*****************************************************************************/
static char * Language( u16 i_code )
{
int i = 0;
while( memcmp( lang_tbl[i].p_code, &i_code, 2 ) &&
lang_tbl[i].p_lang_long[0] )
{
i++;
}
return lang_tbl[i].p_lang_long;
}
/* /*
* Data reading functions * Data reading functions
*/ */
...@@ -361,9 +181,6 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -361,9 +181,6 @@ static void DVDInit( input_thread_t * p_input )
int i_chapter; int i_chapter;
int i; int i;
/* I don't want DVDs to start playing immediately */
// p_input->stream.i_new_status = PAUSE_S;
p_dvd = malloc( sizeof(thread_dvd_data_t) ); p_dvd = malloc( sizeof(thread_dvd_data_t) );
if( p_dvd == NULL ) if( p_dvd == NULL )
{ {
...@@ -380,13 +197,14 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -380,13 +197,14 @@ static void DVDInit( input_thread_t * p_input )
/* reading several block once seems to cause lock-up /* reading several block once seems to cause lock-up
* when using input_ToggleES * when using input_ToggleES
* who wrote thez damn buggy piece of shit ??? --stef */ * who wrote thez damn buggy piece of shit ??? --stef */
p_dvd->i_block_once = 1;//32; p_dvd->i_block_once = 32;
p_input->i_read_once = 8;//128; p_input->i_read_once = 128;
i = CSSTest( p_input->i_handle ); i = CSSTest( p_input->i_handle );
if( i < 0 ) if( i < 0 )
{ {
intf_ErrMsg( "dvd error: error in css" );
free( p_dvd ); free( p_dvd );
p_input->b_error = 1; p_input->b_error = 1;
return; return;
...@@ -505,11 +323,11 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -505,11 +323,11 @@ static void DVDInit( input_thread_t * p_input )
p_area = p_input->stream.pp_areas[i_title]; p_area = p_input->stream.pp_areas[i_title];
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* set title, chapter, audio and subpic */ /* set title, chapter, audio and subpic */
DVDSetArea( p_input, p_area ); DVDSetArea( p_input, p_area );
vlc_mutex_unlock( &p_input->stream.stream_lock );
return; return;
} }
...@@ -536,32 +354,24 @@ static void DVDEnd( input_thread_t * p_input ) ...@@ -536,32 +354,24 @@ static void DVDEnd( input_thread_t * p_input )
/***************************************************************************** /*****************************************************************************
* DVDSetArea: initialize input data for title x, chapter y. * DVDSetArea: initialize input data for title x, chapter y.
* It should be called for each user navigation request, and to change * It should be called for each user navigation request.
* audio or sub-picture streams. *****************************************************************************
* ---
* Take care that i_title starts from 0 (vmg) and i_chapter start from 1. * Take care that i_title starts from 0 (vmg) and i_chapter start from 1.
* i_audio, i_spu start from 1 ; 0 means off. * Note that you have to take the lock before entering here.
* A negative value for an argument means it does not change
*****************************************************************************/ *****************************************************************************/
static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
{ {
thread_dvd_data_t * p_dvd; thread_dvd_data_t * p_dvd;
es_descriptor_t * p_es; es_descriptor_t * p_es;
u16 i_id;
int i_vts_title;
int i_audio; int i_audio;
int i_spu; int i_spu;
u16 i_id; int i;
u8 i_ac3;
u8 i_mpeg;
u8 i_lpcm;
u8 i_sub_pic;
u8 i;
int j; int j;
boolean_t b_last;
p_dvd = (thread_dvd_data_t*)p_input->p_plugin_data; p_dvd = (thread_dvd_data_t*)p_input->p_plugin_data;
vlc_mutex_lock( &p_input->stream.stream_lock );
/* we can't use the interface slider until initilization is complete */ /* we can't use the interface slider until initilization is complete */
p_input->stream.b_seekable = 0; p_input->stream.b_seekable = 0;
...@@ -575,6 +385,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -575,6 +385,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_input->stream.p_selected_area = p_input->stream.p_selected_area =
p_input->stream.pp_areas[p_area->i_id]; p_input->stream.pp_areas[p_area->i_id];
/* release the lock to to let the interface go */
// vlc_mutex_unlock( &p_input->stream.stream_lock ); // vlc_mutex_unlock( &p_input->stream.stream_lock );
/* title number: it is not vts nb!, /* title number: it is not vts nb!,
...@@ -582,9 +393,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -582,9 +393,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_dvd->i_title = p_area->i_id; p_dvd->i_title = p_area->i_id;
p_dvd->p_ifo->i_title = p_dvd->i_title; p_dvd->p_ifo->i_title = p_dvd->i_title;
/* uodate title environnement variable so that we don't /* set number of chapters of current title */
* loop on the same title forever */ p_dvd->i_chapter_nb = p_area->i_part_nb;
// main_PutIntVariable( INPUT_TITLE_VAR, p_dvd->i_title + 1 );
/* ifo vts */ /* ifo vts */
if( IfoTitleSet( p_dvd->p_ifo ) < 0 ) if( IfoTitleSet( p_dvd->p_ifo ) < 0 )
...@@ -598,14 +408,13 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -598,14 +408,13 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
#define vmg p_dvd->p_ifo->vmg #define vmg p_dvd->p_ifo->vmg
#define vts p_dvd->p_ifo->vts #define vts p_dvd->p_ifo->vts
/* title position inside the selected vts */ /* title position inside the selected vts */
p_dvd->i_vts_title = i_vts_title = vmg.title_inf.p_attr[p_dvd->i_title-1].i_title_num;
vmg.title_inf.p_attr[p_dvd->i_title-1].i_title_num;
p_dvd->i_title_id = p_dvd->i_title_id =
vts.title_inf.p_title_start[p_dvd->i_vts_title-1].i_title_id; vts.title_inf.p_title_start[i_vts_title-1].i_title_id;
intf_WarnMsg( 3, "dvd: title %d vts_title %d pgc %d", intf_WarnMsg( 3, "dvd: title %d vts_title %d pgc %d",
p_dvd->i_title, p_dvd->i_title,
p_dvd->i_vts_title, i_vts_title,
p_dvd->i_title_id ); p_dvd->i_title_id );
/* css title key for current vts */ /* css title key for current vts */
...@@ -686,12 +495,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -686,12 +495,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_dvd->i_size -= (off_t)( p_dvd->i_sector + 1 ) *DVD_LB_SIZE; p_dvd->i_size -= (off_t)( p_dvd->i_sector + 1 ) *DVD_LB_SIZE;
intf_WarnMsg( 2, "dvd info: title: %d", p_dvd->i_title ); IfoPrintTitle( p_dvd );
intf_WarnMsg( 2, "dvd info: vobstart at: %lld", p_dvd->i_start );
intf_WarnMsg( 2, "dvd info: stream size: %lld", p_dvd->i_size );
intf_WarnMsg( 2, "dvd info: number of chapters: %d",
vmg.title_inf.p_attr[p_dvd->i_title-1].i_chapter_nb );
intf_WarnMsg( 2, "dvd info: number of angles: %d", p_dvd->i_angle_nb );
// vlc_mutex_lock( &p_input->stream.stream_lock ); // vlc_mutex_lock( &p_input->stream.stream_lock );
...@@ -730,6 +534,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -730,6 +534,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_es = NULL; p_es = NULL;
/* ES 0 -> video MPEG2 */ /* ES 0 -> video MPEG2 */
IfoPrintVideo( p_dvd );
p_es = input_AddES( p_input, p_input->stream.pp_programs[0], 0xe0, 0 ); p_es = input_AddES( p_input, p_input->stream.pp_programs[0], 0xe0, 0 );
p_es->i_stream_id = 0xe0; p_es->i_stream_id = 0xe0;
p_es->i_type = MPEG2_VIDEO_ES; p_es->i_type = MPEG2_VIDEO_ES;
...@@ -739,41 +545,29 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -739,41 +545,29 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
{ {
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
} }
intf_WarnMsg( 4, "dvd info: video selected" );
#define audio_status \
vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
/* Audio ES, in the order they appear in .ifo */ /* Audio ES, in the order they appear in .ifo */
i_ac3 = 0x7f;
i_mpeg = 0xc0;
i_lpcm = 0x9f;
for( i = 1 ; i <= vts.manager_inf.i_audio_nb ; i++ ) for( i = 1 ; i <= vts.manager_inf.i_audio_nb ; i++ )
{ {
IfoPrintAudio( p_dvd, i );
intf_WarnMsg( 5, "dvd info: audio %d: %x %x %x %x %x %x %x %x %x %x %x %x", i, /* audio channel is active if first byte is 0x80 */
vts.manager_inf.p_audio_attr[i-1].i_num_channels, if( audio_status.i_available )
vts.manager_inf.p_audio_attr[i-1].i_coding_mode, {
vts.manager_inf.p_audio_attr[i-1].i_multichannel_extension,
vts.manager_inf.p_audio_attr[i-1].i_type,
vts.manager_inf.p_audio_attr[i-1].i_appl_mode,
vts.manager_inf.p_audio_attr[i-1].i_foo,
vts.manager_inf.p_audio_attr[i-1].i_test,
vts.manager_inf.p_audio_attr[i-1].i_bar,
vts.manager_inf.p_audio_attr[i-1].i_quantization,
vts.manager_inf.p_audio_attr[i-1].i_sample_freq,
vts.manager_inf.p_audio_attr[i-1].i_lang_code,
vts.manager_inf.p_audio_attr[i-1].i_caption );
switch( vts.manager_inf.p_audio_attr[i-1].i_coding_mode ) switch( vts.manager_inf.p_audio_attr[i-1].i_coding_mode )
{ {
case 0x00: /* AC3 */ case 0x00: /* AC3 */
i_id = ( ( i_ac3 + i ) << 8 ) | 0xbd; i_id = ( ( 0x80 + audio_status.i_position ) << 8 ) | 0xbd;
p_es = input_AddES( p_input, p_es = input_AddES( p_input,
p_input->stream.pp_programs[0], i_id, 0 ); p_input->stream.pp_programs[0], i_id, 0 );
p_es->i_stream_id = 0xbd; p_es->i_stream_id = 0xbd;
p_es->i_type = AC3_AUDIO_ES; p_es->i_type = AC3_AUDIO_ES;
p_es->b_audio = 1; p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES; p_es->i_cat = AUDIO_ES;
strcpy( p_es->psz_desc, Language( hton16( strcpy( p_es->psz_desc, IfoLanguage( hton16(
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (ac3)" ); strcat( p_es->psz_desc, " (ac3)" );
...@@ -783,14 +577,14 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -783,14 +577,14 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
break; break;
case 0x02: case 0x02:
case 0x03: /* MPEG audio */ case 0x03: /* MPEG audio */
i_id = 0xbf + i; i_id = 0xc0 + audio_status.i_position;
p_es = input_AddES( p_input, p_es = input_AddES( p_input,
p_input->stream.pp_programs[0], i_id, 0 ); p_input->stream.pp_programs[0], i_id, 0 );
p_es->i_stream_id = i_id; p_es->i_stream_id = i_id;
p_es->i_type = MPEG2_AUDIO_ES; p_es->i_type = MPEG2_AUDIO_ES;
p_es->b_audio = 1; p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES; p_es->i_cat = AUDIO_ES;
strcpy( p_es->psz_desc, Language( hton16( strcpy( p_es->psz_desc, IfoLanguage( hton16(
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (mpeg)" ); strcat( p_es->psz_desc, " (mpeg)" );
...@@ -799,63 +593,83 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -799,63 +593,83 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
break; break;
case 0x04: /* LPCM */ case 0x04: /* LPCM */
#if 0
i_id = ( ( i_lpcm + i ) << 8 ) | 0xbd; i_id = ( ( 0xa0 + audio_status.i_position ) << 8 ) | 0xbd;
p_es = input_AddES( p_input, p_es = input_AddES( p_input,
p_input->stream.pp_programs[0], i_id, 0 ); p_input->stream.pp_programs[0], i_id, 0 );
p_es->i_stream_id = i_id; p_es->i_stream_id = i_id;
p_es->i_type = LPCM_AUDIO_ES; p_es->i_type = LPCM_AUDIO_ES;
p_es->b_audio = 1; p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES; p_es->i_cat = AUDIO_ES;
strcpy( p_es->psz_desc, Language( hton16( strcpy( p_es->psz_desc, IfoLanguage( hton16(
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (lpcm)" ); strcat( p_es->psz_desc, " (lpcm)" );
intf_WarnMsg( 3, "dvd info: audio stream %d %s\t(0x%x)", intf_WarnMsg( 3, "dvd info: audio stream %d %s\t(0x%x)",
i, p_es->psz_desc, i_id ); i, p_es->psz_desc, i_id );
#else
i_id = 0;
intf_ErrMsg( "dvd warning: LPCM audio not handled yet" );
#endif
break; break;
case 0x06: /* DTS */ case 0x06: /* DTS */
i_id = 0; i_id = ( ( 0x88 + audio_status.i_position ) << 8 ) | 0xbd;
i_ac3--; intf_ErrMsg( "dvd warning: DTS audio not handled yet"
intf_ErrMsg( "dvd warning: DTS audio not handled yet" ); "(0x%x)", i_id );
break; break;
default: default:
i_id = 0; i_id = 0;
intf_ErrMsg( "dvd warning: unknown audio type %.2x", intf_ErrMsg( "dvd warning: unknown audio type %.2x",
vts.manager_inf.p_audio_attr[i-1].i_coding_mode ); vts.manager_inf.p_audio_attr[i-1].i_coding_mode );
} }
} }
}
#undef audio_status
#define spu_status \
vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_spu_status[i-1]
/* Sub Picture ES */ /* Sub Picture ES */
b_last = 0;
i_sub_pic = 0x20;
for( i = 1 ; i <= vts.manager_inf.i_spu_nb; i++ ) for( i = 1 ; i <= vts.manager_inf.i_spu_nb; i++ )
{ {
if( !b_last ) IfoPrintSpu( p_dvd, i );
if( spu_status.i_available )
{
/* there are several streams for one spu */
if( vts.manager_inf.video_attr.i_ratio )
{ {
i_id = ( i_sub_pic++ << 8 ) | 0xbd; /* 16:9 */
switch( vts.manager_inf.video_attr.i_perm_displ )
{
case 1:
i_id = ( ( 0x20 + spu_status.i_position_pan ) << 8 )
| 0xbd;
break;
case 2:
i_id = ( ( 0x20 + spu_status.i_position_letter ) << 8 )
| 0xbd;
break;
default:
i_id = ( ( 0x20 + spu_status.i_position_wide ) << 8 )
| 0xbd;
break;
}
}
else
{
/* 4:3 */
i_id = ( ( 0x20 + spu_status.i_position_43 ) << 8 )
| 0xbd;
}
p_es = input_AddES( p_input, p_es = input_AddES( p_input,
p_input->stream.pp_programs[0], i_id, 0 ); p_input->stream.pp_programs[0], i_id, 0 );
p_es->i_stream_id = 0xbd; p_es->i_stream_id = 0xbd;
p_es->i_type = DVD_SPU_ES; p_es->i_type = DVD_SPU_ES;
p_es->i_cat = SPU_ES; p_es->i_cat = SPU_ES;
strcpy( p_es->psz_desc, Language( hton16( strcpy( p_es->psz_desc, IfoLanguage( hton16(
vts.manager_inf.p_spu_attr[i-1].i_lang_code ) ) ); vts.manager_inf.p_spu_attr[i-1].i_lang_code ) ) );
intf_WarnMsg( 3, "dvd info: spu stream %d %s\t(0x%x)", intf_WarnMsg( 3, "dvd info: spu stream %d %s\t(0x%x)",
i, p_es->psz_desc, i_id ); i, p_es->psz_desc, i_id );
/* The before the last spu has a 0x0 prefix */
b_last =
( vts.manager_inf.p_spu_attr[i].i_prefix == 0 );
} }
} }
#undef spu_status
if( p_main->b_audio ) if( p_main->b_audio )
{ {
/* For audio: first one if none or a not existing one specified */ /* For audio: first one if none or a not existing one specified */
...@@ -924,9 +738,9 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -924,9 +738,9 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_dvd->i_chapter = 1; p_dvd->i_chapter = 1;
} }
} }
#define title \ #define title \
p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title
if( p_area->i_angle != p_dvd->i_angle ) if( p_area->i_angle != p_dvd->i_angle )
{ {
if( title.p_cell_play[p_dvd->i_prg_cell].i_category & 0xf000 ) if( title.p_cell_play[p_dvd->i_prg_cell].i_category & 0xf000 )
...@@ -952,9 +766,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -952,9 +766,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
/* warn interface that something has changed */ /* warn interface that something has changed */
p_input->stream.b_seekable = 1; p_input->stream.b_seekable = 1;
p_input->stream.b_changed = 1; p_input->stream.b_changed = 1;
intf_WarnMsg( 3, "Pos: %lld Size: %lld", p_input->stream.p_selected_area->i_tell,p_input->stream.p_selected_area->i_size );
vlc_mutex_unlock( &p_input->stream.stream_lock ); p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_REINIT;
return 0; return 0;
} }
...@@ -971,7 +784,6 @@ static int DVDRead( input_thread_t * p_input, ...@@ -971,7 +784,6 @@ static int DVDRead( input_thread_t * p_input,
{ {
thread_dvd_data_t * p_dvd; thread_dvd_data_t * p_dvd;
dvd_netlist_t * p_netlist; dvd_netlist_t * p_netlist;
input_area_t * p_area;
struct iovec * p_vec; struct iovec * p_vec;
struct data_packet_s * pp_data[p_input->i_read_once]; struct data_packet_s * pp_data[p_input->i_read_once];
u8 * pi_cur; u8 * pi_cur;
...@@ -1043,7 +855,7 @@ static int DVDRead( input_thread_t * p_input, ...@@ -1043,7 +855,7 @@ static int DVDRead( input_thread_t * p_input,
p_input->stream.p_selected_area->i_tell = i_off - p_input->stream.p_selected_area->i_tell = i_off -
p_input->stream.p_selected_area->i_start; p_input->stream.p_selected_area->i_start;
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter; p_input->stream.p_selected_area->i_part = p_dvd->i_chapter;
intf_WarnMsg( 2, "chapter %d", p_dvd->i_chapter);
/* the synchro has to be reinitialized when we change cell */ /* the synchro has to be reinitialized when we change cell */
p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_REINIT; p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_REINIT;
...@@ -1147,7 +959,6 @@ intf_WarnMsg( 2, "chapter %d", p_dvd->i_chapter); ...@@ -1147,7 +959,6 @@ intf_WarnMsg( 2, "chapter %d", p_dvd->i_chapter);
p_input->stream.p_selected_area->i_tell += i_read_bytes; p_input->stream.p_selected_area->i_tell += i_read_bytes;
b_eot = !( p_input->stream.p_selected_area->i_tell < p_dvd->i_size ); b_eot = !( p_input->stream.p_selected_area->i_tell < p_dvd->i_size );
b_eof = b_eot && ( ( p_dvd->i_title + 1 ) >= p_input->stream.i_area_nb ); b_eof = b_eot && ( ( p_dvd->i_title + 1 ) >= p_input->stream.i_area_nb );
p_area = p_input->stream.pp_areas[p_dvd->i_title + 1];
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
...@@ -1158,9 +969,11 @@ intf_WarnMsg( 2, "chapter %d", p_dvd->i_chapter); ...@@ -1158,9 +969,11 @@ intf_WarnMsg( 2, "chapter %d", p_dvd->i_chapter);
if( b_eot ) if( b_eot )
{ {
intf_WarnMsg( 3, "dvd info: new title" ); intf_WarnMsg( 4, "dvd info: new title" );
p_dvd->i_title++; p_dvd->i_title++;
DVDSetArea( p_input, p_area ); vlc_mutex_lock( &p_input->stream.stream_lock );
DVDSetArea( p_input, p_input->stream.pp_areas[p_dvd->i_title] );
vlc_mutex_unlock( &p_input->stream.stream_lock );
return 0; return 0;
} }
...@@ -1181,10 +994,10 @@ static int DVDRewind( input_thread_t * p_input ) ...@@ -1181,10 +994,10 @@ static int DVDRewind( input_thread_t * p_input )
} }
/***************************************************************************** /*****************************************************************************
* DVDSeek : Goes to a given position on the stream ; this one is used by the * DVDSeek : Goes to a given position on the stream.
* input and translate chronological position from input to logical postion *****************************************************************************
* on the device * This one is used by the input and translate chronological position from
* --- * input to logical position on the device.
* The lock should be taken before calling this function. * The lock should be taken before calling this function.
*****************************************************************************/ *****************************************************************************/
static void DVDSeek( input_thread_t * p_input, off_t i_off ) static void DVDSeek( input_thread_t * p_input, off_t i_off )
...@@ -1430,7 +1243,6 @@ static int DVDChooseAngle( thread_dvd_data_t * p_dvd ) ...@@ -1430,7 +1243,6 @@ static int DVDChooseAngle( thread_dvd_data_t * p_dvd )
case 0x5: case 0x5:
p_dvd->i_prg_cell += p_dvd->i_angle - 1; p_dvd->i_prg_cell += p_dvd->i_angle - 1;
p_dvd->i_angle_cell = 0; p_dvd->i_angle_cell = 0;
// intf_WarnMsg( 3, "dvd info: choosing angle %d", p_dvd->i_angle );
break; break;
/* we exit a multi-angle section */ /* we exit a multi-angle section */
case 0x9: case 0x9:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_dvd.h: thread structure of the DVD plugin * input_dvd.h: thread structure of the DVD plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: input_dvd.h,v 1.21 2001/04/22 00:08:26 stef Exp $ * $Id: input_dvd.h,v 1.22 2001/05/19 00:39:30 stef Exp $
* *
* Author: Stéphane Borel <stef@via.ecp.fr> * Author: Stéphane Borel <stef@via.ecp.fr>
* *
...@@ -40,7 +40,6 @@ typedef struct thread_dvd_data_s ...@@ -40,7 +40,6 @@ typedef struct thread_dvd_data_s
/* Navigation information */ /* Navigation information */
int i_title; int i_title;
int i_vts_title;
int i_title_id; int i_title_id;
int i_chapter_nb; int i_chapter_nb;
...@@ -67,19 +66,3 @@ typedef struct thread_dvd_data_s ...@@ -67,19 +66,3 @@ typedef struct thread_dvd_data_s
struct ifo_s * p_ifo; struct ifo_s * p_ifo;
} thread_dvd_data_t; } thread_dvd_data_t;
/*****************************************************************************
* Prototypes in dvd_css.c
*****************************************************************************/
int CSSTest ( int );
int CSSInit ( int, struct css_s * );
int CSSGetKey ( int, struct css_s * );
int CSSDescrambleSector ( u8 * , u8 * );
/*****************************************************************************
* Prototypes in dvd_ifo.c
*****************************************************************************/
int IfoCreate ( struct thread_dvd_data_s * );
int IfoInit ( struct ifo_s * );
int IfoTitleSet ( struct ifo_s * );
void IfoDestroy ( struct ifo_s * );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_callbacks.c : Callbacks for the Gtk+ plugin. * gtk_callbacks.c : Callbacks for the Gtk+ plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.c,v 1.18 2001/05/15 14:49:48 stef Exp $ * $Id: gtk_callbacks.c,v 1.19 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -200,11 +200,12 @@ void GtkTitlePrev( GtkButton * button, gpointer user_data ) ...@@ -200,11 +200,12 @@ void GtkTitlePrev( GtkButton * button, gpointer user_data )
if( i_id > 0 ) if( i_id > 0 )
{ {
p_area = p_intf->p_input->stream.pp_areas[i_id]; p_area = p_intf->p_input->stream.pp_areas[i_id];
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_title_update = 1; p_intf->p_sys->b_title_update = 1;
GtkSetupMenus( p_intf );
} }
} }
...@@ -221,11 +222,12 @@ void GtkTitleNext( GtkButton * button, gpointer user_data ) ...@@ -221,11 +222,12 @@ void GtkTitleNext( GtkButton * button, gpointer user_data )
if( i_id < p_intf->p_input->stream.i_area_nb ) if( i_id < p_intf->p_input->stream.i_area_nb )
{ {
p_area = p_intf->p_input->stream.pp_areas[i_id]; p_area = p_intf->p_input->stream.pp_areas[i_id];
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_title_update = 1; p_intf->p_sys->b_title_update = 1;
GtkSetupMenus( p_intf );
} }
} }
...@@ -242,11 +244,12 @@ void GtkChapterPrev( GtkButton * button, gpointer user_data ) ...@@ -242,11 +244,12 @@ void GtkChapterPrev( GtkButton * button, gpointer user_data )
if( p_area->i_part > 0 ) if( p_area->i_part > 0 )
{ {
p_area->i_part--; p_area->i_part--;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_chapter_update = 1; p_intf->p_sys->b_chapter_update = 1;
GtkSetupMenus( p_intf );
} }
} }
...@@ -262,11 +265,12 @@ void GtkChapterNext( GtkButton * button, gpointer user_data ) ...@@ -262,11 +265,12 @@ void GtkChapterNext( GtkButton * button, gpointer user_data )
if( p_area->i_part < p_area->i_part_nb ) if( p_area->i_part < p_area->i_part_nb )
{ {
p_area->i_part++; p_area->i_part++;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_chapter_update = 1; p_intf->p_sys->b_chapter_update = 1;
GtkSetupMenus( p_intf );
} }
} }
...@@ -274,8 +278,7 @@ void GtkChapterNext( GtkButton * button, gpointer user_data ) ...@@ -274,8 +278,7 @@ void GtkChapterNext( GtkButton * button, gpointer user_data )
* About box * About box
****************************************************************************/ ****************************************************************************/
gboolean gboolean GtkAboutShow( GtkWidget *widget,
GtkAboutShow (GtkWidget *widget,
GdkEventButton *event, GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
...@@ -305,8 +308,7 @@ void GtkAboutOk( GtkButton * button, gpointer user_data) ...@@ -305,8 +308,7 @@ void GtkAboutOk( GtkButton * button, gpointer user_data)
* Jump box * Jump box
****************************************************************************/ ****************************************************************************/
gboolean gboolean GtkJumpShow( GtkWidget *widget,
GtkJumpShow (GtkWidget *widget,
GdkEventButton *event, GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
...@@ -326,8 +328,7 @@ GtkJumpShow (GtkWidget *widget, ...@@ -326,8 +328,7 @@ GtkJumpShow (GtkWidget *widget,
} }
void void GtkJumpOk( GtkButton *button,
GtkJumpOk (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf; intf_thread_t * p_intf;
...@@ -365,8 +366,7 @@ GtkJumpOk (GtkButton *button, ...@@ -365,8 +366,7 @@ GtkJumpOk (GtkButton *button,
} }
void void GtkJumpCancel( GtkButton *button,
GtkJumpCancel (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) ); gtk_widget_hide( gtk_widget_get_toplevel( GTK_WIDGET (button) ) );
...@@ -404,11 +404,3 @@ void GtkJumpActivate( GtkMenuItem * menuitem, gpointer user_data ) ...@@ -404,11 +404,3 @@ void GtkJumpActivate( GtkMenuItem * menuitem, gpointer user_data )
{ {
GtkJumpShow( GTK_WIDGET( menuitem ), NULL, user_data ); GtkJumpShow( GTK_WIDGET( menuitem ), NULL, user_data );
} }
void
GtkPlaylistDestroy (GtkObject *object,
gpointer user_data)
{
}
...@@ -33,7 +33,3 @@ void GtkWindowToggleActivate( GtkMenuItem *, gpointer ); ...@@ -33,7 +33,3 @@ void GtkWindowToggleActivate( GtkMenuItem *, gpointer );
void GtkFullscreenActivate ( GtkMenuItem *, gpointer ); void GtkFullscreenActivate ( GtkMenuItem *, gpointer );
void GtkAboutActivate ( GtkMenuItem *, gpointer ); void GtkAboutActivate ( GtkMenuItem *, gpointer );
void GtkJumpActivate ( GtkMenuItem *, gpointer ); void GtkJumpActivate ( GtkMenuItem *, gpointer );
void
GtkPlaylistDestroy (GtkObject *object,
gpointer user_data);
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_menu.c : functions to handle menu items. * gtk_menu.c : functions to handle menu items.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_menu.c,v 1.2 2001/05/15 14:49:48 stef Exp $ * $Id: gtk_menu.c,v 1.3 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -60,24 +60,57 @@ ...@@ -60,24 +60,57 @@
#include "main.h" #include "main.h"
/*
* Local Prototypes
*/
static gint GtkLanguageMenus( gpointer , GtkWidget *, es_descriptor_t *, gint,
void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) );
void GtkMenubarAudioToggle ( GtkCheckMenuItem *, gpointer );
void GtkPopupAudioToggle ( GtkCheckMenuItem *, gpointer );
void GtkMenubarSubtitleToggle( GtkCheckMenuItem *, gpointer );
void GtkPopupSubtitleToggle ( GtkCheckMenuItem *, gpointer );
static gint GtkTitleMenu( gpointer, GtkWidget *,
void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) );
static gint GtkRadioMenu( intf_thread_t *, GtkWidget *, GSList *,
char *, int, int,
void( *pf_toggle )( GtkCheckMenuItem *, gpointer ) );
void GtkMenubarAngleToggle( GtkCheckMenuItem *, gpointer );
void GtkPopupAngleToggle( GtkCheckMenuItem *, gpointer );
gint GtkSetupMenus( intf_thread_t * p_intf );
/**************************************************************************** /****************************************************************************
* Gtk*Toggle: callbacks to toggle the value of a checkmenuitem * Gtk*Toggle: callbacks to toggle the value of a checkmenuitem
**************************************************************************** ****************************************************************************
* We need separate functions for menubar and popup here since we can't use * We need separate functions for menubar and popup here since we can't use
* user_data to transmit intf_* * user_data to transmit intf_* and we need to refresh the other menu.
****************************************************************************/ ****************************************************************************/
#define GtkLangToggle( b_update ) \ #define GtkLangToggle( intf, menu, type, callback, b_update ) \
intf_thread_t * p_intf; \
GtkWidget * p_menu; \
es_descriptor_t * p_es; \ es_descriptor_t * p_es; \
\ \
if( !b_update ) \ p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
\
if( !p_intf->p_sys->b_update ) \
{ \ { \
p_menu = GTK_WIDGET( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_popup ), (menu) ) ); \
p_es = (es_descriptor_t*)user_data; \ p_es = (es_descriptor_t*)user_data; \
\ \
input_ToggleES( p_intf->p_input, p_es, menuitem->active ); \ input_ToggleES( p_intf->p_input, p_es, menuitem->active ); \
\ \
b_update = menuitem->active; \ p_intf->p_sys->b_update = menuitem->active; \
\
if( p_intf->p_sys->b_update ) \
{ \
GtkLanguageMenus( p_intf, p_menu, p_es, type, callback ); \
} \ } \
\
p_intf->p_sys->b_update = 0; \
}
/* /*
* Audio * Audio
...@@ -85,39 +118,38 @@ ...@@ -85,39 +118,38 @@
void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); GtkLangToggle( "intf_window", "popup_audio", AUDIO_ES,
GtkPopupAudioToggle, b_audio_update );
GtkLangToggle( p_intf->p_sys->b_audio_update );
} }
void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); GtkLangToggle( "intf_popup", "menubar_audio", AUDIO_ES,
GtkMenubarAudioToggle, b_audio_update );
GtkLangToggle( p_intf->p_sys->b_audio_update );
} }
/* /*
* Subtitles * Subtitles
*/ */
void GtkMenubarSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkMenubarSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); GtkLangToggle( "intf_window", "popup_subpictures", SPU_ES,
GtkPopupSubtitleToggle, b_spu_update );
GtkLangToggle( p_intf->p_sys->b_spu_update );
} }
void GtkPopupSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkPopupSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{ {
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); GtkLangToggle( "intf_popup", "menubar_subpictures", SPU_ES,
GtkMenubarSubtitleToggle, b_spu_update );
GtkLangToggle( p_intf->p_sys->b_spu_update );
} }
#undef GtkLangToggle
/* /*
* Navigation * Navigation
*/ */
void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem, void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem,
gpointer user_data ) gpointer user_data )
{ {
...@@ -127,11 +159,13 @@ void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem, ...@@ -127,11 +159,13 @@ void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem,
!p_intf->p_sys->b_title_update && !p_intf->p_sys->b_title_update &&
!p_intf->p_sys->b_chapter_update ) !p_intf->p_sys->b_chapter_update )
{ {
input_area_t *p_area = p_intf->p_input->stream.p_selected_area; input_area_t *p_area;
gint i_title = DATA2TITLE( user_data ); gint i_title = DATA2TITLE( user_data );
gint i_chapter = DATA2CHAPTER( user_data ); gint i_chapter = DATA2CHAPTER( user_data );
p_area = p_intf->p_input->stream.p_selected_area;
if( p_area != p_intf->p_input->stream.pp_areas[i_title] ) if( p_area != p_intf->p_input->stream.pp_areas[i_title] )
{ {
p_area = p_intf->p_input->stream.pp_areas[i_title]; p_area = p_intf->p_input->stream.pp_areas[i_title];
...@@ -139,9 +173,11 @@ void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem, ...@@ -139,9 +173,11 @@ void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem,
} }
p_area->i_part = i_chapter; p_area->i_part = i_chapter;
p_intf->p_sys->b_chapter_update = 1;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_input, (input_area_t*)p_area );
p_intf->p_sys->b_chapter_update = 1;
GtkSetupMenus( p_intf );
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
} }
...@@ -151,101 +187,107 @@ void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem, ...@@ -151,101 +187,107 @@ void GtkPopupNavigationToggle( GtkCheckMenuItem * menuitem,
* Title * Title
*/ */
#define GtkTitleToggle( intf ) \
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
\
if( menuitem->active && !p_intf->p_sys->b_title_update ) \
{ \
gint i_title = (gint)user_data; \
p_intf->p_input->pf_set_area( p_intf->p_input, \
p_intf->p_input->stream.pp_areas[i_title] ); \
\
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); \
\
p_intf->p_sys->b_title_update = 1; \
}
void GtkMenubarTitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkMenubarTitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{ {
GtkTitleToggle( "intf_window" ); intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
}
void GtkPopupTitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) if( menuitem->active && !p_intf->p_sys->b_title_update )
{ {
GtkTitleToggle( "intf_popup" ); gint i_title = (gint)user_data;
input_ChangeArea( p_intf->p_input,
p_intf->p_input->stream.pp_areas[i_title] );
p_intf->p_sys->b_title_update = 1;
GtkSetupMenus( p_intf );
p_intf->p_sys->b_title_update = 0;
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
} }
/* /*
* Chapter * Chapter
*/ */
#define GtkChapterToggle( intf ) \
intf_thread_t * p_intf; \
input_area_t * p_area; \
gint i_chapter; \
char psz_chapter[5]; \
\
p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
p_area = p_intf->p_input->stream.p_selected_area; \
i_chapter = (gint)user_data; \
\
if( menuitem->active && !p_intf->p_sys->b_chapter_update ) \
{ \
p_area->i_part = i_chapter; \
p_intf->p_input->pf_set_area( p_intf->p_input, \
(input_area_t*)p_area ); \
\
snprintf( psz_chapter, 3, "%02d", p_area->i_part ); \
gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter ); \
\
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); \
\
p_intf->p_sys->b_chapter_update = 1; \
}
void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{ {
GtkChapterToggle( "intf_window" ); intf_thread_t * p_intf;
} input_area_t * p_area;
gint i_chapter;
char psz_chapter[5];
GtkWidget * p_popup_menu;
void GtkPopupChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
{ p_area = p_intf->p_input->stream.p_selected_area;
GtkChapterToggle( "intf_popup" ); i_chapter = (gint)user_data;
if( menuitem->active && !p_intf->p_sys->b_chapter_update )
{
p_area->i_part = i_chapter;
input_ChangeArea( p_intf->p_input, (input_area_t*)p_area );
snprintf( psz_chapter, 4, "%02d", p_area->i_part );
psz_chapter[ 4 ] = '\0';
gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter );
p_intf->p_sys->b_chapter_update = 1;
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_navigation" ) );
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
GtkTitleMenu( p_intf, p_popup_menu, GtkPopupNavigationToggle );
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
p_intf->p_sys->b_chapter_update = 0;
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
}
} }
/* /*
* Angle * Angle
*/ */
#define GtkAngleToggle( intf ) \ #define GtkAngleToggle( intf, window, menu, callback ) \
intf_thread_t * p_intf; \ intf_thread_t * p_intf; \
GtkWidget * p_menu; \
input_area_t * p_area; \ input_area_t * p_area; \
gint i_angle; \
\ \
p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \ p_intf = GetIntf( GTK_WIDGET(menuitem), (intf) ); \
p_area = p_intf->p_input->stream.p_selected_area; \
i_angle = (gint)user_data; \
\ \
if( menuitem->active && !p_intf->p_sys->b_angle_update ) \ if( menuitem->active && !p_intf->p_sys->b_angle_update ) \
{ \ { \
p_area->i_angle = i_angle; \ p_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( \
p_intf->p_input->pf_set_area( p_intf->p_input, \ p_intf->p_sys->window ), (menu) ) ); \
(input_area_t*)p_area ); \ p_area = p_intf->p_input->stream.p_selected_area; \
p_area->i_angle = (gint)user_data; \
\
input_ChangeArea( p_intf->p_input, (input_area_t*)p_area ); \
\ \
p_intf->p_sys->b_angle_update = 1; \ p_intf->p_sys->b_angle_update = 1; \
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock ); \
GtkRadioMenu( p_intf, p_menu, NULL, "Angle", \
p_area->i_angle_nb, p_area->i_angle, (callback) ); \
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock ); \
p_intf->p_sys->b_angle_update = 0; \
} }
void GtkMenubarAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkMenubarAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{ {
GtkAngleToggle( "intf_window" ) GtkAngleToggle( "intf_window", p_popup, "popup_angle",
GtkPopupAngleToggle );
} }
void GtkPopupAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkPopupAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{ {
GtkAngleToggle( "intf_popup" ) GtkAngleToggle( "intf_popup", p_window, "menubar_angle",
GtkMenubarAngleToggle );
} }
#undef GtkAngleToggle
/**************************************************************************** /****************************************************************************
* Functions to generate menus * Functions to generate menus
****************************************************************************/ ****************************************************************************/
...@@ -433,6 +475,8 @@ static gint GtkLanguageMenus( gpointer p_data, ...@@ -433,6 +475,8 @@ static gint GtkLanguageMenus( gpointer p_data,
p_item_active = NULL; p_item_active = NULL;
i_item = 0; i_item = 0;
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
/* create a set of language buttons and append them to the container */ /* create a set of language buttons and append them to the container */
for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ ) for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ )
{ {
...@@ -468,6 +512,7 @@ static gint GtkLanguageMenus( gpointer p_data, ...@@ -468,6 +512,7 @@ static gint GtkLanguageMenus( gpointer p_data,
} }
} }
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
/* link the new menu to the menubar item */ /* link the new menu to the menubar item */
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
...@@ -477,10 +522,8 @@ static gint GtkLanguageMenus( gpointer p_data, ...@@ -477,10 +522,8 @@ static gint GtkLanguageMenus( gpointer p_data,
* We have to release the lock since input_ToggleES needs it */ * We have to release the lock since input_ToggleES needs it */
if( p_item_active != NULL ) if( p_item_active != NULL )
{ {
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ), gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
TRUE ); TRUE );
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
} }
/* be sure that menu is sensitive if non empty */ /* be sure that menu is sensitive if non empty */
...@@ -492,7 +535,6 @@ static gint GtkLanguageMenus( gpointer p_data, ...@@ -492,7 +535,6 @@ static gint GtkLanguageMenus( gpointer p_data,
return TRUE; return TRUE;
} }
#if 1
/***************************************************************************** /*****************************************************************************
* GtkTitleMenu: sets menus for titles and chapters selection * GtkTitleMenu: sets menus for titles and chapters selection
***************************************************************************** *****************************************************************************
...@@ -732,13 +774,12 @@ static gint GtkTitleMenu( gpointer p_data, ...@@ -732,13 +774,12 @@ static gint GtkTitleMenu( gpointer p_data,
return TRUE; return TRUE;
} }
#endif
/***************************************************************************** /*****************************************************************************
* GtkSetupMenu: function that generates title/chapter/audio/subpic * GtkSetupMenus: function that generates title/chapter/audio/subpic
* menus with help from preceding functions * menus with help from preceding functions
*****************************************************************************/ *****************************************************************************/
gint GtkSetupMenu( intf_thread_t * p_intf ) gint GtkSetupMenus( intf_thread_t * p_intf )
{ {
es_descriptor_t * p_audio_es; es_descriptor_t * p_audio_es;
es_descriptor_t * p_spu_es; es_descriptor_t * p_spu_es;
...@@ -746,13 +787,13 @@ gint GtkSetupMenu( intf_thread_t * p_intf ) ...@@ -746,13 +787,13 @@ gint GtkSetupMenu( intf_thread_t * p_intf )
GtkWidget * p_popup_menu; GtkWidget * p_popup_menu;
gint i; gint i;
p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update | p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
( p_intf->p_sys->i_part !=
p_intf->p_input->stream.p_selected_area->i_part );
p_intf->p_sys->b_angle_update |= p_intf->p_sys->b_title_update; p_intf->p_sys->b_angle_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update; p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update; p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update;
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
if( p_intf->p_sys->b_title_update ) if( p_intf->p_sys->b_title_update )
{ {
char psz_title[5]; char psz_title[5];
...@@ -841,6 +882,8 @@ gint GtkSetupMenu( intf_thread_t * p_intf ) ...@@ -841,6 +882,8 @@ gint GtkSetupMenu( intf_thread_t * p_intf )
} }
} }
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
/* audio menus */ /* audio menus */
if( p_intf->p_sys->b_audio_update ) if( p_intf->p_sys->b_audio_update )
{ {
...@@ -851,8 +894,10 @@ gint GtkSetupMenu( intf_thread_t * p_intf ) ...@@ -851,8 +894,10 @@ gint GtkSetupMenu( intf_thread_t * p_intf )
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_audio" ) ); p_intf->p_sys->p_popup ), "popup_audio" ) );
p_intf->p_sys->b_audio_update = 1;
GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES, GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES,
GtkMenubarAudioToggle ); GtkMenubarAudioToggle );
p_intf->p_sys->b_audio_update = 1;
GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES, GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES,
GtkPopupAudioToggle ); GtkPopupAudioToggle );
...@@ -869,8 +914,10 @@ gint GtkSetupMenu( intf_thread_t * p_intf ) ...@@ -869,8 +914,10 @@ gint GtkSetupMenu( intf_thread_t * p_intf )
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_subpictures" ) ); p_intf->p_sys->p_popup ), "popup_subpictures" ) );
p_intf->p_sys->b_spu_update = 1;
GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES, GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES,
GtkMenubarSubtitleToggle ); GtkMenubarSubtitleToggle );
p_intf->p_sys->b_spu_update = 1;
GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES, GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES,
GtkPopupSubtitleToggle ); GtkPopupSubtitleToggle );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_menu.h: prototypes for menu functions * gtk_menu.h: prototypes for menu functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_menu.h,v 1.2 2001/05/15 14:49:48 stef Exp $ * $Id: gtk_menu.h,v 1.3 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr> * Stéphane Borel <stef@via.ecp.fr>
...@@ -21,3 +21,8 @@ ...@@ -21,3 +21,8 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
struct intf_thread_s;
gint GtkSetupMenus( struct intf_thread_s * );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_playlist.h : Playlist functions for the Gtk plugin. * gtk_playlist.h : Playlist functions for the Gtk plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_playlist.h,v 1.3 2001/05/15 14:49:48 stef Exp $ * $Id: gtk_playlist.h,v 1.4 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Pierre Baillet <oct@zoy.org> * Authors: Pierre Baillet <oct@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -50,3 +50,13 @@ void GtkPlaylistActivate ( GtkMenuItem *, gpointer ); ...@@ -50,3 +50,13 @@ void GtkPlaylistActivate ( GtkMenuItem *, gpointer );
void GtkNextActivate ( GtkMenuItem *, gpointer ); void GtkNextActivate ( GtkMenuItem *, gpointer );
void GtkPrevActivate ( GtkMenuItem *, gpointer ); void GtkPrevActivate ( GtkMenuItem *, gpointer );
struct intf_thread_s;
struct playlist_s;
void GtkDropDataReceived ( struct intf_thread_s *, GtkSelectionData *,
guint, int );
int GtkAppendList ( struct playlist_s *, int, GList * );
void GtkRebuildCList ( GtkCList *, struct playlist_s * );
void GtkPlayListManage ( struct intf_thread_s * );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gtk.c: Gtk+ interface * intf_gtk.c: Gtk+ interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gtk.c,v 1.19 2001/05/15 14:49:48 stef Exp $ * $Id: intf_gtk.c,v 1.20 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -312,7 +312,7 @@ static gint GtkManage( gpointer p_data ) ...@@ -312,7 +312,7 @@ static gint GtkManage( gpointer p_data )
} }
/* update the playlist */ /* update the playlist */
GtkPlayListManage( p_data ); // GtkPlayListManage( p_data );
if( p_intf->p_input != NULL && !p_intf->b_die ) if( p_intf->p_input != NULL && !p_intf->b_die )
{ {
...@@ -357,9 +357,15 @@ static gint GtkManage( gpointer p_data ) ...@@ -357,9 +357,15 @@ static gint GtkManage( gpointer p_data )
} }
#undef p_area #undef p_area
} }
GtkSetupMenu( p_intf );
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
if( p_intf->p_sys->i_part !=
p_intf->p_input->stream.p_selected_area->i_part )
{
p_intf->p_sys->b_chapter_update = 1;
GtkSetupMenus( p_intf );
}
} }
else if( !p_intf->b_die ) else if( !p_intf->b_die )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gtk.h: private Gtk+ interface description * intf_gtk.h: private Gtk+ interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gtk.h,v 1.4 2001/05/15 01:01:44 stef Exp $ * $Id: intf_gtk.h,v 1.5 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -99,21 +99,4 @@ typedef struct intf_sys_s ...@@ -99,21 +99,4 @@ typedef struct intf_sys_s
} intf_sys_t; } intf_sys_t;
/****************************************************************************
* Prototypes
****************************************************************************/
/*
* from gtk_menu.c
*/
gint GtkSetupMenu( intf_thread_t * );
/*
* from gtk_playlist.c
*/
void GtkDropDataReceived ( intf_thread_t *, GtkSelectionData *,
guint, int );
int GtkAppendList ( playlist_t *, int, GList * );
void GtkRebuildCList ( GtkCList *, playlist_t * );
void GtkPlayListManage ( intf_thread_t * );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_spdif: ac3 passthrough output * aout_spdif: ac3 passthrough output
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.c,v 1.5 2001/05/15 01:01:44 stef Exp $ * $Id: aout_spdif.c,v 1.6 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -90,10 +90,10 @@ void aout_SpdifThread( aout_thread_t * p_aout ) ...@@ -90,10 +90,10 @@ void aout_SpdifThread( aout_thread_t * p_aout )
/* TODO: write the muliplexer :) */ /* TODO: write the muliplexer :) */
if( p_aout->fifo[i_fifo].i_type == AOUT_ADEC_SPDIF_FIFO ) if( p_aout->fifo[i_fifo].i_type == AOUT_ADEC_SPDIF_FIFO )
{ {
// vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock ); vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
if( p_aout->fifo[i_fifo].b_die ) if( p_aout->fifo[i_fifo].b_die )
{ {
// vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock ); vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
aout_FreeFifo( &p_aout->fifo[i_fifo] ); aout_FreeFifo( &p_aout->fifo[i_fifo] );
} }
else if( !AOUT_FIFO_ISEMPTY( p_aout->fifo[i_fifo] ) ) else if( !AOUT_FIFO_ISEMPTY( p_aout->fifo[i_fifo] ) )
...@@ -112,11 +112,15 @@ void aout_SpdifThread( aout_thread_t * p_aout ) ...@@ -112,11 +112,15 @@ void aout_SpdifThread( aout_thread_t * p_aout )
p_aout->fifo[i_fifo].l_start_frame = p_aout->fifo[i_fifo].l_start_frame =
(p_aout->fifo[i_fifo].l_start_frame + 1 ) (p_aout->fifo[i_fifo].l_start_frame + 1 )
& AOUT_FIFO_SIZE; & AOUT_FIFO_SIZE;
// vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock ); vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
i_frame++; i_frame++;
i_blank = 0; i_blank = 0;
} }
else
{
vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
}
} }
} }
if( !i_frame ) if( !i_frame )
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.107 2001/05/07 03:14:09 stef Exp $ * $Id: input.c,v 1.108 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -133,6 +133,7 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status ) ...@@ -133,6 +133,7 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
p_input->stream.i_area_nb = 0; p_input->stream.i_area_nb = 0;
p_input->stream.pp_areas = NULL; p_input->stream.pp_areas = NULL;
p_input->stream.p_selected_area = NULL; p_input->stream.p_selected_area = NULL;
p_input->stream.p_new_area = NULL;
/* By default there is one areas in a stream */ /* By default there is one areas in a stream */
input_AddArea( p_input ); input_AddArea( p_input );
p_input->stream.p_selected_area = p_input->stream.pp_areas[0]; p_input->stream.p_selected_area = p_input->stream.pp_areas[0];
...@@ -239,6 +240,12 @@ static void RunThread( input_thread_t *p_input ) ...@@ -239,6 +240,12 @@ static void RunThread( input_thread_t *p_input )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
if( p_input->stream.p_new_area )
{
p_input->pf_set_area( p_input, p_input->stream.p_new_area );
p_input->stream.p_new_area = NULL;
}
if( p_input->stream.p_selected_area->i_seek != NO_SEEK ) if( p_input->stream.p_selected_area->i_seek != NO_SEEK )
{ {
if( p_input->stream.b_seekable && p_input->pf_seek != NULL ) if( p_input->stream.b_seekable && p_input->pf_seek != NULL )
...@@ -261,6 +268,18 @@ static void RunThread( input_thread_t *p_input ) ...@@ -261,6 +268,18 @@ static void RunThread( input_thread_t *p_input )
p_input->stream.p_selected_area->i_seek = NO_SEEK; p_input->stream.p_selected_area->i_seek = NO_SEEK;
} }
if( p_input->stream.p_removed_es )
{
input_UnselectES( p_input, p_input->stream.p_removed_es );
p_input->stream.p_removed_es = NULL;
}
if( p_input->stream.p_newly_selected_es )
{
input_SelectES( p_input, p_input->stream.p_newly_selected_es );
p_input->stream.p_newly_selected_es = NULL;
}
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
i_error = p_input->pf_read( p_input, pp_packets ); i_error = p_input->pf_read( p_input, pp_packets );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-intf.c: services to the interface * input_ext-intf.c: services to the interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ext-intf.c,v 1.23 2001/05/07 03:14:09 stef Exp $ * $Id: input_ext-intf.c,v 1.24 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -236,8 +236,9 @@ void input_DumpStream( input_thread_t * p_input ) ...@@ -236,8 +236,9 @@ void input_DumpStream( input_thread_t * p_input )
/***************************************************************************** /*****************************************************************************
* input_ChangeES: answers to a user request with calls to (Un)SelectES * input_ChangeES: answers to a user request with calls to (Un)SelectES
* --- *****************************************************************************
* Useful since the interface plugins know p_es * Useful since the interface plugins know p_es
* This functon is deprecated, use input_ToggleEs instead.
*****************************************************************************/ *****************************************************************************/
int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es, int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es,
u8 i_cat ) u8 i_cat )
...@@ -317,11 +318,11 @@ int input_ToggleES( input_thread_t * p_input, es_descriptor_t * p_es, ...@@ -317,11 +318,11 @@ int input_ToggleES( input_thread_t * p_input, es_descriptor_t * p_es,
{ {
if( b_select ) if( b_select )
{ {
input_SelectES( p_input, p_es ); p_input->stream.p_newly_selected_es = p_es;
} }
else else
{ {
input_UnselectES( p_input, p_es ); p_input->stream.p_removed_es = p_es;
} }
} }
...@@ -329,3 +330,17 @@ int input_ToggleES( input_thread_t * p_input, es_descriptor_t * p_es, ...@@ -329,3 +330,17 @@ int input_ToggleES( input_thread_t * p_input, es_descriptor_t * p_es,
return 0; return 0;
} }
/****************************************************************************
* input_ChangeArea: interface request an area change
****************************************************************************/
int input_ChangeArea( input_thread_t * p_input, input_area_t * p_area )
{
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_new_area = p_area;
vlc_mutex_unlock( &p_input->stream.stream_lock );
return 0;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_programs.c,v 1.55 2001/05/01 12:22:18 sam Exp $ * $Id: input_programs.c,v 1.56 2001/05/19 00:39:30 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -64,6 +64,8 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len ) ...@@ -64,6 +64,8 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len )
p_input->stream.b_changed = 0; p_input->stream.b_changed = 0;
p_input->stream.pp_es = NULL; p_input->stream.pp_es = NULL;
p_input->stream.pp_selected_es = NULL; p_input->stream.pp_selected_es = NULL;
p_input->stream.p_removed_es = NULL;
p_input->stream.p_newly_selected_es = NULL;
p_input->stream.pp_programs = NULL; p_input->stream.pp_programs = NULL;
if( i_data_len ) if( i_data_len )
...@@ -673,19 +675,11 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -673,19 +675,11 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
} }
break; break;
#if 0
case LPCM_AUDIO_ES: case LPCM_AUDIO_ES:
if( p_main->b_audio ) if( p_main->b_audio )
{
if( p_main->b_spdif )
{
decoder.pf_create_thread = spdif_CreateThread;
}
else
{ {
intf_ErrMsg( "input error: LPCM audio not handled yet" ); intf_ErrMsg( "input error: LPCM audio not handled yet" );
break; break;
}
p_config = (void *)GetAdecConfig( p_input, p_es ); p_config = (void *)GetAdecConfig( p_input, p_es );
...@@ -696,7 +690,6 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -696,7 +690,6 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
} }
break; break;
#endif
case DVD_SPU_ES: case DVD_SPU_ES:
if( p_main->b_video ) if( p_main->b_video )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment