[linux-dvb] What do you think of mpsys library ? (for ca_zap)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 02 April 2005 00:13, Johannes Stezenbach wrote:
> Kenneth Aafl?y wrote:
> > } vid_dev_info_t;
> 
> Please don't use typedefs unless you are explicitly defining
> opaque data types. It makes it more difficult to see what's going on.

I'm wondering if you recentment is against the typedef in general or the
implementation of a clean api. The api will be well documented, and so
will the new typedefed types? I was merily following the alsa api here,
so I'm not in any way married to it yet! Any suggestions is very much
welcome, please prove why your suggestion will produce a cleaner api.

> > ... :)
> > int vid_dev_set_hierarchy(vid_dev_t *, vid_dev_hierarchy_t);
> 
> I don't think this is useful. If you want to tune you pass all data
> you have in one call.

Well, if we are going to be general, then why not do it properly?
I had an idea earlier, please look at what is presented below.

I was actually thinking more along the lines of this, once other pieces started
to present themselves, which I belive is a strong argument for pondering on the
api for a while before any library is conceived;

Kenneth

tune.h
-------------------------------------------------------------------------------
/**
 * Create a new channel for which the parameters is already known or is to be
 * tried to tune to.
 */
int vid_create_channel(vid_channel_t **, vid_dev_t *);

/**
 * Store the channel into the existing hierarchy of channels that the library
 * manages.
 *
 * \note The channel will be owned by the library after this call succeds.
 */
int vid_store_channel(vid_channel_t *);

/**
 * Free a channel that has been created and not passed to store_channel,
 * but is to be disposed of.
 */
int vid_free_channel(vid_channel_t *);

/**
 * Tune to the channel handle.
 */
int vid_dev_tune(vid_dev_t *, vid_channel_t *);

/**
 * NULL is returned if the device has not been tuned yet.
 */
vid_channel_t * vid_get_current_channel(vid_dev_t *);

/**
 * Set/Get the frequency of the channel.
 * XXX - uint64_t ??
 */
int vid_channel_set_frequency(vid_channel_t *, unsigned long frequency);
unsigned long vid_channel_get_frequency(vid_channel_t *);

/**
 * Set/Get DVB/ATSC parameters of the channel.
 * XXX - combined struct ??
 */

typedef enum _vid_channel_param {
        VID_CHANNEL_PARAM_INVERSION,
        VID_CHANNEL_PARAM_FEC_RATE,
        VID_CHANNEL_PARAM_LOW_FEC_RATE,
        VID_CHANNEL_PARAM_MODULATION,
        VID_CHANNEL_PARAM_BANDWIDTH,
        VID_CHANNEL_PARAM_TRANSMISSION_MODE,
        VID_CHANNEL_PARAM_GUARD_INTERVAL,
        VID_CHANNEL_PARAM_HIERARCHY,

        VID_CHANNEL_PARAM_LAST
} vid_channel_param_t;

int vid_channel_set_param(vid_channel_param_t, int value);
int vid_channel_get_param(vid_channel_param_t);

/* TODO:
 * get/set_param(vid_channel_param_t, <type>);
 */


record.h
-------------------------------------------------------------------------------

typedef struct _vid_rec vid_rec_t;
typedef struct _vid_rec_component vid_component_t;

/**
 * Open for recording any recording available on the device.
 */
int vid_rec_open(vid_rec_t **, vid_dev_t *);

/**
 * Open for recording on channel given.
 */
int vid_rec_open(vid_rec_t **, vid_channel_t *);

int vid_rec_close(vid_rec_t *);

/**
 * Get the current components of the channel that it is possible to record.
 */
int vid_rec_get_components(const vid_rec_component_t **, vid_rec_t *);

int vid_rec_add_component(vid_rec_t *, vid_rec_component_t *);
int vid_rec_remove_component(vid_rec_t *, vid_rec_component_t *);


int vid_rec_start(vid_rec_t *);
int vid_rec_stop(vid_rec_t *);

/**
 * Pause the recording, data will be lost.
 */
int vid_rec_pause(vid_rec_t *);



[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux