Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
f6ef9859
Commit
f6ef9859
authored
Jul 18, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better packetizer helpers
parent
f0ddd615
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
89 deletions
+34
-89
include/vlc_demux.h
include/vlc_demux.h
+21
-15
modules/demux/a52.c
modules/demux/a52.c
+2
-17
modules/demux/dts.c
modules/demux/dts.c
+2
-2
modules/demux/flac.c
modules/demux/flac.c
+2
-12
modules/demux/mpeg/m4a.c
modules/demux/mpeg/m4a.c
+3
-20
modules/demux/mpeg/mpgv.c
modules/demux/mpeg/mpgv.c
+4
-23
No files found.
include/vlc_demux.h
View file @
f6ef9859
...
...
@@ -199,25 +199,31 @@ static inline vlc_bool_t isDemux( demux_t *p_demux, char *psz_requested )
if( stream_Peek( p_demux->s , &p_peek, size ) < size ) return VLC_EGENERIC;}
#define POKE( peek, stuff, size ) (strncasecmp( (char *)peek, stuff, size )==0)
#define CREATE_PACKETIZER( a,b,c,d ) \
p_sys->p_packetizer = vlc_object_create( p_demux, VLC_OBJECT_DECODER ); \
p_sys->p_packetizer->pf_decode_audio = 0; \
p_sys->p_packetizer->pf_decode_video = 0; \
p_sys->p_packetizer->pf_decode_sub = 0; \
p_sys->p_packetizer->pf_packetize = 0; \
es_format_Init( &p_sys->p_packetizer->fmt_in, AUDIO_ES, \
#define COMMON_INIT_PACKETIZER( location ) \
location = vlc_object_create( p_demux, VLC_OBJECT_DECODER ); \
location->pf_decode_audio = 0; \
location->pf_decode_video = 0; \
location->pf_decode_sub = 0; \
location->pf_packetize = 0; \
#define INIT_APACKETIZER( location, a,b,c,d ) \
COMMON_INIT_PACKETIZER(location ); \
es_format_Init( &location->fmt_in, AUDIO_ES, \
VLC_FOURCC( a, b, c, d ) );
#define INIT_VPACKETIZER( location, a,b,c,d ) \
COMMON_INIT_PACKETIZER(location ); \
es_format_Init( &location->fmt_in, VIDEO_ES, \
VLC_FOURCC( a, b, c, d ) );
/* BEWARE ! This can lead to memory leaks ! */
#define LOAD_PACKETIZER_OR_FAIL( msg ) \
p_sys->p_packetizer->p_module = \
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 ); \
\
if( p_sys->p_packetizer->p_module == NULL ) \
#define LOAD_PACKETIZER_OR_FAIL( location, msg ) \
location->p_module = \
module_Need( location, "packetizer", NULL, 0 ); \
if( location->p_module == NULL ) \
{ \
vlc_object_destroy(
p_sys->p_packetizer
); \
vlc_object_destroy(
location
); \
msg_Err( p_demux, "cannot find packetizer for " # msg ); \
free( p_sys ); \
return VLC_EGENERIC; \
...
...
modules/demux/a52.c
View file @
f6ef9859
...
...
@@ -146,23 +146,8 @@ static int Open( vlc_object_t * p_this )
p_sys
->
b_big_endian
=
b_big_endian
;
/* Load the A52 packetizer */
p_sys
->
p_packetizer
=
vlc_object_create
(
p_demux
,
VLC_OBJECT_DECODER
);
p_sys
->
p_packetizer
->
pf_decode_audio
=
0
;
p_sys
->
p_packetizer
->
pf_decode_video
=
0
;
p_sys
->
p_packetizer
->
pf_decode_sub
=
0
;
p_sys
->
p_packetizer
->
pf_packetize
=
0
;
/* Initialization of decoder structure */
es_format_Init
(
&
p_sys
->
p_packetizer
->
fmt_in
,
AUDIO_ES
,
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
)
);
p_sys
->
p_packetizer
->
p_module
=
module_Need
(
p_sys
->
p_packetizer
,
"packetizer"
,
NULL
,
0
);
if
(
!
p_sys
->
p_packetizer
->
p_module
)
{
msg_Err
(
p_demux
,
"cannot find A52 packetizer"
);
return
VLC_EGENERIC
;
}
INIT_APACKETIZER
(
p_sys
->
p_packetizer
,
'a'
,
'5'
,
'2'
,
' '
);
LOAD_PACKETIZER_OR_FAIL
(
p_sys
->
p_packetizer
,
"A52"
);
/* Create one program */
p_sys
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
p_sys
->
p_packetizer
->
fmt_in
);
...
...
modules/demux/dts.c
View file @
f6ef9859
...
...
@@ -151,8 +151,8 @@ static int Open( vlc_object_t * p_this )
STANDARD_DEMUX_INIT
;
p_sys
=
p_demux
->
p_sys
;
INIT_PACKETIZER
(
'd'
,
't'
,
's'
,
' '
);
LOAD_PACKETIZER_OR_FAIL
(
"DTS"
);
INIT_
A
PACKETIZER
(
p_sys
->
p_packetizer
,
'd'
,
't'
,
's'
,
' '
);
LOAD_PACKETIZER_OR_FAIL
(
p_sys
->
p_packetizer
,
"DTS"
);
p_sys
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
p_sys
->
p_packetizer
->
fmt_in
);
...
...
modules/demux/flac.c
View file @
f6ef9859
...
...
@@ -107,18 +107,8 @@ static int Open( vlc_object_t * p_this )
return
VLC_EGENERIC
;
}
/*
* Load the FLAC packetizer
*/
p_sys
->
p_packetizer
=
vlc_object_create
(
p_demux
,
VLC_OBJECT_DECODER
);
p_sys
->
p_packetizer
->
pf_decode_audio
=
0
;
p_sys
->
p_packetizer
->
pf_decode_video
=
0
;
p_sys
->
p_packetizer
->
pf_decode_sub
=
0
;
p_sys
->
p_packetizer
->
pf_packetize
=
0
;
/* Initialization of decoder structure */
es_format_Init
(
&
p_sys
->
p_packetizer
->
fmt_in
,
AUDIO_ES
,
VLC_FOURCC
(
'f'
,
'l'
,
'a'
,
'c'
)
);
/* Load the FLAC packetizer */
INIT_APACKETIZER
(
p_sys
->
p_packetizer
,
'f'
,
'l'
,
'a'
,
'c'
);
/* Store STREAMINFO for the decoder and packetizer */
p_sys
->
p_packetizer
->
fmt_in
.
i_extra
=
fmt
.
i_extra
=
STREAMINFO_SIZE
+
4
;
...
...
modules/demux/mpeg/m4a.c
View file @
f6ef9859
...
...
@@ -106,27 +106,10 @@ static int Open( vlc_object_t * p_this )
p_sys
->
p_es
=
NULL
;
p_sys
->
b_start
=
VLC_TRUE
;
/*
* Load the mpeg 4 audio packetizer
*/
p_sys
->
p_packetizer
=
vlc_object_create
(
p_demux
,
VLC_OBJECT_PACKETIZER
);
p_sys
->
p_packetizer
->
pf_decode_audio
=
NULL
;
p_sys
->
p_packetizer
->
pf_decode_video
=
NULL
;
p_sys
->
p_packetizer
->
pf_decode_sub
=
NULL
;
p_sys
->
p_packetizer
->
pf_packetize
=
NULL
;
es_format_Init
(
&
p_sys
->
p_packetizer
->
fmt_in
,
AUDIO_ES
,
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
)
);
/* Load the mpeg 4 audio packetizer */
INIT_APACKETIZER
(
p_sys
->
p_packetizer
,
'm'
,
'p'
,
'4'
,
'a'
);
es_format_Init
(
&
p_sys
->
p_packetizer
->
fmt_out
,
UNKNOWN_ES
,
0
);
p_sys
->
p_packetizer
->
p_module
=
module_Need
(
p_sys
->
p_packetizer
,
"packetizer"
,
NULL
,
0
);
if
(
p_sys
->
p_packetizer
->
p_module
==
NULL
)
{
vlc_object_destroy
(
p_sys
->
p_packetizer
);
msg_Err
(
p_demux
,
"cannot find mp4a packetizer"
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
LOAD_PACKETIZER_OR_FAIL
(
p_sys
->
p_packetizer
,
"mp4 audio"
);
return
VLC_SUCCESS
;
}
...
...
modules/demux/mpeg/mpgv.c
View file @
f6ef9859
...
...
@@ -105,31 +105,12 @@ static int Open( vlc_object_t * p_this )
p_sys
->
b_start
=
VLC_TRUE
;
p_sys
->
p_es
=
NULL
;
/*
* Load the mpegvideo packetizer
*/
p_sys
->
p_packetizer
=
vlc_object_create
(
p_demux
,
VLC_OBJECT_PACKETIZER
);
p_sys
->
p_packetizer
->
pf_decode_audio
=
NULL
;
p_sys
->
p_packetizer
->
pf_decode_video
=
NULL
;
p_sys
->
p_packetizer
->
pf_decode_sub
=
NULL
;
p_sys
->
p_packetizer
->
pf_packetize
=
NULL
;
es_format_Init
(
&
p_sys
->
p_packetizer
->
fmt_in
,
VIDEO_ES
,
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'v'
)
);
/* Load the mpegvideo packetizer */
INIT_VPACKETIZER
(
p_sys
->
p_packetizer
,
'm'
,
'p'
,
'g'
,
'v'
);
es_format_Init
(
&
p_sys
->
p_packetizer
->
fmt_out
,
UNKNOWN_ES
,
0
);
p_sys
->
p_packetizer
->
p_module
=
module_Need
(
p_sys
->
p_packetizer
,
"packetizer"
,
NULL
,
0
);
LOAD_PACKETIZER_OR_FAIL
(
p_sys
->
p_packetizer
,
"MPEG Video"
);
if
(
p_sys
->
p_packetizer
->
p_module
==
NULL
)
{
vlc_object_destroy
(
p_sys
->
p_packetizer
);
msg_Err
(
p_demux
,
"cannot find mpgv packetizer"
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
/*
* create the output
*/
/* create the output */
es_format_Init
(
&
fmt
,
VIDEO_ES
,
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'v'
)
);
p_sys
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
fmt
);
...
...
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