On 9/9/2016 11:46 AM, Matthieu Bouron wrote: > diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c > new file mode 100644 > index 0000000..cf04bc2 > --- /dev/null > +++ b/libavcodec/hevc_parse.c > @@ -0,0 +1,134 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include "bytestream.h" > +#include "h2645_parse.h" > +#include "hevc.h" > +#include "hevc_parse.h" > + > +static int hevc_decode_nal_units(const uint8_t *buf, int buf_size, > HEVCParamSets *ps, > + int is_nalff, int nal_length_size, void > *logctx) > +{ > + int i; > + int ret = 0; > + H2645Packet pkt = { 0 }; > + > + ret = ff_h2645_packet_split(&pkt, buf, buf_size, logctx, is_nalff, > nal_length_size, AV_CODEC_ID_HEVC, 1); > + if (ret < 0) { > + goto done; > + } > + > + for (i = 0; i < pkt.nb_nals; i++) { > + H2645NAL *nal = &pkt.nals[i]; > + > + /* ignore everything except parameter sets and VCL NALUs */ > + switch (nal->type) { > + case NAL_VPS: ff_hevc_decode_nal_vps(&nal->gb, logctx, ps); break; > + case NAL_SPS: ff_hevc_decode_nal_sps(&nal->gb, logctx, ps, 1); break; > + case NAL_PPS: ff_hevc_decode_nal_pps(&nal->gb, logctx, ps); break; > + case NAL_TRAIL_R: > + case NAL_TRAIL_N: > + case NAL_TSA_N: > + case NAL_TSA_R: > + case NAL_STSA_N: > + case NAL_STSA_R: > + case NAL_BLA_W_LP: > + case NAL_BLA_W_RADL: > + case NAL_BLA_N_LP: > + case NAL_IDR_W_RADL: > + case NAL_IDR_N_LP: > + case NAL_CRA_NUT: > + case NAL_RADL_N: > + case NAL_RADL_R: > + case NAL_RASL_N: > + case NAL_RASL_R: > + av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", > nal->type); > + ret = AVERROR_INVALIDDATA; > + goto done; > + break; > + } > + } > + > +done: > + ff_h2645_packet_uninit(&pkt); > + return ret; > +}
This seems to be duplicating code from the "simple" parser in hevc_parser.c, which is only compiled if libavcodec is built without the internal hevc decoder. See if you can find a clean way to reuse it. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel