Advertisement
Guest User

Mai's AT3+ decoder on Linux

a guest
Sep 10th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.99 KB | None | 0 0
  1. --- base/MaiFile.cc.old 2012-12-04 02:21:28.000000000 +0100
  2. +++ base/MaiFile.cc     2013-09-10 19:22:42.269820093 +0200
  3. @@ -341,8 +341,7 @@
  4.     Mai_I64 fpn;
  5.     fpn = this->getFilePointer();
  6.  
  7. -   //if (!::ftruncate64(file0, newLength))
  8. -   if (!::syscall(__NR_ftruncate64, file0, newLength))
  9. +   if (!::ftruncate64(file0, newLength))
  10.     {
  11.         this->seek(fpn);
  12.         return 0;
  13. --- Makefile.old    2013-09-10 19:46:48.000000000 +0200
  14. +++ Makefile        2013-09-10 19:54:37.013141496 +0200
  15. @@ -1,6 +1,6 @@
  16.  outdir=../output
  17.  
  18. -target=$(outdir)/libMaiAT3PlusDecoder.a
  19. +target=$(outdir)/libat3plusdecoder.so
  20.  
  21.  objs=$(outdir)/Heap_Alloc0.o\
  22.     $(outdir)/MaiFile.o\
  23. @@ -18,22 +18,22 @@
  24.     $(outdir)/MaiAT3PlusCoreDecoder_StaticData.o\
  25.     $(outdir)/MaiAT3PlusCoreDecoder_SubFunc.o\
  26.     $(outdir)/MaiAT3PlusFrameDecoder.o\
  27. +   $(outdir)/cframedecoder.o\
  28. -   $(outdir)/MaiBitReader.o\
  29. -   $(outdir)/MaiBitReader.o\
  30.  
  31.  hs=
  32.  
  33.  
  34. -Mai_CXX_O=g++ -O2 -c "-I../include" -fno-exceptions -fno-rtti
  35. +Mai_CXX_O=g++ -O2 -c "-I../include" -fno-exceptions -fno-rtti -fPIC
  36.  
  37.  Mai_RM_O=rm -f
  38.  Mai_AR_O=ar -rcv
  39. +Mai_SO_O=g++ -shared -o
  40.  
  41.  all : $(target)
  42.  
  43.  $(target) : $(objs)
  44.     $(Mai_RM_O) $(target)
  45. -   $(Mai_AR_O) $(target) $(objs)
  46. +   $(Mai_SO_O) $(target) $(objs)
  47.  
  48.  $(objs) : $(hs)
  49.  $(outdir)/%.o : %.cpp
  50. u /dev/null cinterface.cpp
  51. --- /dev/null   2013-09-10 18:17:46.643177700 +0200
  52. +++ cframedecoder.cpp   2013-09-10 20:54:12.993119214 +0200
  53. @@ -0,0 +1,41 @@
  54. +/*
  55. + * MaiAT3PlusCoreDecoder
  56. + * Copyright (c) 2013 ryuukazenomai <ryuukazenomai@foxmail.com>
  57. + *
  58. + * This file is part of MaiAT3PlusDecoder.
  59. + *
  60. + * MaiAT3PlusDecoder is free software; you can redistribute it and/or
  61. + * modify it under the terms of the GNU Lesser General Public
  62. + * License as published by the Free Software Foundation; either
  63. + * version 2.1 of the License, or (at your option) any later version.
  64. + *
  65. + * MaiAT3PlusDecoder is distributed in the hope that it will be useful,
  66. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  67. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  68. + * Lesser General Public License for more details.
  69. + *
  70. + * You should have received a copy of the GNU Lesser General Public
  71. + * License along with MaiAT3PlusDecoder; if not, write to the Free Software
  72. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  73. + */
  74. +#include "MaiAT3PlusFrameDecoder.h"
  75. +
  76. +extern "C" void* Atrac3plusDecoder_openContext()
  77. +{
  78. +    return new MaiAT3PlusFrameDecoder;
  79. +}
  80. +
  81. +extern "C" int Atrac3plusDecoder_closeContext(void* context)
  82. +{
  83. +    MaiAT3PlusFrameDecoder *frame_decoder =(MaiAT3PlusFrameDecoder*)context;
  84. +    if (frame_decoder)
  85. +        delete frame_decoder;
  86. +    return 0;
  87. +}
  88. +
  89. +extern "C" int Atrac3plusDecoder_decodeFrame(void* context, void* inbuf, int inbytes, int* channels, void** outbuf)
  90. +{
  91. +    MaiAT3PlusFrameDecoder *frame_decoder = (MaiAT3PlusFrameDecoder*)context;
  92. +    return frame_decoder->decodeFrame((Mai_I8*)inbuf, inbytes, channels, (Mai_I16**)outbuf);
  93. +}
  94. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement