Recherche avancée

Médias (91)

Autres articles (112)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (12031)

  • Python ThreadedTCPServer : "Name or service not known"

    11 avril 2014, par Hal

    I was developing a ThreadedTCPServer to communicate with a PHP application also residing in this same machine. This is suppose to receive requests from this PHP app and to convert some videos locally using ffmpeg.

    Here's the code :

    # -*- coding: utf-8 -*-
    import os
    import socket
    import threading
    import logging.config
    import SocketServer, time
    from queuev2 import QueueServer

    logging.basicConfig(format='[%(asctime)s.%(msecs).03d] %(message)s', datefmt='%Y-%m-%d %H:%M:%S', filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'converter.log'), level=logging.INFO)

    class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):

       def handle(self):
           data = self.request.recv(1024)
           cur_thread = threading.current_thread()
           response = "{}: {}".format(cur_thread.name, data)
           videoPool.add(data)
           print "Output! %s" % data
           self.request.sendall(response)

    class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
       pass

    if __name__ == "__main__":

       logging.info("Initializing...")
       videoPool = QueueServer()
       HOST, PORT = "localhost", 6666

       server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
       ip, port = server.server_address

       # Start a thread with the server -- that thread will then start one
       # more thread for each request
       server_thread = threading.Thread(target=server.serve_forever)

       # Exit the server thread when the main thread terminates
       server_thread.daemon = True
       server_thread.start()

       print("Server loop running in thread: %s" % server_thread.name)

       # "Groundhog day" time
       while True:
           time.sleep(999)
           pass

       #server.shutdown()

    This works well in my development laptop, but on the server i'm getting the following error :

    Traceback (most recent call last):
     File "server.py", line 31, in <module>
       server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
     File "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
       self.server_bind()
     File "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
       self.socket.bind(self.server_address)
     File "/usr/lib/python2.7/socket.py", line 224, in meth
       return getattr(self._sock,name)(*args)
    socket.gaierror: [Errno -2] Name or service not known
    </module>

    I'm guessing it has to do with the port I'm using (6666), but I've tried others and it hasn't been working. Would Unix Domain Sockets be of use here ? Can you give me an example ?

  • Revision 6eb2cacf0d : Added a speed feature "allow_skip_recode" This commit added a speed feature to

    25 mars 2014, par Yaowu Xu

    Changed Paths :
     Modify /vp9/encoder/vp9_encodeframe.c


     Modify /vp9/encoder/vp9_onyx_if.c


     Modify /vp9/encoder/vp9_onyx_int.h



    Added a speed feature "allow_skip_recode"

    This commit added a speed feature to make the logic of calculating
    skip_recode on a block level more explicit. This also enable the
    feature to be enabled at speed 5 where the previous logic is too
    conservative, help gain back the lost speed for —rt(-5).

    Change-Id : Ieb37ca3e85c2e7bda343486edf13d5f5395f2233

  • Getting “field has incomplete type” and "conflicting types"

    4 novembre 2013, par Viet

    I'm trying build pjsip from source with video support by gcc on ubuntu. After i success full run ./configure and make dep, i run make and i have error below :

    ../src/pjmedia/ffmpeg_util.c:46:18: error: field ‘codec_id’ has incomplete type
    ../src/pjmedia/ffmpeg_util.c:148:13: error: conflicting types for ‘pjmedia_format_id_to_CodecID’
    ../src/pjmedia/ffmpeg_util.h:23:13: note: previous declaration of ‘pjmedia_format_id_to_CodecID’ was here
    ../src/pjmedia/ffmpeg_util.c: In function ‘pjmedia_format_id_to_CodecID’:
    ../src/pjmedia/ffmpeg_util.c:154:35: warning: comparison between pointer and integer [enabled by default]
    ../src/pjmedia/ffmpeg_util.c:155:6: error: dereferencing pointer to incomplete type
    ../src/pjmedia/ffmpeg_util.c:155:6: warning: statement with no effect [-Wunused-value]
    ../src/pjmedia/ffmpeg_util.c:160:5: error: dereferencing pointer to incomplete type
    ../src/pjmedia/ffmpeg_util.c:160:5: warning: statement with no effect [-Wunused-value]
    ../src/pjmedia/ffmpeg_util.c: At top level:
    ../src/pjmedia/ffmpeg_util.c:164:55: error: parameter 1 (‘codec_id’) has incomplete type

    Here is the code in ffmpeg_util.h and ffmpeg_util.c

    ffmpeg_util.h

    #ifndef __PJMEDIA_FFMPEG_UTIL_H__
    #define __PJMEDIA_FFMPEG_UTIL_H__

    #include <pjmedia></pjmedia>format.h>

    #ifdef _MSC_VER
    #   ifndef __cplusplus
    #   define inline _inline
    #   endif
    #   pragma warning(disable:4244) /* possible loss of data */
    #endif

    #include <libavutil></libavutil>avutil.h>
    #include <libavcodec></libavcodec>avcodec.h>

    void pjmedia_ffmpeg_add_ref();
    void pjmedia_ffmpeg_dec_ref();

    pj_status_t pjmedia_format_id_to_PixelFormat(pjmedia_format_id fmt_id,
                            enum PixelFormat *pixel_format);

    pj_status_t PixelFormat_to_pjmedia_format_id(enum PixelFormat pf,
                            pjmedia_format_id *fmt_id);

    pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id,
                        enum CodecID *codec_id);

    pj_status_t CodecID_to_pjmedia_format_id(enum CodecID codec_id,
                        pjmedia_format_id *fmt_id);

    #endif /* __PJMEDIA_FFMPEG_UTIL_H__ */

    ffmpeg_util.c

    #include <pjmedia></pjmedia>types.h>
    #include <pj></pj>errno.h>
    #include <pj></pj>log.h>
    #include <pj></pj>string.h>

    #if PJMEDIA_HAS_LIBAVFORMAT &amp;&amp; PJMEDIA_HAS_LIBAVUTIL

    #include "ffmpeg_util.h"
    #include <libavformat></libavformat>avformat.h>

    #define MAKE_VER(mj,mn,mi)  ((mj &lt;&lt; 16) | (mn &lt;&lt; 8) | (mi &lt;&lt; 0))
    #define VER_AT_LEAST(mj,mn,mi)  (MAKE_VER(LIBAVUTIL_VERSION_MAJOR, \
                                             LIBAVUTIL_VERSION_MINOR, \
                                             LIBAVUTIL_VERSION_MICRO) >= \
                                    MAKE_VER(mj,mn,mi))



    /* Conversion table between pjmedia_format_id and PixelFormat */
    static const struct ffmpeg_fmt_table_t
    {
       pjmedia_format_id   id;
       enum PixelFormat    pf;
    } ffmpeg_fmt_table[] =
    {
       { PJMEDIA_FORMAT_RGBA, PIX_FMT_RGBA},
       { PJMEDIA_FORMAT_RGB24,PIX_FMT_BGR24},
       { PJMEDIA_FORMAT_BGRA, PIX_FMT_BGRA},
    #if VER_AT_LEAST(51,20,1)
       { PJMEDIA_FORMAT_GBRP, PIX_FMT_GBR24P},
    #endif

       { PJMEDIA_FORMAT_AYUV, PIX_FMT_NONE},
       { PJMEDIA_FORMAT_YUY2, PIX_FMT_YUYV422},
       { PJMEDIA_FORMAT_UYVY, PIX_FMT_UYVY422},
       { PJMEDIA_FORMAT_I420, PIX_FMT_YUV420P},
       //{ PJMEDIA_FORMAT_YV12, PIX_FMT_YUV420P},
       { PJMEDIA_FORMAT_I422, PIX_FMT_YUV422P},
       { PJMEDIA_FORMAT_I420JPEG, PIX_FMT_YUVJ420P},
       { PJMEDIA_FORMAT_I422JPEG, PIX_FMT_YUVJ422P},
    };

    /* Conversion table between pjmedia_format_id and CodecID */
    static const struct ffmpeg_codec_table_t
    {
       pjmedia_format_id   id;
       enum CodecID    codec_id;
    } ffmpeg_codec_table[] =
    {
       {PJMEDIA_FORMAT_H261,   CODEC_ID_H261},
       {PJMEDIA_FORMAT_H263,   CODEC_ID_H263},
       {PJMEDIA_FORMAT_H263P,  CODEC_ID_H263P},
       {PJMEDIA_FORMAT_H264,   CODEC_ID_H264},
       {PJMEDIA_FORMAT_MPEG1VIDEO, CODEC_ID_MPEG1VIDEO},
       {PJMEDIA_FORMAT_MPEG2VIDEO, CODEC_ID_MPEG2VIDEO},
       {PJMEDIA_FORMAT_MPEG4,  CODEC_ID_MPEG4},
       {PJMEDIA_FORMAT_MJPEG,  CODEC_ID_MJPEG}
    };

    static int pjmedia_ffmpeg_ref_cnt;

    static void ffmpeg_log_cb(void* ptr, int level, const char* fmt, va_list vl);

    void pjmedia_ffmpeg_add_ref()
    {
       if (pjmedia_ffmpeg_ref_cnt++ == 0) {
       av_log_set_level(AV_LOG_ERROR);
       av_log_set_callback(&amp;ffmpeg_log_cb);
       av_register_all();
       }
    }

    void pjmedia_ffmpeg_dec_ref()
    {
       if (pjmedia_ffmpeg_ref_cnt-- == 1) {
       /* How to shutdown ffmpeg? */
       }

       if (pjmedia_ffmpeg_ref_cnt &lt; 0) pjmedia_ffmpeg_ref_cnt = 0;
    }


    static void ffmpeg_log_cb(void* ptr, int level, const char* fmt, va_list vl)
    {
       const char *LOG_SENDER = "ffmpeg";
       enum { LOG_LEVEL = 5 };
       char buf[100];
       int bufsize = sizeof(buf), len;
       pj_str_t fmt_st;

       /* Custom callback needs to filter log level by itself */
       if (level > av_log_get_level())
       return;

       /* Add original ffmpeg sender to log format */
       if (ptr) {
       AVClass* avc = *(AVClass**)ptr;
       len = pj_ansi_snprintf(buf, bufsize, "%s: ", avc->item_name(ptr));
       bufsize -= len;
       }

       /* Copy original log format */
       len = pj_ansi_strlen(fmt);
       if (len > bufsize-1)
       len = bufsize-1;
       pj_memcpy(buf+sizeof(buf)-bufsize, fmt, len);
       bufsize -= len;

       /* Trim log format */
       pj_strset(&amp;fmt_st, buf, sizeof(buf)-bufsize);
       pj_strrtrim(&amp;fmt_st);
       buf[fmt_st.slen] = &#39;\0&#39;;

       pj_log(LOG_SENDER, LOG_LEVEL, buf, vl);
    }


    pj_status_t pjmedia_format_id_to_PixelFormat(pjmedia_format_id fmt_id,
                            enum PixelFormat *pixel_format)
    {
       unsigned i;
       for (i=0; iid==fmt_id &amp;&amp; t->pf != PIX_FMT_NONE) {
           *pixel_format = t->pf;
           return PJ_SUCCESS;
       }
       }

       *pixel_format = PIX_FMT_NONE;
       return PJ_ENOTFOUND;
    }

    pj_status_t PixelFormat_to_pjmedia_format_id(enum PixelFormat pf,
                            pjmedia_format_id *fmt_id)
    {
       unsigned i;
       for (i=0; ipf == pf) {
           if (fmt_id) *fmt_id = t->id;
           return PJ_SUCCESS;
       }
       }

       return PJ_ENOTFOUND;
    }

    pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id,
                        enum CodecID *codec_id)
    {
       unsigned i;
       for (i=0; iid==fmt_id &amp;&amp; t->codec_id != PIX_FMT_NONE) {
           *codec_id = t->codec_id;
           return PJ_SUCCESS;
       }
       }

       *codec_id = PIX_FMT_NONE;
       return PJ_ENOTFOUND;
    }

    pj_status_t CodecID_to_pjmedia_format_id(enum CodecID codec_id,
                        pjmedia_format_id *fmt_id)
    {
       unsigned i;
       for (i=0; icodec_id == codec_id) {
           if (fmt_id) *fmt_id = t->id;
           return PJ_SUCCESS;
       }
       }

       return PJ_ENOTFOUND;
    }


    #ifdef _MSC_VER
    #   pragma comment( lib, "avformat.lib")
    #   pragma comment( lib, "avutil.lib")
    #endif

    #endif  /* #if PJMEDIA_HAS_LIBAVFORMAT &amp;&amp; PJMEDIA_HAS_LIBAVUTIL */

    Help me fix this error !