AviCompressionOptions.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //------------------------------------------------------------------------------
  2. // Basler pylon SDK
  3. // Copyright (c) 2011-2021 Basler AG
  4. // http://www.baslerweb.com
  5. // Author: AG
  6. //------------------------------------------------------------------------------
  7. /*!
  8. \file
  9. \brief Contains compression options declaration for the AviWriter class.
  10. */
  11. #ifndef INCLUDED_AVICOMPRESSIONOPTIONS_H_6841242
  12. #define INCLUDED_AVICOMPRESSIONOPTIONS_H_6841242
  13. #include <pylon/Platform.h>
  14. #include <pylon/stdinclude.h>
  15. #ifdef PYLON_WIN_BUILD
  16. #ifdef _MSC_VER
  17. #pragma warning( push )
  18. #pragma warning( disable : 4201 ) // warning C4201: nonstandard extension used : nameless struct/union
  19. #endif
  20. #include <vfw.h>
  21. #ifdef _MSC_VER
  22. #pragma warning( pop )
  23. #endif
  24. #ifdef _MSC_VER
  25. # pragma pack(push, PYLON_PACKING)
  26. #endif /* _MSC_VER */
  27. namespace Pylon
  28. {
  29. /** \addtogroup Pylon_ImageHandlingSupport
  30. * @{
  31. */
  32. ///Wraps the AVI compression options of the Video for Window API
  33. struct SAviCompressionOptions
  34. {
  35. /*!
  36. \brief Create the compression options structure.
  37. To use compression set up the AVICOMPRESSOPTIONS structure.
  38. You can use the dialog provided by the Video for Windows API to do this by setting \c optionalShowDialog to true.
  39. Alternatively, fill the AVICOMPRESSOPTIONS structure with the four character code identifying the codec
  40. and the parameter settings of the codec.
  41. For more information, see the MSDN documentation of the Video for Windows API and the documentation of the codec you are using.
  42. \param[in] optionalShowDialog Optionally show the Compression Options dialog box.
  43. The dialog allows to set the compression parameters.
  44. See the Video for Windows API AviSaveOptions() MSDN documentation.
  45. \param[in] optionalHParentWindow Optional handle to the parent window for the Compression Options dialog box.
  46. See the Video for Windows API AviSaveOptions() MSDN documentation.
  47. */
  48. SAviCompressionOptions( bool optionalShowDialog = false, HWND optionalHParentWindow = NULL )
  49. : hParentWindow( optionalHParentWindow )
  50. , showDialog( optionalShowDialog )
  51. , userDialogReturnOk( false )
  52. , autoKeyFrameInsertionRate( 20 )
  53. {
  54. ::ZeroMemory( &compressionOptions, sizeof( compressionOptions ) );
  55. }
  56. /*!
  57. \brief Create the compression options structure. Preset some compression options.
  58. To use compression set up the AVICOMPRESSOPTIONS structure.
  59. You can use the dialog provided by the Video for Windows API to do this by setting \c optionalShowDialog to true.
  60. Alternatively, fill the AVICOMPRESSOPTIONS structure with the four character code identifying the codec
  61. and the parameter settings of the codec.
  62. For more information, see the MSDN documentation of the Video for Windows API and the documentation of the codec you are using.
  63. \param[in] fourCharacterCode The four character code identifying the codec to use for compression.
  64. \param[in] optionalShowDialog Optionally show the Compression Options dialog box.
  65. The dialog allows to set the compression parameters.
  66. See the Video for Windows API AviSaveOptions() MSDN documentation.
  67. \param[in] optionalHParentWindow Optional handle to the parent window for the Compression Options dialog box.
  68. See the Video for Windows API AviSaveOptions() MSDN documentation.
  69. */
  70. SAviCompressionOptions( const char* fourCharacterCode, bool optionalShowDialog = false, HWND optionalHParentWindow = NULL )
  71. : hParentWindow( optionalHParentWindow )
  72. , showDialog( optionalShowDialog )
  73. , userDialogReturnOk( false )
  74. , autoKeyFrameInsertionRate( 20 )
  75. {
  76. ::ZeroMemory( &compressionOptions, sizeof( compressionOptions ) );
  77. //Set compression.
  78. compressionOptions.dwFlags = AVICOMPRESSF_VALID;
  79. //Handle the case if the code passes has fewer than four characters.
  80. String_t fourCharacterCodeLocal( fourCharacterCode );
  81. fourCharacterCodeLocal += " ";
  82. fourCharacterCodeLocal.resize( 4 );
  83. //Set four character code.
  84. compressionOptions.fccHandler = mmioFOURCC( fourCharacterCodeLocal[0], fourCharacterCodeLocal[1], fourCharacterCodeLocal[2], fourCharacterCodeLocal[3] );
  85. }
  86. HWND hParentWindow; ///< Optional handle to the parent window for the Compression Options dialog box. See the Video for Windows API AviSaveOptions() MSDN documentation.
  87. bool showDialog; ///< Optionally show Compression Options dialog box. See the Video for Windows API AviSaveOptions() MSDN documentation.
  88. bool userDialogReturnOk; ///< Is set to true in the call to the CAviWriter::Open() method if the user pressed OK in the dialog. The compression is not set up if cancel has been pressed.
  89. LONG autoKeyFrameInsertionRate; ///< Indicates to insert a key frame every nth image when KeyFrameSelection_Auto is used.
  90. AVICOMPRESSOPTIONS compressionOptions; ///< The AVICOMPRESSOPTIONS structure needs to be set up with the four character code identifying the codec and the parameter settings of the codec.
  91. ///< For more information, see the MSDN documentation of the Video for Windows API and the documentation of the codec you are using.
  92. };
  93. /**
  94. * @}
  95. */
  96. }
  97. #else
  98. //No AVI support for Linux.
  99. #endif
  100. #ifdef _MSC_VER
  101. # pragma pack(pop)
  102. #endif /* _MSC_VER */
  103. #endif /* INCLUDED_AVICOMPRESSIONOPTIONS_H_6841242 */