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.
26 * @author Matthew Skinner - Initial contribution
29 public class NettyRtspHandler extends ChannelDuplexHandler {
30 RtspConnection rtspConnection;
32 NettyRtspHandler(RtspConnection rtspConnection) {
33 this.rtspConnection = rtspConnection;
37 public void channelRead(@Nullable ChannelHandlerContext ctx, @Nullable Object msg) throws Exception {
38 if (msg == null || ctx == null) {
41 if (!(msg instanceof LastHttpContent)) {
42 rtspConnection.processMessage(msg);
49 public void channelReadComplete(@Nullable ChannelHandlerContext ctx) {
53 public void handlerAdded(@Nullable ChannelHandlerContext ctx) {
57 public void handlerRemoved(@Nullable ChannelHandlerContext ctx) {
61 public void exceptionCaught(@Nullable ChannelHandlerContext ctx, @Nullable Throwable cause) {
65 public void userEventTriggered(@Nullable ChannelHandlerContext ctx, @Nullable Object evt) throws Exception {