mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	correct CodeQL problems
This commit is contained in:
		
							
								
								
									
										34
									
								
								.github/workflows/dnf.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								.github/workflows/dnf.yml
									
									
									
									
										vendored
									
									
								
							@@ -81,17 +81,22 @@ jobs:
 | 
			
		||||
      - name: 👷 Build
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: |
 | 
			
		||||
          DISTRIBUTION=$(echo '${{ matrix.os.distribution }}' | tr '[:upper:]' '[:lower:]')
 | 
			
		||||
          mkdir -p "${GITHUB_WORKSPACE}/deploy"
 | 
			
		||||
          docker run --rm --platform=${{ matrix.architecture[1] }} \
 | 
			
		||||
            -w "/root" \
 | 
			
		||||
            -v "${GITHUB_WORKSPACE}/deploy:/deploy" \
 | 
			
		||||
            -v "${GITHUB_WORKSPACE}:/root/hyperion.ng:rw" \
 | 
			
		||||
            ghcr.io/${{ env.ghcr }}/${DISTRIBUTION}:${{ matrix.os.version }} \
 | 
			
		||||
            /bin/bash -c "tar -czf rpmbuild/SOURCES/hyperion.ng.tar.gz hyperion.ng/ && \
 | 
			
		||||
            cp -f hyperion.ng/rpmbuild/hyperion.spec.in rpmbuild/SPECS/hyperion.spec && \
 | 
			
		||||
            rpmbuild -ba --define '_version ${{ env.VERSION }}' rpmbuild/SPECS/hyperion.spec --clean && \
 | 
			
		||||
            cp -fv rpmbuild/RPMS/$(uname -m)/hyperion* /deploy"
 | 
			
		||||
          echo '::group::Set distribution name to lower case'
 | 
			
		||||
            DISTRIBUTION=$(echo '${{ matrix.os.distribution }}' | tr '[:upper:]' '[:lower:]')
 | 
			
		||||
          echo '::endgroup::'
 | 
			
		||||
 | 
			
		||||
          echo '::group::Building Hyperion'
 | 
			
		||||
            mkdir -p "${GITHUB_WORKSPACE}/deploy"
 | 
			
		||||
            docker run --rm --platform=${{ matrix.architecture[1] }} \
 | 
			
		||||
              -w "/root" \
 | 
			
		||||
              -v "${GITHUB_WORKSPACE}/deploy:/deploy" \
 | 
			
		||||
              -v "${GITHUB_WORKSPACE}:/root/hyperion.ng:rw" \
 | 
			
		||||
              ghcr.io/${{ env.ghcr }}/${DISTRIBUTION}:${{ matrix.os.version }} \
 | 
			
		||||
              /bin/bash -c "tar -czf rpmbuild/SOURCES/hyperion.ng.tar.gz hyperion.ng/ && \
 | 
			
		||||
              cp -f hyperion.ng/rpmbuild/hyperion.spec.in rpmbuild/SPECS/hyperion.spec && \
 | 
			
		||||
              rpmbuild -ba --define '_version ${{ env.VERSION }}' rpmbuild/SPECS/hyperion.spec --clean && \
 | 
			
		||||
              cp -fv rpmbuild/RPMS/$(uname -m)/hyperion* /deploy"
 | 
			
		||||
          echo '::endgroup::'
 | 
			
		||||
        env:
 | 
			
		||||
          ACTOR: "Hyperion Project <admin@hyperion-project.org>"
 | 
			
		||||
          COMMIT_MESSAGE: ${{ github.event.commits[0].message }}
 | 
			
		||||
