Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.26 KB | None | 0 0
  1. diff -r aeeca29707aa -r cbc8d6f3f779 BonDriverProxy.cpp
  2. --- a/BonDriverProxy.cpp    Tue Sep 02 17:10:53 2014 +0900
  3. +++ b/BonDriverProxy.cpp    Tue Sep 02 23:22:36 2014 +0900
  4. @@ -10,7 +10,6 @@
  5.  static std::list<cProxyServer *> InstanceList;
  6.  static cCriticalSection Lock_Instance;
  7.  
  8. -static B_CAS_CARD *g_bcas = 0;
  9.  static int g_b25_round  = 4;
  10.  static int g_b25_enable = 0;
  11.  static int g_b25_strip  = 0;
  12. @@ -59,17 +58,6 @@
  13.         if (ac > 4)
  14.             g_TsPacketBufSize = ::atoi(av[4]);
  15.     }
  16. -
  17. -   if (g_b25_enable)
  18. -   {
  19. -       g_bcas = create_b_cas_card();
  20. -       if (g_bcas) {
  21. -           if (g_bcas->init(g_bcas) < 0) {
  22. -               g_bcas->release(g_bcas);
  23. -               g_bcas = 0;
  24. -           }
  25. -       }
  26. -   }
  27.     return 0;
  28.  }
  29.  
  30. @@ -790,13 +778,33 @@
  31.     ts.tv_sec = 0;
  32.     ts.tv_nsec = WAIT_TIME * 1000 * 1000;
  33.  
  34. +   B_CAS_CARD *bcas = 0;
  35.     ARIB_STD_B25 *b25 = 0;
  36. -   if (g_bcas)
  37. +   if (g_b25_enable)
  38. +   {
  39. +       bcas = create_b_cas_card();
  40. +       if (bcas)
  41. +       {
  42. +           if (bcas->init(g_bcas) < 0)
  43. +           {
  44. +               fprintf(stderr, "bcas::init() failed\n");
  45. +               bcas->release(bcas);
  46. +               bcas = 0;
  47. +           }
  48. +       }
  49. +       else
  50. +       {
  51. +           fprintf(stderr, "bcas::create_b_cas_card failed\n");
  52. +       }
  53. +   }
  54. +   if (bcas)
  55.     {
  56.         if ((b25 = create_arib_std_b25()) != 0)
  57.         {
  58. -           if (b25->set_b_cas_card(b25, g_bcas) < 0)
  59. +           int code;
  60. +           if ((code = b25->set_b_cas_card(b25, bcas)) < 0)
  61.             {
  62. +               fprintf(stderr, "b25::set_b_cas_card failed. (%d)\n", code);
  63.                 b25->release(b25);
  64.                 b25 = 0;
  65.             }
  66. @@ -807,6 +815,10 @@
  67.                 b25->set_multi2_round(b25, g_b25_round);
  68.             }
  69.         }
  70. +       else
  71. +       {
  72. +           fprintf(stderr, "b25::create_arib_std_b25 failed.\n");
  73. +       }
  74.     }
  75.  
  76.     // TS読み込みループ
  77. @@ -829,8 +841,19 @@
  78.                 {
  79.                     buf.data = pBuf;
  80.                     buf.size = dwSize;
  81. -                   b25->put(b25, &buf);
  82. -                   b25->get(b25, &buf);
  83. +                   int code;
  84. +                   if ((code = b25->put(b25, &buf)) < 0)
  85. +                   {
  86. +                       fprintf(stderr, "b25::put (%d)\n", code);
  87. +                       b25->reset(b25);
  88. +                       continue;
  89. +                   }
  90. +                   if ((code = b25->get(b25, &buf)) < 0)
  91. +                   {
  92. +                       fprintf(stderr, "b25::get (%d)\n", code);
  93. +                       b25->reset(b25);
  94. +                       continue;
  95. +                   }
  96.                     if (buf.size == 0)
  97.                         continue;
  98.                 }
  99. @@ -886,6 +909,8 @@
  100.     }
  101.     if (b25)
  102.         b25->release(b25);
  103. +   if (bcas)
  104. +       bcas->release(bcas);
  105.     delete[] pTsBuf;
  106.     return NULL;
  107.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement