Commit b4c915f4 authored by Mark Thompson's avatar Mark Thompson

lavc: Add coded bitstream read/write support for H.264

(cherry picked from commit acf06f45)
(cherry picked from commit 768eb918)
(cherry picked from commit e7f64191)
parent 6734eef6
...@@ -2151,6 +2151,7 @@ CONFIG_EXTRA=" ...@@ -2151,6 +2151,7 @@ CONFIG_EXTRA="
bswapdsp bswapdsp
cabac cabac
cbs cbs
cbs_h264
dirac_parse dirac_parse
dvprofile dvprofile
exif exif
...@@ -2404,6 +2405,7 @@ w32threads_deps="atomics_native" ...@@ -2404,6 +2405,7 @@ w32threads_deps="atomics_native"
threads_if_any="$THREADS_LIST" threads_if_any="$THREADS_LIST"
# subsystems # subsystems
cbs_h264_select="cbs golomb"
dct_select="rdft" dct_select="rdft"
dirac_parse_select="golomb" dirac_parse_select="golomb"
error_resilience_select="me_cmp" error_resilience_select="me_cmp"
......
...@@ -60,6 +60,7 @@ OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o ...@@ -60,6 +60,7 @@ OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o
OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o
OBJS-$(CONFIG_CABAC) += cabac.o OBJS-$(CONFIG_CABAC) += cabac.o
OBJS-$(CONFIG_CBS) += cbs.o OBJS-$(CONFIG_CBS) += cbs.o
OBJS-$(CONFIG_CBS_H264) += cbs_h2645.o h2645_parse.o
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
static const CodedBitstreamType *cbs_type_table[] = { static const CodedBitstreamType *cbs_type_table[] = {
#if CONFIG_CBS_H264
&ff_cbs_type_h264,
#endif
}; };
int ff_cbs_init(CodedBitstreamContext **ctx_ptr, int ff_cbs_init(CodedBitstreamContext **ctx_ptr,
......
...@@ -42,6 +42,8 @@ struct CodedBitstreamType; ...@@ -42,6 +42,8 @@ struct CodedBitstreamType;
/** /**
* The codec-specific type of a bitstream unit. * The codec-specific type of a bitstream unit.
*
* H.264 / AVC: nal_unit_type
*/ */
typedef uint32_t CodedBitstreamUnitType; typedef uint32_t CodedBitstreamUnitType;
......
This diff is collapsed.
This diff is collapsed.
/*
* 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_CBS_H2645_H
#define AVCODEC_CBS_H2645_H
#include <stddef.h>
#include <stdint.h>
#include "h2645_parse.h"
typedef struct CodedBitstreamH2645Context {
// If set, the stream being read is in MP4 (AVCC/HVCC) format. If not
// set, the stream is assumed to be in annex B format.
int mp4;
// Size in bytes of the NAL length field for MP4 format.
int nal_length_size;
// Packet reader.
H2645Packet read_packet;
// Write buffer
uint8_t *write_buffer;
size_t write_buffer_size;
} CodedBitstreamH2645Context;
#endif /* AVCODEC_CBS_H2645_H */
This diff is collapsed.
...@@ -83,4 +83,7 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, ...@@ -83,4 +83,7 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc,
uint32_t range_min, uint32_t range_max); uint32_t range_min, uint32_t range_max);
extern const CodedBitstreamType ff_cbs_type_h264;
#endif /* AVCODEC_CBS_INTERNAL_H */ #endif /* AVCODEC_CBS_INTERNAL_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment