<commit_before>/* ---------------------------------------------------------------------------
** This software is in the public domain, furnished "as is", without technical
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** DeviceSourceFactory.h
** 
** V4L2 live555 source 
**
** -------------------------------------------------------------------------*/

#pragma once

#include <linux/videodev2.h>

#include "DeviceSource.h"
#include "H264_V4l2DeviceSource.h"

class DeviceSourceFactory {
    public:
		static FramedSource* createFramedSource(UsageEnvironment* env, int format, DeviceInterface* devCapture, int queueSize = 5, bool useThread = true, int outfd = -1, bool repeatConfig = true) {
            FramedSource* source = NULL;
            if (format == V4L2_PIX_FMT_H264)
            {
                source = H264_V4L2DeviceSource::createNew(*env, devCapture, outfd, queueSize, useThread, repeatConfig, false);
            }
            else if (format == V4L2_PIX_FMT_HEVC)
            {
                source = H265_V4L2DeviceSource::createNew(*env, devCapture, outfd, queueSize, useThread, repeatConfig, false);
            }
            else 
            {
                source = V4L2DeviceSource::createNew(*env, devCapture, outfd, queueSize, useThread);
            }
            return source;
        }

        static StreamReplicator* createStreamReplicator(UsageEnvironment* env, int format, DeviceInterface* devCapture, int queueSize, bool useThread, int outfd = -1, bool repeatConfig = false) {
            StreamReplicator* replicator = NULL;
            FramedSource* framedSource = DeviceSourceFactory::createFramedSource(env, format, devCapture, queueSize, useThread, outfd, repeatConfig);
            if (framedSource != NULL) 
            {						
                // extend buffer size if needed
                if (devCapture->getBufferSize() > OutPacketBuffer::maxSize)
                {
                    OutPacketBuffer::maxSize = devCapture->getBufferSize();
                }						
                replicator = StreamReplicator::createNew(*env, framedSource, false);
            }
            return replicator;
        }
}; <commit_msg>add default value for createStreamReplicator<commit_after>/* ---------------------------------------------------------------------------
** This software is in the public domain, furnished "as is", without technical
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** DeviceSourceFactory.h
** 
** V4L2 live555 source 
**
** -------------------------------------------------------------------------*/

#pragma once

#include <linux/videodev2.h>

#include "DeviceSource.h"
#include "H264_V4l2DeviceSource.h"

class DeviceSourceFactory {
    public:
		static FramedSource* createFramedSource(UsageEnvironment* env, int format, DeviceInterface* devCapture, int queueSize = 5, bool useThread = true, int outfd = -1, bool repeatConfig = true) {
            FramedSource* source = NULL;
            if (format == V4L2_PIX_FMT_H264)
            {
                source = H264_V4L2DeviceSource::createNew(*env, devCapture, outfd, queueSize, useThread, repeatConfig, false);
            }
            else if (format == V4L2_PIX_FMT_HEVC)
            {
                source = H265_V4L2DeviceSource::createNew(*env, devCapture, outfd, queueSize, useThread, repeatConfig, false);
            }
            else 
            {
                source = V4L2DeviceSource::createNew(*env, devCapture, outfd, queueSize, useThread);
            }
            return source;
        }

        static StreamReplicator* createStreamReplicator(UsageEnvironment* env, int format, DeviceInterface* devCapture, int queueSize = 5, bool useThread = true, int outfd = -1, bool repeatConfig = true) {
            StreamReplicator* replicator = NULL;
            FramedSource* framedSource = DeviceSourceFactory::createFramedSource(env, format, devCapture, queueSize, useThread, outfd, repeatConfig);
            if (framedSource != NULL) 
            {						
                // extend buffer size if needed
                if (devCapture->getBufferSize() > OutPacketBuffer::maxSize)
                {
                    OutPacketBuffer::maxSize = devCapture->getBufferSize();
                }						
                replicator = StreamReplicator::createNew(*env, framedSource, false);
            }
            return replicator;
        }
}; 
{'fraction_non_alphanumeric': 0.15261401557285872, 'fraction_numerical': 0.014905450500556174, 'mean_word_length': 1.9481967213114755, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6405479', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1143, 'n_words': 300}