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
4b090cbd
Commit
4b090cbd
authored
Dec 12, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
realrtsp: fix compilation warning, use calloc and some cosmetics.
parent
c27325cc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
35 deletions
+48
-35
modules/access/rtsp/real_rmff.c
modules/access/rtsp/real_rmff.c
+48
-35
No files found.
modules/access/rtsp/real_rmff.c
View file @
4b090cbd
...
@@ -105,7 +105,7 @@ static int rmff_dump_prop(rmff_prop_t *prop, uint8_t *buffer, int bufsize) {
...
@@ -105,7 +105,7 @@ static int rmff_dump_prop(rmff_prop_t *prop, uint8_t *buffer, int bufsize) {
return
RMFF_PROPHEADER_SIZE
;
return
RMFF_PROPHEADER_SIZE
;
}
}
static
int
rmff_dump_mdpr
(
rmff_mdpr_t
*
mdpr
,
uint8_t
*
buffer
,
int
bufsize
)
{
static
int
rmff_dump_mdpr
(
rmff_mdpr_t
*
mdpr
,
uint8_t
*
buffer
,
unsigned
int
bufsize
)
{
int
s1
,
s2
,
s3
;
int
s1
,
s2
,
s3
;
...
@@ -293,10 +293,10 @@ void rmff_dump_pheader(rmff_pheader_t *h, char *data) {
...
@@ -293,10 +293,10 @@ void rmff_dump_pheader(rmff_pheader_t *h, char *data) {
rmff_fileheader_t
*
rmff_new_fileheader
(
uint32_t
num_headers
)
{
rmff_fileheader_t
*
rmff_new_fileheader
(
uint32_t
num_headers
)
{
rmff_fileheader_t
*
fileheader
=
malloc
(
sizeof
(
rmff_fileheader_t
));
rmff_fileheader_t
*
fileheader
=
calloc
(
1
,
sizeof
(
rmff_fileheader_t
)
);
if
(
!
fileheader
)
return
NULL
;
if
(
!
fileheader
)
return
NULL
;
memset
(
fileheader
,
0
,
sizeof
(
rmff_fileheader_t
));
fileheader
->
object_id
=
RMF_TAG
;
fileheader
->
object_id
=
RMF_TAG
;
fileheader
->
size
=
18
;
fileheader
->
size
=
18
;
fileheader
->
object_version
=
0
;
fileheader
->
object_version
=
0
;
...
@@ -319,10 +319,10 @@ rmff_prop_t *rmff_new_prop (
...
@@ -319,10 +319,10 @@ rmff_prop_t *rmff_new_prop (
uint16_t
num_streams
,
uint16_t
num_streams
,
uint16_t
flags
)
{
uint16_t
flags
)
{
rmff_prop_t
*
prop
=
malloc
(
sizeof
(
rmff_prop_t
));
rmff_prop_t
*
prop
=
calloc
(
1
,
sizeof
(
rmff_prop_t
)
);
if
(
!
prop
)
return
NULL
;
if
(
!
prop
)
return
NULL
;
memset
(
prop
,
0
,
sizeof
(
rmff_prop_t
));
prop
->
object_id
=
PROP_TAG
;
prop
->
object_id
=
PROP_TAG
;
prop
->
size
=
50
;
prop
->
size
=
50
;
prop
->
object_version
=
0
;
prop
->
object_version
=
0
;
...
@@ -355,10 +355,10 @@ rmff_mdpr_t *rmff_new_mdpr(
...
@@ -355,10 +355,10 @@ rmff_mdpr_t *rmff_new_mdpr(
uint32_t
type_specific_len
,
uint32_t
type_specific_len
,
const
char
*
type_specific_data
)
{
const
char
*
type_specific_data
)
{
rmff_mdpr_t
*
mdpr
=
malloc
(
sizeof
(
rmff_mdpr_t
));
rmff_mdpr_t
*
mdpr
=
calloc
(
1
,
sizeof
(
rmff_mdpr_t
)
);
if
(
!
mdpr
)
return
NULL
;
if
(
!
mdpr
)
return
NULL
;
memset
(
mdpr
,
0
,
sizeof
(
rmff_mdpr_t
));
mdpr
->
object_id
=
MDPR_TAG
;
mdpr
->
object_id
=
MDPR_TAG
;
mdpr
->
object_version
=
0
;
mdpr
->
object_version
=
0
;
mdpr
->
stream_number
=
stream_number
;
mdpr
->
stream_number
=
stream_number
;
...
@@ -395,10 +395,10 @@ rmff_mdpr_t *rmff_new_mdpr(
...
@@ -395,10 +395,10 @@ rmff_mdpr_t *rmff_new_mdpr(
rmff_cont_t
*
rmff_new_cont
(
const
char
*
title
,
const
char
*
author
,
const
char
*
copyright
,
const
char
*
comment
)
{
rmff_cont_t
*
rmff_new_cont
(
const
char
*
title
,
const
char
*
author
,
const
char
*
copyright
,
const
char
*
comment
)
{
rmff_cont_t
*
cont
=
malloc
(
sizeof
(
rmff_cont_t
));
rmff_cont_t
*
cont
=
calloc
(
1
,
sizeof
(
rmff_cont_t
)
);
if
(
!
cont
)
return
NULL
;
if
(
!
cont
)
return
NULL
;
memset
(
cont
,
0
,
sizeof
(
rmff_cont_t
));
cont
->
object_id
=
CONT_TAG
;
cont
->
object_id
=
CONT_TAG
;
cont
->
object_version
=
0
;
cont
->
object_version
=
0
;
cont
->
title
=
NULL
;
cont
->
title
=
NULL
;
...
@@ -432,10 +432,10 @@ rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *co
...
@@ -432,10 +432,10 @@ rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *co
}
}
rmff_data_t
*
rmff_new_dataheader
(
uint32_t
num_packets
,
uint32_t
next_data_header
)
{
rmff_data_t
*
rmff_new_dataheader
(
uint32_t
num_packets
,
uint32_t
next_data_header
)
{
rmff_data_t
*
data
=
malloc
(
sizeof
(
rmff_data_t
));
rmff_data_t
*
data
=
calloc
(
1
,
sizeof
(
rmff_data_t
)
);
if
(
!
data
)
return
NULL
;
if
(
!
data
)
return
NULL
;
memset
(
data
,
0
,
sizeof
(
rmff_data_t
));
data
->
object_id
=
DATA_TAG
;
data
->
object_id
=
DATA_TAG
;
data
->
size
=
18
;
data
->
size
=
18
;
data
->
object_version
=
0
;
data
->
object_version
=
0
;
...
@@ -452,19 +452,22 @@ void rmff_print_header(rmff_header_t *h) {
...
@@ -452,19 +452,22 @@ void rmff_print_header(rmff_header_t *h) {
printf
(
"rmff_print_header: NULL given
\n
"
);
printf
(
"rmff_print_header: NULL given
\n
"
);
return
;
return
;
}
}
if
(
h
->
fileheader
)
{
if
(
h
->
fileheader
)
{
printf
(
"
\n
FILE:
\n
"
);
printf
(
"
\n
FILE:
\n
"
);
printf
(
"file version : %d
\n
"
,
h
->
fileheader
->
file_version
);
printf
(
"file version : %d
\n
"
,
h
->
fileheader
->
file_version
);
printf
(
"number of headers : %d
\n
"
,
h
->
fileheader
->
num_headers
);
printf
(
"number of headers : %d
\n
"
,
h
->
fileheader
->
num_headers
);
}
}
if
(
h
->
cont
)
{
if
(
h
->
cont
)
{
printf
(
"
\n
CONTENT:
\n
"
);
printf
(
"
\n
CONTENT:
\n
"
);
printf
(
"title : %s
\n
"
,
h
->
cont
->
title
);
printf
(
"title : %s
\n
"
,
h
->
cont
->
title
);
printf
(
"author : %s
\n
"
,
h
->
cont
->
author
);
printf
(
"author : %s
\n
"
,
h
->
cont
->
author
);
printf
(
"copyright : %s
\n
"
,
h
->
cont
->
copyright
);
printf
(
"copyright : %s
\n
"
,
h
->
cont
->
copyright
);
printf
(
"comment : %s
\n
"
,
h
->
cont
->
comment
);
printf
(
"comment : %s
\n
"
,
h
->
cont
->
comment
);
}
}
if
(
h
->
prop
)
{
if
(
h
->
prop
)
{
printf
(
"
\n
STREAM PROPERTIES:
\n
"
);
printf
(
"
\n
STREAM PROPERTIES:
\n
"
);
printf
(
"bit rate (max/avg) : %i/%i
\n
"
,
h
->
prop
->
max_bit_rate
,
h
->
prop
->
avg_bit_rate
);
printf
(
"bit rate (max/avg) : %i/%i
\n
"
,
h
->
prop
->
max_bit_rate
,
h
->
prop
->
avg_bit_rate
);
printf
(
"packet size (max/avg) : %i/%i bytes
\n
"
,
h
->
prop
->
max_packet_size
,
h
->
prop
->
avg_packet_size
);
printf
(
"packet size (max/avg) : %i/%i bytes
\n
"
,
h
->
prop
->
max_packet_size
,
h
->
prop
->
avg_packet_size
);
...
@@ -481,8 +484,10 @@ void rmff_print_header(rmff_header_t *h) {
...
@@ -481,8 +484,10 @@ void rmff_print_header(rmff_header_t *h) {
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
stream
=
h
->
streams
;
stream
=
h
->
streams
;
if
(
stream
)
{
if
(
stream
)
while
(
*
stream
)
{
{
while
(
*
stream
)
{
printf
(
"
\n
STREAM %i:
\n
"
,
(
*
stream
)
->
stream_number
);
printf
(
"
\n
STREAM %i:
\n
"
,
(
*
stream
)
->
stream_number
);
printf
(
"stream name [mime type] : %s [%s]
\n
"
,
(
*
stream
)
->
stream_name
,
(
*
stream
)
->
mime_type
);
printf
(
"stream name [mime type] : %s [%s]
\n
"
,
(
*
stream
)
->
stream_name
,
(
*
stream
)
->
mime_type
);
printf
(
"bit rate (max/avg) : %i/%i
\n
"
,
(
*
stream
)
->
max_bit_rate
,
(
*
stream
)
->
avg_bit_rate
);
printf
(
"bit rate (max/avg) : %i/%i
\n
"
,
(
*
stream
)
->
max_bit_rate
,
(
*
stream
)
->
avg_bit_rate
);
...
@@ -494,7 +499,8 @@ void rmff_print_header(rmff_header_t *h) {
...
@@ -494,7 +499,8 @@ void rmff_print_header(rmff_header_t *h) {
stream
++
;
stream
++
;
}
}
}
}
if
(
h
->
data
)
{
if
(
h
->
data
)
{
printf
(
"
\n
DATA:
\n
"
);
printf
(
"
\n
DATA:
\n
"
);
printf
(
"size : %i
\n
"
,
h
->
data
->
size
);
printf
(
"size : %i
\n
"
,
h
->
data
->
size
);
printf
(
"packets : %i
\n
"
,
h
->
data
->
num_packets
);
printf
(
"packets : %i
\n
"
,
h
->
data
->
num_packets
);
...
@@ -515,9 +521,11 @@ void rmff_fix_header(rmff_header_t *h) {
...
@@ -515,9 +521,11 @@ void rmff_fix_header(rmff_header_t *h) {
}
}
if
(
!
h
->
streams
)
{
if
(
!
h
->
streams
)
{
lprintf
(
"rmff_fix_header: warning: no MDPR chunks
\n
"
);
lprintf
(
"rmff_fix_header: warning: no MDPR chunks
\n
"
);
}
else
{
}
else
{
streams
=
h
->
streams
;
streams
=
h
->
streams
;
while
(
*
streams
)
{
while
(
*
streams
)
{
num_streams
++
;
num_streams
++
;
num_headers
++
;
num_headers
++
;
header_size
+=
(
*
streams
)
->
size
;
header_size
+=
(
*
streams
)
->
size
;
...
@@ -525,28 +533,32 @@ void rmff_fix_header(rmff_header_t *h) {
...
@@ -525,28 +533,32 @@ void rmff_fix_header(rmff_header_t *h) {
}
}
}
}
if
(
h
->
prop
)
{
if
(
h
->
prop
)
{
if
(
h
->
prop
->
size
!=
50
)
{
if
(
h
->
prop
->
size
!=
50
)
{
lprintf
(
"rmff_fix_header: correcting prop.size from %i to %i
\n
"
,
h
->
prop
->
size
,
50
);
lprintf
(
"rmff_fix_header: correcting prop.size from %i to %i
\n
"
,
h
->
prop
->
size
,
50
);
h
->
prop
->
size
=
50
;
h
->
prop
->
size
=
50
;
}
}
if
(
h
->
prop
->
num_streams
!=
num_streams
)
{
if
(
h
->
prop
->
num_streams
!=
num_streams
)
{
lprintf
(
"rmff_fix_header: correcting prop.num_streams from %i to %i
\n
"
,
h
->
prop
->
num_streams
,
num_streams
);
lprintf
(
"rmff_fix_header: correcting prop.num_streams from %i to %i
\n
"
,
h
->
prop
->
num_streams
,
num_streams
);
h
->
prop
->
num_streams
=
num_streams
;
h
->
prop
->
num_streams
=
num_streams
;
}
}
num_headers
++
;
num_headers
++
;
header_size
+=
50
;
header_size
+=
50
;
}
else
lprintf
(
"rmff_fix_header: warning: no PROP chunk.
\n
"
);
}
else
lprintf
(
"rmff_fix_header: warning: no PROP chunk.
\n
"
);
if
(
h
->
cont
)
{
if
(
h
->
cont
)
{
num_headers
++
;
num_headers
++
;
header_size
+=
h
->
cont
->
size
;
header_size
+=
h
->
cont
->
size
;
}
else
lprintf
(
"rmff_fix_header: warning: no CONT chunk.
\n
"
);
}
else
lprintf
(
"rmff_fix_header: warning: no CONT chunk.
\n
"
);
if
(
!
h
->
data
)
{
if
(
!
h
->
data
)
{
lprintf
(
"rmff_fix_header: no DATA chunk, creating one
\n
"
);
lprintf
(
"rmff_fix_header: no DATA chunk, creating one
\n
"
);
h
->
data
=
malloc
(
sizeof
(
rmff_data_t
)
);
h
->
data
=
calloc
(
1
,
sizeof
(
rmff_data_t
)
);
if
(
h
->
data
)
{
if
(
h
->
data
)
memset
(
h
->
data
,
0
,
sizeof
(
rmff_data_t
));
{
h
->
data
->
object_id
=
DATA_TAG
;
h
->
data
->
object_id
=
DATA_TAG
;
h
->
data
->
object_version
=
0
;
h
->
data
->
object_version
=
0
;
h
->
data
->
size
=
18
;
h
->
data
->
size
=
18
;
...
@@ -558,9 +570,9 @@ void rmff_fix_header(rmff_header_t *h) {
...
@@ -558,9 +570,9 @@ void rmff_fix_header(rmff_header_t *h) {
if
(
!
h
->
fileheader
)
{
if
(
!
h
->
fileheader
)
{
lprintf
(
"rmff_fix_header: no fileheader, creating one"
);
lprintf
(
"rmff_fix_header: no fileheader, creating one"
);
h
->
fileheader
=
malloc
(
sizeof
(
rmff_fileheader_t
)
);
h
->
fileheader
=
calloc
(
1
,
sizeof
(
rmff_fileheader_t
)
);
if
(
h
->
fileheader
)
{
if
(
h
->
fileheader
)
memset
(
h
->
fileheader
,
0
,
sizeof
(
rmff_fileheader_t
));
{
h
->
fileheader
->
object_id
=
RMF_TAG
;
h
->
fileheader
->
object_id
=
RMF_TAG
;
h
->
fileheader
->
size
=
18
;
h
->
fileheader
->
size
=
18
;
h
->
fileheader
->
object_version
=
0
;
h
->
fileheader
->
object_version
=
0
;
...
@@ -619,7 +631,8 @@ void rmff_free_header(rmff_header_t *h)
...
@@ -619,7 +631,8 @@ void rmff_free_header(rmff_header_t *h)
free
(
h
->
cont
->
comment
);
free
(
h
->
cont
->
comment
);
free
(
h
->
cont
);
free
(
h
->
cont
);
}
}
if
(
h
->
streams
)
{
if
(
h
->
streams
)
{
rmff_mdpr_t
**
s
=
h
->
streams
;
rmff_mdpr_t
**
s
=
h
->
streams
;
while
(
*
s
)
{
while
(
*
s
)
{
...
...
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