dholroyd / h264-reader

Rust reader for H264 bitsream syntax
Apache License 2.0
73 stars 25 forks source link

Make SliceHeader fields pub? #39

Closed petzeb closed 1 year ago

petzeb commented 1 year ago

I am trying to use this crate to do some picture order calculations based on the 14496-10 spec. In order to do that I need to access fields in the SliceHeader struct, so I was wondering if they could be made pub for access outside the crate? Or is there a reason why they are private at the moment?

dholroyd commented 1 year ago

The only reason they are private is that I wrote a bunch of parsing code but hadn't worked out what the public API of the type should be yet. I haven't actually used the slice header data myself yet.

If you want access to specific fields, then I'd be happy to accept a patch that adds pub to the pieces you are after. If utility methods might be preferable instead of direct field access I'd be happy to look at that too.

petzeb commented 1 year ago

Ok, makes sense. I will throw up a PR in a bit with the pieces that are needed for POC parsing.

petzeb commented 1 year ago

I made a PR for making the fields needed pub here: https://github.com/dholroyd/h264-reader/pull/41

Also made a second PR that is maybe more of an opinion piece. https://github.com/dholroyd/h264-reader/pull/42 Curious what you think about it, mainly my reasoning about the FieldsAbsolut is that the field bottom_delta is a combination of the delta from the NAL and the pic_order_cnt_lsb which caused me a bit of confusion originally as it is no longer really a delta?

petzeb commented 1 year ago

Thanks for merging the PRs! Are you planning to make a new release including those as well?

dholroyd commented 1 year ago

Sorry for the delay - here's 0.7.0.