Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
95d312d6
Commit
95d312d6
authored
Sep 23, 2014
by
Gabriel Dume
Committed by
Diego Biurrun
Sep 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
concat: K&R formatting cosmetics
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
28f5cd31
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
concat.c
libavformat/concat.c
+15
-13
No files found.
libavformat/concat.c
View file @
95d312d6
...
@@ -21,9 +21,10 @@
...
@@ -21,9 +21,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include "avformat.h"
#include "libavutil/avstring.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "libavutil/mem.h"
#include "avformat.h"
#include "url.h"
#include "url.h"
#define AV_CAT_SEPARATOR "|"
#define AV_CAT_SEPARATOR "|"
...
@@ -59,24 +60,26 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
...
@@ -59,24 +60,26 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
char
*
node_uri
=
NULL
;
char
*
node_uri
=
NULL
;
int
err
=
0
;
int
err
=
0
;
int64_t
size
;
int64_t
size
;
size_t
len
,
i
;
size_t
len
,
i
;
URLContext
*
uc
;
URLContext
*
uc
;
struct
concat_data
*
data
=
h
->
priv_data
;
struct
concat_data
*
data
=
h
->
priv_data
;
struct
concat_nodes
*
nodes
;
struct
concat_nodes
*
nodes
;
av_strstart
(
uri
,
"concat:"
,
&
uri
);
av_strstart
(
uri
,
"concat:"
,
&
uri
);
for
(
i
=
0
,
len
=
1
;
uri
[
i
];
i
++
)
for
(
i
=
0
,
len
=
1
;
uri
[
i
];
i
++
)
{
if
(
uri
[
i
]
==
*
AV_CAT_SEPARATOR
)
if
(
uri
[
i
]
==
*
AV_CAT_SEPARATOR
)
{
/* integer overflow */
/* integer overflow */
if
(
++
len
==
UINT_MAX
/
sizeof
(
*
nodes
))
{
if
(
++
len
==
UINT_MAX
/
sizeof
(
*
nodes
))
{
av_freep
(
&
h
->
priv_data
);
av_freep
(
&
h
->
priv_data
);
return
AVERROR
(
ENAMETOOLONG
);
return
AVERROR
(
ENAMETOOLONG
);
}
}
}
}
if
(
!
(
nodes
=
av_realloc
(
NULL
,
sizeof
(
*
nodes
)
*
len
)))
{
if
(
!
(
nodes
=
av_realloc
(
NULL
,
sizeof
(
*
nodes
)
*
len
)))
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
else
else
data
->
nodes
=
nodes
;
data
->
nodes
=
nodes
;
/* handle input */
/* handle input */
...
@@ -87,8 +90,8 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
...
@@ -87,8 +90,8 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
len
=
strcspn
(
uri
,
AV_CAT_SEPARATOR
);
len
=
strcspn
(
uri
,
AV_CAT_SEPARATOR
);
if
((
err
=
av_reallocp
(
&
node_uri
,
len
+
1
))
<
0
)
if
((
err
=
av_reallocp
(
&
node_uri
,
len
+
1
))
<
0
)
break
;
break
;
av_strlcpy
(
node_uri
,
uri
,
len
+
1
);
av_strlcpy
(
node_uri
,
uri
,
len
+
1
);
uri
+=
len
+
strspn
(
uri
+
len
,
AV_CAT_SEPARATOR
);
uri
+=
len
+
strspn
(
uri
+
len
,
AV_CAT_SEPARATOR
);
/* creating URLContext */
/* creating URLContext */
if
((
err
=
ffurl_open
(
&
uc
,
node_uri
,
flags
,
if
((
err
=
ffurl_open
(
&
uc
,
node_uri
,
flags
,
...
@@ -123,16 +126,17 @@ static int concat_read(URLContext *h, unsigned char *buf, int size)
...
@@ -123,16 +126,17 @@ static int concat_read(URLContext *h, unsigned char *buf, int size)
int
result
,
total
=
0
;
int
result
,
total
=
0
;
struct
concat_data
*
data
=
h
->
priv_data
;
struct
concat_data
*
data
=
h
->
priv_data
;
struct
concat_nodes
*
nodes
=
data
->
nodes
;
struct
concat_nodes
*
nodes
=
data
->
nodes
;
size_t
i
=
data
->
current
;
size_t
i
=
data
->
current
;
while
(
size
>
0
)
{
while
(
size
>
0
)
{
result
=
ffurl_read
(
nodes
[
i
].
uc
,
buf
,
size
);
result
=
ffurl_read
(
nodes
[
i
].
uc
,
buf
,
size
);
if
(
result
<
0
)
if
(
result
<
0
)
return
total
?
total
:
result
;
return
total
?
total
:
result
;
if
(
!
result
)
if
(
!
result
)
{
if
(
i
+
1
==
data
->
length
||
if
(
i
+
1
==
data
->
length
||
ffurl_seek
(
nodes
[
++
i
].
uc
,
0
,
SEEK_SET
)
<
0
)
ffurl_seek
(
nodes
[
++
i
].
uc
,
0
,
SEEK_SET
)
<
0
)
break
;
break
;
}
total
+=
result
;
total
+=
result
;
buf
+=
result
;
buf
+=
result
;
size
-=
result
;
size
-=
result
;
...
@@ -150,9 +154,7 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
...
@@ -150,9 +154,7 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
switch
(
whence
)
{
switch
(
whence
)
{
case
SEEK_END
:
case
SEEK_END
:
for
(
i
=
data
->
length
-
1
;
for
(
i
=
data
->
length
-
1
;
i
&&
pos
<
-
nodes
[
i
].
size
;
i
--
)
i
&&
pos
<
-
nodes
[
i
].
size
;
i
--
)
pos
+=
nodes
[
i
].
size
;
pos
+=
nodes
[
i
].
size
;
break
;
break
;
case
SEEK_CUR
:
case
SEEK_CUR
:
...
...
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