Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: m3u8.MediaSegment implements fmt.Stringer #98

Open
keizo042 opened this issue Nov 15, 2017 · 5 comments
Open

Feature Request: m3u8.MediaSegment implements fmt.Stringer #98

keizo042 opened this issue Nov 15, 2017 · 5 comments

Comments

@keizo042
Copy link

keizo042 commented Nov 15, 2017

hello dev.
Thanks you for your great work. the library is very useful :-)

I'd like to implement (m MediaSegment) String()string for testing like below.
When failing test, I'd like to report as m3u8 text.

package something

import (
	"github.com/grafov/m3u8"
	"testing"
)

func TestXXX(t *testing.T) {
	var expected, actual m3u8.MediaSegment

        actual = do_something()
	if expected.SeqId != actual.SeqId {
		t.Fatalf("expected:%s,  but actual:%s\n", expected.String(), actual.String())
	}
}

there are already (p *MediaPlaylist) String() string and it converts m3u8.MeidaSegment to string.
We can use the procedure to implement function I request.

If you agree to the issue but don't have enough time, I'd like to send PR.

@bradleyfalzon
Copy link
Collaborator

This sounds reasonable, but there's a lot to output, what do you think it would show?

If you agree to the issue but don't have enough time, I'd like to send PR.

This would be great, thanks.

@keizo042
Copy link
Author

It would be good it is same result to media segment part of (p *m3u8.MediaPlaylist) String() string

When all m3u8.MediaSegment field is presense,
(p *m3u8.MediaPlaylist) Decode()(byte.Buffer, error) and (p *m3u8.MediaPlaylist) String() string dump like this .

#EXT-SCTE35:CUE="base64==",ID="identify",TIME=30
#EXT-X-KEY:METHOD=,URI="http://example.com/key",IV=iv
#EXT-X-DISCONTINUITY
#EXT-X-MAP:URI="http;//url",BYTERANGE=10@0
#EXT-X-BYTERANGE:10@0
#EXTINF:10.000,hogehoge
http://example.com/media.ts

I suppose it is not so a lot.

@bradleyfalzon
Copy link
Collaborator

That looks good to me.

@bradleyfalzon
Copy link
Collaborator

@grafov thoughts?

@grafov
Copy link
Owner

grafov commented Nov 15, 2017

@bradleyfalzon I think it is ok to implement such method. @keizo042 would you create PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants