Commit 8a430a88 authored by Stéphane Borel's avatar Stéphane Borel

*first version of plugin for libdvdplay. To test it, you need to have

 libdvdplay installed (available from videolan CVS), and request plugins
compilation in the usual way:
	--enable-dvdplay.
Note that libdvdplay needs libdvdread and libdvdcss.

Currently it has only been tested under linux, with gnome interface (optional)
and xvideo output.

What works (more or less):
 -DVD reading in some rare cases :) (title and menus),
 -Menu pause,
 -Seeking,
 -Selecting directly a specific title/chapter/angle,
 -Changing audio, sub-picture, angle during playback,
 -Interactive menus with mouse only.

What is missing:
 -Menu buttons highlighting (needs spudec patch),
 -Keyboard interaction (needs a specific part in port specific plugins),
 -A specific interface to navigate through menus (needs that I move my ass),
 -Interactive menus won't work with other output plugins so long as they
  have not been patched to send mouse/keyboard events to vlc interface,
 -Whatever you need.

Known bugs (bugs in libdvdplay mostly):
 -Seeking in some menus or intro titles (bad vobu map),
 -Read/seek error with some DVDs,
 -the configure needs tweaking,
 -numerous segfaults,
 -decoder/output modules locking error,
 -fuzzy colors in menus when spudec is active (default in menus).

