Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libdvbpsi
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
libdvbpsi
Commits
5e153880
Commit
5e153880
authored
Feb 23, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/dvbinfo: use dvbpsi_HasDecoder()
Simplify code by using dvbpsi_HasDecoder().
parent
019bd4d0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
43 deletions
+34
-43
examples/dvbinfo/libdvbpsi.c
examples/dvbinfo/libdvbpsi.c
+34
-43
No files found.
examples/dvbinfo/libdvbpsi.c
View file @
5e153880
...
@@ -554,12 +554,8 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat)
...
@@ -554,12 +554,8 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat)
while
(
p_program
)
while
(
p_program
)
{
{
/* Remove old PMT table decoder */
/* Remove old PMT table decoder */
if
(
p_stream
->
pmt
.
handle
)
if
(
dvbpsi_HasDecoder
(
p_stream
->
pmt
.
handle
))
{
dvbpsi_DetachPMT
(
p_stream
->
pmt
.
handle
);
dvbpsi_DetachPMT
(
p_stream
->
pmt
.
handle
);
dvbpsi_DeleteHandle
(
p_stream
->
pmt
.
handle
);
p_stream
->
pmt
.
handle
=
NULL
;
}
/* Attach new PMT decoder */
/* Attach new PMT decoder */
p_stream
->
i_pmt
++
;
p_stream
->
i_pmt
++
;
...
@@ -567,16 +563,8 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat)
...
@@ -567,16 +563,8 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat)
p_stream
->
pmt
.
pid_pmt
=
&
p_stream
->
pid
[
p_program
->
i_pid
];
p_stream
->
pmt
.
pid_pmt
=
&
p_stream
->
pid
[
p_program
->
i_pid
];
p_stream
->
pmt
.
pid_pmt
->
i_pid
=
p_program
->
i_pid
;
p_stream
->
pmt
.
pid_pmt
->
i_pid
=
p_program
->
i_pid
;
p_stream
->
pmt
.
handle
=
dvbpsi_NewHandle
(
&
dvbpsi_message
,
p_stream
->
level
);
if
(
p_stream
->
pmt
.
handle
==
NULL
)
{
fprintf
(
stderr
,
"dvbinfo: Failed to allocate new dvbpsi handle
\n
"
);
break
;
}
if
(
!
dvbpsi_AttachPMT
(
p_stream
->
pmt
.
handle
,
p_program
->
i_number
,
handle_PMT
,
p_stream
))
if
(
!
dvbpsi_AttachPMT
(
p_stream
->
pmt
.
handle
,
p_program
->
i_number
,
handle_PMT
,
p_stream
))
{
{
dvbpsi_DeleteHandle
(
p_stream
->
pmt
.
handle
);
p_stream
->
pmt
.
handle
=
NULL
;
fprintf
(
stderr
,
"dvbinfo: Failed to attach new pmt decoder
\n
"
);
fprintf
(
stderr
,
"dvbinfo: Failed to attach new pmt decoder
\n
"
);
break
;
break
;
}
}
...
@@ -1225,6 +1213,10 @@ ts_stream_t *libdvbpsi_init(int debug)
...
@@ -1225,6 +1213,10 @@ ts_stream_t *libdvbpsi_init(int debug)
stream
->
pat
.
handle
=
NULL
;
stream
->
pat
.
handle
=
NULL
;
goto
error
;
goto
error
;
}
}
/* PMT */
stream
->
pmt
.
handle
=
dvbpsi_NewHandle
(
&
dvbpsi_message
,
level
);
if
(
stream
->
pmt
.
handle
==
NULL
)
goto
error
;
/* CAT */
/* CAT */
stream
->
cat
.
handle
=
dvbpsi_NewHandle
(
&
dvbpsi_message
,
level
);
stream
->
cat
.
handle
=
dvbpsi_NewHandle
(
&
dvbpsi_message
,
level
);
if
(
stream
->
pat
.
handle
==
NULL
)
if
(
stream
->
pat
.
handle
==
NULL
)
...
@@ -1279,31 +1271,30 @@ ts_stream_t *libdvbpsi_init(int debug)
...
@@ -1279,31 +1271,30 @@ ts_stream_t *libdvbpsi_init(int debug)
return
stream
;
return
stream
;
error:
error:
if
(
stream
->
pat
.
handle
)
if
(
dvbpsi_HasDecoder
(
stream
->
pat
.
handle
))
{
dvbpsi_DetachPAT
(
stream
->
pat
.
handle
);
dvbpsi_DetachPAT
(
stream
->
pat
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
cat
.
handle
))
dvbpsi_DetachCAT
(
stream
->
cat
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
sdt
.
handle
))
dvbpsi_DetachDemux
(
stream
->
sdt
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
eit
.
handle
))
dvbpsi_DetachDemux
(
stream
->
eit
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
tdt
.
handle
))
dvbpsi_DetachDemux
(
stream
->
tdt
.
handle
);
if
(
stream
->
pat
.
handle
)
dvbpsi_DeleteHandle
(
stream
->
pat
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
pat
.
handle
);
}
if
(
stream
->
pmt
.
handle
)
dvbpsi_DeleteHandle
(
stream
->
pmt
.
handle
);
if
(
stream
->
cat
.
handle
)
if
(
stream
->
cat
.
handle
)
{
dvbpsi_DetachCAT
(
stream
->
cat
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
cat
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
cat
.
handle
);
}
if
(
stream
->
sdt
.
handle
)
if
(
stream
->
sdt
.
handle
)
{
dvbpsi_DetachDemux
(
stream
->
sdt
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
sdt
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
sdt
.
handle
);
}
if
(
stream
->
eit
.
handle
)
if
(
stream
->
eit
.
handle
)
{
dvbpsi_DetachDemux
(
stream
->
eit
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
eit
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
eit
.
handle
);
}
if
(
stream
->
tdt
.
handle
)
if
(
stream
->
tdt
.
handle
)
{
dvbpsi_DetachDemux
(
stream
->
tdt
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
tdt
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
tdt
.
handle
);
}
free
(
stream
);
free
(
stream
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1313,31 +1304,31 @@ void libdvbpsi_exit(ts_stream_t *stream)
...
@@ -1313,31 +1304,31 @@ void libdvbpsi_exit(ts_stream_t *stream)
printf
(
"
\n
Summary:
\n
"
);
printf
(
"
\n
Summary:
\n
"
);
summary
(
stream
);
summary
(
stream
);
if
(
stream
->
pat
.
handle
)
if
(
dvbpsi_HasDecoder
(
stream
->
pat
.
handle
))
{
dvbpsi_DetachPAT
(
stream
->
pat
.
handle
);
dvbpsi_DetachPAT
(
stream
->
pat
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
pmt
.
handle
))
dvbpsi_DetachPMT
(
stream
->
pmt
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
cat
.
handle
))
dvbpsi_DetachCAT
(
stream
->
cat
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
sdt
.
handle
))
dvbpsi_DetachDemux
(
stream
->
sdt
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
eit
.
handle
))
dvbpsi_DetachDemux
(
stream
->
eit
.
handle
);
if
(
dvbpsi_HasDecoder
(
stream
->
tdt
.
handle
))
dvbpsi_DetachDemux
(
stream
->
tdt
.
handle
);
if
(
stream
->
pat
.
handle
)
dvbpsi_DeleteHandle
(
stream
->
pat
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
pat
.
handle
);
}
if
(
stream
->
pmt
.
handle
)
dvbpsi_DeleteHandle
(
stream
->
pmt
.
handle
);
if
(
stream
->
cat
.
handle
)
if
(
stream
->
cat
.
handle
)
{
dvbpsi_DetachCAT
(
stream
->
cat
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
cat
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
cat
.
handle
);
}
if
(
stream
->
sdt
.
handle
)
if
(
stream
->
sdt
.
handle
)
{
dvbpsi_DetachDemux
(
stream
->
sdt
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
sdt
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
sdt
.
handle
);
}
if
(
stream
->
eit
.
handle
)
if
(
stream
->
eit
.
handle
)
{
dvbpsi_DetachDemux
(
stream
->
eit
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
eit
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
eit
.
handle
);
}
if
(
stream
->
tdt
.
handle
)
if
(
stream
->
tdt
.
handle
)
{
dvbpsi_DetachDemux
(
stream
->
tdt
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
tdt
.
handle
);
dvbpsi_DeleteHandle
(
stream
->
tdt
.
handle
);
}
free
(
stream
);
free
(
stream
);
stream
=
NULL
;
stream
=
NULL
;
...
...
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