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
e99c4bbd
Commit
e99c4bbd
authored
Nov 27, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
img2: update first file only when -updatefirst is specified
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
b7c7eae7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
img2.c
libavformat/img2.c
+20
-5
No files found.
libavformat/img2.c
View file @
e99c4bbd
...
...
@@ -43,6 +43,7 @@ typedef struct {
char
*
video_size
;
/**< Set by a private option. */
char
*
framerate
;
/**< Set by a private option. */
int
loop
;
int
updatefirst
;
}
VideoData
;
typedef
struct
{
...
...
@@ -391,10 +392,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
if
(
!
img
->
is_pipe
)
{
if
(
av_get_frame_filename
(
filename
,
sizeof
(
filename
),
img
->
path
,
img
->
img_number
)
<
0
&&
img
->
img_number
==
2
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"Writing multiple frames to the same file, check the pattern '%s' if this is not what you want
\n
"
,
img
->
path
);
img
->
path
,
img
->
img_number
)
<
0
&&
img
->
img_number
>
1
&&
!
img
->
updatefirst
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Could not get frame filename number %d from pattern '%s'
\n
"
,
img
->
img_number
,
img
->
path
);
return
AVERROR
(
EINVAL
);
}
for
(
i
=
0
;
i
<
3
;
i
++
){
if
(
avio_open2
(
&
pb
[
i
],
filename
,
AVIO_FLAG_WRITE
,
...
...
@@ -461,6 +463,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
#define OFFSET(x) offsetof(VideoData, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static
const
AVOption
options
[]
=
{
{
"pixel_format"
,
""
,
OFFSET
(
pixel_format
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"video_size"
,
""
,
OFFSET
(
video_size
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
...
...
@@ -469,6 +472,11 @@ static const AVOption options[] = {
{
NULL
},
};
static
const
AVOption
muxoptions
[]
=
{
{
"updatefirst"
,
""
,
OFFSET
(
updatefirst
),
AV_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
1
,
ENC
},
{
NULL
},
};
/* input */
#if CONFIG_IMAGE2_DEMUXER
static
const
AVClass
img2_class
=
{
...
...
@@ -507,6 +515,12 @@ AVInputFormat ff_image2pipe_demuxer = {
/* output */
#if CONFIG_IMAGE2_MUXER
static
const
AVClass
img2mux_class
=
{
.
class_name
=
"image2 muxer"
,
.
item_name
=
av_default_item_name
,
.
option
=
muxoptions
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
AVOutputFormat
ff_image2_muxer
=
{
.
name
=
"image2"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"image2 sequence"
),
...
...
@@ -516,7 +530,8 @@ AVOutputFormat ff_image2_muxer = {
.
video_codec
=
CODEC_ID_MJPEG
,
.
write_header
=
write_header
,
.
write_packet
=
write_packet
,
.
flags
=
AVFMT_NOTIMESTAMPS
|
AVFMT_NODIMENSIONS
|
AVFMT_NOFILE
.
flags
=
AVFMT_NOTIMESTAMPS
|
AVFMT_NODIMENSIONS
|
AVFMT_NOFILE
,
.
priv_class
=
&
img2mux_class
,
};
#endif
#if CONFIG_IMAGE2PIPE_MUXER
...
...
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