Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
9bece760
Commit
9bece760
authored
Aug 05, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/img2dec: add start_number_range option
parent
b9076553
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
10 deletions
+14
-10
demuxers.texi
doc/demuxers.texi
+6
-2
img2dec.c
libavformat/img2dec.c
+7
-7
version.h
libavformat/version.h
+1
-1
No files found.
doc/demuxers.texi
View file @
9bece760
...
@@ -35,8 +35,8 @@ specified in the pattern with the string "%%".
...
@@ -35,8 +35,8 @@ specified in the pattern with the string "%%".
If the pattern contains "%d" or "%0@var{N}d", the first filename of
If the pattern contains "%d" or "%0@var{N}d", the first filename of
the file list specified by the pattern must contain a number
the file list specified by the pattern must contain a number
inclusively contained between @var{start_number} and
inclusively contained between @var{start_number} and
@var{start_number}+
4, and all the following numbers must be
@var{start_number}+
@var{start_number_range}-1, and all the following
sequential.
numbers must be
sequential.
The pattern may contain a suffix which is used to automatically
The pattern may contain a suffix which is used to automatically
determine the format of the images contained in the files.
determine the format of the images contained in the files.
...
@@ -62,6 +62,10 @@ format is guessed from the first image file in the sequence.
...
@@ -62,6 +62,10 @@ format is guessed from the first image file in the sequence.
@item start_number
@item start_number
Set the index of the file matched by the image file pattern to start
Set the index of the file matched by the image file pattern to start
to read from. Default value is 0.
to read from. Default value is 0.
@item start_number_range
Set the index interval range to check when looking for the first image
file in the sequence, starting from @var{start_number}. Default value
is 5.
@item video_size
@item video_size
Set the video size of the images to read. If not specified the video
Set the video size of the images to read. If not specified the video
size is guessed from the first image file in the sequence.
size is guessed from the first image file in the sequence.
...
...
libavformat/img2dec.c
View file @
9bece760
...
@@ -59,6 +59,7 @@ typedef struct {
...
@@ -59,6 +59,7 @@ typedef struct {
glob_t
globstate
;
glob_t
globstate
;
#endif
#endif
int
start_number
;
int
start_number
;
int
start_number_range
;
}
VideoDemuxData
;
}
VideoDemuxData
;
static
const
int
sizes
[][
2
]
=
{
static
const
int
sizes
[][
2
]
=
{
...
@@ -108,8 +109,6 @@ static int is_glob(const char *path)
...
@@ -108,8 +109,6 @@ static int is_glob(const char *path)
#endif
#endif
}
}
#define FIRST_INDEX_SEARCH_RANGE 5
/**
/**
* Get index range of image files matched by path.
* Get index range of image files matched by path.
*
*
...
@@ -120,13 +119,13 @@ static int is_glob(const char *path)
...
@@ -120,13 +119,13 @@ static int is_glob(const char *path)
* @return -1 if no image file could be found
* @return -1 if no image file could be found
*/
*/
static
int
find_image_range
(
int
*
pfirst_index
,
int
*
plast_index
,
static
int
find_image_range
(
int
*
pfirst_index
,
int
*
plast_index
,
const
char
*
path
,
int
start_index
)
const
char
*
path
,
int
start_index
,
int
start_index_range
)
{
{
char
buf
[
1024
];
char
buf
[
1024
];
int
range
,
last_index
,
range1
,
first_index
;
int
range
,
last_index
,
range1
,
first_index
;
/* find the first image */
/* find the first image */
for
(
first_index
=
start_index
;
first_index
<
start_index
+
FIRST_INDEX_SEARCH_RANGE
;
first_index
++
)
{
for
(
first_index
=
start_index
;
first_index
<
start_index
+
start_index_range
;
first_index
++
)
{
if
(
av_get_frame_filename
(
buf
,
sizeof
(
buf
),
path
,
first_index
)
<
0
){
if
(
av_get_frame_filename
(
buf
,
sizeof
(
buf
),
path
,
first_index
)
<
0
){
*
pfirst_index
=
*
pfirst_index
=
*
plast_index
=
1
;
*
plast_index
=
1
;
...
@@ -137,7 +136,7 @@ static int find_image_range(int *pfirst_index, int *plast_index,
...
@@ -137,7 +136,7 @@ static int find_image_range(int *pfirst_index, int *plast_index,
if
(
avio_check
(
buf
,
AVIO_FLAG_READ
)
>
0
)
if
(
avio_check
(
buf
,
AVIO_FLAG_READ
)
>
0
)
break
;
break
;
}
}
if
(
first_index
==
start_index
+
FIRST_INDEX_SEARCH_RANGE
)
if
(
first_index
==
start_index
+
start_index_range
)
goto
fail
;
goto
fail
;
/* find the last image */
/* find the last image */
...
@@ -263,10 +262,10 @@ static int read_header(AVFormatContext *s1)
...
@@ -263,10 +262,10 @@ static int read_header(AVFormatContext *s1)
#endif
#endif
}
else
{
}
else
{
if
(
find_image_range
(
&
first_index
,
&
last_index
,
s
->
path
,
if
(
find_image_range
(
&
first_index
,
&
last_index
,
s
->
path
,
s
->
start_number
)
<
0
)
{
s
->
start_number
,
s
->
start_number_range
)
<
0
)
{
av_log
(
s1
,
AV_LOG_ERROR
,
av_log
(
s1
,
AV_LOG_ERROR
,
"Could find no file with with path '%s' and index in the range %d-%d
\n
"
,
"Could find no file with with path '%s' and index in the range %d-%d
\n
"
,
s
->
path
,
s
->
start_number
,
s
->
start_number
+
FIRST_INDEX_SEARCH_RANGE
-
1
);
s
->
path
,
s
->
start_number
,
s
->
start_number
+
s
->
start_number_range
-
1
);
return
AVERROR
(
ENOENT
);
return
AVERROR
(
ENOENT
);
}
}
}
}
...
@@ -391,6 +390,7 @@ static const AVOption options[] = {
...
@@ -391,6 +390,7 @@ static const AVOption options[] = {
{
"loop"
,
"force loop over input file sequence"
,
OFFSET
(
loop
),
AV_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
1
,
DEC
},
{
"loop"
,
"force loop over input file sequence"
,
OFFSET
(
loop
),
AV_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
1
,
DEC
},
{
"pixel_format"
,
"set video pixel format"
,
OFFSET
(
pixel_format
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"pixel_format"
,
"set video pixel format"
,
OFFSET
(
pixel_format
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"start_number"
,
"set first number in the sequence"
,
OFFSET
(
start_number
),
AV_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
INT_MAX
,
DEC
},
{
"start_number"
,
"set first number in the sequence"
,
OFFSET
(
start_number
),
AV_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
INT_MAX
,
DEC
},
{
"start_number_range"
,
"set range for looking at the first sequence number"
,
OFFSET
(
start_number_range
),
AV_OPT_TYPE_INT
,
{.
dbl
=
5
},
1
,
INT_MAX
,
DEC
},
{
"video_size"
,
"set video size"
,
OFFSET
(
video_size
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"video_size"
,
"set video size"
,
OFFSET
(
video_size
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
NULL
},
{
NULL
},
};
};
...
...
libavformat/version.h
View file @
9bece760
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 22
#define LIBAVFORMAT_VERSION_MINOR 22
#define LIBAVFORMAT_VERSION_MICRO 10
0
#define LIBAVFORMAT_VERSION_MICRO 10
1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
LIBAVFORMAT_VERSION_MINOR, \
...
...
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