diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2009-11-20 01:45:13 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2009-11-20 01:45:13 +0000 |
commit | 34e3074e5efa935f2022d870842517d4e0d445c4 (patch) | |
tree | 076a9d822c8ca8a09c8d67343fe13e44d19df461 /src/libvdpau/h264_parser.h | |
parent | f791bb6196c70f923375f0614f178bddaece877b (diff) | |
parent | e18856000d2bd7d6447ab6c59d3eb8ee3d354dfc (diff) | |
download | xine-lib-34e3074e5efa935f2022d870842517d4e0d445c4.tar.gz xine-lib-34e3074e5efa935f2022d870842517d4e0d445c4.tar.bz2 |
Merge vdpau. THIS CONTAINS ABI CHANGES and is therefore not xine-lib 1.1.
Diffstat (limited to 'src/libvdpau/h264_parser.h')
-rw-r--r-- | src/libvdpau/h264_parser.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/src/libvdpau/h264_parser.h b/src/libvdpau/h264_parser.h new file mode 100644 index 000000000..bf3d34100 --- /dev/null +++ b/src/libvdpau/h264_parser.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2008 Julian Scheel + * + * This file is part of xine, a free video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * h264_parser.h: Almost full-features H264 NAL-Parser + */ + +#ifndef NAL_PARSER_H_ +#define NAL_PARSER_H_ + +#include <stdlib.h> + +#include "xine_internal.h" +#include "nal.h" +#include "dpb.h" + +#define MAX_FRAME_SIZE 1024*1024 + +struct nal_parser { + uint8_t buf[MAX_FRAME_SIZE]; + uint32_t buf_len; + + /* prebuf is used to store the currently + * processed nal unit */ + uint8_t prebuf[MAX_FRAME_SIZE]; + uint32_t prebuf_len; + uint32_t next_nal_position; + uint8_t incomplete_nal; + + uint8_t found_sps; + uint8_t found_pps; + uint8_t last_nal_res; + + uint8_t is_idr; + + int field; /* 0=top, 1=bottom, -1=both */ + int slice; + int slice_cnt; + + uint8_t have_top; + uint8_t have_frame; + + uint8_t nal_size_length; + uint32_t next_nal_size; + uint8_t *nal_size_length_buf; + uint8_t have_nal_size_length_buf; + + struct nal_unit *nal0; + struct nal_unit *nal1; + struct nal_unit *current_nal; + struct nal_unit *last_nal; + + uint8_t cpb_dpb_delays_present_flag; + + uint32_t pic_order_cnt_lsb; + uint32_t pic_order_cnt_msb; + uint32_t prev_pic_order_cnt_lsb; + uint32_t prev_pic_order_cnt_msb; + uint32_t frame_num_offset; + + /* this is dpb used for reference frame + * heading to vdpau + unordered frames + */ + struct dpb dpb; +}; + +int parse_nal(uint8_t *buf, int buf_len, struct nal_parser *parser); + +int seek_for_nal(uint8_t *buf, int buf_len, struct nal_parser *parser); + +struct nal_parser* init_parser(); +void free_parser(struct nal_parser *parser); +int parse_frame(struct nal_parser *parser, uint8_t *inbuf, int inbuf_len, + uint8_t **ret_buf, uint32_t *ret_len, uint32_t *ret_slice_cnt); + +/* this has to be called after decoding the frame delivered by parse_frame, + * but before adding a decoded frame to the dpb. + */ +void process_mmc_operations(struct nal_parser *parser); + +void parse_codec_private(struct nal_parser *parser, uint8_t *inbuf, int inbuf_len); + +#endif |