media.go 740 B

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