Commit 24961b35 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Bluray: cosmetics

parent 6afa23b2
/***************************************************************************** /*****************************************************************************
* bluray.c: Blu-ray disc support plugin * bluray.c: Blu-ray disc support plugin
***************************************************************************** *****************************************************************************
* Copyright © 2010-2011 VideoLAN, VLC authors and libbluray AUTHORS * Copyright © 2010-2012 VideoLAN, VLC authors and libbluray AUTHORS
* *
* Authors: Jean-Baptiste Kempf <jb@videolan.org> * Authors: Jean-Baptiste Kempf <jb@videolan.org>
* Hugo Beauzée-Luyssen <hugo@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by * under the terms of the GNU Lesser General Public License as published by
...@@ -124,16 +125,16 @@ struct subpicture_updater_sys_t ...@@ -124,16 +125,16 @@ struct subpicture_updater_sys_t
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int blurayControl(demux_t *, int, va_list); static int blurayControl(demux_t *, int, va_list);
static int blurayDemux(demux_t *); static int blurayDemux(demux_t *);
static int blurayInitTitles(demux_t *p_demux ); static int blurayInitTitles(demux_t *p_demux );
static int bluraySetTitle(demux_t *p_demux, int i_title); static int bluraySetTitle(demux_t *p_demux, int i_title);
static void blurayOverlayProc(void *ptr, const BD_OVERLAY * const overlay); static void blurayOverlayProc(void *ptr, const BD_OVERLAY * const overlay);
static int onMouseEvent( vlc_object_t *p_vout, const char *psz_var, static int onMouseEvent(vlc_object_t *p_vout, const char *psz_var,
vlc_value_t old, vlc_value_t val, void *p_data ); vlc_value_t old, vlc_value_t val, void *p_data);
#define FROM_TICKS(a) (a*CLOCK_FREQ / INT64_C(90000)) #define FROM_TICKS(a) (a*CLOCK_FREQ / INT64_C(90000))
#define TO_TICKS(a) (a*INT64_C(90000)/CLOCK_FREQ) #define TO_TICKS(a) (a*INT64_C(90000)/CLOCK_FREQ)
...@@ -260,9 +261,8 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -260,9 +261,8 @@ static int blurayOpen( vlc_object_t *object )
*/ */
bd_get_event(p_sys->bluray, NULL); bd_get_event(p_sys->bluray, NULL);
p_sys->b_menu = var_InheritBool( p_demux, "bluray-menu" ); p_sys->b_menu = var_InheritBool(p_demux, "bluray-menu");
if ( p_sys->b_menu ) if (p_sys->b_menu) {
{
p_sys->p_input = demux_GetParentInput(p_demux); p_sys->p_input = demux_GetParentInput(p_demux);
if (unlikely(!p_sys->p_input)) if (unlikely(!p_sys->p_input))
goto error; goto error;
...@@ -272,9 +272,7 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -272,9 +272,7 @@ static int blurayOpen( vlc_object_t *object )
/* Registering overlay event handler */ /* Registering overlay event handler */
bd_register_overlay_proc(p_sys->bluray, p_demux, blurayOverlayProc); bd_register_overlay_proc(p_sys->bluray, p_demux, blurayOverlayProc);
} } else {
else
{
/* get title request */ /* get title request */
if ((pos_title = strrchr(bd_path, ':'))) { if ((pos_title = strrchr(bd_path, ':'))) {
/* found character ':' for title information */ /* found character ':' for title information */
...@@ -289,7 +287,7 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -289,7 +287,7 @@ static int blurayOpen( vlc_object_t *object )
} }
} }
p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out); p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out);
if (!p_sys->p_parser) { if (!p_sys->p_parser) {
msg_Err(p_demux, "Failed to create TS demuxer"); msg_Err(p_demux, "Failed to create TS demuxer");
goto error; goto error;
...@@ -420,7 +418,7 @@ static void subpictureUpdaterUpdate(subpicture_t *p_subpic, ...@@ -420,7 +418,7 @@ static void subpictureUpdaterUpdate(subpicture_t *p_subpic,
while (p_src != NULL) { while (p_src != NULL) {
*p_dst = subpicture_region_Clone(p_src); *p_dst = subpicture_region_Clone(p_src);
if (*p_dst == NULL) if (*p_dst == NULL)
break ; break;
p_dst = &((*p_dst)->p_next); p_dst = &((*p_dst)->p_next);
p_src = p_src->p_next; p_src = p_src->p_next;
} }
...@@ -516,7 +514,7 @@ static void blurayActivateOverlay(demux_t *p_demux, const BD_OVERLAY* const ov) ...@@ -516,7 +514,7 @@ static void blurayActivateOverlay(demux_t *p_demux, const BD_OVERLAY* const ov)
&& p_sys->p_vout) { && p_sys->p_vout) {
p_sys->p_overlays[ov->plane]->status = Outdated; p_sys->p_overlays[ov->plane]->status = Outdated;
vlc_mutex_unlock(&p_sys->p_overlays[ov->plane]->lock); vlc_mutex_unlock(&p_sys->p_overlays[ov->plane]->lock);
return ; return;
} }
/* /*
* Mark the overlay as available, but don't display it right now. * Mark the overlay as available, but don't display it right now.
...@@ -695,7 +693,7 @@ static void bluraySendOverlayToVout(demux_t *p_demux) ...@@ -695,7 +693,7 @@ static void bluraySendOverlayToVout(demux_t *p_demux)
vout_RegisterSubpictureChannel(p_sys->p_vout); vout_RegisterSubpictureChannel(p_sys->p_vout);
/* /*
* After this point, the picture should not be accessed from the demux thread, * After this point, the picture should not be accessed from the demux thread,
* as it's hold by the vout thread. * as it is held by the vout thread.
* This must be done only once per subpicture, ie. only once between each * This must be done only once per subpicture, ie. only once between each
* blurayInitOverlay & blurayCloseOverlay call. * blurayInitOverlay & blurayCloseOverlay call.
*/ */
...@@ -771,6 +769,7 @@ static void blurayResetParser( demux_t *p_demux ) ...@@ -771,6 +769,7 @@ static void blurayResetParser( demux_t *p_demux )
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
if (!p_sys->p_parser) if (!p_sys->p_parser)
return; return;
stream_Delete(p_sys->p_parser); stream_Delete(p_sys->p_parser);
p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out); p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out);
if (!p_sys->p_parser) { if (!p_sys->p_parser) {
...@@ -1001,26 +1000,24 @@ static int blurayDemux(demux_t *p_demux) ...@@ -1001,26 +1000,24 @@ static int blurayDemux(demux_t *p_demux)
if (p_sys->b_menu == false) { if (p_sys->b_menu == false) {
blurayHandleEvents(p_demux); blurayHandleEvents(p_demux);
nread = bd_read(p_sys->bluray, p_block->p_buffer, nread = bd_read(p_sys->bluray, p_block->p_buffer,
NB_TS_PACKETS * BD_TS_PACKET_SIZE); NB_TS_PACKETS * BD_TS_PACKET_SIZE);
if (nread < 0) { if (nread < 0) {
block_Release(p_block); block_Release(p_block);
return nread; return nread;
} }
} } else {
else {
BD_EVENT e; BD_EVENT e;
nread = bd_read_ext( p_sys->bluray, p_block->p_buffer, nread = bd_read_ext(p_sys->bluray, p_block->p_buffer,
NB_TS_PACKETS * BD_TS_PACKET_SIZE, &e ); NB_TS_PACKETS * BD_TS_PACKET_SIZE, &e);
if ( nread == 0 ) { if (nread == 0) {
if ( e.event == BD_EVENT_NONE ) if (e.event == BD_EVENT_NONE)
msg_Info( p_demux, "We reached the end of a title" ); msg_Info(p_demux, "We reached the end of a title");
else else
blurayHandleEvent( p_demux, &e ); blurayHandleEvent(p_demux, &e);
block_Release(p_block); block_Release(p_block);
return 1; return 1;
} }
if (p_sys->current_overlay != -1) if (p_sys->current_overlay != -1) {
{
vlc_mutex_lock(&p_sys->p_overlays[p_sys->current_overlay]->lock); vlc_mutex_lock(&p_sys->p_overlays[p_sys->current_overlay]->lock);
if (p_sys->p_overlays[p_sys->current_overlay]->status == ToDisplay) { if (p_sys->p_overlays[p_sys->current_overlay]->status == ToDisplay) {
vlc_mutex_unlock(&p_sys->p_overlays[p_sys->current_overlay]->lock); vlc_mutex_unlock(&p_sys->p_overlays[p_sys->current_overlay]->lock);
...@@ -1038,7 +1035,7 @@ static int blurayDemux(demux_t *p_demux) ...@@ -1038,7 +1035,7 @@ static int blurayDemux(demux_t *p_demux)
p_block->i_buffer = nread; p_block->i_buffer = nread;
stream_DemuxSend( p_sys->p_parser, p_block ); stream_DemuxSend(p_sys->p_parser, p_block);
return 1; return 1;
} }
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