On Sun, 04 Jun 2006 15:05:25 JST
[EMAIL PROTECTED] (Andrew Church) wrote:

>      I've started work on porting the NuppelVideo import module to NMS,
> mainly so we can get rid of most of that ugly RTjpeg code, and I've come
> across a problem: there's no way to tell the demultiplexer to open a file.
> There is configure(), but it doesn't have any filename parameter, so the
> code has no way to know whether it should open vob->video_in_file or
> vob->audio_in_file.

There is a similar problem for multiplexors, so it could be very useful
to take some time to think about this situation.

The overall idea was the following
1) transcode defaults to single file both for import and for export,
so it should be sane to look for vob->video_{in,out}_file first
2) if (vob->audio_{in,out}_file != NULL && strcmp(vob->audio_{in,out}_file,
vob->video_{in,out}_file) != 0)
    use a separate file for audio

To tell the full story, there is another little issue with multiplexors,
since {audio,video}_out_file should be considered as BASENAMES, not full
paths, so avi multiplexor can attach it's own extension, so raw multiplexor,
ogm one and so on. I'll do this change into near future.

To get back on open issues, in facts current situation it's counter intuitive,
maybe clumsy, surely suboptimal.
I don't already add another method since I'm quite worried about method
explosion, I want to avoid it.

>  Am I missing something or do we need to add an open()
> routine or something like that for demuxers?

Looks like open() for (de)multiplexors already has more pros that cons (it
already semplify rotation code and allow to avoid some tricks on it, see
below), so we can add something as

- add int (*open)(TCModuleInstance *self,
                  const char *video_file, const char *audio_file);
/* or maybe s/video/primary/ s/audio/auxiliary/ ? */

that open each given file if argument != NULL and returns -1 if error
(tc_log*()'in it) and N if succesfull, where N it's equal to open files)

examples:

open(instance, NULL, "foo.wav"):
        -1 if error, +1 if successfull (open just one file, the audio one)

open(instance, NULL, NULL):
        -1 if error, 0 if successfull (do nothing)

open(instance, "foo.y4m", "bar.wav"):
        -1 if error, 2 if successfull (open both audio and video files)

configure() method will still behave exactly as before, except the fact that
it no longer open any file for multiplexor/demultiplexors.

A word about stop() method.
It will desiderable that we decouples file flushing/closing operation from
general cleanup routines?

IMHO yes, that will help simplifing multiplexors and rotation code, that
accomplish it's task by close()ing and re-open()ing output file, like was
doing the old one[1] (in pratice having separate close() method let the
rotation code to configure() multiplexor just once at startup).

So yet another method:
int (*close)(TCModuleInstance *self); /* behaves like close(2) */

Of course filters,decoders and encoders needs to setup they open/close methods
to something like


static int dummy_open(TCModuleInstance *self,
                      const char *video_file, const char *audio_file)
{
     DUMMY_HEAVY_CHECK(self, "opening files");
     return -1;
}

static int dummy_close(TCModuleInstance *self)
{
     DUMMY_HEAVY_CHECK(self, "closing files");
     return -1;
}

Any comment it's appreciated.

+++

[1] it's one of simplest but still reasonnably clean methods for
accomplishing this, IMHO.

Best regards,

-- 
Francesco Romani - Ikitt ['people always complain, no matther what you do']
IM contact: (email-me, I have antispam default deny!) icq://27-83-87-867
some known bugs: http://www.transcoding.org/cgi-bin/transcode?Bug_Showcase

Reply via email to