mirror of
https://github.com/pion/mediadevices.git
synced 2025-11-02 20:54:02 +08:00
Add VPX improvements from pion-mediadevices
- Add vpx_image.go: VpxImage wrapper for vpx_image_t with convenient methods - Move BitrateTracker to vpx package: More specific to VPX codec usage - Add bitrate_tracker_test.go: Test coverage for VPX-specific bitrate tracking - Remove generic codec-level BitrateTracker: Replaced by VPX-specific version These changes improve VPX codec functionality and organization by: 1. Adding image handling utilities specific to VPX 2. Providing better bitrate tracking for VPX codecs 3. Improving code organization by moving VPX-specific code to VPX package
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package codec
|
||||
package vpx
|
||||
|
||||
import (
|
||||
"time"
|
||||
@@ -1,4 +1,4 @@
|
||||
package codec
|
||||
package vpx
|
||||
|
||||
import (
|
||||
"math"
|
||||
40
pkg/codec/vpx/vpx_image.go
Normal file
40
pkg/codec/vpx/vpx_image.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package vpx
|
||||
|
||||
/*
|
||||
#cgo pkg-config: vpx
|
||||
#include <vpx/vpx_image.h>
|
||||
*/
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
type VpxImage struct {
|
||||
img *C.vpx_image_t
|
||||
}
|
||||
|
||||
func NewImageFromPtr(ptr *C.vpx_image_t) *VpxImage {
|
||||
return &VpxImage{img: ptr}
|
||||
}
|
||||
|
||||
func (i *VpxImage) Width() int {
|
||||
return int(i.img.d_w)
|
||||
}
|
||||
|
||||
func (i *VpxImage) Height() int {
|
||||
return int(i.img.d_h)
|
||||
}
|
||||
|
||||
func (i *VpxImage) YStride() int {
|
||||
return int(i.img.stride[0])
|
||||
}
|
||||
|
||||
func (i *VpxImage) UStride() int {
|
||||
return int(i.img.stride[1])
|
||||
}
|
||||
|
||||
func (i *VpxImage) VStride() int {
|
||||
return int(i.img.stride[2])
|
||||
}
|
||||
|
||||
func (i *VpxImage) Plane(n int) unsafe.Pointer {
|
||||
return unsafe.Pointer(i.img.planes[n])
|
||||
}
|
||||
Reference in New Issue
Block a user