Skip to content

Commit

Permalink
small turbojpeg fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
fzwoch committed Sep 4, 2023
1 parent 07a5e05 commit 60e0807
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packet.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

// #cgo CFLAGS: -Ilibjpeg-turbo
// #cgo LDFLAGS: -lturbojpeg -Llibjpeg-turbo/linux-x86_64/
//
// #cgo LDFLAGS: -lturbojpeg
//
// #include <obs-module.h>
// #include <turbojpeg.h>
Expand Down Expand Up @@ -104,7 +104,7 @@ func (p *Packet) ToJPEG(pool *Pool) {
func (p *Packet) FromJPEG(pool *Pool) {
ctx := C.tj3Init(C.TJINIT_DECOMPRESS)

C.tj3DecompressHeader(ctx, (*C.uchar)(&p.Buffer[0]), C.ulong(len(p.Buffer)))
C.tj3DecompressHeader(ctx, (*C.uchar)(&p.Buffer[0]), C.size_t(len(p.Buffer)))

width := int(C.tj3Get(ctx, C.TJPARAM_JPEGWIDTH))
height := int(C.tj3Get(ctx, C.TJPARAM_JPEGHEIGHT))
Expand Down Expand Up @@ -175,7 +175,7 @@ func (p *Packet) FromJPEG(pool *Pool) {
panic("")
}

C.tj3DecompressToYUV8(ctx, (*C.uchar)(&p.Buffer[0]), C.ulong(len(p.Buffer)), (*C.uchar)(&buf[0]), 1)
C.tj3DecompressToYUV8(ctx, (*C.uchar)(&p.Buffer[0]), C.size_t(len(p.Buffer)), (*C.uchar)(&buf[0]), 1)
case C.TJCS_RGB:
s := width * height * 3

Expand All @@ -191,7 +191,7 @@ func (p *Packet) FromJPEG(pool *Pool) {
Pix: buf,
}

C.tj3Decompress8(ctx, (*C.uchar)(&p.Buffer[0]), C.ulong(len(p.Buffer)), (*C.uchar)(&buf[0]), 0, C.TJCS_RGB)
C.tj3Decompress8(ctx, (*C.uchar)(&p.Buffer[0]), C.size_t(len(p.Buffer)), (*C.uchar)(&buf[0]), 0, C.TJCS_RGB)
default:
panic("")
}
Expand Down

0 comments on commit 60e0807

Please sign in to comment.