Merge branch 'fix-recording-swf-disabled' of https://github.com/riadvice/bigbluebutton into riadvice-fix-recording-swf-disabled

This commit is contained in:
Richard Alam 2019-06-07 09:14:11 -07:00
commit 19caf3a386
3 changed files with 48 additions and 8 deletions

View File

@ -34,6 +34,7 @@ import org.bigbluebutton.presentation.FileTypeConstants;
import org.bigbluebutton.presentation.ImageResizer;
import org.bigbluebutton.presentation.ImageToSwfSlide;
import org.bigbluebutton.presentation.PageConverter;
import org.bigbluebutton.presentation.PngCreator;
import org.bigbluebutton.presentation.SvgImageCreator;
import org.bigbluebutton.presentation.TextFileCreator;
import org.bigbluebutton.presentation.ThumbnailCreator;
@ -52,10 +53,14 @@ public class ImageToSwfSlidesGenerationService {
private SvgImageCreator svgImageCreator;
private ThumbnailCreator thumbnailCreator;
private TextFileCreator textFileCreator;
private PngCreator pngCreator;
private ImageResizer imageResizer;
private Long maxImageSize;
private long MAX_CONVERSION_TIME = 5*60*1000L;
private String BLANK_SLIDE;
private boolean swfSlidesRequired;
private boolean svgImagesRequired;
private boolean generatePngs;
public ImageToSwfSlidesGenerationService() {
int numThreads = Runtime.getRuntime().availableProcessors();
@ -65,15 +70,24 @@ public class ImageToSwfSlidesGenerationService {
public void generateSlides(UploadedPresentation pres) {
pres.setNumberOfPages(1); // There should be only one image to convert.
if (pres.getNumberOfPages() > 0) {
PageConverter pageConverter = determinePageConverter(pres);
convertImageToSwf(pres, pageConverter);
}
if (swfSlidesRequired) {
if (pres.getNumberOfPages() > 0) {
PageConverter pageConverter = determinePageConverter(pres);
convertImageToSwf(pres, pageConverter);
}
}
/* adding accessibility */
createTextFiles(pres);
createThumbnails(pres);
createSvgImages(pres);
if (svgImagesRequired) {
createSvgImages(pres);
}
if (generatePngs) {
createPngImages(pres);
}
notifier.sendConversionCompletedMessage(pres);
}
@ -105,6 +119,10 @@ public class ImageToSwfSlidesGenerationService {
svgImageCreator.createSvgImages(pres);
}
private void createPngImages(UploadedPresentation pres) {
pngCreator.createPng(pres);
}
private void convertImageToSwf(UploadedPresentation pres, PageConverter pageConverter) {
int numPages = pres.getNumberOfPages();
// A better implementation is described at the link below
@ -178,7 +196,7 @@ public class ImageToSwfSlidesGenerationService {
});
}
}
public void setJpgPageConverter(PageConverter converter) {
this.jpgToSwfConverter = converter;
}
@ -194,14 +212,31 @@ public class ImageToSwfSlidesGenerationService {
public void setThumbnailCreator(ThumbnailCreator thumbnailCreator) {
this.thumbnailCreator = thumbnailCreator;
}
public void setTextFileCreator(TextFileCreator textFileCreator) {
this.textFileCreator = textFileCreator;
}
public void setPngCreator(PngCreator pngCreator) {
this.pngCreator = pngCreator;
}
public void setSvgImageCreator(SvgImageCreator svgImageCreator) {
this.svgImageCreator = svgImageCreator;
}
public void setGeneratePngs(boolean generatePngs) {
this.generatePngs = generatePngs;
}
public void setSwfSlidesRequired(boolean swf) {
this.swfSlidesRequired = swf;
}
public void setSvgImagesRequired(boolean svg) {
this.svgImagesRequired = svg;
}
public void setMaxConversionTime(int minutes) {
MAX_CONVERSION_TIME = minutes * 60 * 1000L;
}

View File

@ -50,7 +50,7 @@ public class PdfToSwfSlidesGenerationService {
private PageConverter pdfToSwfConverter;
private ExecutorService executor;
private ThumbnailCreator thumbnailCreator;
private PngCreator pngCreator;
private PngCreator pngCreator;
private TextFileCreator textFileCreator;
private SvgImageCreator svgImageCreator;
@ -71,9 +71,10 @@ public class PdfToSwfSlidesGenerationService {
// Only create SWF files if the configuration requires it
if (swfSlidesRequired) {
convertPdfToSwf(pres);
createThumbnails(pres);
}
/* adding accessibility */
createThumbnails(pres);
createTextFiles(pres);
// only create SVG images if the configuration requires it

View File

@ -110,12 +110,16 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="jpgPageConverter" ref="jpg2SwfConverter"/>
<property name="svgImageCreator" ref="svgImageCreator"/>
<property name="thumbnailCreator" ref="thumbCreator"/>
<property name="pngCreator" ref="pngCreator"/>
<property name="textFileCreator" ref="textFileCreator"/>
<property name="blankSlide" value="${BLANK_SLIDE}"/>
<property name="maxConversionTime" value="${maxConversionTime}"/>
<property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/>
<property name="imageResizer" ref="imageResizer"/>
<property name="maxImageSize" value="${maxImageSize}"/>
<property name="swfSlidesRequired" value="${swfSlidesRequired}"/>
<property name="svgImagesRequired" value="${svgImagesRequired}"/>
<property name="generatePngs" value="${generatePngs}"/>
</bean>
<bean id="swfSlidesGenerationProgressNotifier"