-
Notifications
You must be signed in to change notification settings - Fork 37
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
Some more Buffer and Memory Fixes #7
Conversation
…and Buffers safe to do multiple times
@vshashi01 I think this should suffice |
|
||
// FillInt8Slice adds the given slice to the buffer at the given offset. The return value reflects the amount | ||
// of data added to the buffer. | ||
func (b *Buffer) FillInt8Slice(offset int64, data []int8) int64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting rid of these as I am not sure if they were implemented correctly and I feel like most users would be working with []byte
sequences anyway. May consider reimplementing in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed I think keep just the FillBytes is good enough.
Another thing that I just thought of is as soon as the MapInfo is created, at the moment there is no way to check if its read only or writable as well. Do you think this should be available with the API as well. Though I think for small programs this is hardly ever a problem. The rest of it looks good. |
Well to be clear the user has to specify how they are mapping the data the first time. That being said, I can see what you mean if the user maps once I think these are edge cases, because how much processing would you really be doing in the context of a single buffer? In my head, most of the time you'd create your data, shove it in there and let gstreamer take over. Or on the receiving end, you'd just pull the buffer into go memory with EDIT: I guess I'll add that the mode on the memory is accessible with something like... mapInfo := buffer.Map(gst.MapWrite | gst.MapRead)
if mapInfo.Flags()&gst.MapWrite != 0 {
fmt.Println("Map has write access")
}
if mapInfo.Flags()&gst.MapRead != 0 {
fmt.Println("Map has read access")
} If this is what you meant by exposing an API for determining how the memory is mapped. |
Yes this is good enough... |
add the ability to unlink and unlink many elems
Buffer.FillBytes
to work on Windows as well with the same fixes fromNewBufferFromBytes
Map
on aMemory
orBuffer
safe to do multiple times (while still only requiring a singleUnmap
)