PresetSeed.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*\
  2. |*| Copyright 2015 bill-auger <https://github.com/bill-auger/av-caster/issues>
  3. |*|
  4. |*| This file is part of the AvCaster program.
  5. |*|
  6. |*| AvCaster is free software: you can redistribute it and/or modify
  7. |*| it under the terms of the GNU Lesser General Public License version 3
  8. |*| as published by the Free Software Foundation.
  9. |*|
  10. |*| AvCaster 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 Lesser General Public License for more details.
  14. |*|
  15. |*| You should have received a copy of the GNU Lesser General Public License
  16. |*| along with AvCaster. If not, see <http://www.gnu.org/licenses/>.
  17. \*/
  18. #include "PresetSeed.h"
  19. PresetSeed::PresetSeed()
  20. {
  21. isScreencapActive = CONFIG::DEFAULT_IS_SCREENCAP_ACTIVE ;
  22. isCameraActive = CONFIG::DEFAULT_IS_CAMERA_ACTIVE ;
  23. isTextActive = CONFIG::DEFAULT_IS_TEXT_ACTIVE ;
  24. isImageActive = CONFIG::DEFAULT_IS_IMAGE_ACTIVE ;
  25. isPreviewActive = CONFIG::DEFAULT_IS_PREVIEW_ACTIVE ;
  26. isAudioActive = CONFIG::DEFAULT_IS_AUDIO_ACTIVE ;
  27. isOutputActive = CONFIG::DEFAULT_IS_OUTPUT_ACTIVE ;
  28. displayN = CONFIG::DEFAULT_DISPLAY_N ;
  29. screenN = CONFIG::DEFAULT_SCREEN_N ;
  30. screencapW = CONFIG::DEFAULT_SCREENCAP_W ;
  31. screencapH = CONFIG::DEFAULT_SCREENCAP_H ;
  32. offsetX = CONFIG::DEFAULT_OFFSET_X ;
  33. offsetY = CONFIG::DEFAULT_OFFSET_Y ;
  34. cameraDeviceIdx = CONFIG::DEFAULT_CAMERA_DEVICE_IDX ;
  35. cameraResolutionIdx = CONFIG::DEFAULT_CAMERA_RES_IDX ;
  36. audioApiIdx = CONFIG::DEFAULT_AUDIO_API_IDX ;
  37. audioDeviceIdx = CONFIG::DEFAULT_AUDIO_DEVICE_IDX ;
  38. audioCodecIdx = CONFIG::DEFAULT_AUDIO_CODEC_IDX ;
  39. nChannels = CONFIG::DEFAULT_N_CHANNELS ;
  40. samplerate = CONFIG::DEFAULT_SAMPLERATE_IDX ;
  41. audioBitrate = CONFIG::DEFAULT_AUDIO_BITRATE_IDX ;
  42. motdText = CONFIG::DEFAULT_MOTD_TEXT ;
  43. textStyleIdx = CONFIG::DEFAULT_TEXT_STYLE_IDX ;
  44. textPosIdx = CONFIG::DEFAULT_TEXT_POSITION_IDX ;
  45. imageLocation = CONFIG::DEFAULT_IMAGE_LOCATION ;
  46. muxerIdx = CONFIG::DEFAULT_OUTPUT_MUXER_IDX ;
  47. outputW = CONFIG::DEFAULT_OUTPUT_W ;
  48. outputH = CONFIG::DEFAULT_OUTPUT_H ;
  49. framerate = CONFIG::DEFAULT_FRAMERATE_IDX ;
  50. videoBitrate = CONFIG::DEFAULT_VIDEO_BITRATE_IDX ;
  51. // subclass responsibility
  52. preset = ValueTree::invalid ;
  53. presetId = Identifier::null ;
  54. presetName = String::empty ;
  55. sinkIdx = -1 ;
  56. outputDest = String::empty ;
  57. }
  58. void PresetSeed::createPreset()
  59. {
  60. preset = ValueTree(presetId) ;
  61. preset.setProperty(CONFIG::PRESET_NAME_ID , var(presetName ) , nullptr) ;
  62. preset.setProperty(CONFIG::IS_SCREENCAP_ACTIVE_ID , var(isScreencapActive ) , nullptr) ;
  63. preset.setProperty(CONFIG::IS_CAMERA_ACTIVE_ID , var(isCameraActive ) , nullptr) ;
  64. preset.setProperty(CONFIG::IS_TEXT_ACTIVE_ID , var(isTextActive ) , nullptr) ;
  65. preset.setProperty(CONFIG::IS_IMAGE_ACTIVE_ID , var(isImageActive ) , nullptr) ;
  66. preset.setProperty(CONFIG::IS_PREVIEW_ACTIVE_ID , var(isPreviewActive ) , nullptr) ;
  67. preset.setProperty(CONFIG::IS_AUDIO_ACTIVE_ID , var(isAudioActive ) , nullptr) ;
  68. preset.setProperty(CONFIG::IS_OUTPUT_ACTIVE_ID , var(isOutputActive ) , nullptr) ;
  69. preset.setProperty(CONFIG::DISPLAY_N_ID , var(displayN ) , nullptr) ;
  70. preset.setProperty(CONFIG::SCREEN_N_ID , var(screenN ) , nullptr) ;
  71. preset.setProperty(CONFIG::SCREENCAP_W_ID , var(screencapW ) , nullptr) ;
  72. preset.setProperty(CONFIG::SCREENCAP_H_ID , var(screencapH ) , nullptr) ;
  73. preset.setProperty(CONFIG::OFFSET_X_ID , var(offsetX ) , nullptr) ;
  74. preset.setProperty(CONFIG::OFFSET_Y_ID , var(offsetY ) , nullptr) ;
  75. preset.setProperty(CONFIG::CAMERA_DEVICE_ID , var(cameraDeviceIdx ) , nullptr) ;
  76. preset.setProperty(CONFIG::CAMERA_RES_ID , var(cameraResolutionIdx ) , nullptr) ;
  77. preset.setProperty(CONFIG::AUDIO_API_ID , var(audioApiIdx ) , nullptr) ;
  78. preset.setProperty(CONFIG::AUDIO_DEVICE_ID , var(audioDeviceIdx ) , nullptr) ;
  79. preset.setProperty(CONFIG::AUDIO_CODEC_ID , var(audioCodecIdx ) , nullptr) ;
  80. preset.setProperty(CONFIG::N_CHANNELS_ID , var(nChannels ) , nullptr) ;
  81. preset.setProperty(CONFIG::SAMPLERATE_ID , var(samplerate ) , nullptr) ;
  82. preset.setProperty(CONFIG::AUDIO_BITRATE_ID , var(audioBitrate ) , nullptr) ;
  83. preset.setProperty(CONFIG::MOTD_TEXT_ID , var(motdText ) , nullptr) ;
  84. preset.setProperty(CONFIG::TEXT_STYLE_ID , var(textStyleIdx ) , nullptr) ;
  85. preset.setProperty(CONFIG::TEXT_POSITION_ID , var(textPosIdx ) , nullptr) ;
  86. preset.setProperty(CONFIG::IMAGE_ID , var(imageLocation ) , nullptr) ;
  87. preset.setProperty(CONFIG::OUTPUT_SINK_ID , var(sinkIdx ) , nullptr) ;
  88. preset.setProperty(CONFIG::OUTPUT_MUXER_ID , var(muxerIdx ) , nullptr) ;
  89. preset.setProperty(CONFIG::OUTPUT_W_ID , var(outputW ) , nullptr) ;
  90. preset.setProperty(CONFIG::OUTPUT_H_ID , var(outputH ) , nullptr) ;
  91. preset.setProperty(CONFIG::FRAMERATE_ID , var(framerate ) , nullptr) ;
  92. preset.setProperty(CONFIG::VIDEO_BITRATE_ID , var(videoBitrate ) , nullptr) ;
  93. preset.setProperty(CONFIG::OUTPUT_DEST_ID , var(outputDest ) , nullptr) ;
  94. }
  95. FilePresetSeed::FilePresetSeed()
  96. {
  97. presetId = CONFIG::FilterId(CONFIG::FILE_PRESET_NAME , APP::VALID_ID_CHARS) ;
  98. presetName = CONFIG::FILE_PRESET_NAME ;
  99. sinkIdx = CONFIG::FILE_OUTPUT_IDX ;
  100. outputDest = CONFIG::DEFAULT_OUTPUT_DEST ;
  101. createPreset() ;
  102. }
  103. RtmpPresetSeed::RtmpPresetSeed()
  104. {
  105. presetId = CONFIG::FilterId(CONFIG::RTMP_PRESET_NAME , APP::VALID_ID_CHARS) ;
  106. presetName = CONFIG::RTMP_PRESET_NAME ;
  107. sinkIdx = CONFIG::RTMP_OUTPUT_IDX ;
  108. outputDest = String::empty ;
  109. createPreset() ;
  110. }
  111. LctvPresetSeed::LctvPresetSeed()
  112. {
  113. presetId = CONFIG::FilterId(CONFIG::LCTV_PRESET_NAME , APP::VALID_ID_CHARS) ;
  114. presetName = CONFIG::LCTV_PRESET_NAME ;
  115. sinkIdx = CONFIG::RTMP_OUTPUT_IDX ;
  116. outputDest = String::empty ;
  117. createPreset() ;
  118. }