diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-19 20:39:04 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-19 20:39:04 +0100 |
commit | 560eb7179a7c46ba277c9c120840816869a47a70 (patch) | |
tree | f2b3b551efdfad47ee5209968fa79f0d882092d3 /libavcodec/h264_parser.c | |
parent | e3755119fae71c9e34b630679c2805fcf1c97e2c (diff) | |
parent | 31d2039cb42668ebcf08248bc48bbad44aa05f49 (diff) | |
download | ffmpeg-streaming-560eb7179a7c46ba277c9c120840816869a47a70.zip ffmpeg-streaming-560eb7179a7c46ba277c9c120840816869a47a70.tar.gz |
Merge commit '31d2039cb42668ebcf08248bc48bbad44aa05f49'
* commit '31d2039cb42668ebcf08248bc48bbad44aa05f49':
h264_parser: export video format and dimensions
Conflicts:
libavcodec/h264_parser.c
libavcodec/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_parser.c')
-rw-r--r-- | libavcodec/h264_parser.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index ac593e6..8eda6b8 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -327,6 +327,35 @@ static inline int parse_nal_units(AVCodecParserContext *s, if(h->sps.ref_frame_count <= 1 && h->pps.ref_count[0] <= 1 && s->pict_type == AV_PICTURE_TYPE_I) s->key_frame = 1; + 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; |