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
3d9a789b
Commit
3d9a789b
authored
Apr 05, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bintext: make use of AV_OPT_TYPE_IMAGE_SIZE
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
33b6d215
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
bintext.c
libavformat/bintext.c
+6
-11
No files found.
libavformat/bintext.c
View file @
3d9a789b
...
@@ -43,7 +43,7 @@ typedef struct {
...
@@ -43,7 +43,7 @@ typedef struct {
int
chars_per_frame
;
/**< characters to send decoder per frame;
int
chars_per_frame
;
/**< characters to send decoder per frame;
set by private options as characters per second, and then
set by private options as characters per second, and then
converted to characters per frame at runtime */
converted to characters per frame at runtime */
char
*
video_size
;
/**< video size (WxH pixels) (private option) */
int
width
,
height
;
/**< video size (WxH pixels) (private option) */
AVRational
framerate
;
/**< frames per second (private option) */
AVRational
framerate
;
/**< frames per second (private option) */
uint64_t
fsize
;
/**< file size less metadata buffer */
uint64_t
fsize
;
/**< file size less metadata buffer */
}
BinDemuxContext
;
}
BinDemuxContext
;
...
@@ -57,12 +57,7 @@ static AVStream * init_stream(AVFormatContext *s)
...
@@ -57,12 +57,7 @@ static AVStream * init_stream(AVFormatContext *s)
st
->
codec
->
codec_tag
=
0
;
st
->
codec
->
codec_tag
=
0
;
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
if
(
bin
->
video_size
)
{
if
(
!
bin
->
width
)
{
if
(
av_parse_video_size
(
&
st
->
codec
->
width
,
&
st
->
codec
->
height
,
bin
->
video_size
)
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Could not parse video size: '%s'
\n
"
,
bin
->
video_size
);
return
NULL
;
}
}
else
{
st
->
codec
->
width
=
(
80
<<
3
);
st
->
codec
->
width
=
(
80
<<
3
);
st
->
codec
->
height
=
(
25
<<
4
);
st
->
codec
->
height
=
(
25
<<
4
);
}
}
...
@@ -153,7 +148,7 @@ static int bintext_read_header(AVFormatContext *s)
...
@@ -153,7 +148,7 @@ static int bintext_read_header(AVFormatContext *s)
bin
->
fsize
=
avio_size
(
pb
);
bin
->
fsize
=
avio_size
(
pb
);
if
(
ff_sauce_read
(
s
,
&
bin
->
fsize
,
&
got_width
,
0
)
<
0
)
if
(
ff_sauce_read
(
s
,
&
bin
->
fsize
,
&
got_width
,
0
)
<
0
)
next_tag_read
(
s
,
&
bin
->
fsize
);
next_tag_read
(
s
,
&
bin
->
fsize
);
if
(
!
bin
->
video_size
)
{
if
(
!
bin
->
width
)
{
predict_width
(
st
->
codec
,
bin
->
fsize
,
got_width
);
predict_width
(
st
->
codec
,
bin
->
fsize
,
got_width
);
calculate_height
(
st
->
codec
,
bin
->
fsize
);
calculate_height
(
st
->
codec
,
bin
->
fsize
);
}
}
...
@@ -252,7 +247,7 @@ static int adf_read_header(AVFormatContext *s)
...
@@ -252,7 +247,7 @@ static int adf_read_header(AVFormatContext *s)
bin
->
fsize
=
avio_size
(
pb
)
-
1
-
192
-
4096
;
bin
->
fsize
=
avio_size
(
pb
)
-
1
-
192
-
4096
;
st
->
codec
->
width
=
80
<<
3
;
st
->
codec
->
width
=
80
<<
3
;
ff_sauce_read
(
s
,
&
bin
->
fsize
,
&
got_width
,
0
);
ff_sauce_read
(
s
,
&
bin
->
fsize
,
&
got_width
,
0
);
if
(
!
bin
->
video_size
)
if
(
!
bin
->
width
)
calculate_height
(
st
->
codec
,
bin
->
fsize
);
calculate_height
(
st
->
codec
,
bin
->
fsize
);
avio_seek
(
pb
,
1
+
192
+
4096
,
SEEK_SET
);
avio_seek
(
pb
,
1
+
192
+
4096
,
SEEK_SET
);
}
}
...
@@ -305,7 +300,7 @@ static int idf_read_header(AVFormatContext *s)
...
@@ -305,7 +300,7 @@ static int idf_read_header(AVFormatContext *s)
bin
->
fsize
=
avio_size
(
pb
)
-
12
-
4096
-
48
;
bin
->
fsize
=
avio_size
(
pb
)
-
12
-
4096
-
48
;
ff_sauce_read
(
s
,
&
bin
->
fsize
,
&
got_width
,
0
);
ff_sauce_read
(
s
,
&
bin
->
fsize
,
&
got_width
,
0
);
if
(
!
bin
->
video_size
)
if
(
!
bin
->
width
)
calculate_height
(
st
->
codec
,
bin
->
fsize
);
calculate_height
(
st
->
codec
,
bin
->
fsize
);
avio_seek
(
pb
,
12
,
SEEK_SET
);
avio_seek
(
pb
,
12
,
SEEK_SET
);
return
0
;
return
0
;
...
@@ -337,7 +332,7 @@ static int read_packet(AVFormatContext *s,
...
@@ -337,7 +332,7 @@ static int read_packet(AVFormatContext *s,
#define OFFSET(x) offsetof(BinDemuxContext, x)
#define OFFSET(x) offsetof(BinDemuxContext, x)
static
const
AVOption
options
[]
=
{
static
const
AVOption
options
[]
=
{
{
"linespeed"
,
"set simulated line speed (bytes per second)"
,
OFFSET
(
chars_per_frame
),
AV_OPT_TYPE_INT
,
{.
i64
=
6000
},
1
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"linespeed"
,
"set simulated line speed (bytes per second)"
,
OFFSET
(
chars_per_frame
),
AV_OPT_TYPE_INT
,
{.
i64
=
6000
},
1
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"video_size"
,
"set video size, such as 640x480 or hd720."
,
OFFSET
(
video_size
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"video_size"
,
"set video size, such as 640x480 or hd720."
,
OFFSET
(
width
),
AV_OPT_TYPE_IMAGE_SIZE
,
{.
str
=
NULL
},
0
,
0
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"framerate"
,
"set framerate (frames per second)"
,
OFFSET
(
framerate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
0
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"framerate"
,
"set framerate (frames per second)"
,
OFFSET
(
framerate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
0
,
AV_OPT_FLAG_DECODING_PARAM
},
{
NULL
},
{
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