Commit 9df7ae98 authored by Timothy B. Terriberry's avatar Timothy B. Terriberry

Add URL support to seeking_example.

Also fixes some indenting in opusfile_example.
parent 8d04070b
......@@ -43,14 +43,14 @@ int main(int _argc,const char **_argv){
of=op_open_url(_argv[1],OP_SSL_SKIP_CERTIFICATE_CHECK,&ret);
#if 0
if(of==NULL){
OpusFileCallbacks cb={NULL,NULL,NULL,NULL};
void *fp;
/*For debugging: force a file to not be seekable.*/
fp=op_fopen(&cb,_argv[1],"rb");
cb.seek=NULL;
cb.tell=NULL;
of=op_open_callbacks(fp,&cb,NULL,0,NULL);
}
OpusFileCallbacks cb={NULL,NULL,NULL,NULL};
void *fp;
/*For debugging: force a file to not be seekable.*/
fp=op_fopen(&cb,_argv[1],"rb");
cb.seek=NULL;
cb.tell=NULL;
of=op_open_callbacks(fp,&cb,NULL,0,NULL);
}
#else
if(of==NULL)of=op_open_file(_argv[1],&ret);
#endif
......
......@@ -248,7 +248,12 @@ int main(int _argc,const char **_argv){
}
memset(&cb,0,sizeof(cb));
if(strcmp(_argv[1],"-")==0)fp=op_fdopen(&cb,fileno(stdin),"rb");
else fp=op_fopen(&cb,_argv[1],"rb");
else{
/*Try to treat the argument as a URL.*/
fp=op_url_stream_create(&cb,_argv[1],OP_SSL_SKIP_CERTIFICATE_CHECK);
/*Fall back assuming it's a regular file name.*/
if(fp==NULL)fp=op_fopen(&cb,_argv[1],"rb");
}
if(cb.seek!=NULL){
real_seek=cb.seek;
cb.seek=seek_stat_counter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment