[FFmpeg-devel] [PATCH v4 2/4] lavc/avs3_parser: add avs3 parser
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Tue Aug 18 20:00:57 EEST 2020
hwrenx at 126.com:
> From: hwren <hwrenx at 126.com>
>
> Signed-off-by: hbj <hanbj at pku.edu.cn>
> Signed-off-by: hwren <hwrenx at 126.com>
> ---
> diff --git a/libavcodec/avs3_parser.h b/libavcodec/avs3_parser.h
> new file mode 100644
> index 0000000000..afc6d235b9
> --- /dev/null
> +++ b/libavcodec/avs3_parser.h
> @@ -0,0 +1,64 @@
> +/*
> + * AVS3-P2/IEEE1857.10 video parser.
> + * Copyright (c) 2020 Zhenyu Wang <wangzhenyu at pkusz.edu.cn>
> + * Bingjie Han <hanbj at pkusz.edu.cn>
> + * Huiwen Ren <hwrenx at gmail.com>
> + *
> + * 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
> + */
> +
> +#ifndef AVCODEC_AVS3PARSER_H
> +#define AVCODEC_AVS3PARSER_H
> +
> +#include "parser.h"
> +
> +#define AVS3_NAL_START_CODE 0x010000
> +#define AVS3_SEQ_START_CODE 0xB0
> +#define AVS3_SEQ_END_CODE 0xB1
> +#define AVS3_USER_DATA_START_CODE 0xB2
> +#define AVS3_INTRA_PIC_START_CODE 0xB3
> +#define AVS3_UNDEF_START_CODE 0xB4
> +#define AVS3_EXTENSION_START_CODE 0xB5
> +#define AVS3_INTER_PIC_START_CODE 0xB6
> +#define AVS3_VIDEO_EDIT_CODE 0xB7
> +#define AVS3_FIRST_SLICE_START_CODE 0x00
> +#define AVS3_PROFILE_BASELINE_MAIN 0x20
> +#define AVS3_PROFILE_BASELINE_MAIN10 0x22
> +
> +#define ISPIC(x) ((x) == AVS3_INTRA_PIC_START_CODE || (x) == AVS3_INTER_PIC_START_CODE)
> +#define ISUNIT(x) ((x) == AVS3_SEQ_START_CODE || ISPIC(x))
> +
> +static const AVRational avs3_frame_rate_tab[16] = {
> + { 0 , 0 }, // forbid
> + { 24000, 1001},
> + { 24 , 1 },
> + { 25 , 1 },
> + { 30000, 1001},
> + { 30 , 1 },
> + { 50 , 1 },
> + { 60000, 1001},
> + { 60 , 1 },
> + { 100 , 1 },
> + { 120 , 1 },
> + { 200 , 1 },
> + { 240 , 1 },
> + { 300 , 1 },
> + { 0 , 0 }, // reserved
> + { 0 , 0 } // reserved
> +};
> +
> +#endif /* AVCODEC_AVS3PARSER_H */
None of the stuff in this header file (except the '#include "parser.h"')
is parser-specific. It should be part of a generic avs3 header file. And
the frame rate table should not be defined in said header file, as this
will lead to duplications of the table. If it is used in more than one
place, it should be declared via extern in this header file; if not, it
should just be declared inside the file that uses it (right now, only
the parser uses it).
(If it is used in more than one library, then it needs to exist in these
libraries separately (or it needs to be avpriv).)
- Andreas
More information about the ffmpeg-devel
mailing list