Recherche avancée

Médias (0)

Mot : - Tags -/logo

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (36)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (3788)

  • Revision 91518 : Notice PHP en moins : lock et unlock n’ont pas de $value ou $ttl.

    28 août 2015, par marcimat@… — Log

    Notice PHP en moins : lock et unlock n’ont pas de $value ou $ttl.

  • Can't lock std::mutex again

    16 juillet 2017, par user3567631

    Sorry for poor English.
    I referenced this FFMPEG to make ffmpeg decoder.
    The open will block, I make it run in detach thread.
    I added std::unique_lock to lock mutex in beginning of open.

    bool FFmpegWrapper::open(std::string strFileName)
    {
    std::unique_lock lock(g_Mutex, std::try_to_lock);

    m_pFormatContext = avformat_alloc_context();
    m_pFormatContext->probesize = 4 * 1024 *100;
    m_pFormatContext->max_analyze_duration = 0 * AV_TIME_BASE;

    if (avformat_open_input(&m_pFormatContext, strFileName.c_str(), nullptr, nullptr) != 0)
       return false;

    if (avformat_find_stream_info(m_pFormatContext, NULL) < 0)
       return false;

    m_iVideoStream = m_iAudioStream = -1;
    for (unsigned int i = 0; i < m_pFormatContext->nb_streams; i++)
    {
       if ((m_iVideoStream < 0) && (m_pFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO))
       {
           m_iVideoStream = i;
       }
       else if ((m_iAudioStream < 0) && (m_pFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO))
       {
           m_iAudioStream = i;
       }
    }

    if (!(hasVideo() || hasAudio()))
       return false; // Didn't find video or audio stream

    if (hasVideo())
    {
       if (!openVideoStream())
           return false;
    }

    if (hasAudio())
    {
       if (!openAudioStream())
           return false;
    }

    retrieveFileInfo();

    m_bIsFileOpen = true;
    m_strFileName = strFileName;

    if (isImage())
    {
       m_dDurationInMs = 0;
       m_dFps = 0;
       m_lCurrentFrameNumber = 1;
       decodeImage();
    }

    m_bIsThreadRunning = false;
    if (m_bIsFileOpen)
       CCLOG("FFmpeg open stream succeed");
    else
       CCLOG("FFmpeg open stream failed");
    m_iState = eOpened;

    return m_bIsFileOpen;
    }

    and added unique_lock in close beginning like this.

    void FFmpegWrapper::close()
    {
    std::unique_lock lock(g_Mutex, std::try_to_lock);
    while (!lock.owns_lock())
    {
       lock.try_lock()
    }

    stop();

    if (m_pVideoBuffer != nullptr)
    {
       delete m_pVideoBuffer;
       m_pVideoBuffer = nullptr;
    }

    if (m_pVideoFrameRGB != nullptr)
    {
       av_free(m_pVideoFrameRGB);
       m_pVideoFrameRGB = nullptr;
    }

    if (m_pVideoFrame != nullptr)
    {
       av_free(m_pVideoFrame);
       m_pVideoFrame = nullptr;
    }

    if (m_pAudioFrame != nullptr)
    {
       av_free(m_pAudioFrame);
       m_pAudioFrame = nullptr;
    }


    if (m_pSwScalingContext != nullptr)
    {
       sws_freeContext(m_pSwScalingContext);
       m_pSwScalingContext = nullptr;
    }

    if (m_pVideoCodecContext != nullptr)
    {
       avcodec_close(m_pVideoCodecContext);
       m_pVideoCodecContext = nullptr;
    }
    if (m_pAudioCodecContext != nullptr)
    {
       avcodec_close(m_pAudioCodecContext);
       m_pAudioCodecContext = nullptr;
    }

    if (m_pFormatContext != nullptr)
    {
       avformat_free_context(m_pFormatContext);    
       m_pFormatContext = nullptr;
    }
    if(m_pSwr != nullptr)
       swr_free(&m_pSwr);

    CCLOG("CLOSE DONE");
    }

    When open is still running ,I want lock mutex again in close in main thread.
    it failed to get mutex ownership it is no problem. But even while loop waited the open() done, try_lock still can’t get the mutex ownership.I thought unique_lock out of scope will unlock mutex ,but it didn’t. I want to know how can I lock the mutex correctly.Thank you !

  • avcodec/utils : use a default lock manager that uses a pthread mutex

    17 octobre 2013, par Michael Niedermayer
    avcodec/utils : use a default lock manager that uses a pthread mutex
    

    That makes avformat & avcodec thread safe without the need to explicitly
    register a lock manager.

    Reviewed-by : wm4 <nfxjfg@googlemail.com>
    Signed-off-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavcodec/utils.c