Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
bfeea8d6
Commit
bfeea8d6
authored
Nov 21, 2003
by
Laurent Aimar
Browse files
* all: remove sout_format_t and use es_format_t instead.
parent
151a7cdf
Changes
21
Hide whitespace changes
Inline
Side-by-side
include/stream_output.h
View file @
bfeea8d6
...
...
@@ -2,7 +2,7 @@
* stream_output.h : stream output module
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: stream_output.h,v 1.1
5
2003/11/
07 16:53:54 massiot
Exp $
* $Id: stream_output.h,v 1.1
6
2003/11/
21 15:32:08 fenrir
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
...
...
@@ -27,6 +27,8 @@
* sout_instance_t: stream output thread descriptor
*****************************************************************************/
#include
"vlc_es.h"
/*
* i_allocated_size: size of allocated buffer
* p_allocated_buffer: where data has been allocated
...
...
@@ -65,26 +67,6 @@ struct sout_buffer_t
struct
sout_buffer_t
*
p_next
;
};
struct
sout_format_t
{
int
i_cat
;
vlc_fourcc_t
i_fourcc
;
/* audio */
int
i_sample_rate
;
int
i_channels
;
int
i_block_align
;
/* video */
int
i_width
;
int
i_height
;
int
i_bitrate
;
int
i_extra_data
;
uint8_t
*
p_extra_data
;
};
struct
sout_fifo_t
{
vlc_mutex_t
lock
;
/* fifo data lock */
...
...
@@ -102,7 +84,7 @@ struct sout_input_t
{
sout_instance_t
*
p_sout
;
s
out
_format_t
*
p_fmt
;
e
s_format_t
*
p_fmt
;
sout_fifo_t
*
p_fifo
;
void
*
p_sys
;
...
...
@@ -114,7 +96,7 @@ struct sout_packetizer_input_t
sout_instance_t
*
p_sout
;
s
out
_format_t
*
p_fmt
;
e
s_format_t
*
p_fmt
;
sout_stream_id_t
*
id
;
};
...
...
@@ -225,7 +207,7 @@ struct sout_stream_t
char
*
psz_next
;
/* add, remove a stream */
sout_stream_id_t
*
(
*
pf_add
)
(
sout_stream_t
*
,
s
out
_format_t
*
);
sout_stream_id_t
*
(
*
pf_add
)
(
sout_stream_t
*
,
e
s_format_t
*
);
int
(
*
pf_del
)
(
sout_stream_t
*
,
sout_stream_id_t
*
);
/* manage a packet */
...
...
@@ -296,7 +278,7 @@ VLC_EXPORT( sout_buffer_t *, sout_FifoShow, ( sout_fifo_t * ) );
#define sout_InputNew( a, b ) __sout_InputNew( VLC_OBJECT(a), b )
VLC_EXPORT
(
sout_packetizer_input_t
*
,
__sout_InputNew
,
(
vlc_object_t
*
,
s
out
_format_t
*
)
);
VLC_EXPORT
(
sout_packetizer_input_t
*
,
__sout_InputNew
,
(
vlc_object_t
*
,
e
s_format_t
*
)
);
VLC_EXPORT
(
int
,
sout_InputDelete
,
(
sout_packetizer_input_t
*
)
);
VLC_EXPORT
(
int
,
sout_InputSendBuffer
,
(
sout_packetizer_input_t
*
,
sout_buffer_t
*
)
);
...
...
@@ -313,7 +295,7 @@ VLC_EXPORT( int, sout_AccessOutSeek, ( sout_access_out_t *, of
VLC_EXPORT
(
int
,
sout_AccessOutWrite
,
(
sout_access_out_t
*
,
sout_buffer_t
*
)
);
VLC_EXPORT
(
sout_mux_t
*
,
sout_MuxNew
,
(
sout_instance_t
*
,
char
*
,
sout_access_out_t
*
)
);
VLC_EXPORT
(
sout_input_t
*
,
sout_MuxAddStream
,
(
sout_mux_t
*
,
s
out
_format_t
*
)
);
VLC_EXPORT
(
sout_input_t
*
,
sout_MuxAddStream
,
(
sout_mux_t
*
,
e
s_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
*
,
sout_buffer_t
*
)
);
...
...
include/vlc_common.h
View file @
bfeea8d6
...
...
@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.8
7
2003/11/21
00
:3
8
:0
1 gbazin
Exp $
* $Id: vlc_common.h,v 1.8
8
2003/11/21
15
:3
2
:0
8 fenrir
Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
...
...
@@ -217,6 +217,12 @@ typedef struct pgrm_sys_t pgrm_sys_t;
typedef
struct
stream_descriptor_t
stream_descriptor_t
;
typedef
struct
stream_sys_t
stream_sys_t
;
/* Format */
typedef
struct
audio_format_t
audio_format_t
;
typedef
struct
video_format_t
video_format_t
;
typedef
struct
subs_format_t
subs_format_t
;
typedef
struct
es_format_t
es_format_t
;
/* NInput */
typedef
struct
stream_t
stream_t
;
typedef
struct
es_out_t
es_out_t
;
...
...
@@ -230,7 +236,6 @@ typedef struct aout_sys_t aout_sys_t;
typedef
struct
aout_fifo_t
aout_fifo_t
;
typedef
struct
aout_input_t
aout_input_t
;
typedef
struct
aout_buffer_t
aout_buffer_t
;
typedef
struct
audio_format_t
audio_format_t
;
typedef
audio_format_t
audio_sample_format_t
;
typedef
struct
audio_date_t
audio_date_t
;
typedef
struct
aout_filter_t
aout_filter_t
;
...
...
@@ -239,7 +244,6 @@ typedef struct aout_filter_t aout_filter_t;
typedef
struct
vout_thread_t
vout_thread_t
;
typedef
struct
vout_sys_t
vout_sys_t
;
typedef
struct
chroma_sys_t
chroma_sys_t
;
typedef
struct
video_format_t
video_format_t
;
typedef
video_format_t
video_frame_format_t
;
typedef
struct
picture_t
picture_t
;
typedef
struct
picture_sys_t
picture_sys_t
;
...
...
@@ -260,7 +264,6 @@ typedef struct sout_access_out_t sout_access_out_t;
typedef
struct
sout_mux_t
sout_mux_t
;
typedef
struct
sout_stream_t
sout_stream_t
;
typedef
struct
sout_cfg_t
sout_cfg_t
;
typedef
struct
sout_format_t
sout_format_t
;
/*typedef struct sap_session_t sap_session_t;
typedef struct slp_session_t slp_session_t;*/
...
...
include/vlc_es.h
View file @
bfeea8d6
...
...
@@ -2,7 +2,7 @@
* vlc_es.h
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vlc_es.h,v 1.
1
2003/11/2
0 22:10:55
fenrir Exp $
* $Id: vlc_es.h,v 1.
2
2003/11/2
1 15:32:08
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -83,16 +83,16 @@ struct video_format_t
/**
* Description of subs
*/
typedef
struct
subs_format_t
struct
subs_format_t
{
char
*
psz_encoding
;
}
subs_format_t
;
};
/**
* ES definition
*/
typedef
struc
t
struct
es_format_
t
{
int
i_cat
;
vlc_fourcc_t
i_codec
;
...
...
@@ -116,7 +116,7 @@ typedef struct
int
i_extra
;
void
*
p_extra
;
}
es_format_t
;
};
static
inline
void
es_format_Init
(
es_format_t
*
fmt
,
int
i_cat
,
vlc_fourcc_t
i_codec
)
...
...
modules/mux/asf.c
View file @
bfeea8d6
...
...
@@ -2,7 +2,7 @@
* asf.c
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: asf.c,v 1.
7
2003/
08
/2
9
1
9:49:33
fenrir Exp $
* $Id: asf.c,v 1.
8
2003/
11
/2
1
1
5:32:08
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -280,11 +280,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
{
case
AUDIO_ES
:
{
int
i_blockalign
=
p_input
->
p_fmt
->
i_block
_
align
;
int
i_blockalign
=
p_input
->
p_fmt
->
audio
.
i_blockalign
;
int
i_bitspersample
=
0
;
int
i_extra
=
0
;
switch
(
p_input
->
p_fmt
->
i_
fourc
c
)
switch
(
p_input
->
p_fmt
->
i_
code
c
)
{
case
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
):
tk
->
i_tag
=
WAVE_FORMAT_A52
;
...
...
@@ -320,25 +320,25 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
case
VLC_FOURCC
(
'u'
,
'8'
,
' '
,
' '
):
tk
->
psz_name
=
"Raw audio 8bits"
;
tk
->
i_tag
=
WAVE_FORMAT_PCM
;
i_blockalign
=
p_input
->
p_fmt
->
i_channels
;
i_blockalign
=
p_input
->
p_fmt
->
audio
.
i_channels
;
i_bitspersample
=
8
;
break
;
case
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'l'
):
tk
->
psz_name
=
"Raw audio 16bits"
;
tk
->
i_tag
=
WAVE_FORMAT_PCM
;
i_blockalign
=
2
*
p_input
->
p_fmt
->
i_channels
;
i_blockalign
=
2
*
p_input
->
p_fmt
->
audio
.
i_channels
;
i_bitspersample
=
16
;
break
;
case
VLC_FOURCC
(
's'
,
'2'
,
'4'
,
'l'
):
tk
->
psz_name
=
"Raw audio 24bits"
;
tk
->
i_tag
=
WAVE_FORMAT_PCM
;
i_blockalign
=
3
*
p_input
->
p_fmt
->
i_channels
;
i_blockalign
=
3
*
p_input
->
p_fmt
->
audio
.
i_channels
;
i_bitspersample
=
24
;
break
;
case
VLC_FOURCC
(
's'
,
'3'
,
'2'
,
'l'
):
tk
->
psz_name
=
"Raw audio 32bits"
;
tk
->
i_tag
=
WAVE_FORMAT_PCM
;
i_blockalign
=
4
*
p_input
->
p_fmt
->
i_channels
;
i_blockalign
=
4
*
p_input
->
p_fmt
->
audio
.
i_channels
;
i_bitspersample
=
32
;
break
;
default:
...
...
@@ -347,20 +347,20 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
tk
->
i_extra
=
sizeof
(
WAVEFORMATEX
)
+
p_input
->
p_fmt
->
i_extra
_data
+
i_extra
;
p_input
->
p_fmt
->
i_extra
+
i_extra
;
tk
->
p_extra
=
malloc
(
tk
->
i_extra
);
bo_init
(
&
bo
,
tk
->
p_extra
,
tk
->
i_extra
);
bo_addle_u16
(
&
bo
,
tk
->
i_tag
);
bo_addle_u16
(
&
bo
,
p_input
->
p_fmt
->
i_channels
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
i_sample
_rate
);
bo_addle_u16
(
&
bo
,
p_input
->
p_fmt
->
audio
.
i_channels
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
audio
.
i
_rate
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
i_bitrate
/
8
);
bo_addle_u16
(
&
bo
,
i_blockalign
);
bo_addle_u16
(
&
bo
,
i_bitspersample
);
if
(
p_input
->
p_fmt
->
i_extra
_data
>
0
)
if
(
p_input
->
p_fmt
->
i_extra
>
0
)
{
bo_addle_u16
(
&
bo
,
p_input
->
p_fmt
->
i_extra
_data
);
bo_add_mem
(
&
bo
,
p_input
->
p_fmt
->
p_extra
_data
,
p_input
->
p_fmt
->
i_extra
_data
);
bo_addle_u16
(
&
bo
,
p_input
->
p_fmt
->
i_extra
);
bo_add_mem
(
&
bo
,
p_input
->
p_fmt
->
p_extra
,
p_input
->
p_fmt
->
i_extra
);
}
else
{
...
...
@@ -379,7 +379,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
msg_Dbg
(
p_mux
,
"adding mp2 header"
);
bo_addle_u16
(
&
bo
,
2
);
/* fwHeadLayer */
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
i_bitrate
);
bo_addle_u16
(
&
bo
,
p_input
->
p_fmt
->
i_channels
==
2
?
1
:
8
);
bo_addle_u16
(
&
bo
,
p_input
->
p_fmt
->
audio
.
i_channels
==
2
?
1
:
8
);
bo_addle_u16
(
&
bo
,
0
);
/* fwHeadModeExt */
bo_addle_u16
(
&
bo
,
1
);
/* wHeadEmphasis */
bo_addle_u16
(
&
bo
,
16
);
/* fwHeadFlags */
...
...
@@ -401,46 +401,46 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
case
VIDEO_ES
:
{
tk
->
i_extra
=
11
+
sizeof
(
BITMAPINFOHEADER
)
+
p_input
->
p_fmt
->
i_extra
_data
;
p_input
->
p_fmt
->
i_extra
;
tk
->
p_extra
=
malloc
(
tk
->
i_extra
);
bo_init
(
&
bo
,
tk
->
p_extra
,
tk
->
i_extra
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
i_width
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
i_height
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
video
.
i_width
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
video
.
i_height
);
bo_add_u8
(
&
bo
,
0x02
);
/* flags */
bo_addle_u16
(
&
bo
,
sizeof
(
BITMAPINFOHEADER
)
+
p_input
->
p_fmt
->
i_extra
_data
);
p_input
->
p_fmt
->
i_extra
);
bo_addle_u32
(
&
bo
,
sizeof
(
BITMAPINFOHEADER
)
+
p_input
->
p_fmt
->
i_extra
_data
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
i_width
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
i_height
);
p_input
->
p_fmt
->
i_extra
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
video
.
i_width
);
bo_addle_u32
(
&
bo
,
p_input
->
p_fmt
->
video
.
i_height
);
bo_addle_u16
(
&
bo
,
1
);
bo_addle_u16
(
&
bo
,
24
);
if
(
p_input
->
p_fmt
->
i_
fourc
c
==
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'v'
)
)
if
(
p_input
->
p_fmt
->
i_
code
c
==
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'v'
)
)
{
tk
->
psz_name
=
"MPEG-4 Video"
;
tk
->
i_fourcc
=
VLC_FOURCC
(
'M'
,
'P'
,
'4'
,
'S'
);
}
else
if
(
p_input
->
p_fmt
->
i_
fourc
c
==
VLC_FOURCC
(
'D'
,
'I'
,
'V'
,
'3'
)
)
else
if
(
p_input
->
p_fmt
->
i_
code
c
==
VLC_FOURCC
(
'D'
,
'I'
,
'V'
,
'3'
)
)
{
tk
->
psz_name
=
"MSMPEG-4 V3 Video"
;
tk
->
i_fourcc
=
VLC_FOURCC
(
'M'
,
'P'
,
'4'
,
'3'
);
}
else
if
(
p_input
->
p_fmt
->
i_
fourc
c
==
VLC_FOURCC
(
'D'
,
'I'
,
'V'
,
'2'
)
)
else
if
(
p_input
->
p_fmt
->
i_
code
c
==
VLC_FOURCC
(
'D'
,
'I'
,
'V'
,
'2'
)
)
{
tk
->
psz_name
=
"MSMPEG-4 V2 Video"
;
tk
->
i_fourcc
=
VLC_FOURCC
(
'M'
,
'P'
,
'4'
,
'2'
);
}
else
if
(
p_input
->
p_fmt
->
i_
fourc
c
==
VLC_FOURCC
(
'D'
,
'I'
,
'V'
,
'1'
)
)
else
if
(
p_input
->
p_fmt
->
i_
code
c
==
VLC_FOURCC
(
'D'
,
'I'
,
'V'
,
'1'
)
)
{
tk
->
psz_name
=
"MSMPEG-4 V1 Video"
;
tk
->
i_fourcc
=
VLC_FOURCC
(
'M'
,
'P'
,
'G'
,
'4'
);
}
else
if
(
p_input
->
p_fmt
->
i_
fourc
c
==
VLC_FOURCC
(
'W'
,
'M'
,
'V'
,
'1'
)
)
else
if
(
p_input
->
p_fmt
->
i_
code
c
==
VLC_FOURCC
(
'W'
,
'M'
,
'V'
,
'1'
)
)
{
tk
->
psz_name
=
"Windows Media Video 1"
;
tk
->
i_fourcc
=
VLC_FOURCC
(
'W'
,
'M'
,
'V'
,
'1'
);
}
else
if
(
p_input
->
p_fmt
->
i_
fourc
c
==
VLC_FOURCC
(
'W'
,
'M'
,
'V'
,
'2'
)
)
else
if
(
p_input
->
p_fmt
->
i_
code
c
==
VLC_FOURCC
(
'W'
,
'M'
,
'V'
,
'2'
)
)
{
tk
->
psz_name
=
"Windows Media Video 2"
;
tk
->
i_fourcc
=
VLC_FOURCC
(
'W'
,
'M'
,
'V'
,
'2'
);
...
...
@@ -448,7 +448,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
else
{
tk
->
psz_name
=
"Unknow Video"
;
tk
->
i_fourcc
=
p_input
->
p_fmt
->
i_
fourc
c
;
tk
->
i_fourcc
=
p_input
->
p_fmt
->
i_
code
c
;
}
bo_add_mem
(
&
bo
,
(
uint8_t
*
)
&
tk
->
i_fourcc
,
4
);
bo_addle_u32
(
&
bo
,
0
);
...
...
@@ -456,10 +456,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
bo_addle_u32
(
&
bo
,
0
);
bo_addle_u32
(
&
bo
,
0
);
bo_addle_u32
(
&
bo
,
0
);
if
(
p_input
->
p_fmt
->
i_extra
_data
>
0
)
if
(
p_input
->
p_fmt
->
i_extra
>
0
)
{
bo_add_mem
(
&
bo
,
p_input
->
p_fmt
->
p_extra
_data
,
p_input
->
p_fmt
->
i_extra
_data
);
bo_add_mem
(
&
bo
,
p_input
->
p_fmt
->
p_extra
,
p_input
->
p_fmt
->
i_extra
);
}
if
(
p_input
->
p_fmt
->
i_bitrate
>
50000
)
...
...
modules/mux/avi.c
View file @
bfeea8d6
...
...
@@ -2,7 +2,7 @@
* avi.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: avi.c,v 1.1
5
2003/
08/17 18:44:26
fenrir Exp $
* $Id: avi.c,v 1.1
6
2003/
11/21 15:32:08
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -264,22 +264,22 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
p_stream
->
p_bih
=
NULL
;
p_stream
->
p_wf
=
malloc
(
sizeof
(
WAVEFORMATEX
)
+
p_input
->
p_fmt
->
i_extra
_data
);
p_input
->
p_fmt
->
i_extra
);
#define p_wf p_stream->p_wf
p_wf
->
cbSize
=
p_input
->
p_fmt
->
i_extra
_data
;
p_wf
->
cbSize
=
p_input
->
p_fmt
->
i_extra
;
if
(
p_wf
->
cbSize
>
0
)
{
memcpy
(
&
p_wf
[
1
],
p_input
->
p_fmt
->
p_extra
_data
,
p_input
->
p_fmt
->
i_extra
_data
);
p_input
->
p_fmt
->
p_extra
,
p_input
->
p_fmt
->
i_extra
);
}
p_wf
->
nChannels
=
p_input
->
p_fmt
->
i_channels
;
p_wf
->
nSamplesPerSec
=
p_input
->
p_fmt
->
i_sample
_rate
;
p_wf
->
nBlockAlign
=
p_input
->
p_fmt
->
i_block
_
align
;
p_wf
->
nChannels
=
p_input
->
p_fmt
->
audio
.
i_channels
;
p_wf
->
nSamplesPerSec
=
p_input
->
p_fmt
->
audio
.
i
_rate
;
p_wf
->
nBlockAlign
=
p_input
->
p_fmt
->
audio
.
i_blockalign
;
p_wf
->
nAvgBytesPerSec
=
p_input
->
p_fmt
->
i_bitrate
/
8
;
p_wf
->
wBitsPerSample
=
0
;
switch
(
p_input
->
p_fmt
->
i_
fourc
c
)
switch
(
p_input
->
p_fmt
->
i_
code
c
)
{
case
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
):
p_wf
->
wFormatTag
=
WAVE_FORMAT_A52
;
...
...
@@ -334,18 +334,18 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
}
p_stream
->
p_wf
=
NULL
;
p_stream
->
p_bih
=
malloc
(
sizeof
(
BITMAPINFOHEADER
)
+
p_input
->
p_fmt
->
i_extra
_data
);
p_input
->
p_fmt
->
i_extra
);
#define p_bih p_stream->p_bih
p_bih
->
biSize
=
sizeof
(
BITMAPINFOHEADER
)
+
p_input
->
p_fmt
->
i_extra
_data
;
if
(
p_input
->
p_fmt
->
i_extra
_data
>
0
)
p_input
->
p_fmt
->
i_extra
;
if
(
p_input
->
p_fmt
->
i_extra
>
0
)
{
memcpy
(
&
p_bih
[
1
],
p_input
->
p_fmt
->
p_extra
_data
,
p_input
->
p_fmt
->
i_extra
_data
);
p_input
->
p_fmt
->
p_extra
,
p_input
->
p_fmt
->
i_extra
);
}
p_bih
->
biWidth
=
p_input
->
p_fmt
->
i_width
;
p_bih
->
biHeight
=
p_input
->
p_fmt
->
i_height
;
p_bih
->
biWidth
=
p_input
->
p_fmt
->
video
.
i_width
;
p_bih
->
biHeight
=
p_input
->
p_fmt
->
video
.
i_height
;
p_bih
->
biPlanes
=
1
;
p_bih
->
biBitCount
=
24
;
p_bih
->
biSizeImage
=
0
;
...
...
@@ -353,13 +353,13 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
p_bih
->
biYPelsPerMeter
=
0
;
p_bih
->
biClrUsed
=
0
;
p_bih
->
biClrImportant
=
0
;
switch
(
p_input
->
p_fmt
->
i_
fourc
c
)
switch
(
p_input
->
p_fmt
->
i_
code
c
)
{
case
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'v'
):
p_bih
->
biCompression
=
VLC_FOURCC
(
'X'
,
'V'
,
'I'
,
'D'
);
break
;
default:
p_bih
->
biCompression
=
p_input
->
p_fmt
->
i_
fourc
c
;
p_bih
->
biCompression
=
p_input
->
p_fmt
->
i_
code
c
;
break
;
}
#undef p_bih
...
...
modules/mux/mp4.c
View file @
bfeea8d6
...
...
@@ -2,7 +2,7 @@
* mp4.c: mp4/mov muxer
*****************************************************************************
* Copyright (C) 2001, 2002, 2003 VideoLAN
* $Id: mp4.c,v 1.
6
2003/1
0/17 16:40:08 gbazin
Exp $
* $Id: mp4.c,v 1.
7
2003/1
1/21 15:32:08 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -73,7 +73,7 @@ typedef struct
typedef
struct
{
s
out
_format_t
*
p_fmt
;
e
s_format_t
*
p_fmt
;
int
i_track_id
;
/* index */
...
...
@@ -209,10 +209,10 @@ static bo_t *GetESDS( mp4_stream_t *p_stream )
int
i_object_type_indication
;
int
i_decoder_specific_info_size
;
if
(
p_stream
->
p_fmt
->
i_extra
_data
>
0
)
if
(
p_stream
->
p_fmt
->
i_extra
>
0
)
{
i_decoder_specific_info_size
=
GetDescrLength
(
p_stream
->
p_fmt
->
i_extra
_data
);
GetDescrLength
(
p_stream
->
p_fmt
->
i_extra
);
}
else
{
...
...
@@ -231,7 +231,7 @@ static bo_t *GetESDS( mp4_stream_t *p_stream )
/* DecoderConfigDescr */
bo_add_descr
(
esds
,
0x04
,
13
+
i_decoder_specific_info_size
);
switch
(
p_stream
->
p_fmt
->
i_
fourc
c
)
switch
(
p_stream
->
p_fmt
->
i_
code
c
)
{
case
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'v'
):
i_object_type_indication
=
0x20
;
...
...
@@ -246,7 +246,7 @@ static bo_t *GetESDS( mp4_stream_t *p_stream )
break
;
case
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'a'
):
i_object_type_indication
=
p_stream
->
p_fmt
->
i_sample
_rate
<
32000
?
0x69
:
0x6b
;
p_stream
->
p_fmt
->
audio
.
i
_rate
<
32000
?
0x69
:
0x6b
;
break
;
default:
i_object_type_indication
=
0x00
;
...
...
@@ -260,16 +260,16 @@ static bo_t *GetESDS( mp4_stream_t *p_stream )
bo_add_32be
(
esds
,
0x7fffffff
);
// maxBitrate
bo_add_32be
(
esds
,
0
);
// avgBitrate
if
(
p_stream
->
p_fmt
->
i_extra
_data
>
0
)
if
(
p_stream
->
p_fmt
->
i_extra
>
0
)
{
int
i
;
/* DecoderSpecificInfo */
bo_add_descr
(
esds
,
0x05
,
p_stream
->
p_fmt
->
i_extra
_data
);
bo_add_descr
(
esds
,
0x05
,
p_stream
->
p_fmt
->
i_extra
);
for
(
i
=
0
;
i
<
p_stream
->
p_fmt
->
i_extra
_data
;
i
++
)
for
(
i
=
0
;
i
<
p_stream
->
p_fmt
->
i_extra
;
i
++
)
{
bo_add_8
(
esds
,
p_stream
->
p_fmt
->
p_extra
_data
[
i
]
);
bo_add_8
(
esds
,
((
uint8_t
*
)
p_stream
->
p_fmt
->
p_extra
)
[
i
]
);
}
}
...
...
@@ -427,7 +427,7 @@ static void Close( vlc_object_t * p_this )
}
if
(
p_stream
->
p_fmt
->
i_cat
==
AUDIO_ES
)
{
i_timescale
=
p_stream
->
p_fmt
->
i_sample
_rate
;
i_timescale
=
p_stream
->
p_fmt
->
audio
.
i
_rate
;
}
else
{
...
...
@@ -480,8 +480,8 @@ static void Close( vlc_object_t * p_this )
}
else
{
bo_add_32be
(
tkhd
,
p_stream
->
p_fmt
->
i_width
<<
16
);
// width (presentation)
bo_add_32be
(
tkhd
,
p_stream
->
p_fmt
->
i_height
<<
16
);
// height(presentation)
bo_add_32be
(
tkhd
,
p_stream
->
p_fmt
->
video
.
i_width
<<
16
);
// width (presentation)
bo_add_32be
(
tkhd
,
p_stream
->
p_fmt
->
video
.
i_height
<<
16
);
// height(presentation)
}
box_fix
(
tkhd
);
box_gather
(
trak
,
tkhd
);
...
...
@@ -599,7 +599,7 @@ static void Close( vlc_object_t * p_this )
int
i
;
vlc_bool_t
b_mpeg4_hdr
;
switch
(
p_stream
->
p_fmt
->
i_
fourc
c
)
switch
(
p_stream
->
p_fmt
->
i_
code
c
)
{
case
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
):
memcpy
(
fcc
,
"mp4a"
,
4
);
...
...
@@ -615,7 +615,7 @@ static void Close( vlc_object_t * p_this )
break
;
default:
memcpy
(
fcc
,
(
char
*
)
&
p_stream
->
p_fmt
->
i_
fourc
c
,
4
);
memcpy
(
fcc
,
(
char
*
)
&
p_stream
->
p_fmt
->
i_
code
c
,
4
);
b_mpeg4_hdr
=
VLC_FALSE
;
break
;
}
...
...
@@ -631,11 +631,11 @@ static void Close( vlc_object_t * p_this )
bo_add_16be
(
soun
,
0
);
// version;
bo_add_16be
(
soun
,
0
);
// revision level (0)
bo_add_32be
(
soun
,
0
);
// vendor
bo_add_16be
(
soun
,
p_stream
->
p_fmt
->
i_channels
);
// channel-count
bo_add_16be
(
soun
,
p_stream
->
p_fmt
->
audio
.
i_channels
);
// channel-count
bo_add_16be
(
soun
,
16
);
// FIXME sample size
bo_add_16be
(
soun
,
-
2
);
// compression id
bo_add_16be
(
soun
,
0
);
// packet size (0)
bo_add_16be
(
soun
,
p_stream
->
p_fmt
->
i_sample
_rate
);
// sampleratehi
bo_add_16be
(
soun
,
p_stream
->
p_fmt
->
audio
.
i
_rate
);
// sampleratehi
bo_add_16be
(
soun
,
0
);
// sampleratelo
/* add an ES Descriptor */
...
...
@@ -659,7 +659,7 @@ static void Close( vlc_object_t * p_this )
int
i
;
vlc_bool_t
b_mpeg4_hdr
;
switch
(
p_stream
->
p_fmt
->
i_
fourc
c
)
switch
(
p_stream
->
p_fmt
->
i_
code
c
)
{
case
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'v'
):
case
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'v'
):
...
...
@@ -673,7 +673,7 @@ static void Close( vlc_object_t * p_this )
break
;
default:
memcpy
(
fcc
,
(
char
*
)
&
p_stream
->
p_fmt
->
i_
fourc
c
,
4
);
memcpy
(
fcc
,
(
char
*
)
&
p_stream
->
p_fmt
->
i_
code
c
,
4
);
b_mpeg4_hdr
=
VLC_FALSE
;
break
;
}
...
...
@@ -692,8 +692,8 @@ static void Close( vlc_object_t * p_this )
bo_add_32be
(
vide
,
0
);
// predefined;
}
bo_add_16be
(
vide
,
p_stream
->
p_fmt
->
i_width
);
// i_width
bo_add_16be
(
vide
,
p_stream
->
p_fmt
->
i_height
);
// i_height
bo_add_16be
(
vide
,
p_stream
->
p_fmt
->
video
.
i_width
);
// i_width
bo_add_16be
(
vide
,
p_stream
->
p_fmt
->
video
.
i_height
);
// i_height
bo_add_32be
(
vide
,
0x00480000
);
// h 72dpi
bo_add_32be
(
vide
,
0x00480000
);
// v 72dpi
...
...
@@ -916,9 +916,9 @@ static void Close( vlc_object_t * p_this )
p_stream
=
p_sys
->
pp_streams
[
i_trak
];
if
(
p_stream
->
p_fmt
->
p_extra
_data
)
if
(
p_stream
->
p_fmt
->
p_extra
)
{
free
(
p_stream
->
p_fmt
->
p_extra
_data
);
free
(
p_stream
->
p_fmt
->
p_extra
);
}
free
(
p_stream
->
p_fmt
);
free
(
p_stream
->
entry
);
...
...
@@ -945,7 +945,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
sout_mux_sys_t
*
p_sys
=
p_mux
->
p_sys
;
mp4_stream_t
*
p_stream
;
switch
(
p_input
->
p_fmt
->
i_
fourc
c
)
switch
(
p_input
->
p_fmt
->
i_
code
c
)
{
case
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
):
case
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'v'
):
...
...
@@ -956,20 +956,20 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
break
;
default:
msg_Err
(
p_mux
,
"unsupported codec %4.4s in mp4"
,
(
char
*
)
&
p_input
->
p_fmt
->
i_
fourc
c
);
(
char
*
)
&
p_input
->
p_fmt
->
i_
code
c
);
return
VLC_EGENERIC
;
}
p_stream
=
malloc
(
sizeof
(
mp4_stream_t
)
);
p_stream
->
p_fmt
=
malloc
(
sizeof
(
s
out
_format_t
)
);
memcpy
(
p_stream
->
p_fmt
,
p_input
->
p_fmt
,
sizeof
(
s
out
_format_t
)
);
if
(
p_stream
->
p_fmt
->
i_extra
_data
)
p_stream
->
p_fmt
=
malloc
(
sizeof
(
e
s_format_t
)
);
memcpy
(
p_stream
->
p_fmt
,
p_input
->
p_fmt
,
sizeof
(
e
s_format_t
)
);
if
(
p_stream
->
p_fmt
->
i_extra
)
{
p_stream
->
p_fmt
->
p_extra
_data
=
malloc
(
p_stream
->
p_fmt
->
i_extra
_data
);
memcpy
(
p_stream
->
p_fmt
->
p_extra
_data
,
p_input
->
p_fmt
->
p_extra
_data
,
p_input
->
p_fmt
->
i_extra
_data
);
p_stream
->
p_fmt
->
p_extra
=
malloc
(
p_stream
->
p_fmt
->
i_extra
);
memcpy
(
p_stream
->
p_fmt
->
p_extra
,
p_input
->
p_fmt
->
p_extra
,
p_input
->
p_fmt
->
i_extra
);
}
p_stream
->
i_track_id
=
p_sys
->
i_nb_streams
+
1
;
p_stream
->
i_entry_count
=
0
;
...
...