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
973f686a
Commit
973f686a
authored
May 24, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rawdec: add video_size private option.
parent
724a900c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
4 deletions
+45
-4
rawdec.c
libavformat/rawdec.c
+37
-3
rawdec.h
libavformat/rawdec.h
+6
-0
rawvideodec.c
libavformat/rawvideodec.c
+2
-1
No files found.
libavformat/rawdec.c
View file @
973f686a
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "avio_internal.h"
#include "avio_internal.h"
#include "rawdec.h"
#include "rawdec.h"
#include "libavutil/opt.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
/* raw input */
/* raw input */
int
ff_raw_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
)
int
ff_raw_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
)
...
@@ -66,17 +67,34 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -66,17 +67,34 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
av_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
break
;
break
;
}
}
case
AVMEDIA_TYPE_VIDEO
:
case
AVMEDIA_TYPE_VIDEO
:
{
FFRawVideoDemuxerContext
*
s1
=
s
->
priv_data
;
int
width
=
0
,
height
=
0
,
ret
;
if
(
ap
->
time_base
.
num
)
if
(
ap
->
time_base
.
num
)
av_set_pts_info
(
st
,
64
,
ap
->
time_base
.
num
,
ap
->
time_base
.
den
);
av_set_pts_info
(
st
,
64
,
ap
->
time_base
.
num
,
ap
->
time_base
.
den
);
else
else
av_set_pts_info
(
st
,
64
,
1
,
25
);
av_set_pts_info
(
st
,
64
,
1
,
25
);
st
->
codec
->
width
=
ap
->
width
;
if
(
s1
->
video_size
)
{
st
->
codec
->
height
=
ap
->
height
;
ret
=
av_parse_video_size
(
&
width
,
&
height
,
s1
->
video_size
);
av_freep
(
&
s1
->
video_size
);
if
(
ret
<
0
)
{
av_log
(
s
,
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
;
st
->
codec
->
pix_fmt
=
ap
->
pix_fmt
;
st
->
codec
->
pix_fmt
=
ap
->
pix_fmt
;
if
(
st
->
codec
->
pix_fmt
==
PIX_FMT_NONE
)
if
(
st
->
codec
->
pix_fmt
==
PIX_FMT_NONE
)
st
->
codec
->
pix_fmt
=
PIX_FMT_YUV420P
;
st
->
codec
->
pix_fmt
=
PIX_FMT_YUV420P
;
break
;
break
;
}
default:
default:
return
-
1
;
return
-
1
;
}
}
...
@@ -165,6 +183,22 @@ const AVClass ff_rawaudio_demuxer_class = {
...
@@ -165,6 +183,22 @@ const AVClass ff_rawaudio_demuxer_class = {
.
version
=
LIBAVUTIL_VERSION_INT
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
};
#define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM
static
const
AVOption
video_options
[]
=
{
{
"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
},
};
#undef OFFSET
#undef DEC
const
AVClass
ff_rawvideo_demuxer_class
=
{
.
class_name
=
"rawvideo demuxer"
,
.
item_name
=
av_default_item_name
,
.
option
=
video_options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
#if CONFIG_G722_DEMUXER
#if CONFIG_G722_DEMUXER
AVInputFormat
ff_g722_demuxer
=
{
AVInputFormat
ff_g722_demuxer
=
{
"g722"
,
"g722"
,
...
...
libavformat/rawdec.h
View file @
973f686a
...
@@ -31,7 +31,13 @@ typedef struct RawAudioDemuxerContext {
...
@@ -31,7 +31,13 @@ typedef struct RawAudioDemuxerContext {
int
channels
;
int
channels
;
}
RawAudioDemuxerContext
;
}
RawAudioDemuxerContext
;
typedef
struct
FFRawVideoDemuxerContext
{
const
AVClass
*
class
;
/**< Class for private options. */
char
*
video_size
;
/**< String describing video size, set by a private option. */
}
FFRawVideoDemuxerContext
;
extern
const
AVClass
ff_rawaudio_demuxer_class
;
extern
const
AVClass
ff_rawaudio_demuxer_class
;
extern
const
AVClass
ff_rawvideo_demuxer_class
;
int
ff_raw_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
);
int
ff_raw_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
);
...
...
libavformat/rawvideodec.c
View file @
973f686a
...
@@ -47,11 +47,12 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -47,11 +47,12 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat
ff_rawvideo_demuxer
=
{
AVInputFormat
ff_rawvideo_demuxer
=
{
"rawvideo"
,
"rawvideo"
,
NULL_IF_CONFIG_SMALL
(
"raw video format"
),
NULL_IF_CONFIG_SMALL
(
"raw video format"
),
0
,
sizeof
(
FFRawVideoDemuxerContext
)
,
NULL
,
NULL
,
ff_raw_read_header
,
ff_raw_read_header
,
rawvideo_read_packet
,
rawvideo_read_packet
,
.
flags
=
AVFMT_GENERIC_INDEX
,
.
flags
=
AVFMT_GENERIC_INDEX
,
.
extensions
=
"yuv,cif,qcif,rgb"
,
.
extensions
=
"yuv,cif,qcif,rgb"
,
.
value
=
CODEC_ID_RAWVIDEO
,
.
value
=
CODEC_ID_RAWVIDEO
,
.
priv_class
=
&
ff_rawvideo_demuxer_class
,
};
};
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