[libbluray-devel] [Git][videolan/libbluray][master] 2 commits: Add const

Petri Hintukainen gitlab at videolan.org
Sun Jan 31 13:26:31 UTC 2021



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
c5523223 by hpi1 at 2021-01-30T19:46:37+02:00
Add const

- - - - -
0bb10b62 by hpi1 at 2021-01-30T19:47:16+02:00
Add const

- - - - -


6 changed files:

- src/libbluray/bdnav/navigation.c
- src/libbluray/bdnav/navigation.h
- src/libbluray/bluray.c
- src/libbluray/decoders/graphics_controller.c
- src/libbluray/register.c
- src/libbluray/register.h


Changes:

=====================================
src/libbluray/bdnav/navigation.c
=====================================
@@ -513,7 +513,7 @@ void nav_free_title_list(NAV_TITLE_LIST **title_list)
 
 uint8_t nav_clip_lookup_aspect(const NAV_CLIP *clip, int pid)
 {
-    CLPI_PROG *progs;
+    const CLPI_PROG *progs;
     int ii, jj;
 
     if (clip->cl == NULL) {
@@ -522,7 +522,7 @@ uint8_t nav_clip_lookup_aspect(const NAV_CLIP *clip, int pid)
 
     progs = clip->cl->program.progs;
     for (ii = 0; ii < clip->cl->program.num_prog; ii++) {
-        CLPI_PROG_STREAM *ps = progs[ii].streams;
+        const CLPI_PROG_STREAM *ps = progs[ii].streams;
         for (jj = 0; jj < progs[ii].num_streams; jj++) {
             if (ps[jj].pid == pid)
             {
@@ -827,9 +827,10 @@ NAV_TITLE* nav_title_open(BD_DISC *disc, const char *playlist, unsigned angle)
 
 // Search for random access point closest to the requested packet
 // Packets are 192 byte TS packets
-NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_pkt, uint32_t *out_pkt)
+const NAV_CLIP* nav_chapter_search(const NAV_TITLE *title, unsigned chapter,
+                                   uint32_t *clip_pkt, uint32_t *out_pkt)
 {
-    NAV_CLIP *clip;
+    const NAV_CLIP *clip;
 
     if (chapter > title->chap_list.count) {
         clip = &title->clip_list.clip[0];
@@ -843,9 +844,9 @@ NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_
     return clip;
 }
 
-uint32_t nav_chapter_get_current(NAV_TITLE * title, uint32_t title_pkt)
+uint32_t nav_chapter_get_current(const NAV_TITLE * title, uint32_t title_pkt)
 {
-    NAV_MARK * mark;
+    const NAV_MARK * mark;
     uint32_t ii;
 
     if (title == NULL) {
@@ -868,9 +869,10 @@ uint32_t nav_chapter_get_current(NAV_TITLE * title, uint32_t title_pkt)
 
 // Search for random access point closest to the requested packet
 // Packets are 192 byte TS packets
-NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, uint32_t *out_pkt)
+const NAV_CLIP* nav_mark_search(const NAV_TITLE *title, unsigned mark,
+                                uint32_t *clip_pkt, uint32_t *out_pkt)
 {
-    NAV_CLIP *clip;
+    const NAV_CLIP *clip;
 
     if (mark > title->mark_list.count) {
         clip = &title->clip_list.clip[0];
@@ -884,7 +886,8 @@ NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, u
     return clip;
 }
 
-void nav_clip_packet_search(const 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) {
@@ -906,10 +909,11 @@ void nav_clip_packet_search(const NAV_CLIP *clip, uint32_t pkt, uint32_t *clip_p
 // Packets are 192 byte TS packets
 // pkt is relative to the beginning of the title
 // out_pkt and out_time is relative to the the clip which the packet falls in
-NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt, uint32_t *out_pkt, uint32_t *out_time)
+const NAV_CLIP* nav_packet_search(const NAV_TITLE *title, uint32_t pkt,
+                                  uint32_t *clip_pkt, uint32_t *out_pkt, uint32_t *out_time)
 {
+    const NAV_CLIP *clip;
     uint32_t pos, len;
-    NAV_CLIP *clip;
     unsigned ii;
 
     *out_time = 0;
@@ -968,7 +972,8 @@ uint32_t nav_clip_angle_change_search(const NAV_CLIP *clip, uint32_t pkt, uint32
 
 // Search for random access point closest to the requested time
 // Time is in 45khz ticks
-NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt)
+const NAV_CLIP* nav_time_search(const NAV_TITLE *title, uint32_t tick,
+                                uint32_t *clip_pkt, uint32_t *out_pkt)
 {
     uint32_t pos, len;
     const MPLS_PI *pi = NULL;
@@ -1034,7 +1039,7 @@ void nav_clip_time_search(const NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pk
  * Pointer to NAV_CLIP struct
  * NULL - End of clip list
  */
-NAV_CLIP* nav_next_clip(NAV_TITLE *title, const NAV_CLIP *clip)
+const NAV_CLIP* nav_next_clip(const NAV_TITLE *title, const NAV_CLIP *clip)
 {
     if (clip == NULL) {
         return &title->clip_list.clip[0];


=====================================
src/libbluray/bdnav/navigation.h
=====================================
@@ -151,15 +151,18 @@ 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, const NAV_CLIP *clip);
-BD_PRIVATE uint32_t  nav_chapter_get_current(NAV_TITLE *title, uint32_t title_pkt);
+BD_PRIVATE uint32_t  nav_chapter_get_current(const NAV_TITLE *title, uint32_t title_pkt);
 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);
-BD_PRIVATE NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
-BD_PRIVATE NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_pkt, uint32_t *out_pkt);
-BD_PRIVATE NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, uint32_t *out_pkt);
+BD_PRIVATE const NAV_CLIP* nav_next_clip(const NAV_TITLE *title, const NAV_CLIP *clip);
+BD_PRIVATE const NAV_CLIP* nav_packet_search(const NAV_TITLE *title, uint32_t pkt,
+                                             uint32_t *clip_pkt, uint32_t *out_pkt, uint32_t *out_time);
+BD_PRIVATE const NAV_CLIP* nav_time_search(const NAV_TITLE *title, uint32_t tick,
+                                           uint32_t *clip_pkt, uint32_t *out_pkt);
+BD_PRIVATE const NAV_CLIP* nav_chapter_search(const NAV_TITLE *title, unsigned chapter,
+                                              uint32_t *clip_pkt, uint32_t *out_pkt);
+BD_PRIVATE const NAV_CLIP* nav_mark_search(const NAV_TITLE *title, unsigned mark,
+                                           uint32_t *clip_pkt, uint32_t *out_pkt);
 
 /* clip ops */
 


=====================================
src/libbluray/bluray.c
=====================================
@@ -3047,7 +3047,7 @@ static void _set_scr(BLURAY *bd, int64_t pts)
     }
 }
 
-static void _process_psr_restore_event(BLURAY *bd, BD_PSR_EVENT *ev)
+static void _process_psr_restore_event(BLURAY *bd, const BD_PSR_EVENT *ev)
 {
     /* PSR restore events are handled internally.
      * Restore stored playback position.
@@ -3094,7 +3094,7 @@ static void _process_psr_restore_event(BLURAY *bd, BD_PSR_EVENT *ev)
  * notification events to APP
  */
 
-static void _process_psr_write_event(BLURAY *bd, BD_PSR_EVENT *ev)
+static void _process_psr_write_event(BLURAY *bd, const BD_PSR_EVENT *ev)
 {
     if (ev->ev_type == BD_PSR_WRITE) {
         BD_DEBUG(DBG_BLURAY, "PSR write: psr%u = %u\n", ev->psr_idx, ev->new_val);
@@ -3134,7 +3134,7 @@ static void _process_psr_write_event(BLURAY *bd, BD_PSR_EVENT *ev)
     }
 }
 
-static void _process_psr_change_event(BLURAY *bd, BD_PSR_EVENT *ev)
+static void _process_psr_change_event(BLURAY *bd, const BD_PSR_EVENT *ev)
 {
     BD_DEBUG(DBG_BLURAY, "PSR change: psr%u = %u\n", ev->psr_idx, ev->new_val);
 
@@ -3209,7 +3209,7 @@ static void _process_psr_change_event(BLURAY *bd, BD_PSR_EVENT *ev)
     }
 }
 
-static void _process_psr_event(void *handle, BD_PSR_EVENT *ev)
+static void _process_psr_event(void *handle, const BD_PSR_EVENT *ev)
 {
     BLURAY *bd = (BLURAY*)handle;
 


=====================================
src/libbluray/decoders/graphics_controller.c
=====================================
@@ -759,7 +759,7 @@ static void _gc_reset(GRAPHICS_CONTROLLER *gc)
 /*
  * register hook
  */
-static void _process_psr_event(void *handle, BD_PSR_EVENT *ev)
+static void _process_psr_event(void *handle, const BD_PSR_EVENT *ev)
 {
     GRAPHICS_CONTROLLER *gc = (GRAPHICS_CONTROLLER *)handle;
 


=====================================
src/libbluray/register.c
=====================================
@@ -160,7 +160,7 @@ static const char * const bd_psr_name[BD_PSR_COUNT] = {
 
 typedef struct {
     void *handle;
-    void (*cb)(void *, BD_PSR_EVENT*);
+    void (*cb)(void *, const BD_PSR_EVENT*);
 } PSR_CB_DATA;
 
 struct bd_registers_s
@@ -221,7 +221,7 @@ void bd_psr_unlock(BD_REGISTERS *p)
  * PSR change callback register / unregister
  */
 
-void bd_psr_register_cb  (BD_REGISTERS *p, void (*callback)(void*,BD_PSR_EVENT*), void *cb_handle)
+void bd_psr_register_cb  (BD_REGISTERS *p, void (*callback)(void*,const BD_PSR_EVENT*), void *cb_handle)
 {
     /* no duplicates ! */
     PSR_CB_DATA *cb;
@@ -250,7 +250,7 @@ void bd_psr_register_cb  (BD_REGISTERS *p, void (*callback)(void*,BD_PSR_EVENT*)
     bd_psr_unlock(p);
 }
 
-void bd_psr_unregister_cb(BD_REGISTERS *p, void (*callback)(void*,BD_PSR_EVENT*), void *cb_handle)
+void bd_psr_unregister_cb(BD_REGISTERS *p, void (*callback)(void*,const BD_PSR_EVENT*), void *cb_handle)
 {
     unsigned i = 0;
 


=====================================
src/libbluray/register.h
=====================================
@@ -255,7 +255,7 @@ typedef struct {
  * @param callback  callback function pointer
  * @param handle  application-specific handle that is provided to callback function as first parameter
  */
-void bd_psr_register_cb(BD_REGISTERS *, void (*callback)(void*,BD_PSR_EVENT*), void *cb_handle);
+void bd_psr_register_cb(BD_REGISTERS *, void (*callback)(void*,const BD_PSR_EVENT*), void *cb_handle);
 
 /**
  *
@@ -265,7 +265,7 @@ void bd_psr_register_cb(BD_REGISTERS *, void (*callback)(void*,BD_PSR_EVENT*), v
  * @param callback  callback function to unregister
  * @param handle  application-specific handle that was used when callback was registered
  */
-void bd_psr_unregister_cb(BD_REGISTERS *, void (*callback)(void*,BD_PSR_EVENT*), void *cb_handle);
+void bd_psr_unregister_cb(BD_REGISTERS *, void (*callback)(void*,const BD_PSR_EVENT*), void *cb_handle);
 
 BD_PRIVATE int psr_init_3D(BD_REGISTERS *, int initial_mode, int force);
 



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/0dacea90a66d4a950bf9702888c0b3dcb7cc1a08...0bb10b623a5d852d64b5b084c4be7b23e0ed7a1c

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/0dacea90a66d4a950bf9702888c0b3dcb7cc1a08...0bb10b623a5d852d64b5b084c4be7b23e0ed7a1c
You're receiving this email because of your account on code.videolan.org.




More information about the libbluray-devel mailing list