Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add H265 support endpoint for camera manager #2995

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
label="Encoding"
:disabled="is_redirect_source"
:rules="[validate_required_field]"
@change="change_endpoints_from_encode($event)"
/>
<v-select
v-model="selected_size"
Expand Down Expand Up @@ -389,6 +390,7 @@ export default Vue.extend({
if (endpoint.startsWith('rtsp://')) return StreamType.RTSP
if (endpoint.startsWith('rtspt://')) return StreamType.RTSPT
if (endpoint.startsWith('rtsph://')) return StreamType.RTSPH
if (endpoint.startsWith('udp265://')) return StreamType.UDP265
return StreamType.UDP
},
availableStreamTypes(endpoint: string): {text: StreamType, pirate: boolean, desc?: string}[] {
Expand All @@ -397,6 +399,7 @@ export default Vue.extend({
const protocols = [
{ text: StreamType.RTSP, pirate: false },
{ text: StreamType.UDP, pirate: false },
{ text: StreamType.UDP265, pirate: false },
]

const pirateModeProtocols = [
Expand All @@ -418,6 +421,22 @@ export default Vue.extend({

return protocols
},
change_endpoints_from_encode(encode: VideoEncodeType) {
this.stream_endpoints = this.stream_endpoints.map((endpoint) => {
if (encode === VideoEncodeType.H264) {
if (endpoint.includes('udp265://')) {
return endpoint.replace('udp265://', 'udp://')
}
}

if (encode === VideoEncodeType.H265) {
if (endpoint.includes('udp://')) {
return endpoint.replace('udp://', 'udp265://')
}
}
return endpoint
})
},
set_default_address_for_stream(index: number, stream_type: StreamType) {
switch (stream_type) {
case StreamType.UDP:
Expand All @@ -426,6 +445,12 @@ export default Vue.extend({
Vue.set(this.stream_endpoints, index, `udp://${this.user_ip_address}:${5600 + index}`)
}
break
case StreamType.UDP265:
if (!this.stream_endpoints[index].includes('udp265://')) {
// Vue.set() forces the update of a nested property
Vue.set(this.stream_endpoints, index, `udp265://${this.user_ip_address}:${5600 + index}`)
}
break
case StreamType.RTSP:
case StreamType.RTSPU:
case StreamType.RTSPT:
Expand Down
1 change: 1 addition & 0 deletions core/frontend/src/types/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum VideoEncodeType {
export enum StreamType {
RTSP = 'RTSP',
UDP = 'UDP',
UDP265 = 'UDP265',
RTSPU = 'RTSPU',
RTSPT = 'RTSPT',
RTSPH = 'RTSPH',
Expand Down
2 changes: 1 addition & 1 deletion core/frontend/src/utils/pattern_validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function isIpAddress(ip: string): boolean {

export function isUdpAddress(address: string): boolean {
try {
return new URL(address).protocol === 'udp:'
return ['udp:', 'udp265:'].includes(new URL(address).protocol)
} catch (error) {
return false
}
Expand Down