
Recherche avancée
Médias (2)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (40)
-
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 (...) -
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...) -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
Sur d’autres sites (6644)
-
Missing functions in new version of FFmpeg
25 avril 2013, par AsikI am upgrading a wrapper around ffmpeg to the most recent version of the library. Some functions have been renamed or replaced. For the most part I've been able to found equivalents easily, but the following two are giving me trouble :
av_abort_set_callback
av_abort_default_callbackI could not find these functions by searching online, so what happened to them and what should they be replaced with now ?
Here is a copy of the header file "abort.h" where they were located :
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_ABORT_H
#define AVUTIL_ABORT_H
/**
* Causes abnormal program termination. By default, av_abort_callback calls
* abort() from the stdlib. This behavior can be altered by setting a
* different av_abort callback function.
*/
void av_abort_internal(void);
void av_abort_set_callback(void (*)(void));
void av_abort_default_callback(void);
#define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); av_abort_internal(); } while(0)
#endif /* AVUTIL_ABORT_H */ -
shared library built with g++ compile is works and with automake compile can not be used
23 avril 2013, par user2310175I'm building a shared libraries on CentOS 6.2.
The shared library will be build have some cpp files,headers,c shared libraries
and ffmpeg.The shared library is used to convert videos. When i use the g++ compile like this :g++ DataType.h h264function.h h264function.cpp videoconvert.h videoconvert.cpp stdafx.h stdafx.cpp YV12toRGB.h YV12toRGB.cpp -lMPCtrl -lavcodec -lavformat -lavutil - lhcnetsdk -lPlayCtrl -lpthread -fPIC -shared -o libtest.so
It can work properly,and the video can be converted as standard h264 coded.That seems the files used for building the library is
good.But when i use the autotools to make the library,it can not work correct.Here is my configure.in and Makefile.am :
Makefile.am :
prefix=/usr
lib_LTLIBRARIES=libhikvisiontranso.la
libhikvisiontranso_la_SOURCES=stdafx.h stdafx.cpp videoconvert.h videoconvert.cpp
h264function.h h264function.cpp YV12toRGB.h YV12toRGB.cpp DataType.h
libhikvisiontranso_la_LDFLAGS=-avoid-version -shared
libhikvisiontranso_la_LIBADD=-lpthread -lMPCtrl -lhcnetsdk -lPlayCtrl -lavformat - lavcodec -lavutil
ACLOCAL_AMFLAGS= -I m4configure.in :
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([hikvisiontranso],[1.0], [songxiawuren@gmail.com])
AM_INIT_AUTOMAKE([libhikvisiontranso.so],[1.0])
AC_CONFIG_SRCDIR([DataType.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AT_INIT
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([inttypes.h limits.h stddef.h stdint.h stdlib.h string.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_PROG_LIBTOOL
AC_CONFIG_FILES([Makefile])
AC_OUTPUTThe wrong output is :
SDL Init
init console=1
Output #0, avi, to '/home/ningge/Desktop/HaikangDvr.avi':
Stream #0.0: Invalid Codec type -1
Height = 576; Width = 704;totalfram=90000
Segmentation fault (core dumped)The right is :
SDL Init
init console=1
Output #0, avi, to '/home/ningge/Desktop/HaikangDvr.avi':
Stream #0.0: Video: mpeg4, yuv420p, 704x576, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Height = 576; Width = 704;totalfram=90000
CSDLInit goOutI hope someone can help me to find what's wrong with automake.
-
ffmpeg in child process doesn't exit when parent closes pipe
28 mars 2013, par user2221129This code snippet is from a pthread process. It is responsible for reading configuration/options to pass to ffmpeg. The data piped to ffmpeg is coming in on a ring buffer of video frames (as a proof of concept, in the final implementation these would be coming from a camera device). The parent writes to the child via a pipe established with dup2. The problem I'm having is that most of the time, the ffmpeg process doesn't seem to recognize the pipe has been closed by the parent (as strace shows the ffmpeg is in read). There are probably some unhandled mutex situations.
#define CHILD_READ writepipe[0]
#define PARENT_WRITE writepipe[1]
#define MAX_VIDEO_BUFFERS 30
static int last_frame_written = -1;
static int buffer_size = -1;
static void *video_buffer[MAX_VIDEO_BUFFERS];
#define MAXTHREADS 2
static pthread_t thread[MAXTHREADS];
static int sigusr[MAXTHREADS];
static int sigusr_thread[MAXTHREADS];
#define MAXPARAMETERS 100
void* encoder_thread(void *ptr)
{
int param;
const char **parameters = new const char* [MAXPARAMETERS];
ssize_t bytes_written_debug = 0;
int writepipe[2] = {-1,-1};
int last_frame_read = -1;
pid_t childpid;
// xxx
if ( 0 != pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) )
{
fprintf(stderr,"pthread_setcancelstate could not be set\n");
}
param = *(int*)ptr;
fprintf(stderr,"param = %d\n", param);
switch (param)
{
...read config file and populate parameters for child call...
}
while ( last_frame_written == -1 )
{
fprintf(stderr,"ENCODER THREAD WAITING\n");
sleep(1);
}
if ( pipe(writepipe) < 0 )
{
...handle error case...
}
if ( (childpid = fork()) < 0)
{
fprintf(stderr,"child failed\n");
}
else if ( 0 == childpid ) /* in the child */
{
dup2(CHILD_READ, STDIN_FILENO);
//close(CHILD_READ); // doesn't seem to matter
close(PARENT_WRITE);
execv("/usr/bin/ffmpeg",(char **)parameters);
return;
}
else /* in the parent */
{
fprintf(stderr,"THREAD CHILD PID: %d\n",childpid);
close(CHILD_READ);
while ( last_frame_written > -1 && 0==sigusr_thread[param] )
{
if ( last_frame_read != last_frame_written )
{
// send frame to child (ffmpeg)
last_frame_read = last_frame_written;
bytes_written_debug = write(PARENT_WRITE,video_buffer[last_frame_read], buffer_size);
if ( bytes_written_debug < 0 )
{
fprintf(stderr, "write error\n");
break;
}
}
usleep(10000); // assume ~100Hz rate
}
/// Problems begin now: no more data from main process,
/// Shouldn't this close "close" the pipe created with dup2 and hence EOF ffmpeg?
if ( close(PARENT_WRITE) )
{
fprintf(stderr,"\n\nclose failure! wtf?\n\n\n");
}
// debug sleep:
// waiting 10 sec doesn't seem to help...
// trying to give ffmpeg some time if it needs it
sleep(10);
// kill never fails here:
if ( !kill(childpid,SIGINT) )
{
fprintf(stderr, "\n\nkill child %d\n", childpid);
}
else
{
fprintf(stderr, "\n\nkill failed for child %d\n", childpid);
}
fprintf(stderr,"\n\nwaiting\n\n\n");
int status = 0;
// wait forever (in most cases); ps -axw shows all the ffmpeg's
wait(&status);
}
}
int main()
{
...
for ( int i = 0; i < MAXTHREADS; ++i)
{
sigusr[i] = 0;
sigusr_thread[i] = 0;
param[i] = i;
iret = pthread_create( &thread[i], NULL, encoder_thread, (void*) &param[i] );
}
...
// Maybe this is important to the pthread signaling?
// Don't think so because thread's SIGINT isn't picked up by signal handler (not shown)
sigemptyset(&set);
sigaddset(&set, SIGHUP);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGUSR1);
sigaddset(&set, SIGUSR2);
sigaddset(&set, SIGALRM);
/* block out these signals */
sigprocmask(SIG_BLOCK, &set, NULL);
...read file/populate frame buffer until file exhausted...
fprintf(stderr, "waiting for threads to exit\n");
for ( int i = 0; i < MAXTHREADS; ++i)
{
sigusr_thread[i] = 1;
pthread_join( thread[i], NULL);
}
fprintf(stderr, "done waiting for threads to exit\n");
...
return 0;
}I've embedded comments and questions in the thread's parent code after the frame buffer read/write loop.
Hope I've provided enough detail - stackoverflow posting noob ! Thank you.