[libbluray-devel] _update_clip_psrs(): make check + update atomic

hpi1 git at videolan.org
Mon Apr 14 10:58:07 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Apr 14 11:03:52 2014 +0300| [36f3239bf74b498e6d5cdd6c61b856f25075b491] | committer: hpi1

_update_clip_psrs(): make check + update atomic

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=36f3239bf74b498e6d5cdd6c61b856f25075b491
---

 src/libbluray/bluray.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index acea045..40ba0ad 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -358,6 +358,7 @@ static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
         uint32_t psr_val;
 
         if (stn->num_audio) {
+            bd_psr_lock(bd->regs);
             psr_val = bd_psr_read(bd->regs, PSR_PRIMARY_AUDIO_ID);
             if (psr_val == 0 || psr_val > stn->num_audio) {
                 _update_stream_psr_by_lang(bd->regs,
@@ -367,8 +368,10 @@ static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
             } else {
                 audio_lang = str_to_uint32((const char *)stn->audio[psr_val - 1].lang, 3);
             }
+            bd_psr_unlock(bd->regs);
         }
         if (stn->num_pg) {
+            bd_psr_lock(bd->regs);
             psr_val = bd_psr_read(bd->regs, PSR_PG_STREAM) & 0xfff;
             if ((psr_val == 0) || (psr_val > stn->num_pg)) {
                 _update_stream_psr_by_lang(bd->regs,
@@ -376,6 +379,7 @@ static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
                                            stn->pg, stn->num_pg,
                                            NULL, audio_lang);
             }
+            bd_psr_unlock(bd->regs);
         }
     }
 }



More information about the libbluray-devel mailing list