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
70fbfd75
Commit
70fbfd75
authored
May 24, 2013
by
Andrey Utkin
Committed by
Michael Niedermayer
May 25, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
img2dec: Add ts_from_file option
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
2c2e69b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
demuxers.texi
doc/demuxers.texi
+4
-0
img2dec.c
libavformat/img2dec.c
+16
-2
No files found.
doc/demuxers.texi
View file @
70fbfd75
...
...
@@ -210,6 +210,10 @@ to read from. Default value is 0.
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 ts_from_file
If set to 1, will set frame timestamp to modification time of image file. Note
that monotonity of timestamps is not provided: images go in the same order as
without this option. Default value is 0.
@item video_size
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.
...
...
libavformat/img2dec.c
View file @
70fbfd75
...
...
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/stat.h>
#include "libavutil/avstring.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
...
...
@@ -63,6 +64,7 @@ typedef struct {
int
start_number
;
int
start_number_range
;
int
frame_size
;
int
ts_from_file
;
}
VideoDemuxData
;
static
const
int
sizes
[][
2
]
=
{
...
...
@@ -223,7 +225,10 @@ static int img_read_header(AVFormatContext *s1)
st
->
need_parsing
=
AVSTREAM_PARSE_FULL
;
}
avpriv_set_pts_info
(
st
,
60
,
s
->
framerate
.
den
,
s
->
framerate
.
num
);
if
(
s
->
ts_from_file
)
avpriv_set_pts_info
(
st
,
60
,
1
,
1
);
else
avpriv_set_pts_info
(
st
,
60
,
s
->
framerate
.
den
,
s
->
framerate
.
num
);
if
(
s
->
width
&&
s
->
height
)
{
st
->
codec
->
width
=
s
->
width
;
...
...
@@ -381,8 +386,14 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
return
AVERROR
(
ENOMEM
);
pkt
->
stream_index
=
0
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
if
(
!
s
->
is_pipe
)
if
(
s
->
ts_from_file
)
{
struct
stat
img_stat
;
if
(
stat
(
filename
,
&
img_stat
))
return
AVERROR
(
EIO
);
pkt
->
pts
=
(
int64_t
)
img_stat
.
st_mtime
;
}
else
if
(
!
s
->
is_pipe
)
{
pkt
->
pts
=
s
->
pts
;
}
pkt
->
size
=
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
...
...
@@ -420,6 +431,8 @@ static int img_read_close(struct AVFormatContext* s1)
static
int
img_read_seek
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
timestamp
,
int
flags
)
{
VideoDemuxData
*
s1
=
s
->
priv_data
;
if
(
s1
->
ts_from_file
)
/* Seeking is not supported in this case */
return
AVERROR
(
ESPIPE
);
if
(
timestamp
<
0
||
!
s1
->
loop
&&
timestamp
>
s1
->
img_last
-
s1
->
img_first
)
return
-
1
;
...
...
@@ -444,6 +457,7 @@ static const AVOption options[] = {
{
"start_number_range"
,
"set range for looking at the first sequence number"
,
OFFSET
(
start_number_range
),
AV_OPT_TYPE_INT
,
{.
i64
=
5
},
1
,
INT_MAX
,
DEC
},
{
"video_size"
,
"set video size"
,
OFFSET
(
width
),
AV_OPT_TYPE_IMAGE_SIZE
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"frame_size"
,
"force frame size in bytes"
,
OFFSET
(
frame_size
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
DEC
},
{
"ts_from_file"
,
"set frame timestamp from file's one"
,
OFFSET
(
ts_from_file
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
DEC
},
{
NULL
},
};
...
...
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