Re: [Mlt-devel] question on usage of MLT Producer
Brought to you by:
ddennedy,
lilo_booter
From: Dan D. <da...@de...> - 2008-03-03 07:16:05
|
Sorry to take so long, On Wed, Feb 27, 2008 at 11:15 PM, jaromil <ja...@dy...> wrote: > On Wed, Feb 27, 2008 at 11:43:55AM -0800, Dan Dennedy wrote: > > On Tue, Feb 26, 2008 at 8:02 AM, jaromil <ja...@dy...> wrote: > > > > i am trying to instantiate a producer for direct usage in the > > > simpliest way possible, proceeding as follows: > > > I need to have a yuv422 buffer for every frame, whenever my callback > is called in the application. as i mentioned, the threading is handled > in freej, it cannot be handled by an mlt_consumer. in case you believe OK, this should not be a problem. > this is accomplishable by using an higher level of the API please > point me out the way, i'll try that. > > so far my progresses lead to something that seems to work better (at > least no hard crashes), below a simplified flow: > > init() { > > mlt_factory_init( NULL ); > > real_producer = mlt_factory_producer( "fezzik", file ); As we resolved before, "fezzik" could be NULL to use the default, which is fezzik. If you had used "avformat" you might have noticed that it works as expected (at least, I think so in most versions, but not certain), and that might or might not be what you want. The fezzik producer does two things. First, it is a loader that uses a fezzik.dict file that contains a mapping of file name extension to a list of producers to try, and if all fails, then it tries avformat. Secondly, and this is the important part for you, it automatically applies a set of filters defined in fezzik.ini. For each line in the file, it tries each filter in the list until one is successfully created. The purpose is to "normalise" or "conform" all of the inputs to some common resolution, color space, aspect ratio, and progressive scan if needed. You might not want the automatic filters if you just want to get the pure decoded image. > > mlt_producer_optimise( real_producer ); The mlt_producer_optimise is not necessary for your simple case. > service = mlt_producer_service( producer ); > > } > > > feed_every_frame() { > > > mlt_image_format format = mlt_image_yuv422; > mlt_frame frame; > uint8_t **image; > > mlt_service_get_frame( service, &frame, 1 ); > > mlt_frame_get_image( frame, image, &format, &width, &height, 0 ); There are 2 problems here. First, image should be a single pointer passed as &image. The function needs to be able to tell you the caller where the image will be. Here you are passing the pointer by value, and the address to the image will be lost on return. Secondly, width and height should be set to what you desire. That is the purpose of format as well. You express what you desire, but the producer may not always be able to comply. In the case of fezzik producer, it applies a filter called "resize." The purpose of this filter is to pad the image with black in order keeping the original aspect ratio. This filter currently *requires* that you tell it the desired width and height. However, it should be able to infer this from the current profile (defaults to PAL). I am going to commit a change to fix this now. However, in the meantime, you can either specify the width and height you want, and fezzik will automatically add filters that scale and pad, or you should just use the "avformat" producer. -- +-DRD-+ |