repositories
/
deb_ffmpeg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Debian version 2.5.0~trusty1.1
[deb_ffmpeg.git]
/
ffmpeg
/
libavformat
/
concat.c
diff --git
a/ffmpeg/libavformat/concat.c
b/ffmpeg/libavformat/concat.c
index 3bbc83dfef16b629264c975dad4c28a37cee002d..81fe97082c432e8cdd758d1263af50427fa81695 100644
(file)
--- a/
ffmpeg/libavformat/concat.c
+++ b/
ffmpeg/libavformat/concat.c
@@
-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/mem.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
+
+#include "avformat.h"
#include "url.h"
#define AV_CAT_SEPARATOR "|"
#include "url.h"
#define AV_CAT_SEPARATOR "|"
@@
-59,24
+60,26
@@
static av_cold int concat_open(URLContext *h, const char *uri, int flags)
char *node_uri = NULL;
int err = 0;
int64_t size;
char *node_uri = NULL;
int err = 0;
int64_t size;
- size_t
len, i;
+ size_t len, i;
URLContext *uc;
struct concat_data *data = h->priv_data;
struct concat_nodes *nodes;
av_strstart(uri, "concat:", &uri);
URLContext *uc;
struct concat_data *data = h->priv_data;
struct concat_nodes *nodes;
av_strstart(uri, "concat:", &uri);
- for (i = 0, len = 1; uri[i]; i++)
- if (uri[i] == *AV_CAT_SEPARATOR)
+ for (i = 0, len = 1; uri[i]; i++)
{
+ if (uri[i] == *AV_CAT_SEPARATOR)
{
/* integer overflow */
if (++len == UINT_MAX / sizeof(*nodes)) {
av_freep(&h->priv_data);
return AVERROR(ENAMETOOLONG);
}
/* integer overflow */
if (++len == UINT_MAX / sizeof(*nodes)) {
av_freep(&h->priv_data);
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;
/* handle input */
data->nodes = nodes;
/* handle input */
@@
-87,8
+90,8
@@
static av_cold int concat_open(URLContext *h, const char *uri, int flags)
len = strcspn(uri, AV_CAT_SEPARATOR);
if ((err = av_reallocp(&node_uri, len + 1)) < 0)
break;
len = strcspn(uri, AV_CAT_SEPARATOR);
if ((err = av_reallocp(&node_uri, len + 1)) < 0)
break;
- av_strlcpy(node_uri, uri, len
+
1);
- uri += len + strspn(uri
+
len, AV_CAT_SEPARATOR);
+ av_strlcpy(node_uri, uri, len
+
1);
+ uri += len + strspn(uri
+
len, AV_CAT_SEPARATOR);
/* creating URLContext */
if ((err = ffurl_open(&uc, node_uri, flags,
/* creating URLContext */
if ((err = ffurl_open(&uc, node_uri, flags,
@@
-124,16
+127,17
@@
static int concat_read(URLContext *h, unsigned char *buf, int size)
int result, total = 0;
struct concat_data *data = h->priv_data;
struct concat_nodes *nodes = data->nodes;
int result, total = 0;
struct concat_data *data = h->priv_data;
struct concat_nodes *nodes = data->nodes;
- size_t i = data->current;
+ size_t i
= data->current;
while (size > 0) {
result = ffurl_read(nodes[i].uc, buf, size);
if (result < 0)
return total ? total : result;
while (size > 0) {
result = ffurl_read(nodes[i].uc, buf, size);
if (result < 0)
return total ? total : result;
- if (!result)
+ if (!result)
{
if (i + 1 == data->length ||
ffurl_seek(nodes[++i].uc, 0, SEEK_SET) < 0)
break;
if (i + 1 == data->length ||
ffurl_seek(nodes[++i].uc, 0, SEEK_SET) < 0)
break;
+ }
total += result;
buf += result;
size -= result;
total += result;
buf += result;
size -= result;
@@
-151,9
+155,7
@@
static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
switch (whence) {
case SEEK_END:
switch (whence) {
case SEEK_END:
- for (i = data->length - 1;
- i && pos < -nodes[i].size;
- i--)
+ for (i = data->length - 1; i && pos < -nodes[i].size; i--)
pos += nodes[i].size;
break;
case SEEK_CUR:
pos += nodes[i].size;
break;
case SEEK_CUR: