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
c0ca06c3
Commit
c0ca06c3
authored
Mar 28, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add message type to message callback function.
parent
baf927dd
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
111 additions
and
37 deletions
+111
-37
examples/decode_bat.c
examples/decode_bat.c
+10
-2
examples/decode_mpeg.c
examples/decode_mpeg.c
+9
-1
examples/decode_pat.c
examples/decode_pat.c
+10
-2
examples/decode_pmt.c
examples/decode_pmt.c
+10
-2
examples/decode_sdt.c
examples/decode_sdt.c
+10
-2
examples/dvbinfo/libdvbpsi.c
examples/dvbinfo/libdvbpsi.c
+10
-2
examples/get_pcr_pid.c
examples/get_pcr_pid.c
+10
-2
misc/gen_pat.c
misc/gen_pat.c
+10
-2
misc/gen_pmt.c
misc/gen_pmt.c
+10
-2
src/dvbpsi.c
src/dvbpsi.c
+8
-8
src/dvbpsi.h
src/dvbpsi.h
+14
-12
No files found.
examples/decode_bat.c
View file @
c0ca06c3
...
...
@@ -208,9 +208,17 @@ static void NewSubtableBAT(void * p_zero, dvbpsi_t *p_dvbpsi,
}
}
static
void
message
(
dvbpsi_t
*
handle
,
const
char
*
msg
)
static
void
message
(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
/*****************************************************************************
...
...
examples/decode_mpeg.c
View file @
c0ca06c3
...
...
@@ -293,8 +293,16 @@ static void report_PCRPacketTiming( int i_cc, ts_pid_t *ts_pid,
#endif
}
static
void
message
(
dvbpsi_t
*
handle
,
const
char
*
msg
)
static
void
message
(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
...
...
examples/decode_pat.c
View file @
c0ca06c3
...
...
@@ -96,9 +96,17 @@ static void DumpPAT(void* p_zero, dvbpsi_pat_t* p_pat)
dvbpsi_DeletePAT
(
p_pat
);
}
static
void
message
(
dvbpsi_t
*
handle
,
const
char
*
msg
)
static
void
message
(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
/*****************************************************************************
...
...
examples/decode_pmt.c
View file @
c0ca06c3
...
...
@@ -239,9 +239,17 @@ static void DumpPMT(void* p_zero, dvbpsi_pmt_t* p_pmt)
dvbpsi_DeletePMT
(
p_pmt
);
}
static
void
message
(
dvbpsi_t
*
handle
,
const
char
*
msg
)
static
void
message
(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
/*****************************************************************************
...
...
examples/decode_sdt.c
View file @
c0ca06c3
...
...
@@ -125,9 +125,17 @@ static void DumpSDT(void* p_zero, dvbpsi_sdt_t* p_sdt)
/*****************************************************************************
* DVBPSI messaging callback
*****************************************************************************/
static
void
message
(
dvbpsi_t
*
handle
,
const
char
*
msg
)
static
void
message
(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
/*****************************************************************************
...
...
examples/dvbinfo/libdvbpsi.c
View file @
c0ca06c3
...
...
@@ -266,8 +266,16 @@ mtime_t mdate(void)
/*****************************************************************************
* libdvbpsi message callback functions
*****************************************************************************/
static
void
dvbpsi_message
(
dvbpsi_t
*
p_dvbpsi
,
const
char
*
msg
)
static
void
dvbpsi_message
(
dvbpsi_t
*
p_dvbpsi
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
...
...
@@ -1363,7 +1371,7 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length)
{
stream
->
i_lost_bytes
+=
i_lost
;
i
+=
i_lost
;
fprintf
(
stderr
,
"dvbinfo: Lost %
ld bytes out of %ld in buffer
\n
"
,
i_lost
,
length
);
fprintf
(
stderr
,
"dvbinfo: Lost %
"
PRId64
" bytes out of %"
PRId64
" in buffer
\n
"
,
(
int64_t
)
i_lost
,
(
int64_t
)
length
);
if
(
i
>=
length
)
return
true
;
}
...
...
examples/get_pcr_pid.c
View file @
c0ca06c3
...
...
@@ -73,9 +73,17 @@ static dvbpsi_t *p_pmt_dvbpsi_fds[MAX_PROGRAMS];
/*****************************************************************************
* DVBPSI messaging callback
*****************************************************************************/
static
void
message
(
dvbpsi_t
*
handle
,
const
char
*
msg
)
static
void
message
(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
/*****************************************************************************
...
...
misc/gen_pat.c
View file @
c0ca06c3
...
...
@@ -95,9 +95,17 @@ static void writePSI(uint8_t* p_packet, dvbpsi_psi_section_t* p_section)
}
}
static
void
message
(
dvbpsi_t
*
handle
,
const
char
*
msg
)
static
void
message
(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
/*****************************************************************************
...
...
misc/gen_pmt.c
View file @
c0ca06c3
...
...
@@ -98,9 +98,17 @@ static void writePSI(uint8_t* p_packet, dvbpsi_psi_section_t* p_section)
}
}
static
void
message
(
dvbpsi_t
*
handle
,
const
char
*
msg
)
static
void
message
(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
)
{
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
switch
(
level
)
{
case
DVBPSI_MSG_ERROR
:
fprintf
(
stderr
,
"Error: "
);
break
;
case
DVBPSI_MSG_WARN
:
fprintf
(
stderr
,
"Warning: "
);
break
;
case
DVBPSI_MSG_DEBUG
:
fprintf
(
stderr
,
"Debug: "
);
break
;
default:
/* do nothing */
return
;
}
fprintf
(
stderr
,
"%s
\n
"
,
msg
);
}
/*****************************************************************************
...
...
src/dvbpsi.c
View file @
c0ca06c3
...
...
@@ -447,7 +447,7 @@ void dvbpsi_PushPacket(dvbpsi_t *handle, uint8_t* p_data)
#endif
#ifdef HAVE_VARIADIC_MACROS
void
message
(
dvbpsi_t
*
dvbpsi
,
const
in
t
level
,
const
char
*
fmt
,
...)
void
message
(
dvbpsi_t
*
dvbpsi
,
const
dvbpsi_msg_level_
t
level
,
const
char
*
fmt
,
...)
{
if
((
dvbpsi
->
i_msg_level
>
DVBPSI_MSG_NONE
)
&&
(
level
<=
dvbpsi
->
i_msg_level
))
...
...
@@ -470,7 +470,7 @@ void message(dvbpsi_t *dvbpsi, const int level, const char *fmt, ...)
va_end
(
ap
);
if
(
err
>
DVBPSI_MSG_NONE
)
{
if
(
dvbpsi
->
pf_message
)
dvbpsi
->
pf_message
(
dvbpsi
,
msg
);
dvbpsi
->
pf_message
(
dvbpsi
,
level
,
msg
);
}
free
(
msg
);
}
...
...
@@ -480,7 +480,7 @@ void message(dvbpsi_t *dvbpsi, const int level, const char *fmt, ...)
/* Common code for printing messages */
# if defined(_GNU_SOURCE)
# define DVBPSI_MSG_COMMON
\
# define DVBPSI_MSG_COMMON
(level)
\
do { \
va_list ap; \
va_start(ap, fmt); \
...
...
@@ -497,7 +497,7 @@ void message(dvbpsi_t *dvbpsi, const int level, const char *fmt, ...)
va_end(ap); \
if (err > 0) { \
if (dvbpsi->pf_message) \
dvbpsi->pf_message(dvbpsi,
msg);
\
dvbpsi->pf_message(dvbpsi,
level, msg);
\
} \
free(msg); \
} while(0);
...
...
@@ -515,7 +515,7 @@ void message(dvbpsi_t *dvbpsi, const int level, const char *fmt, ...)
va_end(ap); \
if (err > 0) { \
if (dvbpsi->pf_message) \
dvbpsi->pf_message(dvbpsi,
msg);
\
dvbpsi->pf_message(dvbpsi,
level, msg);
\
} \
free(msg); \
} while(0);
...
...
@@ -526,7 +526,7 @@ void dvbpsi_error(dvbpsi_t *dvbpsi, const char *src, const char *fmt, ...)
if
((
dvbpsi
->
i_msg_level
>
DVBPSI_MSG_NONE
)
&&
(
DVBPSI_MSG_ERROR
<=
dvbpsi
->
i_msg_level
))
{
DVBPSI_MSG_COMMON
DVBPSI_MSG_COMMON
(
DVBPSI_MSG_ERROR
)
}
}
...
...
@@ -535,7 +535,7 @@ void dvbpsi_warning(dvbpsi_t *dvbpsi, const char *src, const char *fmt, ...)
if
((
dvbpsi
->
i_msg_level
>
DVBPSI_MSG_NONE
)
&&
(
DVBPSI_MSG_WARN
<=
dvbpsi
->
i_msg_level
))
{
DVBPSI_MSG_COMMON
DVBPSI_MSG_COMMON
(
DVBPSI_MSG_WARN
)
}
}
...
...
@@ -544,7 +544,7 @@ void dvbpsi_debug(dvbpsi_t *dvbpsi, const char *src, const char *fmt, ...)
if
((
dvbpsi
->
i_msg_level
>
DVBPSI_MSG_NONE
)
&&
(
DVBPSI_MSG_DEBUG
<=
dvbpsi
->
i_msg_level
))
{
DVBPSI_MSG_COMMON
DVBPSI_MSG_COMMON
(
DVBPSI_MSG_DEBUG
)
}
}
#endif
src/dvbpsi.h
View file @
c0ca06c3
...
...
@@ -50,29 +50,31 @@ extern "C" {
*/
typedef
struct
dvbpsi_s
dvbpsi_t
;
/*!
* \enum dvbpsi_msg_level
* \brief DVBPSI message level enum
*/
typedef
enum
dvbpsi_msg_level
{
DVBPSI_MSG_NONE
=
-
1
,
/*!< No messages */
DVBPSI_MSG_ERROR
=
0
,
/*!< Error messages only */
DVBPSI_MSG_WARN
=
1
,
/*!< Error and Warning messages */
DVBPSI_MSG_DEBUG
=
2
,
/*!< Error, warning and debug messages */
}
dvbpsi_msg_level_t
;
/*****************************************************************************
* dvbpsi_message_cb
*****************************************************************************/
/*!
* \typedef void (* dvbpsi_message_cb)(dvbpsi_handle p_decoder,
* const dvbpse_msg_level_t level,
* const char* msg)
* \brief Callback type definition.
*/
typedef
void
(
*
dvbpsi_message_cb
)(
dvbpsi_t
*
handle
,
const
dvbpsi_msg_level_t
level
,
const
char
*
msg
);
/*!
* \enum dvbpsi_msg_level
* \brief DVBPSI message level enum
*/
enum
dvbpsi_msg_level
{
DVBPSI_MSG_NONE
=
-
1
,
/*!< No messages */
DVBPSI_MSG_ERROR
=
0
,
/*!< Error messages only */
DVBPSI_MSG_WARN
=
1
,
/*!< Error and Warning messages */
DVBPSI_MSG_DEBUG
=
2
,
/*!< Error, warning and debug messages */
};
/*****************************************************************************
* dvbpsi_t
*****************************************************************************/
...
...
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