view subopt-helper.h @ 27145:44ceb8c35dbc

r25385: Add new audio filter for encoding multi-channel audio into ac3 at runtime. r25389: Support using unrar executable to access rar-compressed vobsub files. r25440: Fix the expand text's format by the source. r25455: (previously applied) typo noticed by Paul TT r25529: Support ?(!NAME:TEXT) format for expanding string by property. r25566: update copyright year to 2008 r25585: Add an example for dvdnav:// usage with path. r25587: when {v|a}_o_mpegpes:card isn't specified by the user [...] r25607: documented angle commands r25610: Allow overriding [Script Info] parameters with -ass-force-style option. r25639: Add heartbeat-cmd option r25656: dvd-device can specify iso files too r25657: dumpstream is NOT a better way to copy a dvd title r25665: updated english manpage with protocol/extension profile loading feature r25671: document vo.* and ao.* playback profiles r25751: Extend heartbeat-cmd man page entry r25752: Seems that all - should be escaped in the man page r25762: added missing escapes r25763: added missing "&"
author kraymer
date Mon, 30 Jun 2008 19:35:32 +0000
parents 4129c8cfa742
children 2b021e3e1000
line wrap: on
line source

#ifndef MPLAYER_SUBOPT_HELPER_H
#define MPLAYER_SUBOPT_HELPER_H

/**
 * \file subopt-helper.h
 *
 * \brief Datatype and functions declarations for usage 
 *        of the suboption parser.
 *
 */

#define OPT_ARG_BOOL 0
#define OPT_ARG_INT  1
#define OPT_ARG_STR  2
#define OPT_ARG_MSTRZ 3 ///< A malloced, zero terminated string, use free()!
#define OPT_ARG_FLOAT 4

typedef int (*opt_test_f)(void *);

/** simple structure for defining the option name, type and storage location */
typedef struct opt_s
{
  const char * name; ///< string that identifies the option
  int type;    ///< option type as defined in subopt-helper.h
  void * valp; ///< pointer to the mem where the value should be stored
  opt_test_f test; ///< argument test func ( optional )
  int set;     ///< Is set internally by the parser if the option was found.
               ///< Don't use it at initialization of your opts, it will be
               ///< overriden anyway!
} opt_t;

/** parses the string for the options specified in opt */
int subopt_parse( char const * const str, opt_t * opts );


/*------------------ arg specific types and declaration -------------------*/
typedef struct strarg_s
{
  int len; ///< length of the string determined by the parser
  char const * str;  ///< pointer to position inside the parse string
} strarg_t;


int int_non_neg( int * i );
int int_pos( int * i );

int strargcmp(strarg_t *arg, const char *str);
int strargcasecmp(strarg_t *arg, char *str);

#endif /* MPLAYER_SUBOPT_HELPER_H */