I hereby claim:
- I am fornax96 on github.
- I am fornax96 (https://keybase.io/fornax96) on keybase.
- I have a public key ASAg6qRo5dRf-RB5DYxujXaF40NXIU96BYzafs1f3a37eAo
To claim this, I am signing this object:
| func videoThumbnail(ps *pixelstore.PixelStore, sourceFile pixelstore.FileID) (image.Image, error) { | |
| // To generate thumbnails from video files we use FFMPEG. One challenge is | |
| // that FFMPEG needs to seek to the end of the video to decode the stream | |
| // metadata. Saving the whole file to disk would be inefficient. Luckily | |
| // FFMPEG supports reading (and seeking) videos over HTTP. Here we start a | |
| // HTTP server on a random TCP port, then the address of the listener is | |
| // given to FFMPEG to read the file from. When FFMPEG exits we shut down the | |
| // listener and the HTTP server. The resulting thumbnail image is piped to | |
| // stdout and saved in a buffer. The buffer is then decoded and returned | |
| // from the function |
I hereby claim:
To claim this, I am signing this object:
| package util | |
| // ExecutionLimiter is a utility which limits the concurrent execution of a | |
| // function. When it is initialized it creates a channel with x capacity and | |
| // fills it with x booleans. Every time the Lock() function is called a bool is | |
| // removed from the channel. When the channel is empty the function will block | |
| // until the Unlock function is called, which puts a new bool into the channel. | |
| type ExecutionLimiter struct { | |
| channel chan bool | |
| } |
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "net" | |
| "net/http" | |
| "os" | |
| "os/exec" | |
| "os/signal" |
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "os" | |
| "strconv" | |
| "strings" | |
| ) |