• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

asticode / go-astiav / 15045166436

15 May 2025 12:39PM UTC coverage: 86.021% (-1.1%) from 87.082%
15045166436

push

github

asticode
Bumped golang version to 1.21 in go.mod

2966 of 3448 relevant lines covered (86.02%)

54.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/hardware_device_context.go
1
package astiav
2

3
//#include <libavcodec/avcodec.h>
4
//#include <libavutil/hwcontext.h>
5
import "C"
6
import (
7
        "unsafe"
8
)
9

10
// https://ffmpeg.org/doxygen/7.0/structAVHWDeviceContext.html
11
type HardwareDeviceContext struct {
12
        c *C.AVBufferRef
13
}
14

15
// https://ffmpeg.org/doxygen/7.0/hwcontext_8c.html#a21fbd088225e4e25c4d9a01b3f5e8c51
16
func CreateHardwareDeviceContext(t HardwareDeviceType, device string, options *Dictionary, flags int) (*HardwareDeviceContext, error) {
×
17
        hdc := HardwareDeviceContext{}
×
18
        deviceC := (*C.char)(nil)
×
19
        if device != "" {
×
20
                deviceC = C.CString(device)
×
21
                defer C.free(unsafe.Pointer(deviceC))
×
22
        }
×
23
        optionsC := (*C.AVDictionary)(nil)
×
24
        if options != nil {
×
25
                optionsC = options.c
×
26
        }
×
27
        if err := newError(C.av_hwdevice_ctx_create(&hdc.c, (C.enum_AVHWDeviceType)(t), deviceC, optionsC, C.int(flags))); err != nil {
×
28
                return nil, err
×
29
        }
×
30
        return &hdc, nil
×
31
}
32

33
// https://ffmpeg.org/doxygen/7.0/hwcontext_8c.html#a80f4c1184e1758150b6d9bc0adf2c1df
34
func (hdc *HardwareDeviceContext) HardwareFramesConstraints() *HardwareFramesConstraints {
×
35
        return newHardwareFramesConstraintsFromC(C.av_hwdevice_get_hwframe_constraints(hdc.c, nil))
×
36
}
×
37

38
func (hdc *HardwareDeviceContext) Free() {
×
39
        if hdc.c != nil {
×
40
                C.av_buffer_unref(&hdc.c)
×
41
        }
×
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc