
Recherche avancée
Autres articles (99)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Le plugin : Gestion de la mutualisation
2 mars 2010, parLe plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
Installation basique
On installe les fichiers de SPIP sur le serveur.
On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
< ?php (...) -
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation"
Sur d’autres sites (9578)
-
CGO : How do I write to a file in Golang using a pointer to the C data ?
24 avril 2018, par nevernewI’m writing an app for the windows platform using FFmpeg and it’s golang wrapper goav, but I’m having trouble understanding how to use the C pointers to gain access to an array.
I’m trying to write the frame data, pointed to by a uint8 pointer from C, to a .ppm file in golang.
Once I have this done, for proof of concept that FFmpeg is doing what I expect it to, I want to set the frames to a texture in OpenGl to make a video player with cool transitions ; any pointers to do that nice and efficiently would be so very helpful ! I’m guessing I need to write some shader code to draw the ppm as a texture...
I’m starting to understanding how to cast the pointers between C and Go types, but how can I access the data and write it in Go with the same result as C ? In C I just have to set the pointer offset for the data and state how much of it to write :
for (y = 0; y < height; y++) {
fwrite(pFrame->data[0]+y*pFrame->linesize[0], 1, width*3, pFile);
}I’ve stripped out all the relevant parts of the C code, the wrapper and my code, shown below :
C code - libavutil/frame.h
#include
typedef struct AVFrame {
#define AV_NUM_DATA_POINTERS 8
uint8_t *data[AV_NUM_DATA_POINTERS];
int linesize[AV_NUM_DATA_POINTERS];
}Golang goav wrapper
package avutil
/*
#cgo pkg-config: libavutil
#include <libavutil></libavutil>frame.h>
#include
*/
import "C"
import (
"unsafe"
)
type Frame C.struct_AVFrame
func Data(f *Frame) *uint8 {
return (*uint8)(unsafe.Pointer((*C.uint8_t)(unsafe.Pointer(&f.data))))
}
func Linesize(f *Frame) int {
return int(*(*C.int)(unsafe.Pointer(&f.linesize)))
}My Golang code
package main
import "github.com/giorgisio/goav/avutil"
func saveFrame(videoFrame *avutil.Frame, width int, height int, iFrame int) {
var szFilename string
var y int
var file *os.File
var err error
szFilename = ""
// Open file
szFilename = fmt.Sprintf("frame%d.ppm", iFrame)
if file, err = os.Open(szFilename); err != nil {
log.Println("Error Reading")
}
// Write header
fh := []byte(fmt.Sprintf("P6\n%d %d\n255\n", width, height))
file.Write(fh)
var b byte = 0
// Write pixel data
for y = 0; y < height; y++ {
d := avutil.Data(videoFrame) // d should be a pointer to the first byte of data
l := avutil.Linesize(videoFrame)
// I'm basically lost trying to figure out how to write this to a file
data := make([]byte, width*3)
addr := int(*d) + y*l // figure out the address
for i := 0; i < l; i++ {
// This is where I'm having the problem, I get an "invalid
// memory address or nil pointer dereference" error
byteArrayPtr := (*byte)(unsafe.Pointer(uintptr(addr) + uintptr(i)*unsafe.Sizeof(b)))
data = append(data, *byteArrayPtr)
fmt.Println(*byteArrayPtr)
}
file.Write(data)
}
file.Close()
}So, how can I write to a file using a pointer to the data, like you can do in C ?
-
avcodec/agm : Check for too many too short codes in make_new_tree()
21 avril 2019, par Michael Niedermayeravcodec/agm : Check for too many too short codes in make_new_tree()
Fixes : SEGV on unknown address
Fixes : 14198/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5723579234123776Found-by : continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by : Paul B Mahol <onemda@gmail.com>
Signed-off-by : Michael Niedermayer <michael@niedermayer.cc> -
avcodec/libdav1d : free the Dav1dData packet on dav1d_send_data() failure
1er février 2022, par James Almeravcodec/libdav1d : free the Dav1dData packet on dav1d_send_data() failure
We still own it on failure, and there's no point trying to feed it again.
This should address the issue reported in dav1d #383 and part of VLC #26259.
Signed-off-by : James Almer <jamrial@gmail.com>
Reviewed-by : Ronald S. Bultje <rsbultje@gmail.com>