[libbluray-devel] [Git][videolan/libbluray][master] 5 commits: bdnav: regonize fmts files
Petri Hintukainen
gitlab at videolan.org
Mon Aug 3 16:11:50 CEST 2020
Petri Hintukainen pushed to branch master at VideoLAN / libbluray
Commits:
2dfe914f by hpi1 at 2020-08-03T17:03:40+03:00
bdnav: regonize fmts files
- - - - -
64cf2cb8 by hpi1 at 2020-08-03T17:04:26+03:00
refcnt: add (optional) cleanup routine
- - - - -
9ecdddea by hpi1 at 2020-08-03T17:05:06+03:00
BD-J: get title infos in init()
- - - - -
280e8fc7 by hpi1 at 2020-08-03T17:05:33+03:00
Simplify
- - - - -
1ec56c76 by hpi1 at 2020-08-03T17:05:51+03:00
Add const
- - - - -
10 changed files:
- src/libbluray/bdj/java/org/videolan/Libbluray.java
- src/libbluray/bdnav/mpls_parse.c
- src/libbluray/bdnav/navigation.c
- src/libbluray/bdnav/navigation.h
- src/libbluray/bluray.c
- src/libbluray/decoders/pg_decode.c
- src/libbluray/decoders/rle.c
- src/libbluray/decoders/rle.h
- src/util/refcnt.c
- src/util/refcnt.h
Changes:
=====================================
src/libbluray/bdj/java/org/videolan/Libbluray.java
=====================================
@@ -353,6 +353,13 @@ public class Libbluray {
loadAdapter(System.getProperty("org.videolan.loader.adapter"));
loadAdapter(pkg);
+ /* get title infos */
+ titleInfos = getTitleInfosN(nativePointer);
+ if (titleInfos == null) {
+ /* this is fatal */
+ throw new Error("getTitleInfos() failed");
+ }
+
booted = true;
}
@@ -388,9 +395,7 @@ public class Libbluray {
System.err.println("shutdown() failed: " + e + "\n" + Logger.dumpStack(e));
}
nativePointer = 0;
- synchronized (titleInfosLock) {
- titleInfos = null;
- }
+ titleInfos = null;
synchronized (bdjoFilesLock) {
bdjoFiles = null;
}
@@ -430,20 +435,11 @@ public class Libbluray {
/* used by javax/tv/service/SIManagerImpl */
public static int numTitles() {
- synchronized (titleInfosLock) {
- if (titleInfos == null) {
- titleInfos = getTitleInfosN(nativePointer);
- if (titleInfos == null) {
- return -1;
- }
- }
- return titleInfos.length - 2;
- }
+ return titleInfos.length - 2;
}
/* used by org/bluray/ti/TitleImpl */
public static TitleInfo getTitleInfo(int titleNum) {
- synchronized (titleInfosLock) {
int numTitles = numTitles();
if (numTitles < 0)
return null;
@@ -456,7 +452,6 @@ public class Libbluray {
throw new IllegalArgumentException();
return titleInfos[titleNum];
- }
}
/* used by org/bluray/ti/PlayListImpl */
@@ -831,6 +826,5 @@ public class Libbluray {
int x0, int y0, int x1, int y1);
private static long nativePointer = 0;
- private static Object titleInfosLock = new Object();
private static TitleInfo[] titleInfos = null;
}
=====================================
src/libbluray/bdnav/mpls_parse.c
=====================================
@@ -463,7 +463,7 @@ _parse_playitem(BITSTREAM *bits, MPLS_PI *pi)
bs_read_string(bits, clip_id, 5);
bs_read_string(bits, codec_id, 4);
- if (memcmp(codec_id, "M2TS", 4) != 0) {
+ if (memcmp(codec_id, "M2TS", 4) != 0 && memcmp(codec_id, "FMTS", 4) != 0) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "Incorrect CodecIdentifier (%s)\n", codec_id);
}
@@ -516,7 +516,7 @@ _parse_playitem(BITSTREAM *bits, MPLS_PI *pi)
bs_read_string(bits, pi->clip[ii].clip_id, 5);
bs_read_string(bits, pi->clip[ii].codec_id, 4);
- if (memcmp(pi->clip[ii].codec_id, "M2TS", 4) != 0) {
+ if (memcmp(pi->clip[ii].codec_id, "M2TS", 4) != 0 && memcmp(pi->clip[ii].codec_id, "FMTS", 4) != 0) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "Incorrect CodecIdentifier (%s)\n", pi->clip[ii].codec_id);
}
pi->clip[ii].stc_id = bs_read(bits, 8);
@@ -570,7 +570,7 @@ _parse_subplayitem(BITSTREAM *bits, MPLS_SUB_PI *spi)
bs_read_string(bits, clip_id, 5);
bs_read_string(bits, codec_id, 4);
- if (memcmp(codec_id, "M2TS", 4) != 0) {
+ if (memcmp(codec_id, "M2TS", 4) != 0 && memcmp(codec_id, "FMTS", 4) != 0) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "Incorrect CodecIdentifier (%s)\n", codec_id);
}
@@ -610,7 +610,7 @@ _parse_subplayitem(BITSTREAM *bits, MPLS_SUB_PI *spi)
bs_read_string(bits, spi->clip[ii].clip_id, 5);
bs_read_string(bits, spi->clip[ii].codec_id, 4);
- if (memcmp(spi->clip[ii].codec_id, "M2TS", 4) != 0) {
+ if (memcmp(spi->clip[ii].codec_id, "M2TS", 4) != 0 && memcmp(spi->clip[ii].codec_id, "FMTS", 4) != 0) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "Incorrect CodecIdentifier (%s)\n", spi->clip[ii].codec_id);
}
spi->clip[ii].stc_id = bs_read(bits, 8);
=====================================
src/libbluray/bdnav/navigation.c
=====================================
@@ -511,7 +511,7 @@ void nav_free_title_list(NAV_TITLE_LIST **title_list)
*
*/
-uint8_t nav_clip_lookup_aspect(NAV_CLIP *clip, int pid)
+uint8_t nav_clip_lookup_aspect(const NAV_CLIP *clip, int pid)
{
CLPI_PROG *progs;
int ii, jj;
@@ -642,7 +642,10 @@ static void _fill_clip(NAV_TITLE *title,
}
memcpy(clip->name, mpls_clip[clip->angle].clip_id, 5);
- memcpy(&clip->name[5], ".m2ts", 6);
+ if (!memcmp(mpls_clip[clip->angle].codec_id, "FMTS", 4))
+ memcpy(&clip->name[5], ".fmts", 6);
+ else
+ memcpy(&clip->name[5], ".m2ts", 6);
clip->clip_id = atoi(mpls_clip[clip->angle].clip_id);
clpi_free(&clip->cl);
@@ -881,7 +884,7 @@ NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, u
return clip;
}
-void nav_clip_packet_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *clip_pkt, uint32_t *clip_time)
+void nav_clip_packet_search(const NAV_CLIP *clip, uint32_t pkt, uint32_t *clip_pkt, uint32_t *clip_time)
{
*clip_time = clip->in_time;
if (clip->cl != NULL) {
@@ -955,7 +958,7 @@ NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt,
// Search to the timestamp obtained from nav_angle_change_search using
// nav_clip_time_search. Otherwise start at the start_pkt defined
// by the clip.
-uint32_t nav_clip_angle_change_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *time)
+uint32_t nav_clip_angle_change_search(const NAV_CLIP *clip, uint32_t pkt, uint32_t *time)
{
if (clip->cl == NULL) {
return pkt;
@@ -1002,7 +1005,7 @@ NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, u
// Search for random access point closest to the requested time
// Time is in 45khz ticks, between clip in_time and out_time.
-void nav_clip_time_search(NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt)
+void nav_clip_time_search(const NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt)
{
if (tick >= clip->out_time) {
*clip_pkt = clip->end_pkt;
@@ -1031,7 +1034,7 @@ void nav_clip_time_search(NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uin
* Pointer to NAV_CLIP struct
* NULL - End of clip list
*/
-NAV_CLIP* nav_next_clip(NAV_TITLE *title, NAV_CLIP *clip)
+NAV_CLIP* nav_next_clip(NAV_TITLE *title, const NAV_CLIP *clip)
{
if (clip == NULL) {
return &title->clip_list.clip[0];
@@ -1042,22 +1045,22 @@ NAV_CLIP* nav_next_clip(NAV_TITLE *title, NAV_CLIP *clip)
return &title->clip_list.clip[clip->ref + 1];
}
-NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle)
+void nav_set_angle(NAV_TITLE *title, unsigned angle)
{
int ii;
uint32_t pos = 0;
uint32_t time = 0;
if (title == NULL) {
- return clip;
+ return;
}
if (angle > 8) {
// invalid angle
- return clip;
+ return;
}
if (angle == title->angle) {
// no change
- return clip;
+ return;
}
title->angle = angle;
@@ -1074,10 +1077,9 @@ NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle)
pi->still_mode, pi->still_time, cl, ii, &pos, &time);
}
_extrapolate_title(title);
- return clip;
}
-char *nav_clip_textst_font(NAV_CLIP *clip, int index)
+char *nav_clip_textst_font(const NAV_CLIP *clip, int index)
{
char *file;
=====================================
src/libbluray/bdnav/navigation.h
=====================================
@@ -151,9 +151,9 @@ BD_PRIVATE void nav_free_title_list(NAV_TITLE_LIST **title_list);
BD_PRIVATE NAV_TITLE* nav_title_open(struct bd_disc *disc, const char *playlist, unsigned angle) BD_ATTR_MALLOC;
BD_PRIVATE void nav_title_close(NAV_TITLE **title);
-BD_PRIVATE NAV_CLIP* nav_next_clip(NAV_TITLE *title, NAV_CLIP *clip);
+BD_PRIVATE NAV_CLIP* nav_next_clip(NAV_TITLE *title, const NAV_CLIP *clip);
BD_PRIVATE uint32_t nav_chapter_get_current(NAV_TITLE *title, uint32_t title_pkt);
-BD_PRIVATE NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle);
+BD_PRIVATE void nav_set_angle(NAV_TITLE *title, unsigned angle);
BD_PRIVATE NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt,
uint32_t *out_pkt, uint32_t *out_time);
@@ -163,11 +163,11 @@ BD_PRIVATE NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *
/* clip ops */
-BD_PRIVATE uint32_t nav_clip_angle_change_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *time);
-BD_PRIVATE void nav_clip_time_search(NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
-BD_PRIVATE void nav_clip_packet_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *clip_pkt, uint32_t *clip_time);
+BD_PRIVATE uint32_t nav_clip_angle_change_search(const NAV_CLIP *clip, uint32_t pkt, uint32_t *time);
+BD_PRIVATE void nav_clip_time_search(const NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
+BD_PRIVATE void nav_clip_packet_search(const NAV_CLIP *clip, uint32_t pkt, uint32_t *clip_pkt, uint32_t *clip_time);
-BD_PRIVATE char *nav_clip_textst_font(NAV_CLIP *clip, int index);
-BD_PRIVATE uint8_t nav_clip_lookup_aspect(NAV_CLIP *clip, int pid);
+BD_PRIVATE char *nav_clip_textst_font(const NAV_CLIP *clip, int index);
+BD_PRIVATE uint8_t nav_clip_lookup_aspect(const NAV_CLIP *clip, int pid);
#endif // _NAVIGATION_H_
=====================================
src/libbluray/bluray.c
=====================================
@@ -67,7 +67,7 @@ typedef enum {
typedef struct {
/* current clip */
- NAV_CLIP *clip;
+ const NAV_CLIP *clip;
BD_FILE_H *fp;
uint64_t clip_size;
uint64_t clip_block_pos;
@@ -92,7 +92,7 @@ typedef struct {
} BD_STREAM;
typedef struct {
- NAV_CLIP *clip;
+ const NAV_CLIP *clip;
size_t clip_size;
uint8_t *buf;
} BD_PRELOAD;
@@ -241,7 +241,7 @@ static void _update_time_psr(BLURAY *bd, uint32_t time)
static uint32_t _update_time_psr_from_stream(BLURAY *bd)
{
/* update PSR_TIME from stream. Not real presentation time (except when seeking), but near enough. */
- NAV_CLIP *clip = bd->st0.clip;
+ const NAV_CLIP *clip = bd->st0.clip;
if (bd->title && clip) {
@@ -311,7 +311,7 @@ static void _update_stream_psr_by_lang(BD_REGISTERS *regs,
0x80000fff);
}
-static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
+static void _update_clip_psrs(BLURAY *bd, const NAV_CLIP *clip)
{
MPLS_STN *stn = &clip->title->pl->play_item[clip->ref].stn;
uint32_t audio_lang = 0;
@@ -358,7 +358,7 @@ static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
static void _update_playlist_psrs(BLURAY *bd)
{
- NAV_CLIP *clip = bd->st0.clip;
+ const NAV_CLIP *clip = bd->st0.clip;
bd_psr_write(bd->regs, PSR_PLAYLIST, atoi(bd->title->name));
bd_psr_write(bd->regs, PSR_ANGLE_NUMBER, bd->title->angle + 1);
@@ -497,7 +497,7 @@ static void _update_textst_timer(BLURAY *bd)
/* next event in this clip ? */
if (cmds.wakeup_time >= bd->st0.clip->in_time && cmds.wakeup_time < bd->st0.clip->out_time) {
/* find event position in main path clip */
- NAV_CLIP *clip = bd->st0.clip;
+ const NAV_CLIP *clip = bd->st0.clip;
if (clip->cl) {
uint32_t spn;
nav_clip_time_search(clip, cmds.wakeup_time, &spn, NULL);
@@ -821,7 +821,7 @@ static int _preload_m2ts(BLURAY *bd, BD_PRELOAD *p)
}
static int64_t _seek_stream(BLURAY *bd, BD_STREAM *st,
- NAV_CLIP *clip, uint32_t clip_pkt)
+ const NAV_CLIP *clip, uint32_t clip_pkt)
{
if (!clip)
return -1;
@@ -1612,7 +1612,7 @@ static void _playmark_reached(BLURAY *bd)
*/
static void _seek_internal(BLURAY *bd,
- NAV_CLIP *clip, uint32_t title_pkt, uint32_t clip_pkt)
+ const NAV_CLIP *clip, uint32_t title_pkt, uint32_t clip_pkt)
{
if (_seek_stream(bd, &bd->st0, clip, clip_pkt) >= 0) {
uint32_t media_time;
@@ -1648,7 +1648,7 @@ static void _seek_internal(BLURAY *bd,
static void _change_angle(BLURAY *bd)
{
if (bd->seamless_angle_change) {
- bd->st0.clip = nav_set_angle(bd->title, bd->st0.clip, bd->request_angle);
+ nav_set_angle(bd->title, bd->request_angle);
bd->seamless_angle_change = 0;
bd_psr_write(bd->regs, PSR_ANGLE_NUMBER, bd->title->angle + 1);
@@ -1660,7 +1660,7 @@ static void _change_angle(BLURAY *bd)
int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
{
uint32_t clip_pkt, out_pkt;
- NAV_CLIP *clip;
+ const NAV_CLIP *clip;
if (tick >> 33) {
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bd_seek_time(%" PRIu64 ") failed: invalid timestamp\n", tick);
@@ -1693,7 +1693,7 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
uint64_t bd_tell_time(BLURAY *bd)
{
uint32_t clip_pkt = 0, out_pkt = 0, out_time = 0;
- NAV_CLIP *clip;
+ const NAV_CLIP *clip;
if (!bd) {
return 0;
@@ -1716,7 +1716,7 @@ uint64_t bd_tell_time(BLURAY *bd)
int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter)
{
uint32_t clip_pkt, out_pkt;
- NAV_CLIP *clip;
+ const NAV_CLIP *clip;
bd_mutex_lock(&bd->mutex);
@@ -1777,7 +1777,7 @@ uint32_t bd_get_current_chapter(BLURAY *bd)
int64_t bd_seek_playitem(BLURAY *bd, unsigned clip_ref)
{
uint32_t clip_pkt, out_pkt;
- NAV_CLIP *clip;
+ const NAV_CLIP *clip;
bd_mutex_lock(&bd->mutex);
@@ -1804,7 +1804,7 @@ int64_t bd_seek_playitem(BLURAY *bd, unsigned clip_ref)
int64_t bd_seek_mark(BLURAY *bd, unsigned mark)
{
uint32_t clip_pkt, out_pkt;
- NAV_CLIP *clip;
+ const NAV_CLIP *clip;
bd_mutex_lock(&bd->mutex);
@@ -1830,7 +1830,7 @@ int64_t bd_seek_mark(BLURAY *bd, unsigned mark)
int64_t bd_seek(BLURAY *bd, uint64_t pos)
{
uint32_t pkt, clip_pkt, out_pkt, out_time;
- NAV_CLIP *clip;
+ const NAV_CLIP *clip;
bd_mutex_lock(&bd->mutex);
@@ -2520,7 +2520,7 @@ static int _bd_select_angle(BLURAY *bd, unsigned angle)
orig_angle = bd->title->angle;
- bd->st0.clip = nav_set_angle(bd->title, bd->st0.clip, angle);
+ nav_set_angle(bd->title, angle);
if (orig_angle == bd->title->angle) {
return 1;
@@ -2614,7 +2614,7 @@ int bd_get_main_title(BLURAY *bd)
return bd->title_list->main_title_idx;
}
-static int _copy_streams(NAV_CLIP *clip, BLURAY_STREAM_INFO **pstreams, MPLS_STREAM *si, int count)
+static int _copy_streams(const NAV_CLIP *clip, BLURAY_STREAM_INFO **pstreams, MPLS_STREAM *si, int count)
{
BLURAY_STREAM_INFO *streams;
int ii;
@@ -2695,7 +2695,7 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx,
for (ii = 0; ii < title_info->clip_count; ii++) {
MPLS_PI *pi = &title->pl->play_item[ii];
BLURAY_CLIP_INFO *ci = &title_info->clips[ii];
- NAV_CLIP *nc = &title->clip_list.clip[ii];
+ const NAV_CLIP *nc = &title->clip_list.clip[ii];
memcpy(ci->clip_id, pi->clip->clip_id, sizeof(ci->clip_id));
ci->pkt_count = nc->end_pkt - nc->start_pkt;
@@ -3012,7 +3012,7 @@ static void _process_psr_restore_event(BLURAY *bd, BD_PSR_EVENT *ev)
return;
case PSR_PLAYLIST:
bd_select_playlist(bd, ev->new_val);
- nav_set_angle(bd->title, bd->st0.clip, bd_psr_read(bd->regs, PSR_ANGLE_NUMBER) - 1);
+ nav_set_angle(bd->title, bd_psr_read(bd->regs, PSR_ANGLE_NUMBER) - 1);
return;
case PSR_PLAYITEM:
bd_seek_playitem(bd, ev->new_val);
@@ -3863,7 +3863,7 @@ int bd_get_meta_file(BLURAY *bd, const char *name, void **data, int64_t *size)
struct clpi_cl *bd_get_clpi(BLURAY *bd, unsigned clip_ref)
{
if (bd->title && clip_ref < bd->title->clip_list.count) {
- NAV_CLIP *clip = &bd->title->clip_list.clip[clip_ref];
+ const NAV_CLIP *clip = &bd->title->clip_list.clip[clip_ref];
return clpi_copy(clip->cl);
}
return NULL;
=====================================
src/libbluray/decoders/pg_decode.c
=====================================
@@ -129,7 +129,7 @@ static int _decode_rle(BITBUFFER *bb, BD_PG_OBJECT *p)
if (rle_size < 1)
rle_size = 1;
- tmp = refcnt_realloc(p->img, rle_size * sizeof(BD_PG_RLE_ELEM));
+ tmp = refcnt_realloc(p->img, rle_size * sizeof(BD_PG_RLE_ELEM), NULL);
if (!tmp) {
BD_DEBUG(DBG_DECODE | DBG_CRIT, "pg_decode_object(): realloc failed\n");
return 0;
@@ -170,7 +170,7 @@ static int _decode_rle(BITBUFFER *bb, BD_PG_OBJECT *p)
num_rle++;
if (num_rle >= rle_size) {
rle_size *= 2;
- tmp = refcnt_realloc(p->img, rle_size * sizeof(BD_PG_RLE_ELEM));
+ tmp = refcnt_realloc(p->img, rle_size * sizeof(BD_PG_RLE_ELEM), NULL);
if (!tmp) {
BD_DEBUG(DBG_DECODE | DBG_CRIT, "pg_decode_object(): realloc failed\n");
return 0;
=====================================
src/libbluray/decoders/rle.c
=====================================
@@ -37,7 +37,7 @@ static int _rle_ensure_size(RLE_ENC *p)
return -1;
}
/* realloc to 2x */
- void *tmp = refcnt_realloc(start, p->num_elem * 2 * sizeof(BD_PG_RLE_ELEM));
+ void *tmp = refcnt_realloc(start, p->num_elem * 2 * sizeof(BD_PG_RLE_ELEM), NULL);
if (!tmp) {
p->error = 1;
return -1;
=====================================
src/libbluray/decoders/rle.h
=====================================
@@ -52,7 +52,7 @@ static inline int rle_begin(RLE_ENC *p)
{
p->num_elem = 1024;
p->free_elem = 1024;
- p->elem = refcnt_realloc(NULL, p->num_elem * sizeof(BD_PG_RLE_ELEM));
+ p->elem = refcnt_realloc(NULL, p->num_elem * sizeof(BD_PG_RLE_ELEM), NULL);
if (!p->elem) {
return -1;
}
=====================================
src/util/refcnt.c
=====================================
@@ -34,6 +34,7 @@
*/
typedef struct {
+ void (*cleanup)(void *);
BD_MUTEX mutex; /* initialized only if counted == 1 */
int count; /* reference count */
unsigned counted; /* 1 if this object is ref-counted */
@@ -85,10 +86,13 @@ void bd_refcnt_dec(const void *obj)
bd_mutex_destroy(&ref->mutex);
}
+ if (ref->cleanup)
+ ref->cleanup(&ref[1]);
+
free(ref);
}
-void *refcnt_realloc(void *obj, size_t sz)
+void *refcnt_realloc(void *obj, size_t sz, void (*cleanup)(void *))
{
sz += sizeof(BD_REFCNT);
@@ -103,6 +107,7 @@ void *refcnt_realloc(void *obj, size_t sz)
if (obj) {
obj = realloc(&((BD_REFCNT *)obj)[-1], sz);
if (!obj) {
+ /* do not call cleanup() - nothing is free'd here */
return NULL;
}
} else {
@@ -113,6 +118,7 @@ void *refcnt_realloc(void *obj, size_t sz)
memset(obj, 0, sizeof(BD_REFCNT));
}
+ ((BD_REFCNT *)obj)->cleanup = cleanup;
return &((BD_REFCNT *)obj)[1];
}
=====================================
src/util/refcnt.h
=====================================
@@ -50,7 +50,7 @@ extern "C" {
*
*/
-BD_PRIVATE void *refcnt_realloc(void *obj, size_t sz);
+BD_PRIVATE void *refcnt_realloc(void *obj, size_t sz, void (*cleanup)(void *));
#ifndef BD_OVERLAY_INTERFACE_VERSION
void bd_refcnt_inc(const void *obj);
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/5d567c805b98002c88088d3958668eb78298f56d...1ec56c7653e6ede56be94c126730f662580ef726
--
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/5d567c805b98002c88088d3958668eb78298f56d...1ec56c7653e6ede56be94c126730f662580ef726
You're receiving this email because of your account on code.videolan.org.
More information about the libbluray-devel
mailing list