diff --git a/libavformat/hevcdec.c b/libavformat/hevcdec.c index 51e1504459..c187652765 100644 --- a/libavformat/hevcdec.c +++ b/libavformat/hevcdec.c @@ -1,5 +1,5 @@ /* - * RAW H.265 video demuxer + * RAW HEVC video demuxer * Copyright (c) 2013 Dirk Farin * * This file is part of FFmpeg. @@ -22,39 +22,41 @@ #include "avformat.h" #include "rawdec.h" +#include "libavcodec/hevc.h" + static int hevc_probe(AVProbeData *p) { - uint32_t code= -1; - int vps=0, sps=0, pps=0, idr=0; + uint32_t code = -1; + int vps = 0, sps = 0, pps = 0, irap = 0; int i; - for(i=0; ibuf_size-1; i++){ - code = (code<<8) + p->buf[i]; + for (i = 0; i < p->buf_size - 1; i++) { + code = (code << 8) + p->buf[i]; if ((code & 0xffffff00) == 0x100) { - uint8_t nal2 = p->buf[i+1]; - int type = (code & 0x7E)>>1; + uint8_t nal2 = p->buf[i + 1]; + int type = (code & 0x7E) >> 1; - if (code & 0x81) // forbidden and reserved zero bits - return 0; + if (code & 0x81) // forbidden and reserved zero bits + return 0; - if (nal2 & 0xf8) // reserved zero - return 0; + if (nal2 & 0xf8) // reserved zero + return 0; - switch (type) { - case 32: vps++; break; - case 33: sps++; break; - case 34: pps++; break; - case 19: - case 20: idr++; break; - } + switch (type) { + case NAL_VPS: vps++; break; + case NAL_SPS: sps++; break; + case NAL_PPS: pps++; break; + case 19: + case 20: irap++; break; + } } } - // printf("vps=%d, sps=%d, pps=%d, idr=%d\n", vps, sps, pps, idr); + // printf("vps=%d, sps=%d, pps=%d, irap=%d\n", vps, sps, pps, irap); - if (vps && sps && pps && idr) + if (vps && sps && pps && irap) return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg return 0; } -FF_DEF_RAWVIDEO_DEMUXER(hevc , "raw HEVC video", hevc_probe, "h265,265,hevc", AV_CODEC_ID_HEVC) +FF_DEF_RAWVIDEO_DEMUXER(hevc, "raw HEVC video", hevc_probe, "hevc,h265,265", AV_CODEC_ID_HEVC)