2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.ipcamera.internal.rtsp;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
18 import io.netty.channel.ChannelDuplexHandler;
19 import io.netty.channel.ChannelHandlerContext;
20 import io.netty.handler.codec.http.LastHttpContent;
23 * The {@link NettyRtspHandler} is used to decode RTSP traffic into message Strings.
25 * @author Matthew Skinner - Initial contribution
28 public class NettyRtspHandler extends ChannelDuplexHandler {
29 RtspConnection rtspConnection;
31 NettyRtspHandler(RtspConnection rtspConnection) {
32 this.rtspConnection = rtspConnection;
36 public void channelRead(@Nullable ChannelHandlerContext ctx, @Nullable Object msg) throws Exception {
37 if (msg == null || ctx == null) {
40 if (!(msg instanceof LastHttpContent)) {
41 rtspConnection.processMessage(msg);
48 public void channelReadComplete(@Nullable ChannelHandlerContext ctx) {
52 public void handlerAdded(@Nullable ChannelHandlerContext ctx) {
56 public void handlerRemoved(@Nullable ChannelHandlerContext ctx) {
60 public void exceptionCaught(@Nullable ChannelHandlerContext ctx, @Nullable Throwable cause) {
64 public void userEventTriggered(@Nullable ChannelHandlerContext ctx, @Nullable Object evt) throws Exception {