Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
21145a59
Commit
21145a59
authored
Jan 25, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TS: fix ts-dump error handling, remove a useless variable
parent
d64ca8ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
34 deletions
+30
-34
modules/demux/ts.c
modules/demux/ts.c
+30
-34
No files found.
modules/demux/ts.c
View file @
21145a59
...
...
@@ -392,7 +392,6 @@ struct demux_sys_t
char
*
psz_file
;
/* file to dump data in */
FILE
*
p_file
;
/* filehandle */
uint64_t
i_write
;
/* bytes written */
bool
b_file_out
;
/* dump mode enabled */
/* */
bool
b_start_record
;
...
...
@@ -590,12 +589,9 @@ static int Open( vlc_object_t *p_this )
p_sys
->
i_write
=
0
;
p_sys
->
buffer
=
NULL
;
p_sys
->
p_file
=
NULL
;
p_sys
->
b_file_out
=
false
;
p_sys
->
psz_file
=
var_CreateGetString
(
p_demux
,
"ts-dump-file"
);
if
(
*
p_sys
->
psz_file
!=
'\0'
)
p_sys
->
psz_file
=
var_InheritString
(
p_demux
,
"ts-dump-file"
);
if
(
p_sys
->
psz_file
!=
NULL
)
{
p_sys
->
b_file_out
=
true
;
b_append
=
var_CreateGetBool
(
p_demux
,
"ts-dump-append"
);
if
(
b_append
)
psz_mode
=
"ab"
;
...
...
@@ -607,14 +603,20 @@ static int Open( vlc_object_t *p_this )
msg_Info
(
p_demux
,
"dumping raw stream to standard output"
);
p_sys
->
p_file
=
stdout
;
}
else
if
(
(
p_sys
->
p_file
=
vlc_fopen
(
p_sys
->
psz_file
,
psz_mode
)
)
==
NULL
)
else
{
p_sys
->
p_file
=
vlc_fopen
(
p_sys
->
psz_file
,
psz_mode
);
if
(
p_sys
->
p_file
==
NULL
)
{
msg_Err
(
p_demux
,
"cannot create `%s' for writing"
,
p_sys
->
psz_file
);
p_sys
->
b_file_out
=
false
;
msg_Err
(
p_demux
,
"cannot write to file `%s': %m"
,
p_sys
->
psz_file
);
free
(
p_sys
->
psz_file
);
vlc_mutex_destroy
(
&
p_sys
->
csa_lock
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
}
if
(
p_sys
->
b_file_out
)
{
/* Determine how many packets to read. */
int
bufsize
=
var_CreateGetInteger
(
p_demux
,
"ts-dump-size"
);
p_sys
->
i_ts_read
=
(
int
)
(
bufsize
/
p_sys
->
i_packet_size
);
...
...
@@ -626,12 +628,8 @@ static int Open( vlc_object_t *p_this )
msg_Info
(
p_demux
,
"%s raw stream to file `%s' reading packets %d"
,
b_append
?
"appending"
:
"dumping"
,
p_sys
->
psz_file
,
p_sys
->
i_ts_read
);
}
}
/* Fill p_demux field */
if
(
p_sys
->
b_file_out
)
p_demux
->
pf_demux
=
DemuxFile
;
}
else
p_demux
->
pf_demux
=
Demux
;
p_demux
->
pf_control
=
Control
;
...
...
@@ -709,7 +707,7 @@ static int Open( vlc_object_t *p_this )
p_sys
->
b_es_id_pid
=
var_CreateGetBool
(
p_demux
,
"ts-es-id-pid"
);
char
*
psz_string
=
var_CreateGetString
(
p_demux
,
"ts-out"
);
if
(
psz_string
&&
*
psz_string
&&
!
p_sys
->
b_file_out
)
if
(
psz_string
&&
*
psz_string
&&
!
p_sys
->
p_file
)
{
char
*
psz
=
strchr
(
psz_string
,
':'
);
int
i_port
=
0
;
...
...
@@ -822,14 +820,15 @@ static int Open( vlc_object_t *p_this )
p_sys
->
b_force_seek_per_percent
=
true
;
}
while
(
!
p_sys
->
b_file_out
&&
p_sys
->
i_pmt_es
<=
0
&&
vlc_object_alive
(
p_demux
)
)
if
(
p_sys
->
p_file
!=
NULL
)
return
VLC_SUCCESS
;
while
(
p_sys
->
i_pmt_es
<=
0
&&
vlc_object_alive
(
p_demux
)
)
{
if
(
p_demux
->
pf_demux
(
p_demux
)
!=
1
)
break
;
}
return
VLC_SUCCESS
;
}
...
...
@@ -900,16 +899,13 @@ static void Close( vlc_object_t *p_this )
free
(
p_sys
->
programs_list
.
p_values
);
/* If in dump mode, then close the file */
if
(
p_sys
->
b_file_out
)
if
(
p_sys
->
p_file
!=
NULL
)
{
msg_Info
(
p_demux
,
"closing %s (%"
PRId64
" KiB dumped)"
,
p_sys
->
psz_file
,
p_sys
->
i_write
/
1024
);
if
(
p_sys
->
p_file
!=
stdout
)
{
fclose
(
p_sys
->
p_file
);
}
}
/* When streaming, close the port */
if
(
p_sys
->
fd
>
-
1
)
{
...
...
@@ -1178,7 +1174,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
int64_t
*
pi64
;
int
i_int
;
if
(
p_sys
->
b_file_out
)
if
(
p_sys
->
p_file
!=
NULL
)
return
demux_vaControlHelper
(
p_demux
->
s
,
0
,
-
1
,
0
,
1
,
i_query
,
args
);
switch
(
i_query
)
...
...
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