forked from livepeer/lpms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,55 @@ | ||
package stream | ||
|
||
import ( | ||
"context" | ||
"io/ioutil" | ||
|
||
"github.com/kz26/m3u8" | ||
"github.com/nareix/joy4/av" | ||
) | ||
|
||
//For now, this class is only for testing purposes (so we can write out the transcoding results and compare) | ||
type FileStream struct { | ||
StreamID string | ||
// RTMPTimeout time.Duration | ||
// HLSTimeout time.Duration | ||
buffer *streamBuffer | ||
} | ||
|
||
var outputDir = "data" | ||
|
||
func (s *FileStream) Len() int64 { | ||
return s.buffer.len() | ||
} | ||
|
||
func NewFileStream(id string) *FileStream { | ||
return &FileStream{buffer: newStreamBuffer(), StreamID: id} | ||
} | ||
|
||
func (s *FileStream) GetStreamID() string { | ||
return s.StreamID | ||
} | ||
|
||
//ReadRTMPFromStream reads the content from the RTMP stream out into the dst. | ||
func (s *FileStream) ReadRTMPFromStream(ctx context.Context, dst av.MuxCloser) error { | ||
return nil | ||
} | ||
|
||
func (s *FileStream) WriteRTMPToStream(ctx context.Context, src av.DemuxCloser) error { | ||
return nil | ||
} | ||
|
||
func (s *FileStream) WriteHLSPlaylistToStream(pl m3u8.MediaPlaylist) error { | ||
return nil | ||
} | ||
|
||
func (s *FileStream) WriteHLSSegmentToStream(seg HLSSegment) error { | ||
err := ioutil.WriteFile("./data/"+s.StreamID+"_"+seg.Name, seg.Data, 0644) | ||
// check(err) | ||
|
||
return err | ||
} | ||
|
||
func (s *FileStream) ReadHLSFromStream(buffer HLSMuxer) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters