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
ad619b43
Commit
ad619b43
authored
Sep 17, 2005
by
Sam Hocevar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Build decode_mpeg on Win32, just don’t build the network part.
parent
c44a14d8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
15 deletions
+53
-15
configure.ac
configure.ac
+12
-7
examples/Makefile.am
examples/Makefile.am
+5
-5
examples/decode_mpeg.c
examples/decode_mpeg.c
+36
-3
No files found.
configure.ac
View file @
ad619b43
...
...
@@ -23,11 +23,7 @@ case x"${target_os}" in
xdarwin*)
CFLAGS="${CFLAGS} -no-cpp-precomp"
;;
*mingw32* | *cygwin* | *wince* | *mingwce* | *pe*)
HAVE_WIN32=yes
;;
esac
AM_CONDITIONAL(HAVE_WIN32, test "${HAVE_WIN32}" = "yes")
dnl --enable-debug
AC_ARG_ENABLE(debug,
...
...
@@ -37,7 +33,7 @@ AC_ARG_ENABLE(debug,
no) debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[debug=false])
if test
x$debug = xtrue
if test
"$debug" = "true"
then
CFLAGS="${CFLAGS} -DDEBUG -g"
fi
...
...
@@ -51,7 +47,7 @@ AC_ARG_ENABLE(release,
no) release=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-release) ;;
esac],[release=false])
if test
x$release = xtrue
if test
"$release" = "true"
then
CFLAGS="${CFLAGS} -O6"
else
...
...
@@ -61,6 +57,9 @@ fi
dnl Check for headers
AC_CHECK_HEADERS(stdint.h inttypes.h)
AC_CHECK_HEADERS(sys/socket.h, [ac_have_sys_socket_h=yes])
AM_CONDITIONAL(HAVE_SYS_SOCKET_H, test "${ac_have_sys_socket_h}" = "yes")
dnl Check for variadic macros
AC_CACHE_CHECK([for variadic cpp macros],
[ac_cv_cpp_variadic_macros],
...
...
@@ -74,7 +73,13 @@ if test "${ac_cv_cpp_variadic_macros}" != "no"; then
AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
fi
AC_OUTPUT([Makefile src/Makefile examples/Makefile misc/Makefile doc/Makefile debian/Makefile wince/Makefile])
AC_OUTPUT([Makefile
src/Makefile
examples/Makefile
misc/Makefile
doc/Makefile
debian/Makefile
wince/Makefile])
echo "
libdvbpsi configuration
...
...
examples/Makefile.am
View file @
ad619b43
## Process this file with automake to produce Makefile.in
noinst_PROGRAMS
=
decode_pat decode_pmt decode_sdt
if
!HAVE_WIN32
noinst_PROGRAMS
+=
decode_mpeg
endif
noinst_PROGRAMS
=
decode_pat decode_pmt decode_sdt decode_mpeg
decode_pat_SOURCES
=
decode_pat.c
decode_pat_LDFLAGS
=
-L
../src
-ldvbpsi
...
...
@@ -14,6 +11,9 @@ decode_pmt_LDFLAGS = -L../src -ldvbpsi -lm
decode_sdt_SOURCES
=
decode_sdt.c
decode_sdt_LDFLAGS
=
-L
../src
-ldvbpsi
decode_mpeg_SOURCES
=
connect.c decode_mpeg.c
decode_mpeg_SOURCES
=
decode_mpeg.c
if
HAVE_SYS_SOCKET_H
decode_mpeg_SOURCES
+=
connect.c
endif
decode_mpeg_LDFLAGS
=
-L
../src
-ldvbpsi
-lm
examples/decode_mpeg.c
View file @
ad619b43
...
...
@@ -161,6 +161,7 @@ int ReadPacket( int i_fd, uint8_t* p_dst )
return
(
i
==
0
)
?
1
:
0
;
}
#ifdef HAVE_SYS_SOCKET_H
int
ReadPacketFromSocket
(
int
i_socket
,
uint8_t
*
p_dst
,
size_t
i_size
)
{
int
i_rc
=
-
1
;
...
...
@@ -169,6 +170,7 @@ int ReadPacketFromSocket( int i_socket, uint8_t* p_dst, size_t i_size)
i_rc
=
read
(
i_socket
,
p_dst
,
i_size
);
return
(
i_rc
<=
i_size
)
?
1
:
0
;
}
#endif
/*****************************************************************************
* DumpPAT
...
...
@@ -363,17 +365,26 @@ void DumpPMT(void* p_data, dvbpsi_pmt_t* p_pmt)
*****************************************************************************/
void
usage
(
char
*
name
)
{
#ifdef HAVE_SYS_SOCKET_H
printf
(
"Usage: %s [--file <filename>|--udp <ipaddress> --port <port> -mtu <mtu>|--help]
\n
"
,
name
);
printf
(
" %s [-f <filename>|-u <ipaddress> -p <port> -m <mtu>|-h]
\n
"
,
name
);
#else
printf
(
"Usage: %s [--file <filename>|--help]
\n
"
,
name
);
printf
(
" %s [-f <filename>|-h]
\n
"
,
name
);
#endif
printf
(
"
\n
"
);
printf
(
" %s --help
\n
"
,
name
);
printf
(
" %s --file <filename>
\n
"
,
name
);
#ifdef HAVE_SYS_SOCKET_H
printf
(
" %s --udp <ipaddres> --port <port> --mtu <mtu>
\n
"
,
name
);
#endif
printf
(
"Arguments:
\n
"
);
printf
(
"file : read MPEG2-TS stream from file
\n
"
);
#ifdef HAVE_SYS_SOCKET_H
printf
(
"udp : read MPEG2-TS stream from network using UDP protocol
\n
"
);
printf
(
"port : read MPEG2-TS stream from this port number
\n
"
);
printf
(
"mtu : read MPEG2-TS stream from network using maximum transfer unit (mtu) = 1316
\n
"
);
#endif
printf
(
"help : print this help message
\n
"
);
}
...
...
@@ -382,27 +393,35 @@ void usage( char *name )
*****************************************************************************/
int
main
(
int
i_argc
,
char
*
pa_argv
[])
{
#ifdef HAVE_SYS_SOCKET_H
const
char
*
const
short_options
=
"hf:m:p:u:"
;
#else
const
char
*
const
short_options
=
"hf:"
;
#endif
const
struct
option
long_options
[]
=
{
{
"help"
,
0
,
NULL
,
'h'
},
{
"file"
,
0
,
NULL
,
'f'
},
#ifdef HAVE_SYS_SOCKET_H
{
"mtu"
,
0
,
NULL
,
'm'
},
{
"port"
,
0
,
NULL
,
'p'
},
{
"udp"
,
0
,
NULL
,
'u'
},
#endif
{
NULL
,
0
,
NULL
,
0
}
};
int
next_option
=
0
;
int
i_fd
=
-
1
;
int
i_port
=
0
;
int
i_mtu
=
1316
;
/* (7 * 188) = 1316 < 1500 network MTU */
#ifdef HAVE_SYS_SOCKET_H
int
i_port
=
0
;
char
*
ipaddress
=
NULL
;
#endif
char
*
filename
=
NULL
;
uint8_t
*
p_data
=
NULL
;
ts_stream_t
*
p_stream
=
NULL
;
int
b_ok
;
int
b_ok
=
0
;
/* parser commandline arguments */
do
{
...
...
@@ -416,6 +435,7 @@ int main(int i_argc, char* pa_argv[])
usage
(
pa_argv
[
0
]
);
goto
error
;
break
;
#ifdef HAVE_SYS_SOCKET_H
case
'm'
:
i_mtu
=
atoi
(
optarg
);
if
(
i_mtu
<
0
)
i_mtu
=
1316
;
...
...
@@ -426,6 +446,7 @@ int main(int i_argc, char* pa_argv[])
case
'u'
:
ipaddress
=
strdup
(
optarg
);
break
;
#endif
case
-
1
:
break
;
default:
...
...
@@ -442,6 +463,7 @@ int main(int i_argc, char* pa_argv[])
if
(
!
p_data
)
goto
out_of_memory
;
}
#ifdef HAVE_SYS_SOCKET_H
if
(
ipaddress
)
{
i_fd
=
create_udp_connection
(
ipaddress
,
i_port
);
...
...
@@ -449,6 +471,7 @@ int main(int i_argc, char* pa_argv[])
if
(
!
p_data
)
goto
out_of_memory
;
}
#endif
p_stream
=
(
ts_stream_t
*
)
malloc
(
sizeof
(
ts_stream_t
)
);
if
(
!
p_stream
)
goto
out_of_memory
;
...
...
@@ -457,8 +480,10 @@ int main(int i_argc, char* pa_argv[])
/* Read first packet */
if
(
filename
)
b_ok
=
ReadPacket
(
i_fd
,
p_data
);
#ifdef HAVE_SYS_SOCKET_H
else
b_ok
=
ReadPacketFromSocket
(
i_fd
,
p_data
,
i_mtu
);
#endif
/* Enter infinite loop */
p_stream
->
pat
.
handle
=
dvbpsi_AttachPAT
(
DumpPAT
,
p_stream
);
...
...
@@ -539,7 +564,7 @@ int main(int i_argc, char* pa_argv[])
if
(
b_discontinuity_indicator
)
{
if
(
b_pcr
)
printf
(
"New PCR pid %d value %l
d
\n
"
,
i_pid
,
p_stream
->
pid
[
i_pid
].
i_pcr
);
printf
(
"New PCR pid %d value %l
ld
\n
"
,
i_pid
,
(
long
long
int
)
p_stream
->
pid
[
i_pid
].
i_pcr
);
if
(
b_discontinuity_seen
)
{
/* cc discontinuity is expected */
...
...
@@ -560,8 +585,10 @@ int main(int i_argc, char* pa_argv[])
/* Read next packet */
if
(
filename
)
b_ok
=
ReadPacket
(
i_fd
,
p_data
);
#ifdef HAVE_SYS_SOCKET_H
else
b_ok
=
ReadPacketFromSocket
(
i_fd
,
p_data
,
i_mtu
);
#endif
}
dvbpsi_DetachPMT
(
p_stream
->
pmt
.
handle
);
dvbpsi_DetachPAT
(
p_stream
->
pat
.
handle
);
...
...
@@ -569,12 +596,16 @@ int main(int i_argc, char* pa_argv[])
/* clean up */
if
(
filename
)
close
(
i_fd
);
#ifdef HAVE_SYS_SOCKET_H
else
close_connection
(
i_fd
);
#endif
if
(
p_data
)
free
(
p_data
);
if
(
filename
)
free
(
filename
);
#ifdef HAVE_SYS_SOCKET_H
if
(
ipaddress
)
free
(
ipaddress
);
#endif
/* free other stuff first ;-)*/
if
(
p_stream
)
free
(
p_stream
);
...
...
@@ -586,7 +617,9 @@ out_of_memory:
error:
if
(
p_data
)
free
(
p_data
);
if
(
filename
)
free
(
filename
);
#ifdef HAVE_SYS_SOCKET_H
if
(
ipaddress
)
free
(
ipaddress
);
#endif
/* free other stuff first ;-)*/
if
(
p_stream
)
free
(
p_stream
);
...
...
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