forked from giorgisio/goav
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Partial rewrite: Go like func naming; Objs
- Loading branch information
Showing
20 changed files
with
1,680 additions
and
1,786 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
AvPicture | ||
*/ | ||
package avcodec | ||
|
||
//#cgo pkg-config: libavcodec | ||
//#include <libavcodec/avcodec.h> | ||
import "C" | ||
import ( | ||
"unsafe" | ||
) | ||
|
||
//Setup the picture fields based on the specified image parameters and the provided image data buffer. | ||
func (p *AvPicture) AvpictureFill(pt *uint8, pf AvPixelFormat, w, h int) int { | ||
return int(C.avpicture_fill((*C.struct_AVPicture)(p), (*C.uint8_t)(pt), (C.enum_AVPixelFormat)(pf), C.int(w), C.int(h))) | ||
} | ||
|
||
//Copy pixel data from an AvPicture into a buffer. | ||
func (p *AvPicture) AvpictureLayout(pf AvPixelFormat, w, h int, d *string, ds int) int { | ||
return int(C.avpicture_layout((*C.struct_AVPicture)(p), (C.enum_AVPixelFormat)(pf), C.int(w), C.int(h), (*C.uchar)(unsafe.Pointer(d)), C.int(ds))) | ||
} | ||
|
||
//Copy image src to dst. | ||
func (p *AvPicture) AvPictureCopy(d *AvPicture, pf AvPixelFormat, w, h int) { | ||
C.av_picture_copy((*C.struct_AVPicture)(d), (*C.struct_AVPicture)(p), (C.enum_AVPixelFormat)(pf), C.int(w), C.int(h)) | ||
} | ||
|
||
//Crop image top and left side. | ||
func (p *AvPicture) AvPictureCrop(d *AvPicture, pf AvPixelFormat, t, l int) int { | ||
return int(C.av_picture_crop((*C.struct_AVPicture)(d), (*C.struct_AVPicture)(p), (C.enum_AVPixelFormat)(pf), C.int(t), C.int(l))) | ||
} | ||
|
||
//Pad image. | ||
func (p *AvPicture) AvPicturePad(d *AvPicture, h, w int, pf AvPixelFormat, t, b, l, r int, c *int) int { | ||
return int(C.av_picture_pad((*C.struct_AVPicture)(d), (*C.struct_AVPicture)(p), (C.int)(h), (C.int)(w), (C.enum_AVPixelFormat)(pf), (C.int)(t), (C.int)(b), (C.int)(l), (C.int)(r), (*C.int)(unsafe.Pointer(c)))) | ||
} | ||
|
||
//Free a picture previously allocated by avpicture_alloc(). Allocate memory for the pixels of a picture and setup the AvPicture fields for it. | ||
func (p *AvPicture) AvpictureAlloc(t AvPixelFormat, w, h int) int { | ||
return int(C.avpicture_alloc((*C.struct_AVPicture)(p), (C.enum_AVPixelFormat)(t), C.int(w), C.int(h))) | ||
} | ||
|
||
func (p *AvPicture) AvpictureFree() { | ||
C.avpicture_free((*C.struct_AVPicture)(p)) | ||
} | ||
|
||
//Calculate the size in bytes that a picture of the given width and height would occupy if stored in the given picture format. | ||
func AvpictureGetSize(pf AvPixelFormat, w, h int) int { | ||
return int(C.avpicture_get_size((C.enum_AVPixelFormat)(pf), C.int(w), C.int(h))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.