Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
275a5d4a
Commit
275a5d4a
authored
Mar 06, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ASF: thread-safe pseudo-random numbers
parent
6268a229
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
18 deletions
+8
-18
modules/access/mms/asf.c
modules/access/mms/asf.c
+4
-11
modules/mux/asf.c
modules/mux/asf.c
+4
-7
No files found.
modules/access/mms/asf.c
View file @
275a5d4a
...
...
@@ -26,6 +26,7 @@
#endif
#include <vlc_common.h>
#include <vlc_rand.h>
#include "asf.h"
#include "buffer.h"
...
...
@@ -47,18 +48,10 @@ static int CmpGuid( const guid_t *p_guid1, const guid_t *p_guid2 )
void
GenerateGuid
(
guid_t
*
p_guid
)
{
int
i
;
srand
(
mdate
()
&
0xffffffff
);
/* FIXME should be generated using random data */
p_guid
->
v1
=
0xbabac001
;
p_guid
->
v2
=
(
(
uint64_t
)
rand
()
<<
16
)
/
RAND_MAX
;
p_guid
->
v3
=
(
(
uint64_t
)
rand
()
<<
16
)
/
RAND_MAX
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
p_guid
->
v4
[
i
]
=
(
(
uint64_t
)
rand
()
*
256
)
/
RAND_MAX
;
}
vlc_rand_bytes
(
&
p_guid
->
v2
,
sizeof
(
p_guid
->
v2
));
vlc_rand_bytes
(
&
p_guid
->
v3
,
sizeof
(
p_guid
->
v3
));
vlc_rand_bytes
(
p_guid
->
v4
,
sizeof
(
p_guid
->
v4
));
}
void
asf_HeaderParse
(
asf_header_t
*
hdr
,
...
...
modules/mux/asf.c
View file @
275a5d4a
...
...
@@ -38,6 +38,7 @@
#include <vlc_block.h>
#include <vlc_codecs.h>
#include <vlc_arrays.h>
#include <vlc_rand.h>
typedef
GUID
guid_t
;
...
...
@@ -228,14 +229,10 @@ static int Open( vlc_object_t *p_this )
p_sys
->
i_packet_count
=
0
;
/* Generate a random fid */
srand
(
mdate
()
&
0xffffffff
);
p_sys
->
fid
.
Data1
=
0xbabac001
;
p_sys
->
fid
.
Data2
=
(
(
uint64_t
)
rand
()
<<
16
)
/
RAND_MAX
;
p_sys
->
fid
.
Data3
=
(
(
uint64_t
)
rand
()
<<
16
)
/
RAND_MAX
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
p_sys
->
fid
.
Data4
[
i
]
=
(
(
uint64_t
)
rand
()
<<
8
)
/
RAND_MAX
;
}
vlc_rand_bytes
(
&
p_sys
->
fid
.
Data2
,
sizeof
(
p_sys
->
fid
.
Data2
));
vlc_rand_bytes
(
&
p_sys
->
fid
.
Data3
,
sizeof
(
p_sys
->
fid
.
Data3
));
vlc_rand_bytes
(
p_sys
->
fid
.
Data4
,
sizeof
(
p_sys
->
fid
.
Data4
));
/* Meta data */
p_sys
->
psz_title
=
var_GetString
(
p_mux
,
SOUT_CFG_PREFIX
"title"
);
...
...
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