obs-qsv11-plugin-main.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. This file is provided under a dual BSD/GPLv2 license. When using or
  3. redistributing this file, you may do so under either license.
  4. GPL LICENSE SUMMARY
  5. Copyright(c) Oct. 2015 Intel Corporation.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of version 2 of the GNU General Public License as
  8. published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. Contact Information:
  14. Seung-Woo Kim, [email protected]
  15. 705 5th Ave S #500, Seattle, WA 98104
  16. BSD LICENSE
  17. Copyright(c) <date> Intel Corporation.
  18. Redistribution and use in source and binary forms, with or without
  19. modification, are permitted provided that the following conditions
  20. are met:
  21. * Redistributions of source code must retain the above copyright
  22. notice, this list of conditions and the following disclaimer.
  23. * Redistributions in binary form must reproduce the above copyright
  24. notice, this list of conditions and the following disclaimer in
  25. the documentation and/or other materials provided with the
  26. distribution.
  27. * Neither the name of Intel Corporation nor the names of its
  28. contributors may be used to endorse or promote products derived
  29. from this software without specific prior written permission.
  30. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  33. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  35. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  36. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  37. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  38. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  39. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  40. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  41. */
  42. #include <obs-module.h>
  43. #include "mfxsession.h"
  44. OBS_DECLARE_MODULE()
  45. OBS_MODULE_USE_DEFAULT_LOCALE("obs-qsv11", "en-US")
  46. MODULE_EXPORT const char *obs_module_description(void)
  47. {
  48. return "Intel Quick Sync Video H.264 encoder support for Windows";
  49. }
  50. extern struct obs_encoder_info obs_qsv_encoder;
  51. extern struct obs_encoder_info obs_qsv_encoder_tex;
  52. bool obs_module_load(void)
  53. {
  54. mfxIMPL impl = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D11;
  55. mfxVersion ver = {{0, 1}};
  56. mfxSession session;
  57. mfxStatus sts;
  58. sts = MFXInit(impl, &ver, &session);
  59. if (sts == MFX_ERR_NONE) {
  60. obs_register_encoder(&obs_qsv_encoder);
  61. obs_register_encoder(&obs_qsv_encoder_tex);
  62. MFXClose(session);
  63. } else {
  64. impl = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D9;
  65. sts = MFXInit(impl, &ver, &session);
  66. if (sts == MFX_ERR_NONE) {
  67. obs_register_encoder(&obs_qsv_encoder);
  68. MFXClose(session);
  69. }
  70. }
  71. return true;
  72. }