github.com/pion/webrtc/v3@v3.2.24/pkg/media/media.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  // Package media provides media writer and filters
     5  package media
     6  
     7  import (
     8  	"time"
     9  
    10  	"github.com/pion/rtp"
    11  )
    12  
    13  // A Sample contains encoded media and timing information
    14  type Sample struct {
    15  	Data               []byte
    16  	Timestamp          time.Time
    17  	Duration           time.Duration
    18  	PacketTimestamp    uint32
    19  	PrevDroppedPackets uint16
    20  	Metadata           interface{}
    21  }
    22  
    23  // Writer defines an interface to handle
    24  // the creation of media files
    25  type Writer interface {
    26  	// Add the content of an RTP packet to the media
    27  	WriteRTP(packet *rtp.Packet) error
    28  	// Close the media
    29  	// Note: Close implementation must be idempotent
    30  	Close() error
    31  }