If you want my help, then please describe the closed vs. open source
nature of the project or this particular code. I am not helping
non-open source projects at this time and not available for hire/paid
support at this time either. If you plan to contribute this code to
the project, please post the full code of the contribution to a public
source repository for review and assistance, or fork/clone the MLT git
repo and include your contribution.

On Sun, Jun 30, 2013 at 11:21 AM, Tomas Neme <lacrymol...@gmail.com> wrote:
> I'm getting a segfault upon calling mlt_frame_close after my consumer loop,
> the code is below, and it's really simple, it just gets the frame with
> rt_frame, and passes it to output. Output gets the image with
> mlt_frame_get_image and copies it over to shared memory. The segfault
> happens in the line marked with ///<<<<<<<<<<<<<<
>
> I *think* it might have something to do with the playback velocity and
> whatnot. I wasn't able to figure out how to force this to be real time, and
> I'm thinking maybe I'm requesting the same frame twice and closing it or
> something of the sort, although I have seen the segfault happen on the first
> run of the thread loop
>
> static void output( mlt_consumer this, void *share, int size, mlt_frame
> frame ) {
>   // Get the properties
>   mlt_properties properties = MLT_CONSUMER_PROPERTIES( this );
>
>   mlt_image_format fmt = mlt_properties_get_int(properties, "_format");
>   int width = mlt_properties_get_int(properties, "width");
>   int height = mlt_properties_get_int(properties, "height");
>   pthread_rwlock_t *rwlock = mlt_properties_get_data(properties, "_rwlock",
> NULL);
>   uint8_t *image=NULL;
>   mlt_frame_get_image(frame, &image, &fmt, &width, &height, 0);
>   int image_size = mlt_image_format_size(fmt, width, height, NULL);
>
>   pthread_rwlock_wrlock(rwlock);
>
>   void *walk = share;
>
>   uint32_t *header = (uint32_t*) walk;
>
>   header[0] = image_size;
>   header[1] = fmt;
>   header[2] = width;
>   header[3] = height;
>   walk = header + 4;
>
>   memcpy(walk, image, image_size);
>   walk += image_size;
>
>   pthread_rwlock_unlock(rwlock);
> }
>
>
> static void *consumer_thread( void *arg ) {
>   // Map the argument to the object
>   mlt_consumer this = arg;
>
>   // Get the properties
>   mlt_properties properties = MLT_CONSUMER_PROPERTIES( this );
>
>   // Get the terminate_on_pause property
>   int top = mlt_properties_get_int( properties, "terminate_on_pause" );
>
>   // Frame and size
>   mlt_frame frame = NULL;
>
>   // shared memory info
>   int size = 0;
>   uint8_t *share = mlt_properties_get_data(properties, "_writespace",
> &size);
>
>   // Loop while running
>   while( mlt_properties_get_int( properties, "running" ) ) {
>     // Get the frame
>     frame = mlt_consumer_rt_frame( this );
>
>     // Check that we have a frame to work with
>     if ( frame != NULL ) {
>       // Terminate on pause
>       if ( top && mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ),
> "_speed" ) == 0 ) {
>         mlt_frame_close( frame );
>         break;
>       }
>       output( this, share, size, frame );
>       mlt_frame_close(frame);  ///<<<<<<<<<<<<<<
>     }
>   }
>
>   mlt_consumer_stopped( this );
>
>   return NULL;
> }
>
>
> Thanks
>
> Tomas
>
> --
> "The whole of Japan is pure invention. There is no such country, there are
> no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Mlt-devel mailing list
> Mlt-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mlt-devel
>



-- 
+-DRD-+

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to