Commit 244e24ee authored by Petri Hintukainen's avatar Petri Hintukainen

Move UO mask parsing to uo_mask.c

parent 184278ac
......@@ -74,6 +74,8 @@ libbluray_la_SOURCES = \
src/libbluray/bdnav/navigation.c \
src/libbluray/bdnav/sound_parse.h \
src/libbluray/bdnav/sound_parse.c \
src/libbluray/bdnav/uo_mask.h \
src/libbluray/bdnav/uo_mask.c \
src/libbluray/bdnav/uo_mask_table.h \
src/libbluray/decoders/graphics_controller.h \
src/libbluray/decoders/graphics_controller.c \
......
......@@ -25,6 +25,7 @@
#include "mpls_parse.h"
#include "extdata_parse.h"
#include "uo_mask.h"
#include "disc/disc.h"
......@@ -54,58 +55,12 @@ _human_readable_sig(char *sig, uint32_t s1, uint32_t s2)
sig[8] = 0;
}
int
mpls_parse_uo(uint8_t *buf, BD_UO_MASK *uo)
{
BITBUFFER bb;
bb_init(&bb, buf, 8);
memset(uo, 0, sizeof(BD_UO_MASK));
uo->menu_call = bb_read(&bb, 1);
uo->title_search = bb_read(&bb, 1);
uo->chapter_search = bb_read(&bb, 1);
uo->time_search = bb_read(&bb, 1);
uo->skip_to_next_point = bb_read(&bb, 1);
uo->skip_to_prev_point = bb_read(&bb, 1);
uo->play_firstplay = bb_read(&bb, 1);
uo->stop = bb_read(&bb, 1);
uo->pause_on = bb_read(&bb, 1);
uo->pause_off = bb_read(&bb, 1);
uo->still_off = bb_read(&bb, 1);
uo->forward = bb_read(&bb, 1);
uo->backward = bb_read(&bb, 1);
uo->resume = bb_read(&bb, 1);
uo->move_up = bb_read(&bb, 1);
uo->move_down = bb_read(&bb, 1);
uo->move_left = bb_read(&bb, 1);
uo->move_right = bb_read(&bb, 1);
uo->select = bb_read(&bb, 1);
uo->activate = bb_read(&bb, 1);
uo->select_and_activate = bb_read(&bb, 1);
uo->primary_audio_change = bb_read(&bb, 1);
bb_skip(&bb, 1);
uo->angle_change = bb_read(&bb, 1);
uo->popup_on = bb_read(&bb, 1);
uo->popup_off = bb_read(&bb, 1);
uo->pg_enable_disable = bb_read(&bb, 1);
uo->pg_change = bb_read(&bb, 1);
uo->secondary_video_enable_disable = bb_read(&bb, 1);
uo->secondary_video_change = bb_read(&bb, 1);
uo->secondary_audio_enable_disable = bb_read(&bb, 1);
uo->secondary_audio_change = bb_read(&bb, 1);
bb_skip(&bb, 1);
uo->pip_pg_change = bb_read(&bb, 1);
bb_skip(&bb, 30);
return 1;
}
static int
_parse_uo(BITSTREAM *bits, BD_UO_MASK *uo)
{
uint8_t buf[8];
bs_read_bytes(bits, buf, 8);
return mpls_parse_uo(buf, uo);
return uo_mask_parse(buf, uo);
}
static int
......
......@@ -34,6 +34,4 @@ BD_PRIVATE MPLS_PL* mpls_parse(const char *path) BD_ATTR_MALLOC;
BD_PRIVATE MPLS_PL* mpls_get(struct bd_disc *disc, const char *file);
BD_PRIVATE void mpls_free(MPLS_PL **pl);
BD_PRIVATE int mpls_parse_uo(uint8_t *buf, BD_UO_MASK *uo);
#endif // _MPLS_PARSE_H_
/*
* This file is part of libbluray
* Copyright (C) 2009-2010 John Stebbins
* Copyright (C) 2012 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "uo_mask.h"
#include "uo_mask_table.h"
#include "util/bits.h"
#include <string.h>
int
uo_mask_parse(const uint8_t *buf, BD_UO_MASK *uo)
{
BITBUFFER bb;
bb_init(&bb, buf, 8);
memset(uo, 0, sizeof(BD_UO_MASK));
uo->menu_call = bb_read(&bb, 1);
uo->title_search = bb_read(&bb, 1);
uo->chapter_search = bb_read(&bb, 1);
uo->time_search = bb_read(&bb, 1);
uo->skip_to_next_point = bb_read(&bb, 1);
uo->skip_to_prev_point = bb_read(&bb, 1);
uo->play_firstplay = bb_read(&bb, 1);
uo->stop = bb_read(&bb, 1);
uo->pause_on = bb_read(&bb, 1);
uo->pause_off = bb_read(&bb, 1);
uo->still_off = bb_read(&bb, 1);
uo->forward = bb_read(&bb, 1);
uo->backward = bb_read(&bb, 1);
uo->resume = bb_read(&bb, 1);
uo->move_up = bb_read(&bb, 1);
uo->move_down = bb_read(&bb, 1);
uo->move_left = bb_read(&bb, 1);
uo->move_right = bb_read(&bb, 1);
uo->select = bb_read(&bb, 1);
uo->activate = bb_read(&bb, 1);
uo->select_and_activate = bb_read(&bb, 1);
uo->primary_audio_change = bb_read(&bb, 1);
bb_skip(&bb, 1);
uo->angle_change = bb_read(&bb, 1);
uo->popup_on = bb_read(&bb, 1);
uo->popup_off = bb_read(&bb, 1);
uo->pg_enable_disable = bb_read(&bb, 1);
uo->pg_change = bb_read(&bb, 1);
uo->secondary_video_enable_disable = bb_read(&bb, 1);
uo->secondary_video_change = bb_read(&bb, 1);
uo->secondary_audio_enable_disable = bb_read(&bb, 1);
uo->secondary_audio_change = bb_read(&bb, 1);
bb_skip(&bb, 1);
uo->pip_pg_change = bb_read(&bb, 1);
bb_skip(&bb, 30);
return 1;
}
......@@ -22,9 +22,11 @@
#include "uo_mask_table.h"
#include "util/attributes.h"
#include <stdint.h>
static inline BD_UO_MASK bd_uo_mask_combine(BD_UO_MASK a, BD_UO_MASK b)
static inline BD_UO_MASK uo_mask_combine(BD_UO_MASK a, BD_UO_MASK b)
{
union {
uint64_t u64;
......@@ -40,7 +42,7 @@ static inline BD_UO_MASK bd_uo_mask_combine(BD_UO_MASK a, BD_UO_MASK b)
#define EMPTY_UO_MASK {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0}
static inline BD_UO_MASK bd_empty_uo_mask(void)
static inline BD_UO_MASK uo_mask_get_empty(void)
{
static const union {
const uint64_t u64;
......@@ -50,4 +52,6 @@ static inline BD_UO_MASK bd_empty_uo_mask(void)
return empty.mask;
}
BD_PRIVATE int uo_mask_parse(const uint8_t *buf, BD_UO_MASK *uo);
#endif // _BD_UO_MASK_H_
......@@ -524,8 +524,8 @@ static void _update_uo_mask(BLURAY *bd)
BD_UO_MASK old_mask = bd->uo_mask;
BD_UO_MASK new_mask;
new_mask = bd_uo_mask_combine(bd->title_uo_mask, bd->st0.uo_mask);
new_mask = bd_uo_mask_combine(bd->gc_uo_mask, new_mask);
new_mask = uo_mask_combine(bd->title_uo_mask, bd->st0.uo_mask);
new_mask = uo_mask_combine(bd->gc_uo_mask, new_mask);
if (_compressed_mask(old_mask) != _compressed_mask(new_mask)) {
_queue_event(bd, BD_EVENT_UO_MASK_CHANGED, _compressed_mask(new_mask));
}
......@@ -589,8 +589,8 @@ static int _open_m2ts(BLURAY *bd, BD_STREAM *st)
MPLS_PL *pl = st->clip->title->pl;
MPLS_STN *stn = &pl->play_item[st->clip->ref].stn;
st->uo_mask = bd_uo_mask_combine(pl->app_info.uo_mask,
pl->play_item[st->clip->ref].uo_mask);
st->uo_mask = uo_mask_combine(pl->app_info.uo_mask,
pl->play_item[st->clip->ref].uo_mask);
_update_uo_mask(bd);
st->m2ts_filter = m2ts_filter_init((int64_t)st->clip->in_time << 1,
......
......@@ -739,7 +739,7 @@ static void _gc_reset(GRAPHICS_CONTROLLER *gc)
gc->popup_visible = 0;
gc->valid_mouse_position = 0;
gc->page_uo_mask = bd_empty_uo_mask();
gc->page_uo_mask = uo_mask_get_empty();
graphics_processor_free(&gc->igp);
graphics_processor_free(&gc->pgp);
......@@ -1393,7 +1393,7 @@ static int _render_page(GRAPHICS_CONTROLLER *gc,
if (s->ics->interactive_composition.ui_model == IG_UI_MODEL_POPUP && !gc->popup_visible) {
gc->page_uo_mask = bd_empty_uo_mask();
gc->page_uo_mask = uo_mask_get_empty();
if (gc->ig_open) {
GC_TRACE("_render_page(): popup menu not visible\n");
......@@ -1948,7 +1948,7 @@ int gc_run(GRAPHICS_CONTROLLER *gc, gc_ctrl_e ctrl, uint32_t param, GC_NAV_CMDS
cmds->nav_cmds = NULL;
cmds->sound_id_ref = -1;
cmds->status = GC_STATUS_NONE;
cmds->page_uo_mask = bd_empty_uo_mask();
cmds->page_uo_mask = uo_mask_get_empty();
}
if (!gc) {
......
......@@ -26,7 +26,7 @@
#include "pg_decode.h" // pg_decode_*()
#include "../hdmv/mobj_parse.h" // mobj_parse_cmd()
#include "../hdmv/mobj_data.h" // MOBJ_CMD
#include "../bdnav/mpls_parse.h" // mpls_parse_uo()
#include "../bdnav/uo_mask.h" // uo_mask_parse()
#include "util/macro.h"
#include "util/logging.h"
......@@ -204,7 +204,7 @@ static int _decode_uo_mask_table(BITBUFFER *bb, BD_UO_MASK *p)
uint8_t buf[8];
bb_read_bytes(bb, buf, 8);
return mpls_parse_uo(buf, p);
return uo_mask_parse(buf, p);
}
static int _decode_page(BITBUFFER *bb, BD_IG_PAGE *p)
......
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