| 177 | } |
| 178 | |
| 179 | static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, |
| 180 | int buf_size, AVCodecContext *avctx) |
| 181 | { |
| 182 | LCEVCParserContext *ctx = s->priv_data; |
| 183 | int flags = (H2645_FLAG_IS_NALFF * !!ctx->is_lvcc) | H2645_FLAG_SMALL_PADDING; |
| 184 | int ret, i; |
| 185 | |
| 186 | /* set some sane default values */ |
| 187 | s->pict_type = AV_PICTURE_TYPE_NONE; |
| 188 | s->key_frame = 0; |
| 189 | s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; |
| 190 | |
| 191 | ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx, |
| 192 | ctx->nal_length_size, AV_CODEC_ID_LCEVC, flags); |
| 193 | if (ret < 0) |
| 194 | return ret; |
| 195 | |
| 196 | for (i = 0; i < ctx->pkt.nb_nals; i++) { |
| 197 | H2645NAL *nal = &ctx->pkt.nals[i]; |
| 198 | |
| 199 | switch (nal->type) { |
| 200 | case LCEVC_IDR_NUT: |
| 201 | s->key_frame = 1; |
| 202 | // fall-through |
| 203 | case LCEVC_NON_IDR_NUT: |
| 204 | parse_nal_unit(s, avctx, nal); |
| 205 | break; |
| 206 | default: |
| 207 | break; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | static int lcevc_parse(AVCodecParserContext *s, |
| 215 | AVCodecContext *avctx, |
no test coverage detected