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
06d8c9e5
Commit
06d8c9e5
authored
May 24, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tty: add video_size private option.
parent
973f686a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
tty.c
libavformat/tty.c
+23
-2
No files found.
libavformat/tty.c
View file @
06d8c9e5
...
...
@@ -28,6 +28,7 @@
#include "libavutil/avstring.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "avformat.h"
#include "sauce.h"
...
...
@@ -35,6 +36,7 @@ typedef struct {
AVClass
*
class
;
int
chars_per_frame
;
uint64_t
fsize
;
/**< file size less metadata buffer */
char
*
video_size
;
/**< A string describing video size, set by a private option. */
}
TtyDemuxContext
;
/**
...
...
@@ -71,14 +73,30 @@ static int read_header(AVFormatContext *avctx,
AVFormatParameters
*
ap
)
{
TtyDemuxContext
*
s
=
avctx
->
priv_data
;
int
width
=
0
,
height
=
0
,
ret
;
AVStream
*
st
=
av_new_stream
(
avctx
,
0
);
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
st
->
codec
->
codec_tag
=
0
;
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
st
->
codec
->
codec_id
=
CODEC_ID_ANSI
;
if
(
ap
->
width
)
st
->
codec
->
width
=
ap
->
width
;
if
(
ap
->
height
)
st
->
codec
->
height
=
ap
->
height
;
if
(
s
->
video_size
)
{
ret
=
av_parse_video_size
(
&
width
,
&
height
,
s
->
video_size
);
av_freep
(
&
s
->
video_size
);
if
(
ret
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Couldn't parse video size.
\n
"
);
return
ret
;
}
}
#if FF_API_FORMAT_PARAMETERS
if
(
ap
->
width
>
0
)
width
=
ap
->
width
;
if
(
ap
->
height
>
0
)
height
=
ap
->
height
;
#endif
st
->
codec
->
width
=
width
;
st
->
codec
->
height
=
height
;
if
(
!
ap
->
time_base
.
num
)
{
av_set_pts_info
(
st
,
60
,
1
,
25
);
...
...
@@ -129,8 +147,11 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
return
0
;
}
#define OFFSET(x) offsetof(TtyDemuxContext, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM
static
const
AVOption
options
[]
=
{
{
"chars_per_frame"
,
""
,
offsetof
(
TtyDemuxContext
,
chars_per_frame
),
FF_OPT_TYPE_INT
,
{.
dbl
=
6000
},
1
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"video_size"
,
"A string describing frame size, such as 640x480 or hd720."
,
OFFSET
(
video_size
),
FF_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
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