detached defbe8a

chore: upgrade purego-ffmpeg to v0.3.0 and update transcoder API

Migrate from v0.1.0 flat API to v0.3.0 convenience API. Constant
renames only — no logic changes. All 84 transcoder tests pass.
commit
defbe8a6c83576f8c7635ed1df0c2c064f482ca4
author
brice · · 2026-03-28 05:37 UTC
parent
5023d63
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
5 files · +28 -58
M go.mod +2 -10
@@ -4,7 +4,7 @@ go 1.26.1
44
55 require (
66 github.com/bnema/purego-cef v0.0.0-00010101000000-000000000000
7- github.com/bnema/purego-ffmpeg v0.1.0
7+ github.com/bnema/purego-ffmpeg v0.3.0
88 github.com/bnema/purego-sqlite v0.1.1
99 github.com/bnema/puregotk v0.2.2
1010 github.com/bnema/puregotk-webkit v0.0.16
@@ -24,11 +24,8 @@ require (
2424 golang.org/x/image v0.38.0
2525 golang.org/x/sys v0.42.0
2626 gopkg.in/yaml.v3 v3.0.1
27- modernc.org/sqlite v1.47.0
2827 )
2928
30-replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704
31-
3229 replace github.com/bnema/purego-cef => ../purego-cef
3330
3431 replace github.com/bnema/purego-ffmpeg => ../purego-ffmpeg
@@ -45,7 +42,6 @@ require (
4542 github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
4643 github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
4744 github.com/davecgh/go-spew v1.1.1 // indirect
48- github.com/dustin/go-humanize v1.0.1 // indirect
4945 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
5046 github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
5147 github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -58,9 +54,7 @@ require (
5854 github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
5955 github.com/muesli/cancelreader v0.2.2 // indirect
6056 github.com/muesli/termenv v0.16.0 // indirect
61- github.com/ncruces/go-strftime v1.0.0 // indirect
6257 github.com/pmezard/go-difflib v1.0.0 // indirect
63- github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
6458 github.com/rivo/uniseg v0.4.7 // indirect
6559 github.com/russross/blackfriday/v2 v2.1.0 // indirect
6660 github.com/sagikazarmark/locafero v0.12.0 // indirect
@@ -77,9 +71,7 @@ require (
7771 golang.org/x/sync v0.20.0 // indirect
7872 golang.org/x/text v0.35.0 // indirect
7973 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
80- modernc.org/libc v1.70.0 // indirect
81- modernc.org/mathutil v1.7.1 // indirect
82- modernc.org/memory v1.11.0 // indirect
74+ modernc.org/sqlite v1.47.0 // indirect
8375 )
8476
8577 replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704
@@ -4,7 +4,7 @@ go 1.26.1
4 4
5 require (5 require (
6 github.com/bnema/purego-cef v0.0.0-00010101000000-0000000000006 github.com/bnema/purego-cef v0.0.0-00010101000000-000000000000
7- github.com/bnema/purego-ffmpeg v0.1.07+ github.com/bnema/purego-ffmpeg v0.3.0
8 github.com/bnema/purego-sqlite v0.1.18 github.com/bnema/purego-sqlite v0.1.1
9 github.com/bnema/puregotk v0.2.29 github.com/bnema/puregotk v0.2.2
10 github.com/bnema/puregotk-webkit v0.0.1610 github.com/bnema/puregotk-webkit v0.0.16
@@ -24,11 +24,8 @@ require (
24 golang.org/x/image v0.38.024 golang.org/x/image v0.38.0
25 golang.org/x/sys v0.42.025 golang.org/x/sys v0.42.0
26 gopkg.in/yaml.v3 v3.0.126 gopkg.in/yaml.v3 v3.0.1
27- modernc.org/sqlite v1.47.0
28 )27 )
29 28
30-replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704
31-
32 replace github.com/bnema/purego-cef => ../purego-cef29 replace github.com/bnema/purego-cef => ../purego-cef
33 30
34 replace github.com/bnema/purego-ffmpeg => ../purego-ffmpeg31 replace github.com/bnema/purego-ffmpeg => ../purego-ffmpeg
@@ -45,7 +42,6 @@ require (
45 github.com/clipperhouse/uax29/v2 v2.5.0 // indirect42 github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
46 github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect43 github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
47 github.com/davecgh/go-spew v1.1.1 // indirect44 github.com/davecgh/go-spew v1.1.1 // indirect
48- github.com/dustin/go-humanize v1.0.1 // indirect
49 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect45 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
50 github.com/go-viper/mapstructure/v2 v2.5.0 // indirect46 github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
51 github.com/inconshreveable/mousetrap v1.1.0 // indirect47 github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -58,9 +54,7 @@ require (
58 github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect54 github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
59 github.com/muesli/cancelreader v0.2.2 // indirect55 github.com/muesli/cancelreader v0.2.2 // indirect
60 github.com/muesli/termenv v0.16.0 // indirect56 github.com/muesli/termenv v0.16.0 // indirect
61- github.com/ncruces/go-strftime v1.0.0 // indirect
62 github.com/pmezard/go-difflib v1.0.0 // indirect57 github.com/pmezard/go-difflib v1.0.0 // indirect
63- github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
64 github.com/rivo/uniseg v0.4.7 // indirect58 github.com/rivo/uniseg v0.4.7 // indirect
65 github.com/russross/blackfriday/v2 v2.1.0 // indirect59 github.com/russross/blackfriday/v2 v2.1.0 // indirect
66 github.com/sagikazarmark/locafero v0.12.0 // indirect60 github.com/sagikazarmark/locafero v0.12.0 // indirect
@@ -77,9 +71,7 @@ require (
77 golang.org/x/sync v0.20.0 // indirect71 golang.org/x/sync v0.20.0 // indirect
78 golang.org/x/text v0.35.0 // indirect72 golang.org/x/text v0.35.0 // indirect
79 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect73 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
80- modernc.org/libc v1.70.0 // indirect74+ modernc.org/sqlite v1.47.0 // indirect
81- modernc.org/mathutil v1.7.1 // indirect
82- modernc.org/memory v1.11.0 // indirect
83 )75 )
84 76
85 replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a270477 replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704
M go.sum +10 -32 generated file: collapsed
M internal/infrastructure/transcoder/audio.go +4 -4
@@ -74,7 +74,7 @@ func newAudioTranscoder(inCodecPar, outFmtCtx unsafe.Pointer, inStreamIdx int) (
7474 }
7575
7676 // Opus always works with float planar samples.
77- ffmpeg.CodecCtxSetSampleFmt(encCtx, int32(ffmpeg.SampleFormatSampleFmtFltp))
77+ ffmpeg.CodecCtxSetSampleFmt(encCtx, int32(ffmpeg.SampleFmtFltp))
7878 ffmpeg.CodecCtxSetSampleRate(encCtx, opusSampleRate)
7979 codecCtxSetBitRate(encCtx, opusBitrate)
8080
@@ -116,7 +116,7 @@ func newAudioTranscoder(inCodecPar, outFmtCtx unsafe.Pointer, inStreamIdx int) (
116116
117117 inSampleRate := ffmpeg.CodecCtxSampleRate(decCtx)
118118 inSampleFmt := ffmpeg.CodecCtxSampleFmt(decCtx)
119- needResample := inSampleRate != opusSampleRate || inSampleFmt != int32(ffmpeg.SampleFormatSampleFmtFltp)
119+ needResample := inSampleRate != opusSampleRate || inSampleFmt != int32(ffmpeg.SampleFmtFltp)
120120
121121 if needResample {
122122 swr = ffmpeg.SwrAlloc()
@@ -130,7 +130,7 @@ func newAudioTranscoder(inCodecPar, outFmtCtx unsafe.Pointer, inStreamIdx int) (
130130 ffmpeg.AVOptSetInt(swr, "in_sample_rate", int64(inSampleRate), 0)
131131 ffmpeg.AVOptSetInt(swr, "out_sample_rate", int64(opusSampleRate), 0)
132132 ffmpeg.AVOptSet(swr, "in_sample_fmt", ffmpeg.GetSampleFmtName(inSampleFmt), 0)
133- ffmpeg.AVOptSet(swr, "out_sample_fmt", ffmpeg.GetSampleFmtName(int32(ffmpeg.SampleFormatSampleFmtFltp)), 0)
133+ ffmpeg.AVOptSet(swr, "out_sample_fmt", ffmpeg.GetSampleFmtName(int32(ffmpeg.SampleFmtFltp)), 0)
134134
135135 // Modern FFmpeg (8.x) requires explicit channel layout configuration
136136 // on the SwrContext. Without it, swr_init may succeed but the resampler
@@ -156,7 +156,7 @@ func newAudioTranscoder(inCodecPar, outFmtCtx unsafe.Pointer, inStreamIdx int) (
156156 return nil, errors.New("failed to allocate resampled frame")
157157 }
158158
159- frameSetFormat(resampledFrame, int32(ffmpeg.SampleFormatSampleFmtFltp))
159+ frameSetFormat(resampledFrame, int32(ffmpeg.SampleFmtFltp))
160160 frameSetSampleRate(resampledFrame, opusSampleRate)
161161 frameSetNbSamples(resampledFrame, opusFrameSize)
162162 // Copy channel layout from decoder to the resampled frame.
@@ -74,7 +74,7 @@ func newAudioTranscoder(inCodecPar, outFmtCtx unsafe.Pointer, inStreamIdx int) (
74 }74 }
75 75
76 // Opus always works with float planar samples.76 // Opus always works with float planar samples.
77- ffmpeg.CodecCtxSetSampleFmt(encCtx, int32(ffmpeg.SampleFormatSampleFmtFltp))77+ ffmpeg.CodecCtxSetSampleFmt(encCtx, int32(ffmpeg.SampleFmtFltp))
78 ffmpeg.CodecCtxSetSampleRate(encCtx, opusSampleRate)78 ffmpeg.CodecCtxSetSampleRate(encCtx, opusSampleRate)
79 codecCtxSetBitRate(encCtx, opusBitrate)79 codecCtxSetBitRate(encCtx, opusBitrate)
80 80
@@ -116,7 +116,7 @@ func newAudioTranscoder(inCodecPar, outFmtCtx unsafe.Pointer, inStreamIdx int) (
116 116
117 inSampleRate := ffmpeg.CodecCtxSampleRate(decCtx)117 inSampleRate := ffmpeg.CodecCtxSampleRate(decCtx)
118 inSampleFmt := ffmpeg.CodecCtxSampleFmt(decCtx)118 inSampleFmt := ffmpeg.CodecCtxSampleFmt(decCtx)
119- needResample := inSampleRate != opusSampleRate || inSampleFmt != int32(ffmpeg.SampleFormatSampleFmtFltp)119+ needResample := inSampleRate != opusSampleRate || inSampleFmt != int32(ffmpeg.SampleFmtFltp)
120 120
121 if needResample {121 if needResample {
122 swr = ffmpeg.SwrAlloc()122 swr = ffmpeg.SwrAlloc()
@@ -130,7 +130,7 @@ func newAudioTranscoder(inCodecPar, outFmtCtx unsafe.Pointer, inStreamIdx int) (
130 ffmpeg.AVOptSetInt(swr, "in_sample_rate", int64(inSampleRate), 0)130 ffmpeg.AVOptSetInt(swr, "in_sample_rate", int64(inSampleRate), 0)
131 ffmpeg.AVOptSetInt(swr, "out_sample_rate", int64(opusSampleRate), 0)131 ffmpeg.AVOptSetInt(swr, "out_sample_rate", int64(opusSampleRate), 0)
132 ffmpeg.AVOptSet(swr, "in_sample_fmt", ffmpeg.GetSampleFmtName(inSampleFmt), 0)132 ffmpeg.AVOptSet(swr, "in_sample_fmt", ffmpeg.GetSampleFmtName(inSampleFmt), 0)
133- ffmpeg.AVOptSet(swr, "out_sample_fmt", ffmpeg.GetSampleFmtName(int32(ffmpeg.SampleFormatSampleFmtFltp)), 0)133+ ffmpeg.AVOptSet(swr, "out_sample_fmt", ffmpeg.GetSampleFmtName(int32(ffmpeg.SampleFmtFltp)), 0)
134 134
135 // Modern FFmpeg (8.x) requires explicit channel layout configuration135 // Modern FFmpeg (8.x) requires explicit channel layout configuration
136 // on the SwrContext. Without it, swr_init may succeed but the resampler136 // on the SwrContext. Without it, swr_init may succeed but the resampler
@@ -156,7 +156,7 @@ func newAudioTranscoder(inCodecPar, outFmtCtx unsafe.Pointer, inStreamIdx int) (
156 return nil, errors.New("failed to allocate resampled frame")156 return nil, errors.New("failed to allocate resampled frame")
157 }157 }
158 158
159- frameSetFormat(resampledFrame, int32(ffmpeg.SampleFormatSampleFmtFltp))159+ frameSetFormat(resampledFrame, int32(ffmpeg.SampleFmtFltp))
160 frameSetSampleRate(resampledFrame, opusSampleRate)160 frameSetSampleRate(resampledFrame, opusSampleRate)
161 frameSetNbSamples(resampledFrame, opusFrameSize)161 frameSetNbSamples(resampledFrame, opusFrameSize)
162 // Copy channel layout from decoder to the resampled frame.162 // Copy channel layout from decoder to the resampled frame.
M internal/infrastructure/transcoder/hwprobe.go +2 -2
@@ -32,14 +32,14 @@ type hwProfile struct {
3232
3333 var vaAPIProfile = hwProfile{
3434 api: "vaapi",
35- deviceType: ffmpeg.AV_HWDEVICE_TYPE_VAAPI,
35+ deviceType: int32(ffmpeg.HwdeviceTypeVaapi),
3636 encoders: []string{"av1_vaapi", "vp9_vaapi", "h264_vaapi"},
3737 decoders: []string{"h264_vaapi", "hevc_vaapi"},
3838 }
3939
4040 var nvencProfile = hwProfile{
4141 api: "nvenc",
42- deviceType: ffmpeg.AV_HWDEVICE_TYPE_CUDA,
42+ deviceType: int32(ffmpeg.HwdeviceTypeCuda),
4343 // hevc_nvenc and h264_nvenc are probed for logging/diagnostic purposes
4444 // but filtered as non-usable by isUsableEncoder (only open codecs like
4545 // AV1 and VP9 are usable in CEF's minimal build).
@@ -32,14 +32,14 @@ type hwProfile struct {
32 32
33 var vaAPIProfile = hwProfile{33 var vaAPIProfile = hwProfile{
34 api: "vaapi",34 api: "vaapi",
35- deviceType: ffmpeg.AV_HWDEVICE_TYPE_VAAPI,35+ deviceType: int32(ffmpeg.HwdeviceTypeVaapi),
36 encoders: []string{"av1_vaapi", "vp9_vaapi", "h264_vaapi"},36 encoders: []string{"av1_vaapi", "vp9_vaapi", "h264_vaapi"},
37 decoders: []string{"h264_vaapi", "hevc_vaapi"},37 decoders: []string{"h264_vaapi", "hevc_vaapi"},
38 }38 }
39 39
40 var nvencProfile = hwProfile{40 var nvencProfile = hwProfile{
41 api: "nvenc",41 api: "nvenc",
42- deviceType: ffmpeg.AV_HWDEVICE_TYPE_CUDA,42+ deviceType: int32(ffmpeg.HwdeviceTypeCuda),
43 // hevc_nvenc and h264_nvenc are probed for logging/diagnostic purposes43 // hevc_nvenc and h264_nvenc are probed for logging/diagnostic purposes
44 // but filtered as non-usable by isUsableEncoder (only open codecs like44 // but filtered as non-usable by isUsableEncoder (only open codecs like
45 // AV1 and VP9 are usable in CEF's minimal build).45 // AV1 and VP9 are usable in CEF's minimal build).
M internal/infrastructure/transcoder/pipeline.go +10 -10
@@ -591,9 +591,9 @@ func (p *pipeline) openVideoEncoder(decCtx unsafe.Pointer) (hwDeviceCtx unsafe.P
591591 var deviceType int32
592592 switch p.hwCaps.API {
593593 case "vaapi":
594- deviceType = ffmpeg.AV_HWDEVICE_TYPE_VAAPI
594+ deviceType = int32(ffmpeg.HwdeviceTypeVaapi)
595595 case "nvenc":
596- deviceType = ffmpeg.AV_HWDEVICE_TYPE_CUDA
596+ deviceType = int32(ffmpeg.HwdeviceTypeCuda)
597597 default:
598598 return nil, nil, fmt.Errorf("unknown HW API: %s", p.hwCaps.API)
599599 }
@@ -660,9 +660,9 @@ func (p *pipeline) tryOpenVideoEncoder(decCtx, hwDeviceCtx unsafe.Pointer, encod
660660 ffmpeg.CodecCtxSetTimeBase(encCtx, ffmpeg.AVRational{Num: framerate.Den, Den: framerate.Num})
661661
662662 if p.hwCaps.API == "vaapi" {
663- ffmpeg.CodecCtxSetPixFmt(encCtx, int32(ffmpeg.PixelFormatPixFmtVaapi))
663+ ffmpeg.CodecCtxSetPixFmt(encCtx, int32(ffmpeg.PixFmtVaapi))
664664 } else {
665- ffmpeg.CodecCtxSetPixFmt(encCtx, int32(ffmpeg.PixelFormatPixFmtNv12))
665+ ffmpeg.CodecCtxSetPixFmt(encCtx, int32(ffmpeg.PixFmtNv12))
666666 }
667667
668668 gopSize := int32(framerate.Num / framerate.Den * 2)
@@ -694,8 +694,8 @@ func (p *pipeline) tryOpenVideoEncoder(decCtx, hwDeviceCtx unsafe.Pointer, encod
694694 }
695695
696696 ffmpeg.HWFramesCtxSetInitialPoolSize(hwFramesData, 20)
697- ffmpeg.HWFramesCtxSetFormat(hwFramesData, int32(ffmpeg.PixelFormatPixFmtVaapi))
698- ffmpeg.HWFramesCtxSetSWFormat(hwFramesData, int32(ffmpeg.PixelFormatPixFmtNv12))
697+ ffmpeg.HWFramesCtxSetFormat(hwFramesData, int32(ffmpeg.PixFmtVaapi))
698+ ffmpeg.HWFramesCtxSetSWFormat(hwFramesData, int32(ffmpeg.PixFmtNv12))
699699 ffmpeg.HWFramesCtxSetWidth(hwFramesData, width)
700700 ffmpeg.HWFramesCtxSetHeight(hwFramesData, height)
701701
@@ -759,7 +759,7 @@ func (p *pipeline) applyQualityPreset(encCtx unsafe.Pointer, encoderName string,
759759
760760 // transcodeVideoPacket decodes a video packet, encodes the resulting
761761 // frames, and writes them to the output.
762-func (p *pipeline) transcodeVideoPacket(pkt, frame, encPkt, decCtx, encCtx, outFmtCtx unsafe.Pointer, inStreamWrap *ffmpeg.Stream, outVideoIdx int) error {
762+func (p *pipeline) transcodeVideoPacket(pkt, frame, encPkt, decCtx, encCtx, outFmtCtx unsafe.Pointer, inStreamWrap ffmpeg.Stream, outVideoIdx int) error {
763763 ret := ffmpeg.CodecSendPacket(decCtx, pkt)
764764 if ret < 0 {
765765 return fmt.Errorf("video decode send packet: %d", ret)
@@ -784,7 +784,7 @@ func (p *pipeline) transcodeVideoPacket(pkt, frame, encPkt, decCtx, encCtx, outF
784784
785785 // encodeAndWriteVideoFrame sends a decoded frame to the encoder and
786786 // writes any resulting packets to the output.
787-func (p *pipeline) encodeAndWriteVideoFrame(frame, encPkt, encCtx, outFmtCtx unsafe.Pointer, inStreamWrap *ffmpeg.Stream, outVideoIdx int) error {
787+func (p *pipeline) encodeAndWriteVideoFrame(frame, encPkt, encCtx, outFmtCtx unsafe.Pointer, inStreamWrap ffmpeg.Stream, outVideoIdx int) error {
788788 encFrame := frame
789789 var cleanup func()
790790 if p.hwCaps.API == "vaapi" {
@@ -824,7 +824,7 @@ func (p *pipeline) encodeAndWriteVideoFrame(frame, encPkt, encCtx, outFmtCtx uns
824824 }
825825
826826 func (p *pipeline) uploadVideoFrameToVAAPI(frame, encCtx unsafe.Pointer) (unsafe.Pointer, func(), error) {
827- if frameFormat(frame) == int32(ffmpeg.PixelFormatPixFmtVaapi) {
827+ if frameFormat(frame) == int32(ffmpeg.PixFmtVaapi) {
828828 return frame, func() {}, nil
829829 }
830830
@@ -844,7 +844,7 @@ func (p *pipeline) uploadVideoFrameToVAAPI(frame, encCtx unsafe.Pointer) (unsafe
844844 }
845845 }
846846
847- frameSetFormat(hwFrame, int32(ffmpeg.PixelFormatPixFmtVaapi))
847+ frameSetFormat(hwFrame, int32(ffmpeg.PixFmtVaapi))
848848 frameSetWidth(hwFrame, frameWidth(frame))
849849 frameSetHeight(hwFrame, frameHeight(frame))
850850 frameSetPts(hwFrame, framePts(frame))
@@ -591,9 +591,9 @@ func (p *pipeline) openVideoEncoder(decCtx unsafe.Pointer) (hwDeviceCtx unsafe.P
591 var deviceType int32591 var deviceType int32
592 switch p.hwCaps.API {592 switch p.hwCaps.API {
593 case "vaapi":593 case "vaapi":
594- deviceType = ffmpeg.AV_HWDEVICE_TYPE_VAAPI594+ deviceType = int32(ffmpeg.HwdeviceTypeVaapi)
595 case "nvenc":595 case "nvenc":
596- deviceType = ffmpeg.AV_HWDEVICE_TYPE_CUDA596+ deviceType = int32(ffmpeg.HwdeviceTypeCuda)
597 default:597 default:
598 return nil, nil, fmt.Errorf("unknown HW API: %s", p.hwCaps.API)598 return nil, nil, fmt.Errorf("unknown HW API: %s", p.hwCaps.API)
599 }599 }
@@ -660,9 +660,9 @@ func (p *pipeline) tryOpenVideoEncoder(decCtx, hwDeviceCtx unsafe.Pointer, encod
660 ffmpeg.CodecCtxSetTimeBase(encCtx, ffmpeg.AVRational{Num: framerate.Den, Den: framerate.Num})660 ffmpeg.CodecCtxSetTimeBase(encCtx, ffmpeg.AVRational{Num: framerate.Den, Den: framerate.Num})
661 661
662 if p.hwCaps.API == "vaapi" {662 if p.hwCaps.API == "vaapi" {
663- ffmpeg.CodecCtxSetPixFmt(encCtx, int32(ffmpeg.PixelFormatPixFmtVaapi))663+ ffmpeg.CodecCtxSetPixFmt(encCtx, int32(ffmpeg.PixFmtVaapi))
664 } else {664 } else {
665- ffmpeg.CodecCtxSetPixFmt(encCtx, int32(ffmpeg.PixelFormatPixFmtNv12))665+ ffmpeg.CodecCtxSetPixFmt(encCtx, int32(ffmpeg.PixFmtNv12))
666 }666 }
667 667
668 gopSize := int32(framerate.Num / framerate.Den * 2)668 gopSize := int32(framerate.Num / framerate.Den * 2)
@@ -694,8 +694,8 @@ func (p *pipeline) tryOpenVideoEncoder(decCtx, hwDeviceCtx unsafe.Pointer, encod
694 }694 }
695 695
696 ffmpeg.HWFramesCtxSetInitialPoolSize(hwFramesData, 20)696 ffmpeg.HWFramesCtxSetInitialPoolSize(hwFramesData, 20)
697- ffmpeg.HWFramesCtxSetFormat(hwFramesData, int32(ffmpeg.PixelFormatPixFmtVaapi))697+ ffmpeg.HWFramesCtxSetFormat(hwFramesData, int32(ffmpeg.PixFmtVaapi))
698- ffmpeg.HWFramesCtxSetSWFormat(hwFramesData, int32(ffmpeg.PixelFormatPixFmtNv12))698+ ffmpeg.HWFramesCtxSetSWFormat(hwFramesData, int32(ffmpeg.PixFmtNv12))
699 ffmpeg.HWFramesCtxSetWidth(hwFramesData, width)699 ffmpeg.HWFramesCtxSetWidth(hwFramesData, width)
700 ffmpeg.HWFramesCtxSetHeight(hwFramesData, height)700 ffmpeg.HWFramesCtxSetHeight(hwFramesData, height)
701 701
@@ -759,7 +759,7 @@ func (p *pipeline) applyQualityPreset(encCtx unsafe.Pointer, encoderName string,
759 759
760 // transcodeVideoPacket decodes a video packet, encodes the resulting760 // transcodeVideoPacket decodes a video packet, encodes the resulting
761 // frames, and writes them to the output.761 // frames, and writes them to the output.
762-func (p *pipeline) transcodeVideoPacket(pkt, frame, encPkt, decCtx, encCtx, outFmtCtx unsafe.Pointer, inStreamWrap *ffmpeg.Stream, outVideoIdx int) error {762+func (p *pipeline) transcodeVideoPacket(pkt, frame, encPkt, decCtx, encCtx, outFmtCtx unsafe.Pointer, inStreamWrap ffmpeg.Stream, outVideoIdx int) error {
763 ret := ffmpeg.CodecSendPacket(decCtx, pkt)763 ret := ffmpeg.CodecSendPacket(decCtx, pkt)
764 if ret < 0 {764 if ret < 0 {
765 return fmt.Errorf("video decode send packet: %d", ret)765 return fmt.Errorf("video decode send packet: %d", ret)
@@ -784,7 +784,7 @@ func (p *pipeline) transcodeVideoPacket(pkt, frame, encPkt, decCtx, encCtx, outF
784 784
785 // encodeAndWriteVideoFrame sends a decoded frame to the encoder and785 // encodeAndWriteVideoFrame sends a decoded frame to the encoder and
786 // writes any resulting packets to the output.786 // writes any resulting packets to the output.
787-func (p *pipeline) encodeAndWriteVideoFrame(frame, encPkt, encCtx, outFmtCtx unsafe.Pointer, inStreamWrap *ffmpeg.Stream, outVideoIdx int) error {787+func (p *pipeline) encodeAndWriteVideoFrame(frame, encPkt, encCtx, outFmtCtx unsafe.Pointer, inStreamWrap ffmpeg.Stream, outVideoIdx int) error {
788 encFrame := frame788 encFrame := frame
789 var cleanup func()789 var cleanup func()
790 if p.hwCaps.API == "vaapi" {790 if p.hwCaps.API == "vaapi" {
@@ -824,7 +824,7 @@ func (p *pipeline) encodeAndWriteVideoFrame(frame, encPkt, encCtx, outFmtCtx uns
824 }824 }
825 825
826 func (p *pipeline) uploadVideoFrameToVAAPI(frame, encCtx unsafe.Pointer) (unsafe.Pointer, func(), error) {826 func (p *pipeline) uploadVideoFrameToVAAPI(frame, encCtx unsafe.Pointer) (unsafe.Pointer, func(), error) {
827- if frameFormat(frame) == int32(ffmpeg.PixelFormatPixFmtVaapi) {827+ if frameFormat(frame) == int32(ffmpeg.PixFmtVaapi) {
828 return frame, func() {}, nil828 return frame, func() {}, nil
829 }829 }
830 830
@@ -844,7 +844,7 @@ func (p *pipeline) uploadVideoFrameToVAAPI(frame, encCtx unsafe.Pointer) (unsafe
844 }844 }
845 }845 }
846 846
847- frameSetFormat(hwFrame, int32(ffmpeg.PixelFormatPixFmtVaapi))847+ frameSetFormat(hwFrame, int32(ffmpeg.PixFmtVaapi))
848 frameSetWidth(hwFrame, frameWidth(frame))848 frameSetWidth(hwFrame, frameWidth(frame))
849 frameSetHeight(hwFrame, frameHeight(frame))849 frameSetHeight(hwFrame, frameHeight(frame))
850 frameSetPts(hwFrame, framePts(frame))850 frameSetPts(hwFrame, framePts(frame))

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close