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
31d2039c
Commit
31d2039c
authored
Feb 09, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264_parser: export video format and dimensions
parent
5b1d9cee
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
1 deletion
+58
-1
APIchanges
doc/APIchanges
+4
-0
avcodec.h
libavcodec/avcodec.h
+22
-0
h264_parser.c
libavcodec/h264_parser.c
+29
-0
parser.c
libavcodec/parser.c
+2
-0
version.h
libavcodec/version.h
+1
-1
No files found.
doc/APIchanges
View file @
31d2039c
...
...
@@ -13,6 +13,10 @@ libavutil: 2014-08-09
API changes, most recent first:
2015-xx-xx - xxxxxxx - lavc 56.13
Add width, height, coded_width, coded_height and format to
AVCodecParserContext.
2015-xx-xx - xxxxxxx - lavu 54.9.0
Add AV_PIX_FMT_QSV for QSV hardware acceleration.
...
...
libavcodec/avcodec.h
View file @
31d2039c
...
...
@@ -3883,6 +3883,28 @@ typedef struct AVCodecParserContext {
* For example, this corresponds to H.264 PicOrderCnt.
*/
int
output_picture_number
;
/**
* Dimensions of the decoded video intended for presentation.
*/
int
width
;
int
height
;
/**
* Dimensions of the coded video.
*/
int
coded_width
;
int
coded_height
;
/**
* The format of the coded data, corresponds to enum AVPixelFormat for video
* and for enum AVSampleFormat for audio.
*
* Note that a decoder can have considerable freedom in how exactly it
* decodes the data, so the format reported here might be different from the
* one returned by a decoder.
*/
int
format
;
}
AVCodecParserContext
;
typedef
struct
AVCodecParser
{
...
...
libavcodec/h264_parser.c
View file @
31d2039c
...
...
@@ -275,6 +275,35 @@ static inline int parse_nal_units(AVCodecParserContext *s,
h
->
sps
=
*
h
->
sps_buffers
[
h
->
pps
.
sps_id
];
h
->
frame_num
=
get_bits
(
&
h
->
gb
,
h
->
sps
.
log2_max_frame_num
);
s
->
coded_width
=
16
*
h
->
sps
.
mb_width
;
s
->
coded_height
=
16
*
h
->
sps
.
mb_height
;
s
->
width
=
s
->
coded_width
-
(
h
->
sps
.
crop_right
+
h
->
sps
.
crop_left
);
s
->
height
=
s
->
coded_height
-
(
h
->
sps
.
crop_top
+
h
->
sps
.
crop_bottom
);
if
(
s
->
width
<=
0
||
s
->
height
<=
0
)
{
s
->
width
=
s
->
coded_width
;
s
->
height
=
s
->
coded_height
;
}
switch
(
h
->
sps
.
bit_depth_luma
)
{
case
9
:
if
(
CHROMA444
(
h
))
s
->
format
=
AV_PIX_FMT_YUV444P9
;
else
if
(
CHROMA422
(
h
))
s
->
format
=
AV_PIX_FMT_YUV422P9
;
else
s
->
format
=
AV_PIX_FMT_YUV420P9
;
break
;
case
10
:
if
(
CHROMA444
(
h
))
s
->
format
=
AV_PIX_FMT_YUV444P10
;
else
if
(
CHROMA422
(
h
))
s
->
format
=
AV_PIX_FMT_YUV422P10
;
else
s
->
format
=
AV_PIX_FMT_YUV420P10
;
break
;
case
8
:
if
(
CHROMA444
(
h
))
s
->
format
=
AV_PIX_FMT_YUV444P
;
else
if
(
CHROMA422
(
h
))
s
->
format
=
AV_PIX_FMT_YUV422P
;
else
s
->
format
=
AV_PIX_FMT_YUV420P
;
break
;
default:
s
->
format
=
AV_PIX_FMT_NONE
;
}
avctx
->
profile
=
ff_h264_get_profile
(
&
h
->
sps
);
avctx
->
level
=
h
->
sps
.
level_idc
;
...
...
libavcodec/parser.c
View file @
31d2039c
...
...
@@ -89,6 +89,8 @@ found:
s
->
dts_sync_point
=
INT_MIN
;
s
->
dts_ref_dts_delta
=
INT_MIN
;
s
->
pts_dts_delta
=
INT_MIN
;
s
->
format
=
-
1
;
return
s
;
}
...
...
libavcodec/version.h
View file @
31d2039c
...
...
@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 56
#define LIBAVCODEC_VERSION_MINOR 1
2
#define LIBAVCODEC_VERSION_MINOR 1
3
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
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