Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
23af3705
Commit
23af3705
authored
Nov 19, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file output: support for writing to an already open file descriptor
parent
8f8f1d5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
12 deletions
+32
-12
modules/access_output/file.c
modules/access_output/file.c
+32
-12
No files found.
modules/access_output/file.c
View file @
23af3705
...
...
@@ -72,7 +72,7 @@ vlc_module_begin ()
set_capability
(
"sout access"
,
50
)
set_category
(
CAT_SOUT
)
set_subcategory
(
SUBCAT_SOUT_ACO
)
add_shortcut
(
"file"
,
"stream"
)
add_shortcut
(
"file"
,
"stream"
,
"fd"
)
add_bool
(
SOUT_CFG_PREFIX
"append"
,
false
,
APPEND_TEXT
,
APPEND_LONGTEXT
,
true
)
#ifdef O_SYNC
...
...
@@ -122,19 +122,40 @@ static int Open( vlc_object_t *p_this )
bool
append
=
var_GetBool
(
p_access
,
SOUT_CFG_PREFIX
"append"
);
if
(
!
strcmp
(
p_access
->
psz_path
,
"-"
)
)
if
(
!
strcmp
(
p_access
->
psz_access
,
"fd"
)
)
{
char
*
end
;
fd
=
strtol
(
p_access
->
psz_path
,
&
end
,
0
);
if
(
!*
p_access
->
psz_path
||
*
end
)
{
msg_Err
(
p_access
,
"invalid file descriptor: %s"
,
p_access
->
psz_path
);
return
VLC_EGENERIC
;
}
fd
=
vlc_dup
(
fd
);
if
(
fd
==
-
1
)
{
msg_Err
(
p_access
,
"cannot use file descriptor: %m"
);
return
VLC_EGENERIC
;
}
}
#ifndef UNDER_CE
else
if
(
!
strcmp
(
p_access
->
psz_path
,
"-"
)
)
{
#ifdef WIN32
setmode
(
fileno
(
stdout
),
O_BINARY
);
#endif
fd
=
vlc_dup
(
fileno
(
stdout
));
if
(
fd
==
-
1
)
{
msg_Err
(
p_access
,
"cannot use standard output: %m"
);
return
VLC_EGENERIC
;
}
msg_Dbg
(
p_access
,
"using stdout"
);
#else
#warning stdout is not supported on Windows Mobile, but may be used on Windows CE
fd
=
-
1
;
#endif
}
#endif
else
{
char
*
psz_tmp
=
str_format
(
p_access
,
p_access
->
psz_path
);
...
...
@@ -146,12 +167,11 @@ static int Open( vlc_object_t *p_this )
#endif
(
append
?
0
:
O_TRUNC
),
0666
);
free
(
psz_tmp
);
}
if
(
fd
==
-
1
)
{
msg_Err
(
p_access
,
"cannot open `%s' (%m)"
,
p_access
->
psz_path
);
return
VLC_EGENERIC
;
if
(
fd
==
-
1
)
{
msg_Err
(
p_access
,
"cannot create %s: %m"
,
p_access
->
psz_path
);
return
VLC_EGENERIC
;
}
}
p_access
->
pf_write
=
Write
;
...
...
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