Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
17b5ee09
Commit
17b5ee09
authored
Dec 08, 2009
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move MuxGetStream() to libvlccore, bump plugin ABI
parent
ced2f640
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
166 deletions
+51
-166
include/vlc_plugin.h
include/vlc_plugin.h
+2
-2
include/vlc_sout.h
include/vlc_sout.h
+1
-0
modules/mux/asf.c
modules/mux/asf.c
+2
-41
modules/mux/mp4.c
modules/mux/mp4.c
+2
-40
modules/mux/mpeg/ps.c
modules/mux/mpeg/ps.c
+2
-43
modules/mux/ogg.c
modules/mux/ogg.c
+4
-40
src/stream_output/stream_output.c
src/stream_output/stream_output.c
+38
-0
No files found.
include/vlc_plugin.h
View file @
17b5ee09
...
...
@@ -120,8 +120,8 @@ enum vlc_module_properties
/**
* Current plugin ABI version
*/
# define MODULE_SYMBOL 1_1_0
d
# define MODULE_SUFFIX "__1_1_0
d
"
# define MODULE_SYMBOL 1_1_0
e
# define MODULE_SUFFIX "__1_1_0
e
"
/*****************************************************************************
* Add a few defines. You do not want to read this section. Really.
...
...
include/vlc_sout.h
View file @
17b5ee09
...
...
@@ -183,6 +183,7 @@ VLC_EXPORT( sout_input_t *, sout_MuxAddStream, ( sout_mux_t *, es_format_t *
VLC_EXPORT
(
void
,
sout_MuxDeleteStream
,
(
sout_mux_t
*
,
sout_input_t
*
)
);
VLC_EXPORT
(
void
,
sout_MuxDelete
,
(
sout_mux_t
*
)
);
VLC_EXPORT
(
void
,
sout_MuxSendBuffer
,
(
sout_mux_t
*
,
sout_input_t
*
,
block_t
*
)
);
VLC_EXPORT
(
int
,
sout_MuxGetStream
,
(
sout_mux_t
*
,
int
,
mtime_t
*
));
static
inline
int
sout_MuxControl
(
sout_mux_t
*
p_mux
,
int
i_query
,
...
)
{
...
...
modules/mux/asf.c
View file @
17b5ee09
...
...
@@ -161,8 +161,6 @@ struct sout_mux_sys_t
char
*
psz_rating
;
};
static
int
MuxGetStream
(
sout_mux_t
*
,
int
*
pi_stream
,
mtime_t
*
pi_dts
);
static
block_t
*
asf_header_create
(
sout_mux_t
*
,
bool
);
static
block_t
*
asf_packet_create
(
sout_mux_t
*
,
asf_track_t
*
,
block_t
*
);
static
block_t
*
asf_stream_end_create
(
sout_mux_t
*
);
...
...
@@ -695,12 +693,12 @@ static int Mux( sout_mux_t *p_mux )
{
sout_input_t
*
p_input
;
asf_track_t
*
tk
;
int
i_stream
;
mtime_t
i_dts
;
block_t
*
data
;
block_t
*
pk
;
if
(
MuxGetStream
(
p_mux
,
&
i_stream
,
&
i_dts
)
)
int
i_stream
=
sout_MuxGetStream
(
p_mux
,
1
,
&
i_dts
);
if
(
i_stream
<
0
)
{
/* not enough data */
return
VLC_SUCCESS
;
...
...
@@ -747,43 +745,6 @@ static int Mux( sout_mux_t *p_mux )
return
VLC_SUCCESS
;
}
static
int
MuxGetStream
(
sout_mux_t
*
p_mux
,
int
*
pi_stream
,
mtime_t
*
pi_dts
)
{
mtime_t
i_dts
;
int
i_stream
;
int
i
;
for
(
i
=
0
,
i_dts
=
0
,
i_stream
=
-
1
;
i
<
p_mux
->
i_nb_inputs
;
i
++
)
{
sout_input_t
*
p_input
=
p_mux
->
pp_inputs
[
i
];
block_t
*
p_data
;
if
(
block_FifoCount
(
p_input
->
p_fifo
)
<=
0
)
{
if
(
p_input
->
p_fmt
->
i_cat
==
AUDIO_ES
||
p_input
->
p_fmt
->
i_cat
==
VIDEO_ES
)
{
/* We need that audio+video fifo contain at least 1 packet */
return
VLC_EGENERIC
;
}
/* SPU */
continue
;
}
p_data
=
block_FifoShow
(
p_input
->
p_fifo
);
if
(
i_stream
==
-
1
||
p_data
->
i_dts
<
i_dts
)
{
i_stream
=
i
;
i_dts
=
p_data
->
i_dts
;
}
}
*
pi_stream
=
i_stream
;
*
pi_dts
=
i_dts
;
return
VLC_SUCCESS
;
}
/****************************************************************************
* Asf header construction
****************************************************************************/
...
...
modules/mux/mp4.c
View file @
17b5ee09
...
...
@@ -452,44 +452,6 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
return
VLC_SUCCESS
;
}
static
int
MuxGetStream
(
sout_mux_t
*
p_mux
,
int
*
pi_stream
,
mtime_t
*
pi_dts
)
{
mtime_t
i_dts
;
int
i_stream
,
i
;
for
(
i
=
0
,
i_dts
=
0
,
i_stream
=
-
1
;
i
<
p_mux
->
i_nb_inputs
;
i
++
)
{
block_fifo_t
*
p_fifo
=
p_mux
->
pp_inputs
[
i
]
->
p_fifo
;
block_t
*
p_buf
;
if
(
block_FifoCount
(
p_fifo
)
<=
1
)
{
if
(
p_mux
->
pp_inputs
[
i
]
->
p_fmt
->
i_cat
!=
SPU_ES
)
{
return
-
1
;
// wait that all fifo have at least 2 packets
}
/* For SPU, we wait only 1 packet */
continue
;
}
p_buf
=
block_FifoShow
(
p_fifo
);
if
(
i_stream
<
0
||
p_buf
->
i_dts
<
i_dts
)
{
i_dts
=
p_buf
->
i_dts
;
i_stream
=
i
;
}
}
if
(
pi_stream
)
{
*
pi_stream
=
i_stream
;
}
if
(
pi_dts
)
{
*
pi_dts
=
i_dts
;
}
return
i_stream
;
}
/*****************************************************************************
* Mux:
*****************************************************************************/
...
...
@@ -500,12 +462,12 @@ static int Mux( sout_mux_t *p_mux )
for
(
;;
)
{
sout_input_t
*
p_input
;
int
i_stream
;
mp4_stream_t
*
p_stream
;
block_t
*
p_data
;
mtime_t
i_dts
;
if
(
MuxGetStream
(
p_mux
,
&
i_stream
,
&
i_dts
)
<
0
)
int
i_stream
=
sout_MuxGetStream
(
p_mux
,
2
,
&
i_dts
);
if
(
i_stream
<
0
)
{
return
(
VLC_SUCCESS
);
}
...
...
modules/mux/mpeg/ps.c
View file @
17b5ee09
...
...
@@ -89,7 +89,6 @@ static int Mux ( sout_mux_t * );
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
int
MuxGetStream
(
sout_mux_t
*
,
int
*
,
mtime_t
*
);
static
void
MuxWritePackHeader
(
sout_mux_t
*
,
block_t
**
,
mtime_t
);
static
void
MuxWriteSystemHeader
(
sout_mux_t
*
,
block_t
**
,
mtime_t
);
...
...
@@ -457,10 +456,10 @@ static int Mux( sout_mux_t *p_mux )
block_t
*
p_ps
,
*
p_data
;
mtime_t
i_dts
;
int
i_stream
;
/* Choose which stream to mux */
if
(
MuxGetStream
(
p_mux
,
&
i_stream
,
&
i_dts
)
)
int
i_stream
=
sout_MuxGetStream
(
p_mux
,
1
,
&
i_dts
);
if
(
i_stream
<
0
)
{
return
VLC_SUCCESS
;
}
...
...
@@ -799,43 +798,3 @@ static void MuxWritePSM( sout_mux_t *p_mux, block_t **p_buf, mtime_t i_dts )
block_ChainAppend
(
p_buf
,
p_hdr
);
}
/*
* Find stream to be muxed.
*/
static
int
MuxGetStream
(
sout_mux_t
*
p_mux
,
int
*
pi_stream
,
mtime_t
*
pi_dts
)
{
mtime_t
i_dts
;
int
i_stream
,
i
;
for
(
i
=
0
,
i_dts
=
0
,
i_stream
=
-
1
;
i
<
p_mux
->
i_nb_inputs
;
i
++
)
{
sout_input_t
*
p_input
=
p_mux
->
pp_inputs
[
i
];
block_t
*
p_data
;
if
(
block_FifoCount
(
p_input
->
p_fifo
)
<=
0
)
{
if
(
p_input
->
p_fmt
->
i_cat
==
AUDIO_ES
||
p_input
->
p_fmt
->
i_cat
==
VIDEO_ES
)
{
/* We need that audio+video fifo contain at least 1 packet */
return
VLC_EGENERIC
;
}
/* SPU */
continue
;
}
p_data
=
block_FifoShow
(
p_input
->
p_fifo
);
if
(
i_stream
==
-
1
||
p_data
->
i_dts
<
i_dts
)
{
i_stream
=
i
;
i_dts
=
p_data
->
i_dts
;
}
}
*
pi_stream
=
i_stream
;
*
pi_dts
=
i_dts
;
return
VLC_SUCCESS
;
}
modules/mux/ogg.c
View file @
17b5ee09
...
...
@@ -127,43 +127,6 @@ typedef struct
}
oggds_header_t
;
/*
* TODO move this function to src/stream_output.c (used by nearly all muxers)
*/
static
int
MuxGetStream
(
sout_mux_t
*
p_mux
,
int
*
pi_stream
,
mtime_t
*
pi_dts
)
{
mtime_t
i_dts
=
0
;
int
i_stream
=
-
1
;
for
(
int
i
=
0
;
i
<
p_mux
->
i_nb_inputs
;
i
++
)
{
block_fifo_t
*
p_fifo
;
p_fifo
=
p_mux
->
pp_inputs
[
i
]
->
p_fifo
;
/* We don't really need to have anything in the SPU fifo */
if
(
p_mux
->
pp_inputs
[
i
]
->
p_fmt
->
i_cat
==
SPU_ES
&&
block_FifoCount
(
p_fifo
)
==
0
)
continue
;
if
(
block_FifoCount
(
p_fifo
)
)
{
block_t
*
p_buf
;
p_buf
=
block_FifoShow
(
p_fifo
);
if
(
i_stream
<
0
||
p_buf
->
i_dts
<
i_dts
)
{
i_dts
=
p_buf
->
i_dts
;
i_stream
=
i
;
}
}
else
return
-
1
;
}
if
(
pi_stream
)
*
pi_stream
=
i_stream
;
if
(
pi_dts
)
*
pi_dts
=
i_dts
;
return
i_stream
;
}
/*****************************************************************************
* Definitions of structures and functions used by this plugins
*****************************************************************************/
...
...
@@ -896,13 +859,12 @@ static int Mux( sout_mux_t *p_mux )
{
sout_mux_sys_t
*
p_sys
=
p_mux
->
p_sys
;
block_t
*
p_og
=
NULL
;
int
i_stream
;
mtime_t
i_dts
;
if
(
p_sys
->
i_add_streams
||
p_sys
->
i_del_streams
)
{
/* Open new ogg stream */
if
(
MuxGetStream
(
p_mux
,
&
i_stream
,
&
i_dts
)
<
0
)
if
(
sout_MuxGetStream
(
p_mux
,
1
,
&
i_dts
)
<
0
)
{
msg_Dbg
(
p_mux
,
"waiting for data..."
);
return
VLC_SUCCESS
;
...
...
@@ -941,7 +903,9 @@ static int Mux( sout_mux_t *p_mux )
for
(
;;
)
{
if
(
MuxGetStream
(
p_mux
,
&
i_stream
,
0
)
<
0
)
return
VLC_SUCCESS
;
int
i_stream
=
sout_MuxGetStream
(
p_mux
,
1
,
NULL
);
if
(
i_stream
<
0
)
return
VLC_SUCCESS
;
MuxBlock
(
p_mux
,
p_mux
->
pp_inputs
[
i_stream
]
);
}
...
...
src/stream_output/stream_output.c
View file @
17b5ee09
...
...
@@ -615,6 +615,44 @@ void sout_MuxSendBuffer( sout_mux_t *p_mux, sout_input_t *p_input,
p_mux
->
pf_mux
(
p_mux
);
}
/*****************************************************************************
* sout_MuxGetStream: find stream to be muxed
*****************************************************************************/
int
sout_MuxGetStream
(
sout_mux_t
*
p_mux
,
int
i_blocks
,
mtime_t
*
pi_dts
)
{
mtime_t
i_dts
=
0
;
int
i_stream
=
-
1
;
for
(
int
i
=
0
;
i
<
p_mux
->
i_nb_inputs
;
i
++
)
{
sout_input_t
*
p_input
=
p_mux
->
pp_inputs
[
i
];
block_t
*
p_data
;
if
(
block_FifoCount
(
p_input
->
p_fifo
)
<
i_blocks
)
{
if
(
p_input
->
p_fmt
->
i_cat
!=
SPU_ES
)
{
return
-
1
;
}
/* FIXME: SPU muxing */
continue
;
}
p_data
=
block_FifoShow
(
p_input
->
p_fifo
);
if
(
i_stream
<
0
||
p_data
->
i_dts
<
i_dts
)
{
i_stream
=
i
;
i_dts
=
p_data
->
i_dts
;
}
}
if
(
pi_dts
)
*
pi_dts
=
i_dts
;
return
i_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