1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package packetdump
import (
"fmt"
"github.com/pion/interceptor"
"github.com/pion/rtcp"
"github.com/pion/rtp"
)
// RTPFormatCallback can be used to apply custom formatting to each dumped RTP
// packet. If new lines should be added after each packet, they must be included
// in the returned format.
// Deprecated: prefer RTPBinaryFormatCallback.
type RTPFormatCallback func(*rtp.Packet, interceptor.Attributes) string
// RTCPFormatCallback can be used to apply custom formatting to each dumped RTCP
// packet. If new lines should be added after each packet, they must be included
// in the returned format.
// Deprecated: prefer RTCPBinaryFormatCallback.
type RTCPFormatCallback func([]rtcp.Packet, interceptor.Attributes) string
// DefaultRTPFormatter returns the default log format for RTP packets
// Deprecated: useless export since set by default.
func DefaultRTPFormatter(pkt *rtp.Packet, _ interceptor.Attributes) string {
return fmt.Sprintf("%s\n", pkt)
}
// DefaultRTCPFormatter returns the default log format for RTCP packets
// Deprecated: useless export since set by default.
func DefaultRTCPFormatter(pkts []rtcp.Packet, _ interceptor.Attributes) string {
return fmt.Sprintf("%s\n", pkts)
}
// RTPBinaryFormatCallback can be used to apply custom formatting or marshaling to each dumped RTP packet.
type RTPBinaryFormatCallback func(*rtp.Packet, interceptor.Attributes) ([]byte, error)
// RTCPBinaryFormatCallback can be used to apply custom formatting or marshaling to each dumped RTCP packet.
type RTCPBinaryFormatCallback func(rtcp.Packet, interceptor.Attributes) ([]byte, error)
|