Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
b271aac5
Commit
b271aac5
authored
Jan 21, 2014
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/libssh: rename context variable from s into libssh
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki@gmail.com
>
parent
52281445
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
libssh.c
libavformat/libssh.c
+26
-26
No files found.
libavformat/libssh.c
View file @
b271aac5
...
@@ -162,21 +162,21 @@ static av_cold void libssh_stat_file(LIBSSHContext *libssh)
...
@@ -162,21 +162,21 @@ static av_cold void libssh_stat_file(LIBSSHContext *libssh)
static
av_cold
int
libssh_close
(
URLContext
*
h
)
static
av_cold
int
libssh_close
(
URLContext
*
h
)
{
{
LIBSSHContext
*
s
=
h
->
priv_data
;
LIBSSHContext
*
libssh
=
h
->
priv_data
;
if
(
s
->
file
)
if
(
libssh
->
file
)
sftp_close
(
s
->
file
);
sftp_close
(
libssh
->
file
);
if
(
s
->
sftp
)
if
(
libssh
->
sftp
)
sftp_free
(
s
->
sftp
);
sftp_free
(
libssh
->
sftp
);
if
(
s
->
session
)
{
if
(
libssh
->
session
)
{
ssh_disconnect
(
s
->
session
);
ssh_disconnect
(
libssh
->
session
);
ssh_free
(
s
->
session
);
ssh_free
(
libssh
->
session
);
}
}
return
0
;
return
0
;
}
}
static
av_cold
int
libssh_open
(
URLContext
*
h
,
const
char
*
url
,
int
flags
)
static
av_cold
int
libssh_open
(
URLContext
*
h
,
const
char
*
url
,
int
flags
)
{
{
LIBSSHContext
*
s
=
h
->
priv_data
;
LIBSSHContext
*
libssh
=
h
->
priv_data
;
char
proto
[
10
],
path
[
MAX_URL_SIZE
],
hostname
[
1024
],
credencials
[
1024
];
char
proto
[
10
],
path
[
MAX_URL_SIZE
],
hostname
[
1024
],
credencials
[
1024
];
int
port
=
22
,
ret
;
int
port
=
22
,
ret
;
const
char
*
user
=
NULL
,
*
pass
=
NULL
;
const
char
*
user
=
NULL
,
*
pass
=
NULL
;
...
@@ -192,22 +192,22 @@ static av_cold int libssh_open(URLContext *h, const char *url, int flags)
...
@@ -192,22 +192,22 @@ static av_cold int libssh_open(URLContext *h, const char *url, int flags)
if
(
port
<=
0
||
port
>
65535
)
if
(
port
<=
0
||
port
>
65535
)
port
=
22
;
port
=
22
;
if
((
ret
=
libssh_create_ssh_session
(
s
,
hostname
,
port
))
<
0
)
if
((
ret
=
libssh_create_ssh_session
(
libssh
,
hostname
,
port
))
<
0
)
goto
fail
;
goto
fail
;
user
=
av_strtok
(
credencials
,
":"
,
&
end
);
user
=
av_strtok
(
credencials
,
":"
,
&
end
);
pass
=
av_strtok
(
end
,
":"
,
&
end
);
pass
=
av_strtok
(
end
,
":"
,
&
end
);
if
((
ret
=
libssh_authentication
(
s
,
user
,
pass
))
<
0
)
if
((
ret
=
libssh_authentication
(
libssh
,
user
,
pass
))
<
0
)
goto
fail
;
goto
fail
;
if
((
ret
=
libssh_create_sftp_session
(
s
))
<
0
)
if
((
ret
=
libssh_create_sftp_session
(
libssh
))
<
0
)
goto
fail
;
goto
fail
;
if
((
ret
=
libssh_open_file
(
s
,
flags
,
path
))
<
0
)
if
((
ret
=
libssh_open_file
(
libssh
,
flags
,
path
))
<
0
)
goto
fail
;
goto
fail
;
libssh_stat_file
(
s
);
libssh_stat_file
(
libssh
);
return
0
;
return
0
;
...
@@ -218,31 +218,31 @@ static av_cold int libssh_open(URLContext *h, const char *url, int flags)
...
@@ -218,31 +218,31 @@ static av_cold int libssh_open(URLContext *h, const char *url, int flags)
static
int64_t
libssh_seek
(
URLContext
*
h
,
int64_t
pos
,
int
whence
)
static
int64_t
libssh_seek
(
URLContext
*
h
,
int64_t
pos
,
int
whence
)
{
{
LIBSSHContext
*
s
=
h
->
priv_data
;
LIBSSHContext
*
libssh
=
h
->
priv_data
;
int64_t
newpos
;
int64_t
newpos
;
if
(
s
->
filesize
==
-
1
&&
(
whence
==
AVSEEK_SIZE
||
whence
==
SEEK_END
))
{
if
(
libssh
->
filesize
==
-
1
&&
(
whence
==
AVSEEK_SIZE
||
whence
==
SEEK_END
))
{
av_log
(
h
,
AV_LOG_ERROR
,
"Error during seeking.
\n
"
);
av_log
(
h
,
AV_LOG_ERROR
,
"Error during seeking.
\n
"
);
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
}
}
switch
(
whence
)
{
switch
(
whence
)
{
case
AVSEEK_SIZE
:
case
AVSEEK_SIZE
:
return
s
->
filesize
;
return
libssh
->
filesize
;
case
SEEK_SET
:
case
SEEK_SET
:
newpos
=
pos
;
newpos
=
pos
;
break
;
break
;
case
SEEK_CUR
:
case
SEEK_CUR
:
newpos
=
sftp_tell64
(
s
->
file
);
newpos
=
sftp_tell64
(
libssh
->
file
);
break
;
break
;
case
SEEK_END
:
case
SEEK_END
:
newpos
=
s
->
filesize
+
pos
;
newpos
=
libssh
->
filesize
+
pos
;
break
;
break
;
default:
default:
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
if
(
sftp_seek64
(
s
->
file
,
newpos
))
{
if
(
sftp_seek64
(
libssh
->
file
,
newpos
))
{
av_log
(
h
,
AV_LOG_ERROR
,
"Error during seeking.
\n
"
);
av_log
(
h
,
AV_LOG_ERROR
,
"Error during seeking.
\n
"
);
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
}
}
...
@@ -252,11 +252,11 @@ static int64_t libssh_seek(URLContext *h, int64_t pos, int whence)
...
@@ -252,11 +252,11 @@ static int64_t libssh_seek(URLContext *h, int64_t pos, int whence)
static
int
libssh_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
)
static
int
libssh_read
(
URLContext
*
h
,
unsigned
char
*
buf
,
int
size
)
{
{
LIBSSHContext
*
s
=
h
->
priv_data
;
LIBSSHContext
*
libssh
=
h
->
priv_data
;
int
bytes_read
;
int
bytes_read
;
if
((
bytes_read
=
sftp_read
(
s
->
file
,
buf
,
size
))
<
0
)
{
if
((
bytes_read
=
sftp_read
(
libssh
->
file
,
buf
,
size
))
<
0
)
{
av_log
(
h
,
AV_LOG_ERROR
,
"Read error.
\n
"
);
av_log
(
libss
h
,
AV_LOG_ERROR
,
"Read error.
\n
"
);
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
}
}
return
bytes_read
;
return
bytes_read
;
...
@@ -264,11 +264,11 @@ static int libssh_read(URLContext *h, unsigned char *buf, int size)
...
@@ -264,11 +264,11 @@ static int libssh_read(URLContext *h, unsigned char *buf, int size)
static
int
libssh_write
(
URLContext
*
h
,
const
unsigned
char
*
buf
,
int
size
)
static
int
libssh_write
(
URLContext
*
h
,
const
unsigned
char
*
buf
,
int
size
)
{
{
LIBSSHContext
*
s
=
h
->
priv_data
;
LIBSSHContext
*
libssh
=
h
->
priv_data
;
int
bytes_written
;
int
bytes_written
;
if
((
bytes_written
=
sftp_write
(
s
->
file
,
buf
,
size
))
<
0
)
{
if
((
bytes_written
=
sftp_write
(
libssh
->
file
,
buf
,
size
))
<
0
)
{
av_log
(
h
,
AV_LOG_ERROR
,
"Write error.
\n
"
);
av_log
(
libss
h
,
AV_LOG_ERROR
,
"Write error.
\n
"
);
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
}
}
return
bytes_written
;
return
bytes_written
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment