Skip to content

Commit 92d43af

Browse files
authored
Remove Seek requirement for some writers (#743)
1 parent b5fda20 commit 92d43af

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

media/src/io/h264_writer/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(test)]
22
mod h264_writer_test;
33

4-
use std::io::{Seek, Write};
4+
use std::io::Write;
55

66
use rtp::codecs::h264::H264Packet;
77
use rtp::packetizer::Depacketizer;
@@ -29,13 +29,13 @@ fn is_key_frame(data: &[u8]) -> bool {
2929
/// Currently it only supports non-interleaved mode
3030
/// Therefore, only 1-23, 24 (STAP-A), 28 (FU-A) NAL types are allowed.
3131
/// <https://tools.ietf.org/html/rfc6184#section-5.2>
32-
pub struct H264Writer<W: Write + Seek> {
32+
pub struct H264Writer<W: Write> {
3333
writer: W,
3434
has_key_frame: bool,
3535
cached_packet: Option<H264Packet>,
3636
}
3737

38-
impl<W: Write + Seek> H264Writer<W> {
38+
impl<W: Write> H264Writer<W> {
3939
// new initializes a new H264 writer with an io.Writer output
4040
pub fn new(writer: W) -> Self {
4141
H264Writer {
@@ -46,7 +46,7 @@ impl<W: Write + Seek> H264Writer<W> {
4646
}
4747
}
4848

49-
impl<W: Write + Seek> Writer for H264Writer<W> {
49+
impl<W: Write> Writer for H264Writer<W> {
5050
/// write_rtp adds a new packet and writes the appropriate headers for it
5151
fn write_rtp(&mut self, packet: &rtp::packet::Packet) -> Result<()> {
5252
if packet.payload.is_empty() {

media/src/io/ogg_writer/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(test)]
22
mod ogg_writer_test;
33

4-
use std::io::{BufWriter, Seek, Write};
4+
use std::io::{BufWriter, Write};
55

66
use byteorder::{LittleEndian, WriteBytesExt};
77
use bytes::Bytes;
@@ -12,7 +12,7 @@ use crate::io::ogg_reader::*;
1212
use crate::io::Writer;
1313

1414
/// OggWriter is used to take RTP packets and write them to an OGG on disk
15-
pub struct OggWriter<W: Write + Seek> {
15+
pub struct OggWriter<W: Write> {
1616
writer: W,
1717
sample_rate: u32,
1818
channel_count: u8,
@@ -25,7 +25,7 @@ pub struct OggWriter<W: Write + Seek> {
2525
last_payload: Bytes,
2626
}
2727

28-
impl<W: Write + Seek> OggWriter<W> {
28+
impl<W: Write> OggWriter<W> {
2929
/// new initialize a new OGG Opus writer with an io.Writer output
3030
pub fn new(writer: W, sample_rate: u32, channel_count: u8) -> Result<Self> {
3131
let mut w = OggWriter {
@@ -166,7 +166,7 @@ impl<W: Write + Seek> OggWriter<W> {
166166
}
167167
}
168168

169-
impl<W: Write + Seek> Writer for OggWriter<W> {
169+
impl<W: Write> Writer for OggWriter<W> {
170170
/// write_rtp adds a new packet and writes the appropriate headers for it
171171
fn write_rtp(&mut self, packet: &rtp::packet::Packet) -> Result<()> {
172172
if packet.payload.is_empty() {

0 commit comments

Comments
 (0)