Skip to content

Commit 2c733b2

Browse files
committed
Added comments
1 parent a031755 commit 2c733b2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: pkg/generator/sine.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ const (
3333
////////////////////////////////////////////////////////////////////////////
3434
// LIFECYCLE
3535

36-
// Sine wave generator - mono float32
36+
// Create a new sine wave generator with one channel using float32
37+
// for samples. The frequency in Hz, volume in decibels and samplerate
38+
// (ie, 44100) for the audio stream are passed as arguments.
3739
func NewSine(freq float64, volume float64, samplerate int) (*sine, error) {
3840
sine := new(sine)
3941

@@ -79,7 +81,7 @@ func NewSine(freq float64, volume float64, samplerate int) (*sine, error) {
7981
return sine, nil
8082
}
8183

82-
// Free resources
84+
// Free resources for the generator
8385
func (s *sine) Close() error {
8486
ff.AVUtil_frame_free(s.frame)
8587
s.frame = nil
@@ -97,6 +99,7 @@ func (s *sine) String() string {
9799
////////////////////////////////////////////////////////////////////////////
98100
// PUBLIC METHODS
99101

102+
// Return the first and subsequent frames of raw audio data
100103
func (s *sine) Frame() media.Frame {
101104
// Set the Pts
102105
if s.frame.Pts() == ff.AV_NOPTS_VALUE {

Diff for: pkg/generator/yuv420p.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ var _ Generator = (*yuv420p)(nil)
2222
////////////////////////////////////////////////////////////////////////////
2323
// LIFECYCLE
2424

25-
// Video generator - YUV420P
25+
// Create a new video generator which generates YUV420P frames
26+
// of the specified size and framerate (in frames per second)
2627
func NewYUV420P(size string, framerate int) (*yuv420p, error) {
2728
yuv420p := new(yuv420p)
2829

@@ -77,6 +78,7 @@ func (yuv420p *yuv420p) String() string {
7778
////////////////////////////////////////////////////////////////////////////
7879
// PUBLIC METHODS
7980

81+
// Return the first and subsequent frames of raw video data
8082
func (yuv420p *yuv420p) Frame() media.Frame {
8183
// Set the Pts
8284
if yuv420p.frame.Pts() == ff.AV_NOPTS_VALUE {

0 commit comments

Comments
 (0)