Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

H264WinDecoderContext.h 2.0KB

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. #ifndef __RFB_H264WINDECODER_H__
  21. #define __RFB_H264WINDECODER_H__
  22. #include <windows.h>
  23. #include <mfidl.h>
  24. #include <mftransform.h>
  25. #include <rfb/H264DecoderContext.h>
  26. namespace rfb {
  27. class H264WinDecoderContext : public H264DecoderContext {
  28. public:
  29. H264WinDecoderContext(const Rect &r) : H264DecoderContext(r) {};
  30. ~H264WinDecoderContext() { freeCodec(); }
  31. virtual void decode(const uint8_t* h264_buffer, uint32_t len,
  32. ModifiablePixelBuffer* pb);
  33. protected:
  34. virtual bool initCodec();
  35. virtual void freeCodec();
  36. private:
  37. LONG stride;
  38. uint32_t full_width = 0;
  39. uint32_t full_height = 0;
  40. uint32_t crop_width = 0;
  41. uint32_t crop_height = 0;
  42. uint32_t offset_x = 0;
  43. uint32_t offset_y = 0;
  44. IMFTransform *decoder = NULL;
  45. IMFTransform *converter = NULL;
  46. IMFSample *input_sample = NULL;
  47. IMFSample *decoded_sample = NULL;
  48. IMFSample *converted_sample = NULL;
  49. IMFMediaBuffer *input_buffer = NULL;
  50. IMFMediaBuffer *decoded_buffer = NULL;
  51. IMFMediaBuffer *converted_buffer = NULL;
  52. void ParseSPS(const uint8_t* buffer, int length);
  53. };
  54. }
  55. #endif