You need to implement locking mechanism like this:

static int
lockmgr(void **mtx, enum AVLockOp op)
{
 switch(op) {
 case AV_LOCK_CREATE:
   *mtx = malloc(sizeof(pthread_mutex_t));
   if(!*mtx)
     return 1;
   return !!pthread_mutex_init(*mtx, NULL);
 case AV_LOCK_OBTAIN:
   return !!pthread_mutex_lock(*mtx);
 case AV_LOCK_RELEASE:
   return !!pthread_mutex_unlock(*mtx);
 case AV_LOCK_DESTROY:
   pthread_mutex_destroy(*mtx);
   free(*mtx);
   return 0;
 }
 return 1;
}



// During application startup.

if(av_lockmgr_register(lockmgr)) {
 // Failure
}

// During application shutdown.

av_lockmgr_register(NULL);


On Sun, Sep 27, 2009 at 2:38 AM, Michael Conrad <mcon...@intellitree.com>wrote:

> On Fri, 25 Sep 2009 08:58:48 -0400, <zcc...@libero.it> wrote:
>
>> Hi to all,
>> I'm realizing an application to displaying more than one MPEG4 network
>> streaming. I used ffmpeg library to decode the streaming, but if  I try to
>> decode two streams in  the same time, it doesn't work fine.
>> Is it possible to use ffmpeg libraries to make this kind of application ?
>>
>
> It works fine if you use only one thread.  In order to have multiple
> threads each decoding their own stream, you need to synchronize access to
> several functions.  One important one is "avcodec_open".  Search this list
> to find more details.
>
> --
> Michael Conrad
> IntelliTree Solutions llc.
> 513-552-6362
> mcon...@intellitree.com
> _______________________________________________
> libav-user mailing list
> libav-user@mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
_______________________________________________
libav-user mailing list
libav-user@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to