
Recherche avancée
Autres articles (54)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (6962)
-
Revision 74084 : ne pas classher avec le core suite à ...
5 juillet 2013, par brunobergot@… — Logne pas classher avec le core suite à http://core.spip.org/projects/spip/repository/revisions/20701
-
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.
-
Ubuntu12.04 : libavformat header trouble when compiling C program
30 mai 2013, par Juneyoung OhMy code is super simple, just include "avformat.h" and call "av_register_all".
full code is below.
1 #include
2 #include
3 #include
4 //#include <libavcodec></libavcodec>avcodec.h>
5 #include <libavformat></libavformat>avformat.h>
6 //#include "libavcodec/avcodec.h"
7 //#include "libavformat/avformat.h"
8
9
10 int main (int argc, char* argv[]){
11 av_register_all();
12 /*
13 AVFormatContext* pFormatCtx;
14 const char* filename = "/home/juneyoungoh/Videos/CON1234ID.ts";
15
16 if(av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL) != 0)
17 {
18 handle_error();
19 }
20
21 if(av_find_stream_info(pFormatCtx) < 0)
22 {
23 handle_error();
24 }
25
26 dump_format(pFormatCtx, 0, filename, 1);
27
28 //av_get_audio_frame_duration();
29 */
30 return 0;
31 }The problem is when I compile this in Terminal it show error.
/tmp/ccvgpGjv.o: In function `main':
getDuration.c:(.text+0x10): undefined reference to `av_register_all'
collect2: ld returned 1 exit statusmy avformat.h file is in
/usr/local/include/libavformat/avformat.h
.Here is something I have already tried.
- gcc getDuration.c
- gcc -I/usr/local/include/ getDuration.c
- gcc -I/usr/local/include/libavformat/ getDuration.c
- gcc -L/usr/local/include/ getDuration.c
- gcc -L/usr/local/include/libavformat/ getDuration.c
- gcc getDuration.c -lavformat
Give me the light of hope +_+