您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

H264DecoderContext.cxx 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* Copyright (C) 2021 Vladimir Sukhonosov <xornet@xornet.org>
  2. * Copyright (C) 2021 Martins Mozeiko <martins.mozeiko@gmail.com>
  3. * All Rights Reserved.
  4. *
  5. * This is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this software; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  18. * USA.
  19. */
  20. #include <os/Mutex.h>
  21. #include <rfb/Exception.h>
  22. #include <rfb/LogWriter.h>
  23. #include <rfb/H264DecoderContext.h>
  24. #ifdef H264_LIBAV
  25. #include <rfb/H264LibavDecoderContext.h>
  26. #define H264DecoderContextType H264LibavDecoderContext
  27. #elif H264_WIN
  28. #include <rfb/H264WinDecoderContext.h>
  29. #define H264DecoderContextType H264WinDecoderContext
  30. #endif
  31. using namespace rfb;
  32. static LogWriter vlog("H264DecoderContext");
  33. H264DecoderContext *H264DecoderContext::createContext(const Rect &r)
  34. {
  35. H264DecoderContext *ret = new H264DecoderContextType(r);
  36. if (!ret->initCodec())
  37. {
  38. throw Exception("H264DecoderContext: Unable to create context");
  39. }
  40. return ret;
  41. }
  42. H264DecoderContext::~H264DecoderContext()
  43. {
  44. }
  45. bool H264DecoderContext::isReady()
  46. {
  47. os::AutoMutex lock(&mutex);
  48. return initialized;
  49. }
  50. void H264DecoderContext::reset()
  51. {
  52. freeCodec();
  53. initCodec();
  54. }