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
ab05ed4c
Commit
ab05ed4c
authored
Jul 06, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo_parser: export pixel format and dimensions
parent
9f4c7397
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
mpegvideo_parser.c
libavcodec/mpegvideo_parser.c
+17
-0
No files found.
libavcodec/mpegvideo_parser.c
View file @
ab05ed4c
...
...
@@ -44,6 +44,8 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
int
top_field_first
,
repeat_first_field
,
progressive_frame
;
int
horiz_size_ext
,
vert_size_ext
,
bit_rate_ext
;
int
did_set_size
=
0
;
int
chroma_format
;
enum
AVPixelFormat
pix_fmt
=
AV_PIX_FMT_NONE
;
//FIXME replace the crap with get_bits()
s
->
repeat_pict
=
0
;
...
...
@@ -65,6 +67,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
ff_set_dimensions
(
avctx
,
pc
->
width
,
pc
->
height
);
did_set_size
=
1
;
}
pix_fmt
=
AV_PIX_FMT_YUV420P
;
frame_rate_index
=
buf
[
3
]
&
0xf
;
pc
->
frame_rate
=
avctx
->
framerate
=
ff_mpeg12_frame_rate_tab
[
frame_rate_index
];
avctx
->
bit_rate
=
((
buf
[
4
]
<<
10
)
|
(
buf
[
5
]
<<
2
)
|
(
buf
[
6
]
>>
6
))
*
400
;
...
...
@@ -85,6 +88,13 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
pc
->
progressive_sequence
=
buf
[
1
]
&
(
1
<<
3
);
avctx
->
has_b_frames
=
!
(
buf
[
5
]
>>
7
);
chroma_format
=
(
buf
[
1
]
>>
1
)
&
3
;
switch
(
chroma_format
)
{
case
1
:
pix_fmt
=
AV_PIX_FMT_YUV420P
;
break
;
case
2
:
pix_fmt
=
AV_PIX_FMT_YUV422P
;
break
;
case
3
:
pix_fmt
=
AV_PIX_FMT_YUV444P
;
break
;
}
pc
->
width
|=
(
horiz_size_ext
<<
12
);
pc
->
height
|=
(
vert_size_ext
<<
12
);
avctx
->
bit_rate
+=
(
bit_rate_ext
<<
18
)
*
400
;
...
...
@@ -138,6 +148,13 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
}
}
the_end:
;
if
(
pix_fmt
!=
AV_PIX_FMT_NONE
)
{
s
->
format
=
pix_fmt
;
s
->
width
=
s
->
coded_width
=
pc
->
width
;
s
->
height
=
s
->
coded_height
=
pc
->
height
;
}
#if FF_API_AVCTX_TIMEBASE
if
(
avctx
->
framerate
.
num
)
avctx
->
time_base
=
av_inv_q
(
avctx
->
framerate
);
...
...
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