The plugin is not guaranteed to work anywhere outside my computer. If it break your, don't come and complain to me :).
parent eddfb25c
...@@ -34,6 +34,7 @@ PLUGINS_DIR := a52 \ ...@@ -34,6 +34,7 @@ PLUGINS_DIR := a52 \
dummy \ dummy \
dvd \ dvd \
dvdread \ dvdread \
dvdplay \
esd \ esd \
familiar \ familiar \
fb \ fb \
...@@ -101,6 +102,7 @@ PLUGINS_TARGETS := a52/a52 \ ...@@ -101,6 +102,7 @@ PLUGINS_TARGETS := a52/a52 \
dummy/null \ dummy/null \
dvd/dvd \ dvd/dvd \
dvdread/dvdread \ dvdread/dvdread \
dvdplay/dvdplay \
esd/esd \ esd/esd \
familiar/familiar \ familiar/familiar \
fb/fb \ fb/fb \
......
...@@ -64,6 +64,7 @@ chroma_i420_yuy2_mmx_CFLAGS = @chroma_i420_yuy2_mmx_CFLAGS@ ...@@ -64,6 +64,7 @@ chroma_i420_yuy2_mmx_CFLAGS = @chroma_i420_yuy2_mmx_CFLAGS@
directx_CFLAGS = @directx_CFLAGS@ directx_CFLAGS = @directx_CFLAGS@
dvd_CFLAGS = @dvd_CFLAGS@ dvd_CFLAGS = @dvd_CFLAGS@
dvdread_CFLAGS = @dvdread_CFLAGS@ dvdread_CFLAGS = @dvdread_CFLAGS@
dvdplay_CFLAGS = @dvdplay_CFLAGS@
esd_CFLAGS = @esd_CFLAGS@ esd_CFLAGS = @esd_CFLAGS@
familiar_CFLAGS = @familiar_CFLAGS@ familiar_CFLAGS = @familiar_CFLAGS@
ffmpeg_CFLAGS = @ffmpeg_CFLAGS@ ffmpeg_CFLAGS = @ffmpeg_CFLAGS@
...@@ -99,6 +100,7 @@ directx_LDFLAGS = @directx_LDFLAGS@ ...@@ -99,6 +100,7 @@ directx_LDFLAGS = @directx_LDFLAGS@
dsp_LDFLAGS = @dsp_LDFLAGS@ dsp_LDFLAGS = @dsp_LDFLAGS@
dvd_LDFLAGS = @dvd_LDFLAGS@ dvd_LDFLAGS = @dvd_LDFLAGS@
dvdread_LDFLAGS = @dvdread_LDFLAGS@ dvdread_LDFLAGS = @dvdread_LDFLAGS@
dvdplay_LDFLAGS = @dvdplay_LDFLAGS@
esd_LDFLAGS = @esd_LDFLAGS@ esd_LDFLAGS = @esd_LDFLAGS@
familiar_LDFLAGS = @familiar_LDFLAGS@ familiar_LDFLAGS = @familiar_LDFLAGS@
filter_distort_LDFLAGS = @filter_distort_LDFLAGS@ filter_distort_LDFLAGS = @filter_distort_LDFLAGS@
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -716,9 +716,46 @@ then ...@@ -716,9 +716,46 @@ then
fi fi
fi fi
]) ])
CPPFLAGS="$save_CPPFLAGS"
fi
dnl
dnl dvdplay module: check for libdvdplay
dnl
AC_ARG_ENABLE(dvdplay,
[ --enable-dvdplay dvdplay input module (default disabled)])
if test "x$enable_dvdplay" != "xno"
then
AC_ARG_WITH(dvdplay,
[ --with-dvdplay=PATH libdvdplay headers and libraries])
if test "x$with_dvdplay" = x
then
test_LDFLAGS=""
test_CFLAGS=""
else
test_LDFLAGS="-L${with_dvdplay}/lib"
test_CFLAGS="-I${with_dvdplay}/include"
fi
CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
AC_CHECK_HEADERS(dvdplay/dvdplay.h, [
PLUGINS="${PLUGINS} dvdplay"
dvdplay_LDFLAGS="${dvdplay_LDFLAGS} ${test_LDFLAGS} -ldvdplay -ldvdread"
dvdplay_CFLAGS="${dvdplay_CFLAGS} ${test_CFLAGS}"
],[
if test "x$enable_dvdplay" != x
then
if test "x$with_dvdplay" != x
then
AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h in ${with_dvdplay}/include])
else
AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h])
fi
fi
])
CPPFLAGS="${save_CPPFLAGS}" CPPFLAGS="${save_CPPFLAGS}"
fi fi
dnl dnl
dnl libdvbpsi ts demux dnl libdvbpsi ts demux
dnl dnl
...@@ -1827,6 +1864,7 @@ AC_SUBST(arts_CFLAGS) ...@@ -1827,6 +1864,7 @@ AC_SUBST(arts_CFLAGS)
AC_SUBST(chroma_i420_yuy2_mmx_CFLAGS) AC_SUBST(chroma_i420_yuy2_mmx_CFLAGS)
AC_SUBST(dvd_CFLAGS) AC_SUBST(dvd_CFLAGS)
AC_SUBST(dvdread_CFLAGS) AC_SUBST(dvdread_CFLAGS)
AC_SUBST(dvdplay_CFLAGS)
AC_SUBST(mpeg_ts_dvbpsi_CFLAGS) AC_SUBST(mpeg_ts_dvbpsi_CFLAGS)
AC_SUBST(directx_CFLAGS) AC_SUBST(directx_CFLAGS)
AC_SUBST(esd_CFLAGS) AC_SUBST(esd_CFLAGS)
...@@ -1861,6 +1899,7 @@ AC_SUBST(directx_LDFLAGS) ...@@ -1861,6 +1899,7 @@ AC_SUBST(directx_LDFLAGS)
AC_SUBST(dsp_LDFLAGS) AC_SUBST(dsp_LDFLAGS)
AC_SUBST(dvd_LDFLAGS) AC_SUBST(dvd_LDFLAGS)
AC_SUBST(dvdread_LDFLAGS) AC_SUBST(dvdread_LDFLAGS)
AC_SUBST(dvdplay_LDFLAGS)
AC_SUBST(mpeg_ts_dvbpsi_LDFLAGS) AC_SUBST(mpeg_ts_dvbpsi_LDFLAGS)
AC_SUBST(esd_LDFLAGS) AC_SUBST(esd_LDFLAGS)
AC_SUBST(familiar_LDFLAGS) AC_SUBST(familiar_LDFLAGS)
......
...@@ -199,6 +199,9 @@ ...@@ -199,6 +199,9 @@
/* Define if you have the <dvdcss/dvdcss.h> header file. */ /* Define if you have the <dvdcss/dvdcss.h> header file. */
#undef HAVE_DVDCSS_DVDCSS_H #undef HAVE_DVDCSS_DVDCSS_H
/* Define if you have the <dvdplay/dvdplay.h> header file. */
#undef HAVE_DVDPLAY_DVDPLAY_H
/* Define if you have the <dvdread/dvd_reader.h> header file. */ /* Define if you have the <dvdread/dvd_reader.h> header file. */
#undef HAVE_DVDREAD_DVD_READER_H #undef HAVE_DVDREAD_DVD_READER_H
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
struct module_symbols_t struct module_symbols_t
{ {
aout_fifo_t * (* __aout_CreateFifo_inner) ( vlc_object_t *, int, int, int, int, void * ) ; aout_fifo_t * (* __aout_CreateFifo_inner) ( vlc_object_t *, int, int, int, int, void * ) ;
char * (* __config_GetPsz_inner) (vlc_object_t *, const char *) ;
char * (* config_GetHomeDir_inner) ( void ) ; char * (* config_GetHomeDir_inner) ( void ) ;
char * (* __config_GetPsz_inner) (vlc_object_t *, const char *) ;
char * (* input_OffsetToTime_inner) ( input_thread_t *, char *, off_t ) ; char * (* input_OffsetToTime_inner) ( input_thread_t *, char *, off_t ) ;
char * (* mstrtime_inner) ( char *psz_buffer, mtime_t date ) ; char * (* mstrtime_inner) ( char *psz_buffer, mtime_t date ) ;
const char * (* DecodeLanguage_inner) ( u16 ) ; const char * (* DecodeLanguage_inner) ( u16 ) ;
...@@ -24,16 +24,7 @@ struct module_symbols_t ...@@ -24,16 +24,7 @@ struct module_symbols_t
int (* __config_LoadCmdLine_inner) ( vlc_object_t *, int *, char *[], vlc_bool_t ) ; int (* __config_LoadCmdLine_inner) ( vlc_object_t *, int *, char *[], vlc_bool_t ) ;
int (* __config_LoadConfigFile_inner) ( vlc_object_t *, const char * ) ; int (* __config_LoadConfigFile_inner) ( vlc_object_t *, const char * ) ;
int (* __config_SaveConfigFile_inner) ( vlc_object_t *, const char * ) ; int (* __config_SaveConfigFile_inner) ( vlc_object_t *, const char * ) ;
int (* __intf_Eject_inner) ( vlc_object_t *, const char * ) ; intf_thread_t * (* __intf_Create_inner) ( vlc_object_t * ) ;
int (* __network_ChannelCreate_inner) ( vlc_object_t * ) ;
int (* __network_ChannelJoin_inner) ( vlc_object_t *, int ) ;
int (* __vlc_cond_destroy_inner) ( char *, int, vlc_cond_t * ) ;
int (* __vlc_cond_init_inner) ( vlc_object_t *, vlc_cond_t * ) ;
int (* __vlc_mutex_destroy_inner) ( char *, int, vlc_mutex_t * ) ;
int (* __vlc_mutex_init_inner) ( vlc_object_t *, vlc_mutex_t * ) ;
int (* __vlc_thread_create_inner) ( vlc_object_t *, char *, int, char *, void * ( * ) ( void * ), vlc_bool_t ) ;
int (* __vlc_threads_end_inner) ( vlc_object_t * ) ;
int (* __vlc_threads_init_inner) ( vlc_object_t * ) ;
int (* input_AccessInit_inner) ( input_thread_t * ) ; int (* input_AccessInit_inner) ( input_thread_t * ) ;
int (* input_AddInfo_inner) ( input_info_category_t *, char *, char *, ... ) ; int (* input_AddInfo_inner) ( input_info_category_t *, char *, char *, ... ) ;
int (* input_ChangeArea_inner) ( input_thread_t *, input_area_t * ) ; int (* input_ChangeArea_inner) ( input_thread_t *, input_area_t * ) ;
...@@ -44,10 +35,19 @@ struct module_symbols_t ...@@ -44,10 +35,19 @@ struct module_symbols_t
int (* input_SetProgram_inner) ( input_thread_t *, pgrm_descriptor_t * ) ; int (* input_SetProgram_inner) ( input_thread_t *, pgrm_descriptor_t * ) ;
int (* input_ToggleES_inner) ( input_thread_t *, es_descriptor_t *, vlc_bool_t ) ; int (* input_ToggleES_inner) ( input_thread_t *, es_descriptor_t *, vlc_bool_t ) ;
int (* input_UnselectES_inner) ( input_thread_t *, es_descriptor_t * ) ; int (* input_UnselectES_inner) ( input_thread_t *, es_descriptor_t * ) ;
int (* __intf_Eject_inner) ( vlc_object_t *, const char * ) ;
int (* __network_ChannelCreate_inner) ( vlc_object_t * ) ;
int (* __network_ChannelJoin_inner) ( vlc_object_t *, int ) ;
int (* playlist_Add_inner) ( playlist_t *, const char *, int, int ) ; int (* playlist_Add_inner) ( playlist_t *, const char *, int, int ) ;
int (* playlist_Delete_inner) ( playlist_t *, int ) ; int (* playlist_Delete_inner) ( playlist_t *, int ) ;
int (* __vlc_cond_destroy_inner) ( char *, int, vlc_cond_t * ) ;
int (* __vlc_cond_init_inner) ( vlc_object_t *, vlc_cond_t * ) ;
int (* __vlc_mutex_destroy_inner) ( char *, int, vlc_mutex_t * ) ;
int (* __vlc_mutex_init_inner) ( vlc_object_t *, vlc_mutex_t * ) ;
int (* __vlc_thread_create_inner) ( vlc_object_t *, char *, int, char *, void * ( * ) ( void * ), vlc_bool_t ) ;
int (* __vlc_threads_end_inner) ( vlc_object_t * ) ;
int (* __vlc_threads_init_inner) ( vlc_object_t * ) ;
int (* vout_ChromaCmp_inner) ( u32, u32 ) ; int (* vout_ChromaCmp_inner) ( u32, u32 ) ;
intf_thread_t * (* __intf_Create_inner) ( vlc_object_t * ) ;
module_config_t * (* config_FindConfig_inner) ( vlc_object_t *, const char *psz_name ) ; module_config_t * (* config_FindConfig_inner) ( vlc_object_t *, const char *psz_name ) ;
module_t * (* __module_Need_inner) ( vlc_object_t *, int, const char *, void * ) ; module_t * (* __module_Need_inner) ( vlc_object_t *, int, const char *, void * ) ;
msg_subscription_t* (* __msg_Subscribe_inner) ( vlc_object_t * ) ; msg_subscription_t* (* __msg_Subscribe_inner) ( vlc_object_t * ) ;
...@@ -69,36 +69,17 @@ struct module_symbols_t ...@@ -69,36 +69,17 @@ struct module_symbols_t
u32 (* UnalignedShowBits_inner) ( bit_stream_t *, unsigned int ) ; u32 (* UnalignedShowBits_inner) ( bit_stream_t *, unsigned int ) ;
vlc_bool_t (* NextDataPacket_inner) ( decoder_fifo_t *, data_packet_t ** ) ; vlc_bool_t (* NextDataPacket_inner) ( decoder_fifo_t *, data_packet_t ** ) ;
vlc_error_t (* intf_RunThread_inner) ( intf_thread_t * ) ; vlc_error_t (* intf_RunThread_inner) ( intf_thread_t * ) ;
void (* aout_DestroyFifo_inner) ( aout_fifo_t *p_fifo ) ;
void (* BitstreamNextDataPacket_inner) ( bit_stream_t * ) ; void (* BitstreamNextDataPacket_inner) ( bit_stream_t * ) ;
void (* CurrentPTS_inner) ( bit_stream_t *, mtime_t *, mtime_t * ) ; void (* config_Duplicate_inner) ( module_t *, module_config_t * ) ;
void (* DecoderError_inner) ( decoder_fifo_t * p_fifo ) ;
void (* InitBitstream_inner) ( bit_stream_t *, decoder_fifo_t *, void ( * )( bit_stream_t *, vlc_bool_t ), void * p_callback_arg ) ;
void (* UnalignedRemoveBits_inner) ( bit_stream_t * ) ;
void (* __config_PutFloat_inner) (vlc_object_t *, const char *, float) ; void (* __config_PutFloat_inner) (vlc_object_t *, const char *, float) ;
void (* __config_PutInt_inner) (vlc_object_t *, const char *, int) ; void (* __config_PutInt_inner) (vlc_object_t *, const char *, int) ;
void (* __config_PutPsz_inner) (vlc_object_t *, const char *, const char *) ; void (* __config_PutPsz_inner) (vlc_object_t *, const char *, const char *) ;
void (* __input_Seek_inner) ( vlc_object_t *, off_t, int ) ;
void (* __input_SetStatus_inner) ( vlc_object_t *, int ) ;
void (* __input_Tell_inner) ( vlc_object_t *, stream_position_t * ) ;
void (* __msg_Dbg_inner) ( void *, const char *, ... ) ;
void (* __msg_Err_inner) ( void *, const char *, ... ) ;
void (* __msg_Generic_inner) ( vlc_object_t *, int, const char *, const char *, ... ) ;
void (* __msg_Info_inner) ( void *, const char *, ... ) ;
void (* __msg_Unsubscribe_inner) ( vlc_object_t *, msg_subscription_t * ) ;
void (* __msg_Warn_inner) ( void *, const char *, ... ) ;
void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ;
void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void (* __vlc_object_destroy_inner) ( vlc_object_t * ) ;
void (* __vlc_object_detach_all_inner) ( vlc_object_t * ) ;
void (* __vlc_object_detach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void (* __vlc_object_release_inner) ( vlc_object_t * ) ;
void (* __vlc_object_yield_inner) ( vlc_object_t * ) ;
void (* __vlc_thread_join_inner) ( vlc_object_t *, char *, int ) ;
void (* __vlc_thread_ready_inner) ( vlc_object_t * ) ;
void (* aout_DestroyFifo_inner) ( aout_fifo_t *p_fifo ) ;
void (* config_Duplicate_inner) ( module_t *, module_config_t * ) ;
void (* config_SetCallbacks_inner) ( module_config_t *, module_config_t * ) ; void (* config_SetCallbacks_inner) ( module_config_t *, module_config_t * ) ;
void (* config_UnsetCallbacks_inner) ( module_config_t * ) ; void (* config_UnsetCallbacks_inner) ( module_config_t * ) ;
void (* CurrentPTS_inner) ( bit_stream_t *, mtime_t *, mtime_t * ) ;
void (* DecoderError_inner) ( decoder_fifo_t * p_fifo ) ;
void (* InitBitstream_inner) ( bit_stream_t *, decoder_fifo_t *, void ( * )( bit_stream_t *, vlc_bool_t ), void * p_callback_arg ) ;
void (* input_AccessEnd_inner) ( input_thread_t * ) ; void (* input_AccessEnd_inner) ( input_thread_t * ) ;
void (* input_AccessReinit_inner) ( input_thread_t * ) ; void (* input_AccessReinit_inner) ( input_thread_t * ) ;
void (* input_BuffersEnd_inner) ( input_thread_t *, input_buffers_t * ) ; void (* input_BuffersEnd_inner) ( input_thread_t *, input_buffers_t * ) ;
...@@ -106,9 +87,9 @@ struct module_symbols_t ...@@ -106,9 +87,9 @@ struct module_symbols_t
void (* input_DecodePES_inner) ( decoder_fifo_t *, pes_packet_t * ) ; void (* input_DecodePES_inner) ( decoder_fifo_t *, pes_packet_t * ) ;
void (* input_DelArea_inner) ( input_thread_t *, input_area_t * ) ; void (* input_DelArea_inner) ( input_thread_t *, input_area_t * ) ;
void (* input_DelES_inner) ( input_thread_t *, es_descriptor_t * ) ; void (* input_DelES_inner) ( input_thread_t *, es_descriptor_t * ) ;
void (* input_DelProgram_inner) ( input_thread_t *, pgrm_descriptor_t * ) ;
void (* input_DeletePES_inner) ( input_buffers_t *, pes_packet_t * ) ;
void (* input_DeletePacket_inner) ( input_buffers_t *, data_packet_t * ) ; void (* input_DeletePacket_inner) ( input_buffers_t *, data_packet_t * ) ;
void (* input_DeletePES_inner) ( input_buffers_t *, pes_packet_t * ) ;
void (* input_DelProgram_inner) ( input_thread_t *, pgrm_descriptor_t * ) ;
void (* input_DemuxPS_inner) ( input_thread_t *, data_packet_t * ) ; void (* input_DemuxPS_inner) ( input_thread_t *, data_packet_t * ) ;
void (* input_DemuxTS_inner) ( input_thread_t *, data_packet_t *, void(*) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t ) ) ; void (* input_DemuxTS_inner) ( input_thread_t *, data_packet_t *, void(*) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t ) ) ;
void (* input_DumpStream_inner) ( input_thread_t * ) ; void (* input_DumpStream_inner) ( input_thread_t * ) ;
...@@ -119,12 +100,33 @@ struct module_symbols_t ...@@ -119,12 +100,33 @@ struct module_symbols_t
void (* input_GatherPES_inner) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t, vlc_bool_t ) ; void (* input_GatherPES_inner) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t, vlc_bool_t ) ;
void (* input_ParsePES_inner) ( input_thread_t *, es_descriptor_t * ) ; void (* input_ParsePES_inner) ( input_thread_t *, es_descriptor_t * ) ;
void (* input_ReleaseBuffer_inner) ( input_buffers_t *, data_buffer_t * ) ; void (* input_ReleaseBuffer_inner) ( input_buffers_t *, data_buffer_t * ) ;
void (* __input_Seek_inner) ( vlc_object_t *, off_t, int ) ;
void (* __input_SetStatus_inner) ( vlc_object_t *, int ) ;
void (* __input_Tell_inner) ( vlc_object_t *, stream_position_t * ) ;
void (* intf_Destroy_inner) ( intf_thread_t * ) ; void (* intf_Destroy_inner) ( intf_thread_t * ) ;
void (* intf_StopThread_inner) ( intf_thread_t * ) ; void (* intf_StopThread_inner) ( intf_thread_t * ) ;
void (* module_Unneed_inner) ( module_t * ) ; void (* module_Unneed_inner) ( module_t * ) ;
void (* __msg_Dbg_inner) ( void *, const char *, ... ) ;
void (* __msg_Err_inner) ( void *, const char *, ... ) ;
void (* __msg_Generic_inner) ( vlc_object_t *, int, const char *, const char *, ... ) ;
void (* __msg_Info_inner) ( void *, const char *, ... ) ;
void (* __msg_Unsubscribe_inner) ( vlc_object_t *, msg_subscription_t * ) ;
void (* __msg_Warn_inner) ( void *, const char *, ... ) ;
void (* msleep_inner) ( mtime_t delay ) ; void (* msleep_inner) ( mtime_t delay ) ;
void (* mwait_inner) ( mtime_t date ) ; void (* mwait_inner) ( mtime_t date ) ;
void (* playlist_Command_inner) ( playlist_t *, int, int ) ; void (* playlist_Command_inner) ( playlist_t *, int, int ) ;
void (* UnalignedRemoveBits_inner) ( bit_stream_t * ) ;
void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ;
void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void * (* __vlc_object_create_inner) ( vlc_object_t *, int ) ;
void (* __vlc_object_destroy_inner) ( vlc_object_t * ) ;
void (* __vlc_object_detach_all_inner) ( vlc_object_t * ) ;
void (* __vlc_object_detach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void * (* __vlc_object_find_inner) ( vlc_object_t *, int, int ) ;
void (* __vlc_object_release_inner) ( vlc_object_t * ) ;
void (* __vlc_object_yield_inner) ( vlc_object_t * ) ;
void (* __vlc_thread_join_inner) ( vlc_object_t *, char *, int ) ;
void (* __vlc_thread_ready_inner) ( vlc_object_t * ) ;
void (* vout_AllocatePicture_inner) ( vout_thread_t *, picture_t *, int, int, u32 ) ; void (* vout_AllocatePicture_inner) ( vout_thread_t *, picture_t *, int, int, u32 ) ;
void (* vout_DatePicture_inner) ( vout_thread_t *, picture_t *, mtime_t ) ; void (* vout_DatePicture_inner) ( vout_thread_t *, picture_t *, mtime_t ) ;
void (* vout_DestroyPicture_inner) ( vout_thread_t *, picture_t * ) ; void (* vout_DestroyPicture_inner) ( vout_thread_t *, picture_t * ) ;
...@@ -135,26 +137,17 @@ struct module_symbols_t ...@@ -135,26 +137,17 @@ struct module_symbols_t
void (* vout_LinkPicture_inner) ( vout_thread_t *, picture_t * ) ; void (* vout_LinkPicture_inner) ( vout_thread_t *, picture_t * ) ;
void (* vout_PlacePicture_inner) ( vout_thread_t *, int, int, int *, int *, int *, int * ) ; void (* vout_PlacePicture_inner) ( vout_thread_t *, int, int, int *, int *, int *, int * ) ;
void (* vout_UnlinkPicture_inner) ( vout_thread_t *, picture_t * ) ; void (* vout_UnlinkPicture_inner) ( vout_thread_t *, picture_t * ) ;
void * (* __vlc_object_create_inner) ( vlc_object_t *, int ) ;
void * (* __vlc_object_find_inner) ( vlc_object_t *, int, int ) ;
vout_thread_t * (* __vout_CreateThread_inner) ( vlc_object_t *, int, int, u32, int ) ; vout_thread_t * (* __vout_CreateThread_inner) ( vlc_object_t *, int, int, u32, int ) ;
}; };
#ifdef __PLUGIN__ #ifdef __PLUGIN__
# define BitstreamNextDataPacket p_symbols->BitstreamNextDataPacket_inner
# define CurrentPTS p_symbols->CurrentPTS_inner
# define DecodeLanguage p_symbols->DecodeLanguage_inner
# define DecoderError p_symbols->DecoderError_inner
# define GetLang_1 p_symbols->GetLang_1_inner
# define GetLang_2B p_symbols->GetLang_2B_inner
# define GetLang_2T p_symbols->GetLang_2T_inner
# define InitBitstream p_symbols->InitBitstream_inner
# define NextDataPacket p_symbols->NextDataPacket_inner
# define UnalignedGetBits p_symbols->UnalignedGetBits_inner
# define UnalignedRemoveBits p_symbols->UnalignedRemoveBits_inner
# define UnalignedShowBits p_symbols->UnalignedShowBits_inner
# define __aout_CreateFifo p_symbols->__aout_CreateFifo_inner # define __aout_CreateFifo p_symbols->__aout_CreateFifo_inner
# define aout_DestroyFifo p_symbols->aout_DestroyFifo_inner
# define BitstreamNextDataPacket p_symbols->BitstreamNextDataPacket_inner
# define config_Duplicate p_symbols->config_Duplicate_inner
# define config_FindConfig p_symbols->config_FindConfig_inner
# define __config_GetFloat p_symbols->__config_GetFloat_inner # define __config_GetFloat p_symbols->__config_GetFloat_inner
# define config_GetHomeDir p_symbols->config_GetHomeDir_inner
# define __config_GetInt p_symbols->__config_GetInt_inner # define __config_GetInt p_symbols->__config_GetInt_inner
# define __config_GetPsz p_symbols->__config_GetPsz_inner # define __config_GetPsz p_symbols->__config_GetPsz_inner
# define __config_LoadCmdLine p_symbols->__config_LoadCmdLine_inner # define __config_LoadCmdLine p_symbols->__config_LoadCmdLine_inner
...@@ -163,46 +156,15 @@ struct module_symbols_t ...@@ -163,46 +156,15 @@ struct module_symbols_t
# define __config_PutInt p_symbols->__config_PutInt_inner # define __config_PutInt p_symbols->__config_PutInt_inner
# define __config_PutPsz p_symbols->__config_PutPsz_inner # define __config_PutPsz p_symbols->__config_PutPsz_inner
# define __config_SaveConfigFile p_symbols->__config_SaveConfigFile_inner # define __config_SaveConfigFile p_symbols->__config_SaveConfigFile_inner
# define __input_Seek p_symbols->__input_Seek_inner
# define __input_SetStatus p_symbols->__input_SetStatus_inner
# define __input_Tell p_symbols->__input_Tell_inner
# define __intf_Create p_symbols->__intf_Create_inner
# define __intf_Eject p_symbols->__intf_Eject_inner
# define __module_Need p_symbols->__module_Need_inner
# define __msg_Dbg p_symbols->__msg_Dbg_inner
# define __msg_Err p_symbols->__msg_Err_inner
# define __msg_Generic p_symbols->__msg_Generic_inner
# define __msg_Info p_symbols->__msg_Info_inner
# define __msg_Subscribe p_symbols->__msg_Subscribe_inner
# define __msg_Unsubscribe p_symbols->__msg_Unsubscribe_inner
# define __msg_Warn p_symbols->__msg_Warn_inner
# define __network_ChannelCreate p_symbols->__network_ChannelCreate_inner
# define __network_ChannelJoin p_symbols->__network_ChannelJoin_inner
# define __vlc_cond_destroy p_symbols->__vlc_cond_destroy_inner
# define __vlc_cond_init p_symbols->__vlc_cond_init_inner
# define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner
# define __vlc_mutex_destroy p_symbols->__vlc_mutex_destroy_inner
# define __vlc_mutex_init p_symbols->__vlc_mutex_init_inner
# define __vlc_object_attach p_symbols->__vlc_object_attach_inner
# define __vlc_object_create p_symbols->__vlc_object_create_inner
# define __vlc_object_destroy p_symbols->__vlc_object_destroy_inner
# define __vlc_object_detach p_symbols->__vlc_object_detach_inner
# define __vlc_object_detach_all p_symbols->__vlc_object_detach_all_inner
# define __vlc_object_find p_symbols->__vlc_object_find_inner
# define __vlc_object_release p_symbols->__vlc_object_release_inner
# define __vlc_object_yield p_symbols->__vlc_object_yield_inner
# define __vlc_thread_create p_symbols->__vlc_thread_create_inner
# define __vlc_thread_join p_symbols->__vlc_thread_join_inner
# define __vlc_thread_ready p_symbols->__vlc_thread_ready_inner
# define __vlc_threads_end p_symbols->__vlc_threads_end_inner
# define __vlc_threads_init p_symbols->__vlc_threads_init_inner
# define __vout_CreateThread p_symbols->__vout_CreateThread_inner
# define aout_DestroyFifo p_symbols->aout_DestroyFifo_inner
# define config_Duplicate p_symbols->config_Duplicate_inner
# define config_FindConfig p_symbols->config_FindConfig_inner
# define config_GetHomeDir p_symbols->config_GetHomeDir_inner
# define config_SetCallbacks p_symbols->config_SetCallbacks_inner # define config_SetCallbacks p_symbols->config_SetCallbacks_inner
# define config_UnsetCallbacks p_symbols->config_UnsetCallbacks_inner # define config_UnsetCallbacks p_symbols->config_UnsetCallbacks_inner
# define CurrentPTS p_symbols->CurrentPTS_inner
# define DecodeLanguage p_symbols->DecodeLanguage_inner
# define DecoderError p_symbols->DecoderError_inner
# define GetLang_1 p_symbols->GetLang_1_inner
# define GetLang_2B p_symbols->GetLang_2B_inner
# define GetLang_2T p_symbols->GetLang_2T_inner
# define InitBitstream p_symbols->InitBitstream_inner
# define input_AccessEnd p_symbols->input_AccessEnd_inner # define input_AccessEnd p_symbols->input_AccessEnd_inner
# define input_AccessInit p_symbols->input_AccessInit_inner # define input_AccessInit p_symbols->input_AccessInit_inner
# define input_AccessReinit p_symbols->input_AccessReinit_inner # define input_AccessReinit p_symbols->input_AccessReinit_inner
...@@ -219,9 +181,9 @@ struct module_symbols_t ...@@ -219,9 +181,9 @@ struct module_symbols_t
# define input_DecodePES p_symbols->input_DecodePES_inner # define input_DecodePES p_symbols->input_DecodePES_inner
# define input_DelArea p_symbols->input_DelArea_inner # define input_DelArea p_symbols->input_DelArea_inner
# define input_DelES p_symbols->input_DelES_inner # define input_DelES p_symbols->input_DelES_inner
# define input_DelProgram p_symbols->input_DelProgram_inner
# define input_DeletePES p_symbols->input_DeletePES_inner
# define input_DeletePacket p_symbols->input_DeletePacket_inner # define input_DeletePacket p_symbols->input_DeletePacket_inner
# define input_DeletePES p_symbols->input_DeletePES_inner
# define input_DelProgram p_symbols->input_DelProgram_inner
# define input_DemuxPS p_symbols->input_DemuxPS_inner # define input_DemuxPS p_symbols->input_DemuxPS_inner
# define input_DemuxTS p_symbols->input_DemuxTS_inner # define input_DemuxTS p_symbols->input_DemuxTS_inner
# define input_DumpStream p_symbols->input_DumpStream_inner # define input_DumpStream p_symbols->input_DumpStream_inner
...@@ -238,8 +200,8 @@ struct module_symbols_t ...@@ -238,8 +200,8 @@ struct module_symbols_t
# define input_InfoCategory p_symbols->input_InfoCategory_inner # define input_InfoCategory p_symbols->input_InfoCategory_inner
# define input_InitStream p_symbols->input_InitStream_inner # define input_InitStream p_symbols->input_InitStream_inner
# define input_NewBuffer p_symbols->input_NewBuffer_inner # define input_NewBuffer p_symbols->input_NewBuffer_inner
# define input_NewPES p_symbols->input_NewPES_inner
# define input_NewPacket p_symbols->input_NewPacket_inner # define input_NewPacket p_symbols->input_NewPacket_inner
# define input_NewPES p_symbols->input_NewPES_inner
# define input_OffsetToTime p_symbols->input_OffsetToTime_inner # define input_OffsetToTime p_symbols->input_OffsetToTime_inner
# define input_ParsePES p_symbols->input_ParsePES_inner # define input_ParsePES p_symbols->input_ParsePES_inner
# define input_ParsePS p_symbols->input_ParsePS_inner # define input_ParsePS p_symbols->input_ParsePS_inner
...@@ -247,27 +209,65 @@ struct module_symbols_t ...@@ -247,27 +209,65 @@ struct module_symbols_t
# define input_ReadPS p_symbols->input_ReadPS_inner # define input_ReadPS p_symbols->input_ReadPS_inner
# define input_ReadTS p_symbols->input_ReadTS_inner # define input_ReadTS p_symbols->input_ReadTS_inner
# define input_ReleaseBuffer p_symbols->input_ReleaseBuffer_inner # define input_ReleaseBuffer p_symbols->input_ReleaseBuffer_inner
# define __input_Seek p_symbols->__input_Seek_inner
# define input_SelectES p_symbols->input_SelectES_inner # define input_SelectES p_symbols->input_SelectES_inner
# define input_SetProgram p_symbols->input_SetProgram_inner # define input_SetProgram p_symbols->input_SetProgram_inner
# define __input_SetStatus p_symbols->__input_SetStatus_inner
# define input_ShareBuffer p_symbols->input_ShareBuffer_inner # define input_ShareBuffer p_symbols->input_ShareBuffer_inner
# define input_SplitBuffer p_symbols->input_SplitBuffer_inner # define input_SplitBuffer p_symbols->input_SplitBuffer_inner
# define __input_Tell p_symbols->__input_Tell_inner
# define input_ToggleES p_symbols->input_ToggleES_inner # define input_ToggleES p_symbols->input_ToggleES_inner
# define input_UnselectES p_symbols->input_UnselectES_inner # define input_UnselectES p_symbols->input_UnselectES_inner
# define __intf_Create p_symbols->__intf_Create_inner
# define intf_Destroy p_symbols->intf_Destroy_inner # define intf_Destroy p_symbols->intf_Destroy_inner
# define __intf_Eject p_symbols->__intf_Eject_inner
# define intf_RunThread p_symbols->intf_RunThread_inner # define intf_RunThread p_symbols->intf_RunThread_inner
# define intf_StopThread p_symbols->intf_StopThread_inner # define intf_StopThread p_symbols->intf_StopThread_inner
# define mdate p_symbols->mdate_inner # define mdate p_symbols->mdate_inner
# define __module_Need p_symbols->__module_Need_inner
# define module_Unneed p_symbols->module_Unneed_inner # define module_Unneed p_symbols->module_Unneed_inner
# define __msg_Dbg p_symbols->__msg_Dbg_inner
# define __msg_Err p_symbols->__msg_Err_inner
# define __msg_Generic p_symbols->__msg_Generic_inner
# define __msg_Info p_symbols->__msg_Info_inner
# define __msg_Subscribe p_symbols->__msg_Subscribe_inner
# define __msg_Unsubscribe p_symbols->__msg_Unsubscribe_inner
# define __msg_Warn p_symbols->__msg_Warn_inner
# define msleep p_symbols->msleep_inner # define msleep p_symbols->msleep_inner
# define mstrtime p_symbols->mstrtime_inner # define mstrtime p_symbols->mstrtime_inner
# define mwait p_symbols->mwait_inner # define mwait p_symbols->mwait_inner
# define __network_ChannelCreate p_symbols->__network_ChannelCreate_inner
# define __network_ChannelJoin p_symbols->__network_ChannelJoin_inner
# define NextDataPacket p_symbols->NextDataPacket_inner
# define playlist_Add p_symbols->playlist_Add_inner # define playlist_Add p_symbols->playlist_Add_inner
# define playlist_Command p_symbols->playlist_Command_inner # define playlist_Command p_symbols->playlist_Command_inner
# define playlist_Delete p_symbols->playlist_Delete_inner # define playlist_Delete p_symbols->playlist_Delete_inner
# define UnalignedGetBits p_symbols->UnalignedGetBits_inner
# define UnalignedRemoveBits p_symbols->UnalignedRemoveBits_inner
# define UnalignedShowBits p_symbols->UnalignedShowBits_inner
# define __vlc_cond_destroy p_symbols->__vlc_cond_destroy_inner
# define __vlc_cond_init p_symbols->__vlc_cond_init_inner
# define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner
# define __vlc_mutex_destroy p_symbols->__vlc_mutex_destroy_inner
# define __vlc_mutex_init p_symbols->__vlc_mutex_init_inner
# define __vlc_object_attach p_symbols->__vlc_object_attach_inner
# define __vlc_object_create p_symbols->__vlc_object_create_inner
# define __vlc_object_destroy p_symbols->__vlc_object_destroy_inner
# define __vlc_object_detach_all p_symbols->__vlc_object_detach_all_inner
# define __vlc_object_detach p_symbols->__vlc_object_detach_inner
# define __vlc_object_find p_symbols->__vlc_object_find_inner
# define __vlc_object_release p_symbols->__vlc_object_release_inner
# define __vlc_object_yield p_symbols->__vlc_object_yield_inner
# define __vlc_thread_create p_symbols->__vlc_thread_create_inner
# define __vlc_thread_join p_symbols->__vlc_thread_join_inner
# define __vlc_thread_ready p_symbols->__vlc_thread_ready_inner
# define __vlc_threads_end p_symbols->__vlc_threads_end_inner
# define __vlc_threads_init p_symbols->__vlc_threads_init_inner
# define vout_AllocatePicture p_symbols->vout_AllocatePicture_inner # define vout_AllocatePicture p_symbols->vout_AllocatePicture_inner
# define vout_ChromaCmp p_symbols->vout_ChromaCmp_inner # define vout_ChromaCmp p_symbols->vout_ChromaCmp_inner
# define vout_CreatePicture p_symbols->vout_CreatePicture_inner # define vout_CreatePicture p_symbols->vout_CreatePicture_inner
# define vout_CreateSubPicture p_symbols->vout_CreateSubPicture_inner # define vout_CreateSubPicture p_symbols->vout_CreateSubPicture_inner
# define __vout_CreateThread p_symbols->__vout_CreateThread_inner
# define vout_DatePicture p_symbols->vout_DatePicture_inner # define vout_DatePicture p_symbols->vout_DatePicture_inner
# define vout_DestroyPicture p_symbols->vout_DestroyPicture_inner # define vout_DestroyPicture p_symbols->vout_DestroyPicture_inner
# define vout_DestroySubPicture p_symbols->vout_DestroySubPicture_inner # define vout_DestroySubPicture p_symbols->vout_DestroySubPicture_inner
......
.dep
*.lo
*.o.*
*.lo.*
dvdplay_SOURCES = dvd.c access.c demux.c intf.c es.c tools.c
/*****************************************************************************
* access.c: access capabilities for dvdplay plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: access.c,v 1.1 2002/07/23 19:56:19 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 <stdio.h>
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
#endif
#if defined( WIN32 )
# include <io.h> /* read() */
#else
# include <sys/uio.h> /* struct iovec */
#endif
#if defined( WIN32 )
# include "input_iovec.h"
#endif
#include "dvd.h"
#include "es.h"
#include "tools.h"
#include "intf.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/* called from outside */
static int dvdplay_Open ( input_thread_t * );
static void dvdplay_Close ( input_thread_t * );
static int dvdplay_SetArea ( input_thread_t *,
input_area_t * );
static int dvdplay_SetProgram ( input_thread_t *,
pgrm_descriptor_t * );
static int dvdplay_Read ( input_thread_t *,
byte_t *, size_t );
static void dvdplay_Seek ( input_thread_t *, off_t );
static void pf_vmg_callback ( void*, dvdplay_event_t );
/* only from inside */
static int dvdNewArea( input_thread_t *, input_area_t * );
static int dvdNewPGC ( input_thread_t * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void _M( access_getfunctions )( function_list_t * p_function_list )
{
#define access p_function_list->functions.access
access.pf_open = dvdplay_Open;
access.pf_close = dvdplay_Close;
access.pf_read = dvdplay_Read;
access.pf_set_area = dvdplay_SetArea;
access.pf_set_program = dvdplay_SetProgram;
access.pf_seek = dvdplay_Seek;
#undef access
}
/*****************************************************************************
* dvdplay_Open: open libdvdplay
*****************************************************************************/
static int dvdplay_Open( input_thread_t *p_input )
{
char * psz_source;
dvd_data_t * p_dvd;
input_area_t * p_area;
int i_title_nr;
int i_title;
int i_chapter;
int i_angle;
int i;
p_dvd = malloc( sizeof(dvd_data_t) );
if( p_dvd == NULL )
{
msg_Err( p_input, "dvdplay error: out of memory" );
return -1;
}
p_input->p_access_data = (void *)p_dvd;
/* command line */
if( ( psz_source = dvdplay_ParseCL( p_input,
&i_title, &i_chapter, &i_angle ) ) == NULL )
{
free( p_dvd );
return -1;
}
/* Open libdvdplay */
p_dvd->vmg = dvdplay_open( psz_source, pf_vmg_callback, (void*)p_input );
/* free allocated strings */
free( psz_source );
if( p_dvd->vmg == NULL )
{
msg_Err( p_input, "dvdplay error: can't open source" );
free( p_dvd );
return -1;
}
p_dvd->p_intf = NULL;
p_dvd->i_still_time = 0;
/* set up input */
p_input->i_mtu = 0;
/* Set stream and area data */
vlc_mutex_lock( &p_input->stream.stream_lock );
/* If we are here we can control the pace... */
p_input->stream.b_pace_control = 1;
/* seek is only allowed when we have size info */
p_input->stream.b_seekable = 0;
/* Initialize ES structures */
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
/* disc input method */
p_input->stream.i_method = INPUT_METHOD_DVD;
i_title_nr = dvdplay_title_nr( p_dvd->vmg );
#define area p_input->stream.pp_areas
/* Area 0 for menu */
area[0]->i_plugin_data = 0;
for( i = 1 ; i <= i_title_nr ; i++ )
{
input_AddArea( p_input );
/* Titles id */
area[i]->i_id = i;
/* Number of chapters */
area[i]->i_part_nb = dvdplay_chapter_nr( p_dvd->vmg, i );
area[i]->i_plugin_data = 0;
}
#undef area
msg_Dbg( p_input, "number of titles: %d", i_title_nr );
i_title = i_title <= i_title_nr ? i_title : 0;
p_area = p_input->stream.pp_areas[i_title];
p_area->i_part = i_chapter;
p_input->stream.p_selected_area = NULL;
/* set title, chapter, audio and subpic */
if( dvdplay_SetArea( p_input, p_area ) )
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
return -1;
}
if( i_angle <= p_input->stream.i_pgrm_number )
{
dvdplay_SetProgram( p_input,
p_input->stream.pp_programs[i_angle - 1] );
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
p_input->psz_demux = "dvdplay";
return 0;
}
/*****************************************************************************
* dvdplay_Close: close libdvdplay
*****************************************************************************/
static void dvdplay_Close( input_thread_t *p_input )
{
dvd_data_t * p_dvd;
p_dvd = (dvd_data_t *)p_input->p_access_data;
/* close libdvdplay */
dvdplay_close( p_dvd->vmg );
free( p_dvd );
p_input->p_access_data = NULL;
}
/*****************************************************************************
* dvdplay_SetProgram: set dvd angle.
*****************************************************************************
* This is actually a hack to make angle change through vlc interface with
* no need for a specific button.
*****************************************************************************/
static int dvdplay_SetProgram( input_thread_t * p_input,
pgrm_descriptor_t * p_program )
{
if( p_input->stream.p_selected_program != p_program )
{
dvd_data_t * p_dvd;
int i_angle;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
i_angle = p_program->i_number;
if( !dvdplay_angle( p_dvd->vmg, i_angle ) )
{
memcpy( p_program, p_input->stream.p_selected_program,
sizeof(pgrm_descriptor_t) );
p_program->i_number = i_angle;
p_input->stream.p_selected_program = p_program;
msg_Dbg( p_input, "angle %d selected", i_angle );
}
}
return 0;
}
/*****************************************************************************
* dvdplay_SetArea: initialize input data for title x, chapter y.
* It should be called for each user navigation request.
*****************************************************************************
* Take care that i_title starts from 0 (vmg) and i_chapter start from 1.
* Note that you have to take the lock before entering here.
*****************************************************************************/
static int dvdplay_SetArea( input_thread_t * p_input, input_area_t * p_area )
{
dvd_data_t * p_dvd;
p_dvd = (dvd_data_t*)p_input->p_access_data;
/*
* Title selection
*/
if( p_area != p_input->stream.p_selected_area )
{
int i_chapter;
/* Store selected chapter */
i_chapter = p_area->i_part;
dvdNewArea( p_input, p_area );
dvdplay_start( p_dvd->vmg, p_area->i_id );
p_area->i_part = i_chapter;
} /* i_title >= 0 */
else
{
p_area = p_input->stream.p_selected_area;
}
/*
* Chapter selection
*/
if( p_area->i_part != dvdplay_chapter_cur( p_dvd->vmg ) )
{
if( ( p_area->i_part > 0 ) &&
( p_area->i_part <= p_area->i_part_nb ))
{
dvdplay_pg( p_dvd->vmg, p_area->i_part );
}
p_area->i_part = dvdplay_chapter_cur( p_dvd->vmg );
}
/* warn interface that something has changed */
p_area->i_tell =
LB2OFF( dvdplay_position( p_dvd->vmg ) ) - p_area->i_start;
p_input->stream.b_changed = 1;
return 0;
}
/*****************************************************************************
* dvdplay_Read: reads data packets.
*****************************************************************************
* Returns -1 in case of error, the number of bytes read if everything went
* well.
*****************************************************************************/
static int dvdplay_Read( input_thread_t * p_input,
byte_t * p_buffer, size_t i_count )
{
dvd_data_t * p_dvd;
off_t i_read;
p_dvd = (dvd_data_t *)p_input->p_access_data;
vlc_mutex_lock( &p_input->stream.stream_lock );
i_read = LB2OFF( dvdplay_read( p_dvd->vmg, p_buffer, OFF2LB( i_count ) ) );
p_input->stream.p_selected_area->i_tell =
LB2OFF( dvdplay_position( p_dvd->vmg ) ) -
p_input->stream.p_selected_area->i_start;
vlc_mutex_unlock( &p_input->stream.stream_lock );
return i_read;
}
/*****************************************************************************
* dvdplay_Seek : Goes to a given position on the stream.
*****************************************************************************
* 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.
*****************************************************************************/
static void dvdplay_Seek( input_thread_t * p_input, off_t i_off )
{
dvd_data_t * p_dvd;
p_dvd = (dvd_data_t *)p_input->p_access_data;
vlc_mutex_lock( &p_input->stream.stream_lock );
dvdplay_seek( p_dvd->vmg, OFF2LB( i_off ) );
vlc_mutex_unlock( &p_input->stream.stream_lock );
return;
}
/*****************************************************************************
* pf_vmg_callback: called by libdvdplay when some event happens
*****************************************************************************
* The stream lock has to be taken before entering here
*****************************************************************************/
static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
{
input_thread_t * p_input;
dvd_data_t * p_dvd;
int i;
p_input = (input_thread_t*)p_args;
p_dvd = (dvd_data_t*)p_input->p_access_data;
switch( event )
{
case NEW_DOMAIN:
break;
case NEW_VTS:
break;
case NEW_FILE:
break;
case NEW_PGC:
if( ( i = dvdplay_title_cur( p_dvd->vmg ) ) !=
p_input->stream.p_selected_area->i_id )
{
/* the title number has changed: update area */
msg_Warn( p_input, "new title %d (%d)", i,
p_input->stream.p_selected_area->i_id );
dvdNewArea( p_input,
p_input->stream.pp_areas[i] );
}
else
{
/* new pgc in same title: reinit ES */
dvdNewPGC( p_input );
p_input->stream.b_changed = 1;
}
break;
case NEW_PG:
/* update current chapter */
p_input->stream.p_selected_area->i_part =
dvdplay_chapter_cur( p_dvd->vmg );
break;
case NEW_CELL:
p_dvd->b_end_of_cell = 0;
break;
case END_OF_CELL:
p_dvd->b_end_of_cell = 1;
break;
case JUMP:
dvdplay_ES( p_input );
break;
case STILL_TIME:
/* we must pause only from demux
* when the data in cache has been decoded */
p_dvd->i_still_time = dvdplay_still_time( p_dvd->vmg );
msg_Dbg( p_input, "still time %d", p_dvd->i_still_time );
break;
case COMPLETE_VIDEO:
break;
case NEW_HIGHLIGHT:
break;
default:
msg_Err( p_input, "unknown event from libdvdplay (%d)",
event );
}
return;
}
static int dvdNewArea( input_thread_t * p_input, input_area_t * p_area )
{
dvd_data_t * p_dvd;
int i_angle_nb, i_angle;
int i;
p_dvd = (dvd_data_t*)p_input->p_access_data;
p_input->stream.p_selected_area = p_area;
/*
* One program for each angle
*/
while( p_input->stream.i_pgrm_number )
{
input_DelProgram( p_input, p_input->stream.pp_programs[0] );
}
input_AddProgram( p_input, 1, sizeof( stream_ps_data_t ) );
p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
dvdplay_angle_info( p_dvd->vmg, &i_angle_nb, &i_angle );
for( i = 1 ; i < i_angle_nb ; i++ )
{
input_AddProgram( p_input, i+1, 0 );
}
dvdplay_SetProgram( p_input,
p_input->stream.pp_programs[i_angle-1] );
dvdNewPGC( p_input );
/* No PSM to read in DVD mode, we already have all information */
p_input->stream.p_selected_program->b_is_ok = 1;
return 0;
}
static int dvdNewPGC( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
// int i_audio_nr = -1;
// int i_audio = -1;
// int i_subp_nr = -1;
// int i_subp = -1;
// int i_sec;
p_dvd = (dvd_data_t*)p_input->p_access_data;
// dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_audio );
// dvdplay_subp_info( p_dvd->vmg, &i_subp_nr, &i_subp );
dvdplay_ES( p_input );
p_input->stream.p_selected_area->i_start =
LB2OFF( dvdplay_title_first( p_dvd->vmg ) );
p_input->stream.p_selected_area->i_size =
LB2OFF( dvdplay_title_end ( p_dvd->vmg ) ) -
p_input->stream.p_selected_area->i_start;
if( p_input->stream.p_selected_area->i_size > 0 )
{
p_input->stream.b_seekable = 1;
}
else
{
p_input->stream.b_seekable = 0;
}
#if 0
i_sec = dvdplay_title_time( p_dvd->vmg );
msg_Dbg( p_input, "title time: %d:%02d:%02d (%d)",
i_sec/3600, (i_sec%3600)/60, i_sec%60, i_sec );
#endif
return 0;
}
/*****************************************************************************
* access.h: send info to access plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: access.h,v 1.1 2002/07/23 19:56:19 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.
*****************************************************************************/
union dvdplay_ctrl_u;
void dvdAccessSendControl( struct input_thread_t *, union dvdplay_ctrl_u * );
/*****************************************************************************
* demux.c: demux functions for dvdplay.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: demux.c,v 1.1 2002/07/23 19:56:19 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
#endif
#include "interface.h"
#include "dvd.h"
#include "intf.h"
#include "es.h"
/* how many packets dvdplay_Demux will read in each loop */
#define dvdplay_READ_ONCE 64
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/* called from outside */
static int dvdplay_Rewind ( struct input_thread_t * );
static int dvdplay_Demux ( struct input_thread_t * );
static int dvdplay_Init ( struct input_thread_t * );
static void dvdplay_End ( struct input_thread_t * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void _M( demux_getfunctions)( function_list_t * p_function_list )
{
#define demux p_function_list->functions.demux
demux.pf_init = dvdplay_Init;
demux.pf_end = dvdplay_End;
demux.pf_demux = dvdplay_Demux;
demux.pf_rewind = dvdplay_Rewind;
#undef demux
}
/*
* Data demux functions
*/
/*****************************************************************************
* dvdplay_Init: initializes dvdplay structures
*****************************************************************************/
static int dvdplay_Init( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
char * psz_intf = NULL;
if( p_input->stream.i_method != INPUT_METHOD_DVD )
{
return -1;
}
p_input->p_demux_data = (void*)p_input->p_access_data;
p_dvd = (dvd_data_t *)p_input->p_demux_data;
psz_intf = config_GetPsz( p_input, "intf" );
config_PutPsz( p_input, "intf", "dvdplay" );
p_dvd->p_intf = intf_Create( p_input );
p_dvd->p_intf->b_block = VLC_FALSE;
intf_RunThread( p_dvd->p_intf );
if( psz_intf != NULL )
{
config_PutPsz( p_input, "intf", psz_intf );
}
return 0;
}
/*****************************************************************************
* dvdplay_End: frees unused data
*****************************************************************************/
static void dvdplay_End( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
intf_thread_t * p_intf = NULL;
p_intf = vlc_object_find( p_input, VLC_OBJECT_INTF, FIND_CHILD );
if( p_intf != NULL )
{
intf_StopThread( p_intf );
vlc_object_detach_all( p_intf );
vlc_object_release( p_intf );
intf_Destroy( p_intf );
}
p_dvd = (dvd_data_t *)p_input->p_demux_data;
p_dvd->p_intf = NULL;
}
/*****************************************************************************
* dvdplay_Demux
*****************************************************************************/
static int dvdplay_Demux( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
data_packet_t * p_data;
ssize_t i_result;
ptrdiff_t i_remains;
int i_data_nb = 0;
p_dvd = (dvd_data_t *)p_input->p_demux_data;
/* Read headers to compute payload length */
do
{
if( ( i_result = input_ReadPS( p_input, &p_data ) ) <= 0)
{
return i_result;
}
i_remains = p_input->p_last_data - p_input->p_current_data;
input_DemuxPS( p_input, p_data );
++i_data_nb;
}
while( i_remains );
// if( p_dvd->b_still && p_dvd->b_end_of_cell && p_dvd->p_intf != NULL )
if( p_dvd->i_still_time && p_dvd->b_end_of_cell && p_dvd->p_intf != NULL )
{
pgrm_descriptor_t * p_pgrm;
/* when we receive still_time flag, we have to pause immediately */
input_SetStatus( p_input, INPUT_STATUS_PAUSE );
dvdIntfStillTime( p_dvd->p_intf, p_dvd->i_still_time );
p_dvd->i_still_time = 0;
vlc_mutex_lock( &p_input->stream.stream_lock );
p_pgrm = p_input->stream.p_selected_program;
p_pgrm->i_synchro_state = SYNCHRO_REINIT;
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_ClockManageControl( p_input, p_pgrm, 0 );
}
return i_data_nb;
}
/*****************************************************************************
* dvdplay_Rewind : reads a stream backward
*****************************************************************************/
static int dvdplay_Rewind( input_thread_t * p_input )
{
return( -1 );
}
/*****************************************************************************
* es.h: functions to handle elementary streams.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: demux.h,v 1.1 2002/07/23 19:56:19 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.
*****************************************************************************/
void dvdplay_DeleteES( struct input_thread_s * );
void dvdplay_Video( struct input_thread_s * );
void dvdplay_Audio( struct input_thread_s * );
void dvdplay_Subp( struct input_thread_s * );
void dvdplay_ES( struct input_thread_s * );
void dvdplay_LaunchDecoders( struct input_thread_s * );
/*****************************************************************************
* dvd.c : dvdplay module for vlc
*****************************************************************************
* This plugins should handle all the known specificities of the DVD format,
* especially the 2048 bytes logical block size.
* It depends on: libdvdplay for ifo files and block reading.
*****************************************************************************
*
* Copyright (C) 2001 VideoLAN
* $Id: dvd.c,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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 <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#include <vlc/vlc.h>
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
void _M( access_getfunctions)( function_list_t * p_function_list );
void _M( demux_getfunctions)( function_list_t * p_function_list );
void _M( intf_getfunctions)( function_list_t * p_function_list );
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_CATEGORY_HINT( "[dvdplay:][device][@[title][,[chapter][,angle]]]", NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "dvdplay input module" )
ADD_CAPABILITY( INTF, 0 )
ADD_CAPABILITY( DEMUX, 0 )
ADD_CAPABILITY( ACCESS, 120 )
ADD_SHORTCUT( "dvd" )
MODULE_INIT_STOP
MODULE_ACTIVATE_START
_M( access_getfunctions)( &p_module->p_functions->access );
_M( demux_getfunctions)( &p_module->p_functions->demux );
_M( intf_getfunctions)( &p_module->p_functions->intf );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/*****************************************************************************
* dvd.h: structure of the dvdplay plugin
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd.h,v 1.1 2002/07/23 19:56:19 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 <dvdread/dvd_reader.h>
#include <dvdread/ifo_types.h>
#include <dvdread/ifo_read.h>
#include <dvdread/nav_read.h>
#include <dvdread/nav_print.h>
#include <dvdplay/dvdplay.h>
#include <dvdplay/info.h>
#include <dvdplay/nav.h>
#include <dvdplay/state.h>
#define LB2OFF(x) ((off_t)(x) * (off_t)(DVD_VIDEO_LB_LEN))
#define OFF2LB(x) ((x) / DVD_VIDEO_LB_LEN)
/*****************************************************************************
* dvd_data_t: structure for communication between dvdplay access, demux
* and intf.
*****************************************************************************/
typedef struct
{
dvdplay_ptr vmg;
intf_thread_t * p_intf;
int i_audio_nb;
int i_spu_nb;
int i_still_time;
vlc_bool_t b_end_of_cell;
dvdplay_event_t event;
dvdplay_ctrl_t control;
} dvd_data_t;
/*****************************************************************************
* es.c: functions to handle elementary streams.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: es.c,v 1.1 2002/07/23 19:56:19 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 <stdio.h>
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
#endif
#include "dvd.h"
#include "iso_lang.h"
void dvdplay_LaunchDecoders( input_thread_t * p_input );
/*****************************************************************************
* dvdplay_DeleteES:
*****************************************************************************/
void dvdplay_DeleteES( input_thread_t* p_input )
{
free( p_input->stream.pp_selected_es );
p_input->stream.pp_selected_es = NULL;
p_input->stream.i_selected_es_number = 0;
while( p_input->stream.i_es_number )
{
input_DelES( p_input, p_input->stream.pp_es[0] );
}
free( p_input->stream.pp_es );
p_input->stream.pp_es = NULL;
p_input->stream.i_es_number = 0;
}
#define ADDES( id, fourcc, cat, lang, size ) \
msg_Dbg( p_input, "new es 0x%x", i_id ); \
p_es = input_AddES( p_input, NULL, id, size ); \
p_es->i_stream_id = i_id & 0xff; \
p_es->i_fourcc = (fourcc); \
p_es->i_cat = (cat); \
if( lang ) \
{ \
strcpy( p_es->psz_desc, DecodeLanguage( lang ) ); \
}
/*****************************************************************************
* dvdplay_Video: read video ES
*****************************************************************************/
void dvdplay_Video( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
es_descriptor_t * p_es;
video_attr_t * p_attr;
int i_id;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
p_attr = dvdplay_video_attr( p_dvd->vmg );
/* ES 0 -> video MPEG2 */
i_id = 0xe0;
if( p_attr->display_aspect_ratio )
{
ADDES( 0xe0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, sizeof(int) );
*(int*)(p_es->p_demux_data) = p_attr->display_aspect_ratio;
}
else
{
ADDES( 0xe0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, 0 );
}
}
/*****************************************************************************
* dvdplay_Audio: read audio ES
*****************************************************************************/
void dvdplay_Audio( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
es_descriptor_t * p_es;
audio_attr_t * p_attr;
int i_audio_nr = -1;
int i_audio = -1;
int i_channels;
int i_lang;
int i_id;
int i;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
p_dvd->i_audio_nb = 0;
dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_audio );
/* Audio ES, in the order they appear in .ifo */
for( i = 1 ; i <= i_audio_nr ; i++ )
{
if( ( i_id = dvdplay_audio_id( p_dvd->vmg, i-1 ) ) > 0 )
{
p_attr = dvdplay_audio_attr( p_dvd->vmg, i-1 );
i_channels = p_attr->channels;
i_lang = p_attr->lang_code;
++p_dvd->i_audio_nb;
switch( p_attr->audio_format )
{
case 0x00: /* AC3 */
ADDES( i_id, VLC_FOURCC('a','5','2',' '), AUDIO_ES, i_lang, 0 );
strcat( p_es->psz_desc, " (ac3)" );
break;
case 0x02:
case 0x03: /* MPEG audio */
ADDES( i_id, VLC_FOURCC('m','p','g','a'), AUDIO_ES, i_lang, 0 );
strcat( p_es->psz_desc, " (mpeg)" );
break;
case 0x04: /* LPCM */
ADDES( i_id, VLC_FOURCC('l','p','c','m'), AUDIO_ES, i_lang, 0 );
strcat( p_es->psz_desc, " (lpcm)" );
break;
case 0x05: /* SDDS */
msg_Warn( p_input, "SDDS audio not handled" );
break;
case 0x06: /* DTS */
msg_Warn( p_input, "DTS audio not handled yet"
"(0x%x)", i_id );
break;
default:
i_id = 0;
msg_Warn( p_input, "unknown audio type %.2x",
p_attr->audio_format );
}
}
}
}
/*****************************************************************************
* dvdplay_Subp: read subpictures ES
*****************************************************************************/
void dvdplay_Subp( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
es_descriptor_t * p_es;
subp_attr_t * p_attr;
u32 * pi_palette;
int i_subp_nr = -1;
int i_subp = -1;
int i_id;
int i;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
p_dvd->i_spu_nb = 0;
dvdplay_subp_info( p_dvd->vmg, &i_subp_nr, &i_subp );
pi_palette = dvdplay_subp_palette( p_dvd->vmg );
for( i = 1 ; i <= i_subp_nr; i++ )
{
if( ( i_id = dvdplay_subp_id( p_dvd->vmg, i-1 ) ) >= 0 )
{
p_attr = dvdplay_subp_attr( p_dvd->vmg, i-1 );
++p_dvd->i_spu_nb;
if( pi_palette )
{
ADDES( i_id, VLC_FOURCC('s','p','u',' '), SPU_ES,
p_attr->lang_code, 16*sizeof(u32) );
*(int*)p_es->p_demux_data = 0xBeeF;
memcpy( (void*)p_es->p_demux_data + sizeof(int),
pi_palette, 16*sizeof(u32) );
}
else
{
ADDES( i_id, VLC_FOURCC('s','p','u',' '), SPU_ES,
p_attr->lang_code, 0 );
}
}
}
}
/*****************************************************************************
* dvdplay_LaunchDecoders
*****************************************************************************/
void dvdplay_LaunchDecoders( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
int i_audio_nr = -1;
int i_audio = -1;
int i_subp_nr = -1;
int i_subp = -1;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_audio );
dvdplay_subp_info( p_dvd->vmg, &i_subp_nr, &i_subp );
if( config_GetInt( p_input, "video" ) )
{
input_SelectES( p_input, p_input->stream.pp_es[0] );
}
// if( !i_audio ) i_audio = 1;
if( i_audio > p_dvd->i_audio_nb ) i_audio = 1;
if( config_GetInt( p_input, "audio" )
&&( i_audio > 0 ) && ( p_dvd->i_audio_nb > 0 ) )
{
if( config_GetInt( p_input, "audio-type" ) == REQUESTED_AC3 )
{
int i_ac3 = i_audio;
while( ( i_ac3 < p_dvd->i_audio_nb ) &&
( p_input->stream.pp_es[i_ac3]->i_fourcc !=
VLC_FOURCC('a','5','2',' ') ) )
{
i_ac3++;
}
if( p_input->stream.pp_es[i_ac3]->i_fourcc ==
VLC_FOURCC('a','5','2',' ') )
{
input_SelectES( p_input,
p_input->stream.pp_es[i_ac3] );
/* warn libdvdplay that we have chosen another stream */
dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_ac3 );
}
else
{
// input_SelectES( p_input,
// p_input->stream.pp_es[i_audio] );
}
}
else
{
input_SelectES( p_input,
p_input->stream.pp_es[i_audio] );
}
}
if( config_GetInt( p_input, "video" )
&& ( i_subp > 0 ) && ( p_dvd->i_spu_nb > 0 ) )
{
i_subp += p_dvd->i_audio_nb;
input_SelectES( p_input, p_input->stream.pp_es[i_subp] );
}
}
/*****************************************************************************
* dvdplay_ES:
*****************************************************************************/
void dvdplay_ES( input_thread_t * p_input )
{
dvdplay_DeleteES ( p_input );
dvdplay_Video ( p_input );
dvdplay_Audio ( p_input );
dvdplay_Subp ( p_input );
dvdplay_LaunchDecoders( p_input );
}
/*****************************************************************************
* es.h: functions to handle elementary streams.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: es.h,v 1.1 2002/07/23 19:56:19 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.
*****************************************************************************/
void dvdplay_DeleteES( struct input_thread_t * );
void dvdplay_Video( struct input_thread_t * );
void dvdplay_Audio( struct input_thread_t * );
void dvdplay_Subp( struct input_thread_t * );
void dvdplay_ES( struct input_thread_t * );
void dvdplay_LaunchDecoders( struct input_thread_t * );
/*****************************************************************************
* intf.c: interface for DVD video manager
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.c,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Authors: 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 <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <unistd.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "stream_control.h"
#include "input_ext-intf.h"
#include "video.h"
#include "video_output.h"
#include "dvd.h"
/*****************************************************************************
* intf_sys_t: description and status of interface
*****************************************************************************/
struct intf_sys_t
{
input_thread_t * p_input;
dvd_data_t * p_dvd;
vlc_bool_t b_still;
vlc_bool_t b_inf_still;
mtime_t m_still_time;
};
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int InitThread ( intf_thread_t *p_intf );
/* Exported functions */
static int intf_Open ( intf_thread_t *p_intf );
static void intf_Close ( intf_thread_t *p_intf );
static void intf_Run ( intf_thread_t *p_intf );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void _M( intf_getfunctions )( function_list_t * p_function_list )
{
p_function_list->functions.intf.pf_open = intf_Open;
p_function_list->functions.intf.pf_close = intf_Close;
p_function_list->functions.intf.pf_run = intf_Run;
}
/*****************************************************************************
* intf_Open: initialize dummy interface
*****************************************************************************/
static int intf_Open( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
return( 1 );
};
p_intf->p_sys->m_still_time = 0;
p_intf->p_sys->b_inf_still = 0;
p_intf->p_sys->b_still = 0;
return( 0 );
}
/*****************************************************************************
* intf_Close: destroy dummy interface
*****************************************************************************/
static void intf_Close( intf_thread_t *p_intf )
{
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_Run: main loop
*****************************************************************************/
static void intf_Run( intf_thread_t *p_intf )
{
vout_thread_t * p_vout;
dvdplay_ctrl_t control;
mtime_t mtime = 0;
mtime_t mlast = 0;
if( InitThread( p_intf ) < 0 )
{
msg_Err( p_intf, "can't initialize intf" );
return;
}
msg_Dbg( p_intf, "intf initialized" );
p_vout = NULL;
control.mouse.i_x = 0;
control.mouse.i_y = 0;
/* Main loop */
while( !p_intf->b_die )
{
vlc_mutex_lock( &p_intf->change_lock );
/*
* still images
*/
#if 1
if( p_intf->p_sys->b_still && !p_intf->p_sys->b_inf_still )
{
if( p_intf->p_sys->m_still_time > 0 )
{
/* update remaining still time */
mtime = mdate();
if( mlast )
{
p_intf->p_sys->m_still_time -= mtime - mlast;
}
mlast = mtime;
}
else
{
/* still time elasped */
input_SetStatus( p_intf->p_sys->p_input,
INPUT_STATUS_PLAY );
p_intf->p_sys->m_still_time = 0;
p_intf->p_sys->b_still = 0;
mlast = 0;
}
}
#else
if( p_intf->p_sys->m_still_time != (mtime_t)(-1) )
{
if( p_intf->p_sys->m_still_time )
{
mtime = mdate();
if( mlast )
{
p_intf->p_sys->m_still_time -= mtime - mlast;
}
if( !p_intf->p_sys->m_still_time )
{
input_SetStatus( p_intf->p_sys->p_input,
INPUT_STATUS_PLAY );
}
mlast = mtime;
}
}
#endif
/*
* mouse cursor
*/
p_vout = vlc_object_find( p_intf->p_sys->p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout != NULL )
{
vlc_mutex_lock( &p_vout->change_lock );
if( control.mouse.i_x != p_vout->i_mouse_x ||
control.mouse.i_y != p_vout->i_mouse_y ||
p_vout->i_mouse_button )
{
int i_activate = 0;
control.mouse.i_x = p_vout->i_mouse_x;
control.mouse.i_y = p_vout->i_mouse_y;
if( p_vout->i_mouse_button )
{
control.type = DVDCtrlMouseActivate;
msg_Dbg( p_intf, "Activate coordinates: %dx%d",
p_vout->i_mouse_x, p_vout->i_mouse_y );
}
else
{
control.type = DVDCtrlMouseSelect;
msg_Dbg( p_intf, "Select coordinates: %dx%d",
p_vout->i_mouse_x, p_vout->i_mouse_y );
}
p_vout->i_mouse_button = 0;
vlc_mutex_unlock( &p_vout->change_lock );
msg_Dbg( p_intf, "send button" );
/* we can safely interact with libdvdplay
* with the stream lock */
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
i_activate =
dvdplay_button( p_intf->p_sys->p_dvd->vmg, &control );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
if( i_activate && p_intf->p_sys->b_still )
{
input_SetStatus( p_intf->p_sys->p_input,
INPUT_STATUS_PLAY );
p_intf->p_sys->b_still = 0;
p_intf->p_sys->b_inf_still = 0;
p_intf->p_sys->m_still_time = 0;
}
}
else
{
vlc_mutex_unlock( &p_vout->change_lock );
}
vlc_object_release( p_vout );
}
vlc_mutex_unlock( &p_intf->change_lock );
/* Wait a bit */
msleep( INTF_IDLE_SLEEP );
}
vlc_object_release( p_intf->p_sys->p_input );
}
/*****************************************************************************
* InitThread:
*****************************************************************************/
static int InitThread( intf_thread_t * p_intf )
{
/* we might need some locking here */
if( !p_intf->b_die )
{
input_thread_t * p_input;
dvd_data_t * p_dvd;
p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT );
p_dvd = (dvd_data_t*)p_input->p_access_data;
p_dvd->p_intf = p_intf;
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_sys->p_input = p_input;
p_intf->p_sys->p_dvd = p_dvd;
vlc_mutex_unlock( &p_intf->change_lock );
return 0;
}
else
{
return -1;
}
}
/*****************************************************************************
* dvdIntfStillTime: function provided to demux plugin to request
* still images
*****************************************************************************/
int dvdIntfStillTime( intf_thread_t *p_intf, int i_sec )
{
vlc_mutex_lock( &p_intf->change_lock );
#if 1
if( i_sec == 0xff )
{
p_intf->p_sys->b_still = 1;
p_intf->p_sys->b_inf_still = 1;
}
else if( i_sec > 0 )
{
p_intf->p_sys->b_still = 1;
p_intf->p_sys->m_still_time = 1000000 * i_sec;
}
#else
if( i_sec > 0 )
{
if( i_sec == 0xff )
{
p_intf->p_sys->m_still_time = (mtime_t)(-1);
msg_Warn( p_intf, "%lld", p_intf->p_sys->m_still_time );
}
else
{
p_intf->p_sys->m_still_time = 1000000 * i_sec;
}
}
#endif
vlc_mutex_unlock( &p_intf->change_lock );
return 0;
}
/*****************************************************************************
* intf.h: send info to intf.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf.h,v 1.1 2002/07/23 19:56:19 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.
*****************************************************************************/
int dvdIntfStillTime( struct intf_thread_t *, int );
/*****************************************************************************
* tools.c: tools for dvd plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: tools.c,v 1.1 2002/07/23 19:56:19 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 <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <vlc/vlc.h>
#include "stream_control.h"
#include "input_ext-intf.h"
#include "input_ext-dec.h"
#include "input_ext-plugins.h"
#include "dvd.h"
/*****************************************************************************
* dvdplay_ParseCL: parse command line
*****************************************************************************/
char * dvdplay_ParseCL( input_thread_t * p_input,
int * i_title, int * i_chapter, int * i_angle )
{
dvd_data_t * p_dvd;
struct stat stat_info;
char * psz_parser;
char * psz_source;
char * psz_next;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
psz_parser = psz_source = strdup( p_input->psz_name );
if( !psz_parser )
{
return NULL;
}
while( *psz_parser && *psz_parser != '@' )
{
psz_parser++;
}
*i_title = 0;
*i_chapter = 1;
*i_angle = 1;
if( *psz_parser == '@' )
{
/* Found options */
*psz_parser = '\0';
++psz_parser;
*i_title = (int)strtol( psz_parser, &psz_next, 10 );
if( *psz_next )
{
psz_parser = psz_next + 1;
*i_chapter = (int)strtol( psz_parser, &psz_next, 10 );
if( *psz_next )
{
*i_angle = (int)strtol( psz_next + 1, NULL, 10 );
}
}
}
*i_title = *i_title >= 0 ? *i_title : 0;
*i_chapter = *i_chapter ? *i_chapter : 1;
*i_angle = *i_angle ? *i_angle : 1;
if( !*psz_source )
{
free( psz_source );
if( !p_input->psz_access )
{
return NULL;
}
psz_source = config_GetPsz( p_input, "dvd" );
}
if( stat( psz_source, &stat_info ) == -1 )
{
msg_Err( p_input, "cannot stat() source `%s' (%s)",
psz_source, strerror(errno));
return NULL;
}
if( !S_ISBLK(stat_info.st_mode) &&
!S_ISCHR(stat_info.st_mode) &&
!S_ISDIR(stat_info.st_mode) )
{
msg_Dbg( p_input, "plugin discarded"
" (not a valid source)" );
return NULL;
}
msg_Dbg( p_input, "dvdroot=%s title=%d chapter=%d angle=%d",
psz_source, *i_title, *i_chapter, *i_angle );
return psz_source;
}
/*****************************************************************************
* tools.h: tools for dvdplay plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: tools.h,v 1.1 2002/07/23 19:56:19 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.
*****************************************************************************/
char * dvdplay_ParseCL( struct input_thread_t *, int*, int*, int* );
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