Recherche avancée

Médias (91)

Autres articles (103)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie 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 (...)

Sur d’autres sites (12173)

  • vp9/x86 : save one register on 32bit idct32x32.

    16 décembre 2014, par Ronald S. Bultje
    vp9/x86 : save one register on 32bit idct32x32.
    

    Fixes build on win32.

    Signed-off-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavcodec/x86/vp9itxfm.asm
  • How to save an SDL bitmap to memory and load it back ?

    19 novembre 2012, par Nav

    I have a bunch of RWops functions :

    static int myseekfunc(SDL_RWops *context, int offset, int whence) { SDL_SetError("Can&#39;t seek in this kind of RWops"); return(-1); }
    static int myreadfunc(SDL_RWops *context, void *ptr, int size, int maxnum) { memset(ptr,0,size*maxnum); return(maxnum); }
    static int mywritefunc(SDL_RWops *context, const void *ptr, int size, int num) { return(num); }
    static int myclosefunc(SDL_RWops *context)
    {
     if(context->type != 0xdeadbeef) { SDL_SetError("Wrong kind of RWops for myclosefunc()"); return(-1); }
     free(context->hidden.unknown.data1);
     SDL_FreeRW(context);
     return(0);
    }

    // Note that this function is NOT static -- we want it directly callable from other source files
    SDL_RWops *MyCustomRWop()
    {
     SDL_RWops *c=SDL_AllocRW();
     if(c==NULL) return(NULL);

     c->seek =myseekfunc;
     c->read =myreadfunc;
     c->write=mywritefunc;
     c->close=myclosefunc;
     c->type =0xdeadbeef;
     printf("deadbeef=%d\n",c->type);
     c->hidden.unknown.data1=malloc(256);//IS THIS CORRECT?
     return(c);
    }

    with which I'm trying to write a BMP into memory and then extract it back. The below code is from tutorial02.
    Two problems I'm facing are :
    1. Unless I call SDL_DisplayYUVOverlay, the SDL_SaveBMP function outputs a blank BMP file to the hard disk. How can I output a BMP file without having to call SDL_DisplayYUVOverlay ?
    2. Although I'm able to save the BMP to memory with SDL_SaveBMP_RW and free the memory with filestream->close, I'm unable to load the BMP back from memory with SDL_SaveBMP. The application crashes while trying to load it. Is it because of the c->hidden.unknown.data1=malloc(256); code above ? What would be the right way of allocating this memory ?

     AVFormatContext *pFormatCtx = NULL;
     int             i, videoStream;
     AVCodecContext  *pCodecCtx = NULL;
     AVCodec         *pCodec = NULL;
     AVFrame         *pFrame = NULL;
     AVPacket        packet;
     SDL_Overlay     *bmp = NULL;
     SDL_Surface     *screen = NULL;
     SDL_Surface     *screen2 = NULL;
     SDL_Rect        rect;
    ....
    ....    
    if(frameFinished)

    {
    SDL_LockYUVOverlay(bmp);//-----------lock

    AVPicture pict;
    pict.data[0] = bmp->pixels[0];
    pict.data[1] = bmp->pixels[2];
    pict.data[2] = bmp->pixels[1];

    pict.linesize[0] = bmp->pitches[0];
    pict.linesize[1] = bmp->pitches[2];
    pict.linesize[2] = bmp->pitches[1];

    // Convert the image into YUV format that SDL uses
    sws_scale( sws_ctx, (uint8_t const * const *)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pict.data, pict.linesize );

    SDL_UnlockYUVOverlay(bmp);//-----------unlock

    rect.x = 0;
    rect.y = 0;
    rect.w = pCodecCtx->width;
    rect.h = pCodecCtx->height;
    SDL_DisplayYUVOverlay(bmp, &amp;rect);
    ++i;

    SDL_RWops *filestream = MyCustomRWop();//SDL_AllocRW();
    SDL_SaveBMP_RW (screen, filestream, i);
    screen2 = SDL_LoadBMP_RW(filestream,1);//LOADING IS THE PROBLEM HERE. DON&#39;T KNOW WHY
    filestream->close;
    SDL_SaveBMP(screen, filepointer);
  • How to make a basic youtube music bot work with searching titles instead of the URL

    21 janvier 2021, par Brandon

    Hello so i've followed this tutorial and added this code to my current bot to make it have a music bot function. Im wondering how to make the following code work with the youtube search function, for example right now I have to do !play URL but I would also like to be able to do !play name of song then the bot will search and play the most matched song.

    &#xA;&#xA;

    I am new to javascript but I know I shouldn't be looking for handouts, but some help would be appreciated.

    &#xA;&#xA;

    const Discord = require("discord.js");&#xA;const { prefix, token } = require("./config.json");&#xA;const ytdl = require("ytdl-core");&#xA;&#xA;const client = new Discord.Client();&#xA;&#xA;const queue = new Map();&#xA;&#xA;client.once("ready", () => {&#xA;  console.log("Ready!");&#xA;});&#xA;&#xA;client.once("reconnecting", () => {&#xA;  console.log("Reconnecting!");&#xA;});&#xA;&#xA;client.once("disconnect", () => {&#xA;  console.log("Disconnect!");&#xA;});&#xA;&#xA;client.on("message", async message => {&#xA;  if (message.author.bot) return;&#xA;  if (!message.content.startsWith(prefix)) return;&#xA;&#xA;  const serverQueue = queue.get(message.guild.id);&#xA;&#xA;  if (message.content.startsWith(`${prefix}play`)) {&#xA;    execute(message, serverQueue);&#xA;    return;&#xA;  } else if (message.content.startsWith(`${prefix}skip`)) {&#xA;    skip(message, serverQueue);&#xA;    return;&#xA;  } else if (message.content.startsWith(`${prefix}stop`)) {&#xA;    stop(message, serverQueue);&#xA;    return;&#xA;  } else {&#xA;    message.channel.send("You need to enter a valid command!");&#xA;  }&#xA;});&#xA;&#xA;async function execute(message, serverQueue) {&#xA;  const args = message.content.split(" ");&#xA;&#xA;  const voiceChannel = message.member.voice.channel;&#xA;  if (!voiceChannel)&#xA;    return message.channel.send(&#xA;      "You need to be in a voice channel to play music!"&#xA;    );&#xA;  const permissions = voiceChannel.permissionsFor(message.client.user);&#xA;  if (!permissions.has("CONNECT") || !permissions.has("SPEAK")) {&#xA;    return message.channel.send(&#xA;      "I need the permissions to join and speak in your voice channel!"&#xA;    );&#xA;  }&#xA;&#xA;  const songInfo = await ytdl.getInfo(args[1]);&#xA;  const song = {&#xA;    title: songInfo.title,&#xA;    url: songInfo.video_url&#xA;  };&#xA;&#xA;  if (!serverQueue) {&#xA;    const queueContruct = {&#xA;      textChannel: message.channel,&#xA;      voiceChannel: voiceChannel,&#xA;      connection: null,&#xA;      songs: [],&#xA;      volume: 5,&#xA;      playing: true&#xA;    };&#xA;&#xA;    queue.set(message.guild.id, queueContruct);&#xA;&#xA;    queueContruct.songs.push(song);&#xA;&#xA;    try {&#xA;      var connection = await voiceChannel.join();&#xA;      queueContruct.connection = connection;&#xA;      play(message.guild, queueContruct.songs[0]);&#xA;    } catch (err) {&#xA;      console.log(err);&#xA;      queue.delete(message.guild.id);&#xA;      return message.channel.send(err);&#xA;    }&#xA;  } else {&#xA;    serverQueue.songs.push(song);&#xA;    return message.channel.send(`${song.title} has been added to the queue!`);&#xA;  }&#xA;}&#xA;&#xA;function skip(message, serverQueue) {&#xA;  if (!message.member.voice.channel)&#xA;    return message.channel.send(&#xA;      "You have to be in a voice channel to stop the music!"&#xA;    );&#xA;  if (!serverQueue)&#xA;    return message.channel.send("There is no song that I could skip!");&#xA;  serverQueue.connection.dispatcher.end();&#xA;}&#xA;&#xA;function stop(message, serverQueue) {&#xA;  if (!message.member.voice.channel)&#xA;    return message.channel.send(&#xA;      "You have to be in a voice channel to stop the music!"&#xA;    );&#xA;  serverQueue.songs = [];&#xA;  serverQueue.connection.dispatcher.end();&#xA;}&#xA;&#xA;function play(guild, song) {&#xA;  const serverQueue = queue.get(guild.id);&#xA;  if (!song) {&#xA;    serverQueue.voiceChannel.leave();&#xA;    queue.delete(guild.id);&#xA;    return;&#xA;  }&#xA;&#xA;  const dispatcher = serverQueue.connection&#xA;    .play(ytdl(song.url))&#xA;    .on("finish", () => {&#xA;      serverQueue.songs.shift();&#xA;      play(guild, serverQueue.songs[0]);&#xA;    })&#xA;    .on("error", error => console.error(error));&#xA;  dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);&#xA;  serverQueue.textChannel.send(`Start playing: **${song.title}**`);&#xA;}&#xA;&#xA;client.login(token);&#xA;

    &#xA;