Compare commits
84 Commits
Author | SHA1 | Date |
---|---|---|
|
e9322f114d | 1 month ago |
|
2198200366 | 2 months ago |
|
636d57edb6 | 2 months ago |
|
acae85b2af | 2 months ago |
|
ce808915ed | 2 months ago |
|
ef86de3922 | 2 months ago |
|
890cdbe5ae | 2 months ago |
|
44ea524f72 | 2 months ago |
|
604fb52ade | 2 months ago |
|
7b4909d98f | 2 months ago |
|
21796e146d | 3 months ago |
|
eafa8d6931 | 3 months ago |
|
5a938d8e51 | 3 months ago |
|
2ac76dbc08 | 3 months ago |
|
80ddc6c4ea | 3 months ago |
|
95caddff15 | 3 months ago |
|
aff10d0819 | 3 months ago |
|
031dae8d5d | 3 months ago |
|
9e6a6af309 | 3 months ago |
|
42c1881a61 | 3 months ago |
|
63ccf0df52 | 3 months ago |
|
d390f12567 | 3 months ago |
|
7a04a01631 | 3 months ago |
|
508a3de19f | 3 months ago |
|
5cf22b4716 | 4 months ago |
|
7f91dbe3fb | 4 months ago |
|
be53549c4b | 4 months ago |
|
e2ad168d6c | 4 months ago |
|
0645e3cfe8 | 5 months ago |
|
14d25e42f1 | 5 months ago |
|
d4ae60fdf7 | 6 months ago |
|
3320b9173a | 6 months ago |
|
b12cf350dc | 7 months ago |
|
bfdd34d45b | 7 months ago |
|
0b4247c538 | 11 months ago |
|
f729b00645 | 11 months ago |
|
202c1fa9a2 | 11 months ago |
|
3ab0401f8e | 11 months ago |
|
462cf630bd | 11 months ago |
|
3f5a1f1a39 | 11 months ago |
|
e6cb11d4b9 | 11 months ago |
|
8d75e1743e | 1 year ago |
|
77d2ca07d9 | 1 year ago |
|
5d10ef4729 | 1 year ago |
|
8c89c6e12e | 1 year ago |
|
1ee9496eff | 1 year ago |
|
75c0088925 | 1 year ago |
|
f145b7a53b | 1 year ago |
|
adec94cc86 | 1 year ago |
|
43b1cb39e9 | 1 year ago |
|
789c47ab5a | 1 year ago |
|
646387575a | 1 year ago |
|
07e7201d5a | 1 year ago |
|
7dee1b863c | 1 year ago |
|
0ecdc522ea | 1 year ago |
|
3b5bb10b5d | 1 year ago |
|
bff93b99e3 | 1 year ago |
|
59a242eda4 | 1 year ago |
|
cb9a64b395 | 1 year ago |
|
9029be33c5 | 2 years ago |
|
3e14254a5c | 2 years ago |
|
6d37dce4ef | 2 years ago |
|
f409ac3a1c | 2 years ago |
|
6b7e20131d | 2 years ago |
|
9af7e4ff34 | 2 years ago |
|
4767fb1cc8 | 2 years ago |
|
c0f06018ae | 2 years ago |
|
a80b4cf202 | 2 years ago |
|
a38262b88e | 2 years ago |
|
dc3c7d8802 | 2 years ago |
|
2a360ab574 | 2 years ago |
|
eaeda29aec | 2 years ago |
|
0165defff3 | 2 years ago |
|
cdbc3a6b85 | 2 years ago |
|
70ce4d562b | 2 years ago |
|
a5c0762671 | 2 years ago |
|
e92e7b41f6 | 2 years ago |
|
9d725ecf6c | 2 years ago |
|
081a550130 | 2 years ago |
|
30a0531776 | 2 years ago |
|
631f43cdcf | 2 years ago |
|
233b631fc4 | 2 years ago |
|
7628fa4711 | 2 years ago |
|
59cfcf6f32 | 2 years ago |
@ -1,11 +1,17 @@
|
||||
linux_docker_builder:
|
||||
script: docker build -t $CIRRUS_REPO_FULL_NAME:cirrus-linux . -f Dockerfile
|
||||
script: docker build -t $CIRRUS_REPO_FULL_NAME:cirrus-linux .
|
||||
|
||||
linuxarmv7_docker_builder:
|
||||
script: docker build -t $CIRRUS_REPO_FULL_NAME:cirrus-rpi . -f Dockerfile.rpi
|
||||
script: |
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
docker build -t $CIRRUS_REPO_FULL_NAME:cirrus-armv7 . --build-arg IMAGE=balenalib/raspberry-pi2
|
||||
|
||||
linuxarmv6_docker_builder:
|
||||
script: docker build -t $CIRRUS_REPO_FULL_NAME:cirrus-armv6 . -f Dockerfile.rpi --build-arg ARCH=armv6l
|
||||
script: |
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
docker build -t $CIRRUS_REPO_FULL_NAME:cirrus-armv6 . --build-arg IMAGE=balenalib/raspberry-pi
|
||||
|
||||
linuxarm64_docker_builder:
|
||||
script: docker build -t $CIRRUS_REPO_FULL_NAME:cirrus-arm64 . -f Dockerfile.arm64
|
||||
script: |
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
docker build -t $CIRRUS_REPO_FULL_NAME:cirrus-arm64 . --build-arg IMAGE=arm64v8/ubuntu:24.04
|
||||
|
@ -0,0 +1,11 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
@ -0,0 +1,38 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# This workflow checks out code, builds an image, performs a container image
|
||||
# scan with Anchore's Syft tool, and uploads the results to the GitHub Dependency
|
||||
# submission API.
|
||||
|
||||
# For more information on the Anchore sbom-action usage
|
||||
# and parameters, see https://github.com/anchore/sbom-action. For more
|
||||
# information about the Anchore SBOM tool, Syft, see
|
||||
# https://github.com/anchore/syft
|
||||
name: Anchore Syft SBOM scan
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
Anchore-Build-Scan:
|
||||
permissions:
|
||||
contents: write # required to upload to the Dependency submission API
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v4
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag localbuild/testimage:latest
|
||||
- name: Scan the image and upload dependency results
|
||||
uses: anchore/sbom-action@v0
|
||||
with:
|
||||
image: "localbuild/testimage:latest"
|
||||
artifact-name: image.spdx.json
|
||||
dependency-snapshot: true
|
@ -0,0 +1,14 @@
|
||||
name: ORT
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
ort:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Use HTTPS instead of SSH for Git cloning
|
||||
run: git config --global url.https://github.com/.insteadOf ssh://git@github.com/
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v3
|
||||
- name: Run GitHub Action for ORT
|
||||
uses: oss-review-toolkit/ort-ci-github-action@main
|
@ -0,0 +1,72 @@
|
||||
# This workflow uses actions that are not certified by GitHub. They are provided
|
||||
# by a third-party and are governed by separate terms of service, privacy
|
||||
# policy, and support documentation.
|
||||
|
||||
name: Scorecard supply-chain security
|
||||
on:
|
||||
# For Branch-Protection check. Only the default branch is supported. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||
branch_protection_rule:
|
||||
# To guarantee Maintained check is occasionally updated. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||
schedule:
|
||||
- cron: '26 13 * * 0'
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
name: Scorecard analysis
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
# Needed to publish results and get a badge (see publish_results below).
|
||||
id-token: write
|
||||
# Uncomment the permissions below if installing in a private repository.
|
||||
# contents: read
|
||||
# actions: read
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
|
||||
# - you want to enable the Branch-Protection check on a *public* repository, or
|
||||
# - you are installing Scorecard on a *private* repository
|
||||
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
|
||||
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
|
||||
|
||||
# Public repositories:
|
||||
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||
# - Allows the repository to include the Scorecard badge.
|
||||
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||
# For private repositories:
|
||||
# - `publish_results` will always be set to `false`, regardless
|
||||
# of the value entered here.
|
||||
publish_results: false
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
|
||||
with:
|
||||
sarif_file: results.sarif
|
@ -1,6 +1,4 @@
|
||||
[submodule "v4l2wrapper"]
|
||||
path = libv4l2cpp
|
||||
url = https://github.com/mpromonet/v4l2wrapper
|
||||
[submodule "hls.js"]
|
||||
path = hls.js
|
||||
url = https://github.com/video-dev/hls.js
|
||||
|
||||
|
@ -1,19 +1,22 @@
|
||||
FROM ubuntu:20.04 as builder
|
||||
ARG IMAGE=ubuntu:24.04
|
||||
FROM $IMAGE as builder
|
||||
LABEL maintainer michel.promonet@free.fr
|
||||
WORKDIR /v4l2rtspserver
|
||||
COPY . /v4l2rtspserver
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates g++ autoconf automake libtool xz-utils cmake make pkg-config git wget libasound2-dev libssl-dev \
|
||||
&& cmake . && make install && apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates g++ autoconf automake libtool xz-utils cmake make patch pkg-config git wget libasound2-dev libssl-dev
|
||||
COPY . .
|
||||
|
||||
FROM ubuntu:20.04
|
||||
RUN cmake . && make install && apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
|
||||
FROM $IMAGE
|
||||
WORKDIR /usr/local/share/v4l2rtspserver
|
||||
COPY --from=builder /usr/local/bin/ /usr/local/bin/
|
||||
COPY --from=builder /usr/local/share/v4l2rtspserver/ /usr/local/share/v4l2rtspserver/
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libasound2 libssl1.1 && apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates libasound2-dev libssl-dev && apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
|
||||
COPY --from=builder /usr/local/bin/ /usr/local/bin/
|
||||
COPY --from=builder /usr/local/share/v4l2rtspserver/ /usr/local/share/v4l2rtspserver/
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/v4l2rtspserver" ]
|
||||
CMD [ "-S" ]
|
||||
|
@ -1,22 +0,0 @@
|
||||
FROM ubuntu:20.04 as builder
|
||||
LABEL maintainer michel.promonet@free.fr
|
||||
WORKDIR /v4l2rtspserver
|
||||
COPY . /v4l2rtspserver
|
||||
|
||||
ARG ARCH=arm64
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates xz-utils cmake make pkg-config git wget gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
|
||||
&& cmake -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY . \
|
||||
&& make install \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
|
||||
|
||||
FROM arm64v8/ubuntu:20.04
|
||||
|
||||
WORKDIR /usr/local/share/v4l2rtspserver
|
||||
COPY --from=builder /usr/local/bin/ /usr/local/bin/
|
||||
COPY --from=builder /usr/local/share/v4l2rtspserver/ /usr/local/share/v4l2rtspserver/
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/v4l2rtspserver" ]
|
||||
CMD [ "-S" ]
|
@ -1,24 +0,0 @@
|
||||
FROM debian as builder
|
||||
LABEL maintainer michel.promonet@free.fr
|
||||
WORKDIR /v4l2rtspserver
|
||||
COPY . /v4l2rtspserver
|
||||
|
||||
ARG ARCH=armv7l
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates xz-utils cmake make pkg-config git wget \
|
||||
&& git clone --depth 1 https://github.com/raspberrypi/tools.git /rpi_tools \
|
||||
&& export PATH=/rpi_tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:$PATH \
|
||||
&& cmake -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY . \
|
||||
&& make install \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
|
||||
|
||||
FROM balenalib/raspberry-pi
|
||||
|
||||
WORKDIR /usr/local/share/v4l2rtspserver
|
||||
COPY --from=builder /usr/local/bin/ /usr/local/bin/
|
||||
COPY --from=builder /usr/local/share/v4l2rtspserver/ /usr/local/share/v4l2rtspserver/
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/v4l2rtspserver" ]
|
||||
CMD [ "-S" ]
|
@ -0,0 +1,21 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Use this section to tell people about which versions of your project are
|
||||
currently being supported with security updates.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 5.1.x | :white_check_mark: |
|
||||
| 5.0.x | :x: |
|
||||
| 4.0.x | :white_check_mark: |
|
||||
| < 4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Use this section to tell people how to report a vulnerability.
|
||||
|
||||
Tell them where to go, how often they can expect to get an update on a
|
||||
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||
declined, etc.
|
@ -1 +0,0 @@
|
||||
Subproject commit e90a1b999071e88af0f734ef18b9e8520c839cec
|
@ -0,0 +1,37 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
** 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.
|
||||
**
|
||||
** H265_V4l2DeviceSource.h
|
||||
**
|
||||
** H265 V4L2 live555 source
|
||||
**
|
||||
** -------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
// project
|
||||
#include "H26x_V4l2DeviceSource.h"
|
||||
|
||||
class H265_V4L2DeviceSource : public H26X_V4L2DeviceSource
|
||||
{
|
||||
public:
|
||||
static H265_V4L2DeviceSource* createNew(UsageEnvironment& env, DeviceInterface * device, int outputFd, unsigned int queueSize, CaptureMode captureMode, bool repeatConfig, bool keepMarker) {
|
||||
return new H265_V4L2DeviceSource(env, device, outputFd, queueSize, captureMode, repeatConfig, keepMarker);
|
||||
}
|
||||
|
||||
protected:
|
||||
H265_V4L2DeviceSource(UsageEnvironment& env, DeviceInterface * device, int outputFd, unsigned int queueSize, CaptureMode captureMode, bool repeatConfig, bool keepMarker)
|
||||
: H26X_V4L2DeviceSource(env, device, outputFd, queueSize, captureMode, repeatConfig, keepMarker) {}
|
||||
|
||||
// overide V4L2DeviceSource
|
||||
virtual std::list< std::pair<unsigned char*,size_t> > splitFrames(unsigned char* frame, unsigned frameSize);
|
||||
virtual std::list< std::string > getInitFrames();
|
||||
virtual bool isKeyFrame(const char*, int);
|
||||
|
||||
protected:
|
||||
std::string m_vps;
|
||||
};
|
||||
|
@ -0,0 +1,40 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
** 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.
|
||||
**
|
||||
** H26x_V4l2DeviceSource.h
|
||||
**
|
||||
** H264/H265 V4L2 live555 source
|
||||
**
|
||||
** -------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
// project
|
||||
#include "V4L2DeviceSource.h"
|
||||
|
||||
// ---------------------------------
|
||||
// H264 V4L2 FramedSource
|
||||
// ---------------------------------
|
||||
const char H264marker[] = {0,0,0,1};
|
||||
const char H264shortmarker[] = {0,0,1};
|
||||
|
||||
class H26X_V4L2DeviceSource : public V4L2DeviceSource
|
||||
{
|
||||
protected:
|
||||
H26X_V4L2DeviceSource(UsageEnvironment& env, DeviceInterface * device, int outputFd, unsigned int queueSize, CaptureMode captureMode, bool repeatConfig, bool keepMarker)
|
||||
: V4L2DeviceSource(env, device, outputFd, queueSize, captureMode), m_repeatConfig(repeatConfig), m_keepMarker(keepMarker) {}
|
||||
|
||||
virtual ~H26X_V4L2DeviceSource() {}
|
||||
|
||||
unsigned char* extractFrame(unsigned char* frame, size_t& size, size_t& outsize, int& frameType);
|
||||
std::string getFrameWithMarker(const std::string & frame);
|
||||
|
||||
protected:
|
||||
std::string m_sps;
|
||||
std::string m_pps;
|
||||
bool m_repeatConfig;
|
||||
bool m_keepMarker;
|
||||
};
|
@ -1 +1 @@
|
||||
Subproject commit e06e49e2dd18082808a4f875993e722604487389
|
||||
Subproject commit 3eff050e79e76eecd240a07e5406f0787ca4af3f
|
@ -0,0 +1,25 @@
|
||||
From: Michel Promonet <michel.promonet@free.fr>
|
||||
Subject: [PATCH] Fix crash formating time_t as long (it is a long long)
|
||||
Signed-off-by: Michel Promonet <michel.promonet@free.fr>
|
||||
|
||||
---
|
||||
--- a/live/liveMedia/ServerMediaSession.cpp
|
||||
+++ b/live/liveMedia/ServerMediaSession.cpp
|
||||
@@ -272,7 +272,7 @@ char* ServerMediaSession::generateSDPDes
|
||||
|
||||
char const* const sdpPrefixFmt =
|
||||
"v=0\r\n"
|
||||
- "o=- %ld%06ld %d IN %s %s\r\n"
|
||||
+ "o=- %lld%06lld %d IN %s %s\r\n"
|
||||
"s=%s\r\n"
|
||||
"i=%s\r\n"
|
||||
"t=0 0\r\n"
|
||||
@@ -300,7 +300,7 @@ char* ServerMediaSession::generateSDPDes
|
||||
|
||||
// Generate the SDP prefix (session-level lines):
|
||||
snprintf(sdp, sdpLength, sdpPrefixFmt,
|
||||
- fCreationTime.tv_sec, fCreationTime.tv_usec, // o= <session id>
|
||||
+ (long long)fCreationTime.tv_sec, (long long)fCreationTime.tv_usec, // o= <session id>
|
||||
1, // o= <version> // (needs to change if params are modified)
|
||||
addressFamily == AF_INET ? "IP4" : "IP6", // o= <address family>
|
||||
ipAddressStr.val(), // o= <address>
|
@ -0,0 +1,88 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
** 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.
|
||||
**
|
||||
** H265_V4l2DeviceSource.cpp
|
||||
**
|
||||
** H265 V4L2 Live555 source
|
||||
**
|
||||
** -------------------------------------------------------------------------*/
|
||||
|
||||
#include <sstream>
|
||||
|
||||
// live555
|
||||
#include <Base64.hh>
|
||||
|
||||
// project
|
||||
#include "logger.h"
|
||||
#include "H265_V4l2DeviceSource.h"
|
||||
|
||||
// split packet in frames
|
||||
std::list< std::pair<unsigned char*,size_t> > H265_V4L2DeviceSource::splitFrames(unsigned char* frame, unsigned frameSize)
|
||||
{
|
||||
std::list< std::pair<unsigned char*,size_t> > frameList;
|
||||
|
||||
size_t bufSize = frameSize;
|
||||
size_t size = 0;
|
||||
int frameType = 0;
|
||||
unsigned char* buffer = this->extractFrame(frame, bufSize, size, frameType);
|
||||
while (buffer != NULL)
|
||||
{
|
||||
switch ((frameType&0x7E)>>1)
|
||||
{
|
||||
case 32: LOG(INFO) << "VPS size:" << size << " bufSize:" << bufSize; m_vps.assign((char*)buffer,size); break;
|
||||
case 33: LOG(INFO) << "SPS size:" << size << " bufSize:" << bufSize; m_sps.assign((char*)buffer,size); break;
|
||||
case 34: LOG(INFO) << "PPS size:" << size << " bufSize:" << bufSize; m_pps.assign((char*)buffer,size); break;
|
||||
case 19:
|
||||
case 20: LOG(INFO) << "IDR size:" << size << " bufSize:" << bufSize;
|
||||
if (m_repeatConfig && !m_vps.empty() && !m_sps.empty() && !m_pps.empty())
|
||||
{
|
||||
frameList.push_back(std::pair<unsigned char*,size_t>((unsigned char*)m_vps.c_str(), m_vps.size()));
|
||||
frameList.push_back(std::pair<unsigned char*,size_t>((unsigned char*)m_sps.c_str(), m_sps.size()));
|
||||
frameList.push_back(std::pair<unsigned char*,size_t>((unsigned char*)m_pps.c_str(), m_pps.size()));
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (!m_vps.empty() && !m_sps.empty() && !m_pps.empty())
|
||||
{
|
||||
char* vps_base64 = base64Encode(m_vps.c_str(), m_vps.size());
|
||||
char* sps_base64 = base64Encode(m_sps.c_str(), m_sps.size());
|
||||
char* pps_base64 = base64Encode(m_pps.c_str(), m_pps.size());
|
||||
|
||||
std::ostringstream os;
|
||||
os << "sprop-vps=" << vps_base64;
|
||||
os << ";sprop-sps=" << sps_base64;
|
||||
os << ";sprop-pps=" << pps_base64;
|
||||
m_auxLine.assign(os.str());
|
||||
|
||||
delete [] vps_base64;
|
||||
delete [] sps_base64;
|
||||
delete [] pps_base64;
|
||||
}
|
||||
frameList.push_back(std::pair<unsigned char*,size_t>(buffer, size));
|
||||
|
||||
buffer = this->extractFrame(&buffer[size], bufSize, size, frameType);
|
||||
}
|
||||
return frameList;
|
||||
}
|
||||
|
||||
std::list< std::string > H265_V4L2DeviceSource::getInitFrames() {
|
||||
std::list< std::string > frameList;
|
||||
frameList.push_back(this->getFrameWithMarker(m_vps));
|
||||
frameList.push_back(this->getFrameWithMarker(m_sps));
|
||||
frameList.push_back(this->getFrameWithMarker(m_pps));
|
||||
return frameList;
|
||||
}
|
||||
|
||||
bool H265_V4L2DeviceSource::isKeyFrame(const char* buffer, int size) {
|
||||
bool res = false;
|
||||
if (size > 4)
|
||||
{
|
||||
int frameType = (buffer[4]&0x7E)>>1;
|
||||
res = (frameType == 19 || frameType == 20);
|
||||
}
|
||||
return res;
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
** 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.
|
||||
**
|
||||
** H26x_V4l2DeviceSource.cpp
|
||||
**
|
||||
** H264/H265 V4L2 Live555 source
|
||||
**
|
||||
** -------------------------------------------------------------------------*/
|
||||
|
||||
#include <sstream>
|
||||
|
||||
// live555
|
||||
#include <Base64.hh>
|
||||
|
||||
// project
|
||||
#include "logger.h"
|
||||
#include "H26x_V4l2DeviceSource.h"
|
||||
|
||||
// extract a frame
|
||||
unsigned char* H26X_V4L2DeviceSource::extractFrame(unsigned char* frame, size_t& size, size_t& outsize, int& frameType)
|
||||
{
|
||||
unsigned char * outFrame = NULL;
|
||||
outsize = 0;
|
||||
unsigned int markerlength = 0;
|
||||
frameType = 0;
|
||||
|
||||
unsigned char *startFrame = (unsigned char*)memmem(frame,size,H264marker,sizeof(H264marker));
|
||||
if (startFrame != NULL) {
|
||||
markerlength = sizeof(H264marker);
|
||||
} else {
|
||||
startFrame = (unsigned char*)memmem(frame,size,H264shortmarker,sizeof(H264shortmarker));
|
||||
if (startFrame != NULL) {
|
||||
markerlength = sizeof(H264shortmarker);
|
||||
}
|
||||
}
|
||||
if (startFrame != NULL) {
|
||||
frameType = startFrame[markerlength];
|
||||
|
||||
int remainingSize = size-(startFrame-frame+markerlength);
|
||||
unsigned char *endFrame = (unsigned char*)memmem(&startFrame[markerlength], remainingSize, H264marker, sizeof(H264marker));
|
||||
if (endFrame == NULL) {
|
||||
endFrame = (unsigned char*)memmem(&startFrame[markerlength], remainingSize, H264shortmarker, sizeof(H264shortmarker));
|
||||
}
|
||||
|
||||
if (m_keepMarker)
|
||||
{
|
||||
size -= startFrame-frame;
|
||||
outFrame = startFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
size -= startFrame-frame+markerlength;
|
||||
outFrame = &startFrame[markerlength];
|
||||
}
|
||||
|
||||
if (endFrame != NULL)
|
||||
{
|
||||
outsize = endFrame - outFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
outsize = size;
|
||||
}
|
||||
size -= outsize;
|
||||
} else if (size>= sizeof(H264shortmarker)) {
|
||||
LOG(INFO) << "No marker found";
|
||||
}
|
||||
|
||||
return outFrame;
|
||||
}
|
||||
|
||||
std::string H26X_V4L2DeviceSource::getFrameWithMarker(const std::string & frame) {
|
||||
std::string frameWithMarker;
|
||||
frameWithMarker.append(H264marker, sizeof(H264marker));
|
||||
frameWithMarker.append(frame);
|
||||
return frameWithMarker;
|
||||
}
|
||||
|
Loading…
Reference in New Issue