@@ -143,17 +148,18 @@ jobs:
 | 
			
		||||
            declare -A distArray=([fc]=fedora [el]=rhel)
 | 
			
		||||
            for file in artifact/hyperion-*.rpm; do
 | 
			
		||||
              if [ -f "$file" ]; then
 | 
			
		||||
                dist_ver_arch=${file##*0.}
 | 
			
		||||
                dist_ver_arch=$(basename -- "$file")
 | 
			
		||||
                dist_ver_arch=${dist_ver_arch%.*}
 | 
			
		||||
                dist_ver=${dist_ver_arch%.*}
 | 
			
		||||
                dist_ver=${dist_ver##*.}
 | 
			
		||||
                [ -z "${dist_ver:0:2}" ] && continue
 | 
			
		||||
                rpm=rpm/${distArray[${dist_ver:0:2}]}/${dist_ver:2}/${dist_ver_arch#*.}
 | 
			
		||||
                rpm=rpm/${distArray[${dist_ver:0:2}]}/${dist_ver:2}/${dist_ver_arch##*.}
 | 
			
		||||
                mkdir -p $rpm/ && cp $file $rpm/
 | 
			
		||||
                rpm --define "_gpg_name ${{ steps.import_gpg.outputs.keyid }}" --addsign $rpm/*.rpm
 | 
			
		||||
                rpm --checksig $rpm/*.rpm
 | 
			
		||||
                createrepo $rpm/
 | 
			
		||||
                gpg --yes --detach-sign --armor $rpm/repodata/repomd.xml
 | 
			
		||||
                sed -r "s/@CHANNEL@/${channel}/g; s/@DIST@/${distArray[${dist_ver:0:2}]}/g; s/@ARCH@/${dist_ver_arch#*.}/g" ${GITHUB_WORKSPACE}/rpmbuild/hyperion.repo.in > rpm/${distArray[${dist_ver:0:2}]}/hyperion.repo
 | 
			
		||||
                sed -r "s/@CHANNEL@/${channel}/g; s/@DIST@/${distArray[${dist_ver:0:2}]}/g; s/@ARCH@/${dist_ver_arch##*.}/g" ${GITHUB_WORKSPACE}/rpmbuild/hyperion.repo.in > rpm/${distArray[${dist_ver:0:2}]}/hyperion.repo
 | 
			
		||||
              fi
 | 
			
		||||
            done
 | 
			
		||||
          echo '::endgroup::'
 | 
			
		||||
 
 | 
			
		||||
@@ -26,17 +26,6 @@
 | 
			
		||||
    <release version="2.0.14" date="2022-11-27" />
 | 
			
		||||
    <release version="2.0.13" date="2022-05-22" />
 | 
			
		||||
    <release version="2.0.12" date="2021-11-21" />
 | 
			
		||||
    <release version="2.0.0-alpha.11" date="2021-10-06" />
 | 
			
		||||
    <release version="2.0.0-alpha.10" date="2021-07-18" />
 | 
			
		||||
    <release version="2.0.0-alpha.9" date="2020-11-19" />
 | 
			
		||||
    <release version="2.0.0-alpha.8" date="2020-09-15" />
 | 
			
		||||
    <release version="2.0.0-alpha.7" date="2020-07-24" />
 | 
			
		||||
    <release version="2.0.0-alpha.6" date="2020-05-28" />
 | 
			
		||||
    <release version="2.0.0-alpha.5" date="2020-04-17" />
 | 
			
		||||
    <release version="2.0.0-alpha.4" date="2020-03-27" />
 | 
			
		||||
    <release version="2.0.0-alpha.3" date="2020-03-01" />
 | 
			
		||||
    <release version="2.0.0-alpha.2" date="2020-02-20" />
 | 
			
		||||
    <release version="2.0.0-alpha.1" date="2020-02-16" />
 | 
			
		||||
  </releases>
 | 
			
		||||
 | 
			
		||||
  <screenshots>
 | 
			
		||||
 
 | 
			
		||||
@@ -136,11 +136,11 @@ class EncoderThreadManager : public QObject
 | 
			
		||||
public:
 | 
			
		||||
	explicit EncoderThreadManager(QObject *parent = nullptr)
 | 
			
		||||
		: QObject(parent)
 | 
			
		||||
		, _threadCount(static_cast<unsigned long>(qMax(QThread::idealThreadCount(), DEFAULT_THREAD_COUNT)))
 | 
			
		||||
		, _threadCount(qMax(QThread::idealThreadCount(), DEFAULT_THREAD_COUNT))
 | 
			
		||||
		, _threads(nullptr)
 | 
			
		||||
	{
 | 
			
		||||
		_threads = new Thread<EncoderThread>*[_threadCount];
 | 
			
		||||
		for (unsigned long i = 0; i < _threadCount; i++)
 | 
			
		||||
		for (int i = 0; i < _threadCount; i++)
 | 
			
		||||
		{
 | 
			
		||||
			_threads[i] = new Thread<EncoderThread>(new EncoderThread, this);
 | 
			
		||||
			_threads[i]->setObjectName("Encoder " + QString::number(i));
 | 
			
		||||
@@ -151,7 +151,7 @@ public:
 | 
			
		||||
	{
 | 
			
		||||
		if (_threads != nullptr)
 | 
			
		||||
		{
 | 
			
		||||
			for(unsigned long  i = 0; i < _threadCount; i++)
 | 
			
		||||
			for(int i = 0; i < _threadCount; i++)
 | 
			
		||||
			{
 | 
			
		||||
				_threads[i]->deleteLater();
 | 
			
		||||
				_threads[i] = nullptr;
 | 
			
		||||
@@ -165,18 +165,18 @@ public:
 | 
			
		||||
	void start()
 | 
			
		||||
	{
 | 
			
		||||
		if (_threads != nullptr)
 | 
			
		||||
			for (unsigned long  i = 0; i < _threadCount; i++)
 | 
			
		||||
			for (int i = 0; i < _threadCount; i++)
 | 
			
		||||
				connect(_threads[i]->thread(), &EncoderThread::newFrame, this, &EncoderThreadManager::newFrame);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void stop()
 | 
			
		||||
	{
 | 
			
		||||
		if (_threads != nullptr)
 | 
			
		||||
			for(unsigned long  i = 0; i < _threadCount; i++)
 | 
			
		||||
			for(int  i = 0; i < _threadCount; i++)
 | 
			
		||||
				disconnect(_threads[i]->thread(), nullptr, nullptr, nullptr);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	unsigned long _threadCount;
 | 
			
		||||
	int _threadCount;
 | 
			
		||||
	Thread<EncoderThread>**	_threads;
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
 
 | 
			
		||||
@@ -209,11 +209,6 @@ bool AudioGrabberLinux::start()
 | 
			
		||||
	_isRunning.store(true, std::memory_order_release);
 | 
			
		||||
 | 
			
		||||
	pthread_attr_t threadAttributes;
 | 
			
		||||
	// int threadPriority = 1;
 | 
			
		||||
 | 
			
		||||
	// sched_param schedulerParameter;
 | 
			
		||||
	// schedulerParameter.sched_priority = threadPriority;
 | 
			
		||||
 | 
			
		||||
	if (pthread_attr_init(&threadAttributes) != 0)
 | 
			
		||||
	{
 | 
			
		||||
		Debug(_log, "Failed to create thread attributes");
 | 
			
		||||
 
 | 
			
		||||
@@ -1018,7 +1018,7 @@ bool V4L2Grabber::process_image(const void *p, int size)
 | 
			
		||||
	}
 | 
			
		||||
	else if (_threadManager != nullptr)
 | 
			
		||||
	{
 | 
			
		||||
		for (unsigned long i = 0; i < _threadManager->_threadCount; i++)
 | 
			
		||||
		for (int i = 0; i < _threadManager->_threadCount; i++)
 | 
			
		||||
		{
 | 
			
		||||
			if (!_threadManager->_threads[i]->isBusy())
 | 
			
		||||
			{
 | 
			
		||||
@@ -1290,11 +1290,11 @@ QJsonArray V4L2Grabber::discover(const QJsonObject& params)
 | 
			
		||||
					format["format"] = pixelFormatToString(encodingFormat);
 | 
			
		||||
 | 
			
		||||
					QMap<std::pair<int, int>, QSet<int>> combined = QMap<std::pair<int, int>, QSet<int>>();
 | 
			
		||||
					for (auto enc : input.value().encodingFormats.values(encodingFormat))
 | 
			
		||||
					for (const auto &enc : input.value().encodingFormats.values(encodingFormat))
 | 
			
		||||
					{
 | 
			
		||||
						std::pair<int, int> width_height{enc.width, enc.height};
 | 
			
		||||
						auto &com = combined[width_height];
 | 
			
		||||
						for (auto framerate : qAsConst(enc.framerates))
 | 
			
		||||
						for (auto framerate : enc.framerates)
 | 
			
		||||
						{
 | 
			
		||||
							com.insert(framerate);
 | 
			
		||||
						}
 | 
			
		||||
@@ -1326,7 +1326,7 @@ QJsonArray V4L2Grabber::discover(const QJsonObject& params)
 | 
			
		||||
			device["video_inputs"] = video_inputs;
 | 
			
		||||
 | 
			
		||||
			QJsonObject controls, controls_default;
 | 
			
		||||
			for (const auto &control : qAsConst(_deviceControls[device_property.key()]))
 | 
			
		||||
			for (const auto &control :  std::as_const(_deviceControls[device_property.key()]))
 | 
			
		||||
			{
 | 
			
		||||
				QJsonObject property;
 | 
			
		||||
				property["minValue"] = control.minValue;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user