Remove the hack used to pass -dvd, etc into the playlist

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9748 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
albeu 2003-03-30 17:08:35 +00:00
parent 5787833ca9
commit 27d79717d4
2 changed files with 10 additions and 109 deletions

View File

@ -56,16 +56,6 @@ m_config_parse_me_command_line(m_config_t *config, int argc, char **argv)
char *opt;
int no_more_opts = 0;
m_entry_t *lst = NULL, *entry = NULL;
void add_file(char* file) {
mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Adding file %s\n",argv[i]);
lst = realloc(lst,(nf+2)*sizeof(m_entry_t));
lst[nf].name = strdup(file);
lst[nf].opts = calloc(2,sizeof(char*));
entry = &lst[nf];
no = 0;
memset(&lst[nf+1],0,sizeof(m_entry_t));
nf++;
}
#ifdef MP_DEBUG
assert(config != NULL);
@ -104,21 +94,6 @@ m_config_parse_me_command_line(m_config_t *config, int argc, char **argv)
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "%s is not an MEncoder option\n",opt);
goto err_out;
}
// Hack for the -vcd ... options
if(strcasecmp(opt,"vcd") == 0)
add_file("VCD Track");
if(strcasecmp(opt,"dvd") == 0)
add_file("DVD Title");
if(strcasecmp(opt,"tv") == 0 && argv[i + 1]) { // TV is a bit more tricky
char* param = argv[i + 1];
char* on = strstr(param,"on");
for( ; on ; on = strstr(on + 1,"on")) {
if(on[2] != ':' && on[2] != '\0') continue;
if(on != param && *(on - 1) != ':') continue;
add_file("TV Channel");
break;
}
}
if(!entry || (mp_opt->flags & M_OPT_GLOBAL)){
tmp = m_config_set_option(config, opt, argv[i + 1]);
if(tmp < 0){
@ -139,8 +114,16 @@ m_config_parse_me_command_line(m_config_t *config, int argc, char **argv)
}
}
i += tmp;
} else /* filename */
add_file(argv[i]);
} else {/* filename */
mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Adding file %s\n",argv[i]);
lst = realloc(lst,(nf+2)*sizeof(m_entry_t));
lst[nf].name = strdup(argv[i]);
lst[nf].opts = calloc(2,sizeof(char*));
entry = &lst[nf];
no = 0;
memset(&lst[nf+1],0,sizeof(m_entry_t));
nf++;
}
}
if(nf == 0) {

View File

@ -40,88 +40,6 @@ static int is_entry_option(char *opt, char *param, play_tree_t** ret) {
entry = parse_playlist_file(param);
if(!entry)
return 1;
} else if(strcasecmp(opt,"vcd") == 0) {
char* s;
if(!param)
return M_OPT_MISSING_PARAM;
s = (char*)malloc((strlen(param) + 6 + 1)*sizeof(char));
sprintf(s,"vcd://%s",param);
entry = play_tree_new();
play_tree_add_file(entry,s);
free(s);
} else if(strcasecmp(opt,"dvd") == 0) {
char* s;
if(!param)
return M_OPT_MISSING_PARAM;
s = (char*)malloc((strlen(param) + 6 + 1)*sizeof(char));
sprintf(s,"dvd://%s",param);
entry = play_tree_new();
play_tree_add_file(entry,s);
free(s);
} else if(strcasecmp(opt,"tv") == 0) {
char *s,*pr,*prs;
char *ps,*pe,*channel=NULL;
char *as;
int on=0;
if(!param)
return M_OPT_MISSING_PARAM;
ps = param;
pe = strchr(param,':');
pr = prs = (char*)malloc((strlen(param)+1)*sizeof(char));
pr[0] = '\0';
while(ps) {
if(!pe)
pe = ps + strlen(ps);
as = strchr(ps,'=');
if(as && as[1] != '\0' && pe-as > 0)
as++;
else
as = NULL;
if( !as && pe-ps == 2 && strncasecmp("on",ps,2) == 0 )
on = 1;
else if(as && as-ps == 8 && strncasecmp("channel",ps,6) == 0 && pe-as > 0) {
channel = (char*)realloc(channel,(pe-as+1)*sizeof(char));
strncpy(channel,as,pe-as);
channel[pe-as] = '\0';
} else if(pe-ps > 0) {
if(prs != pr) {
prs[0] = ':';
prs++;
}
strncpy(prs,ps,pe-ps);
prs += pe-ps;
prs[0] = '\0';
}
if(pe[0] != '\0') {
ps = pe+1;
pe = strchr(ps,':');
} else
ps = NULL;
}
if(on) {
int l=5;
if(channel)
l += strlen(channel);
s = (char*) malloc((l+1)*sizeof(char));
if(channel)
sprintf(s,"tv://%s",channel);
else
sprintf(s,"tv://");
entry = play_tree_new();
play_tree_add_file(entry,s);
if(strlen(pr) > 0)
play_tree_set_param(entry,"tv",pr);
free(s);
}
free(pr);
if(channel)
free(channel);
}
if(entry) {