comparison avcodec.h @ 9140:322fa07fd397 libavcodec

Add handling of frame position in the parser.
author schreter
date Thu, 05 Mar 2009 07:35:06 +0000
parents 3c5920f57063
children 788aa0c09382
comparison
equal deleted inserted replaced
9139:4564ec1f21b0 9140:322fa07fd397
28 28
29 #include <errno.h> 29 #include <errno.h>
30 #include "libavutil/avutil.h" 30 #include "libavutil/avutil.h"
31 31
32 #define LIBAVCODEC_VERSION_MAJOR 52 32 #define LIBAVCODEC_VERSION_MAJOR 52
33 #define LIBAVCODEC_VERSION_MINOR 20 33 #define LIBAVCODEC_VERSION_MINOR 21
34 #define LIBAVCODEC_VERSION_MICRO 0 34 #define LIBAVCODEC_VERSION_MICRO 0
35 35
36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ 36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
37 LIBAVCODEC_VERSION_MINOR, \ 37 LIBAVCODEC_VERSION_MINOR, \
38 LIBAVCODEC_VERSION_MICRO) 38 LIBAVCODEC_VERSION_MICRO)
3196 * time of the frame. 3196 * time of the frame.
3197 * 3197 *
3198 * For example, this corresponds to H.264 dpb_output_delay. 3198 * For example, this corresponds to H.264 dpb_output_delay.
3199 */ 3199 */
3200 int pts_dts_delta; 3200 int pts_dts_delta;
3201
3202 /**
3203 * Position of the packet in file.
3204 *
3205 * Analogous to cur_frame_pts/dts
3206 */
3207 int64_t cur_frame_pos[AV_PARSER_PTS_NB];
3208
3209 /**
3210 * Byte position of currently parsed frame in stream.
3211 */
3212 int64_t pos;
3213
3214 /**
3215 * Previous frame byte position.
3216 */
3217 int64_t last_pos;
3201 } AVCodecParserContext; 3218 } AVCodecParserContext;
3202 3219
3203 typedef struct AVCodecParser { 3220 typedef struct AVCodecParser {
3204 int codec_ids[5]; /* several codec IDs are permitted */ 3221 int codec_ids[5]; /* several codec IDs are permitted */
3205 int priv_data_size; 3222 int priv_data_size;
3215 3232
3216 AVCodecParser *av_parser_next(AVCodecParser *c); 3233 AVCodecParser *av_parser_next(AVCodecParser *c);
3217 3234
3218 void av_register_codec_parser(AVCodecParser *parser); 3235 void av_register_codec_parser(AVCodecParser *parser);
3219 AVCodecParserContext *av_parser_init(int codec_id); 3236 AVCodecParserContext *av_parser_init(int codec_id);
3237
3238 attribute_deprecated
3220 int av_parser_parse(AVCodecParserContext *s, 3239 int av_parser_parse(AVCodecParserContext *s,
3221 AVCodecContext *avctx, 3240 AVCodecContext *avctx,
3222 uint8_t **poutbuf, int *poutbuf_size, 3241 uint8_t **poutbuf, int *poutbuf_size,
3223 const uint8_t *buf, int buf_size, 3242 const uint8_t *buf, int buf_size,
3224 int64_t pts, int64_t dts); 3243 int64_t pts, int64_t dts);
3244
3245 /**
3246 * Parse a packet.
3247 *
3248 * @param s parser context.
3249 * @param avctx codec context.
3250 * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
3251 * @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
3252 * @param buf input buffer.
3253 * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output).
3254 * @param pts input presentation timestamp.
3255 * @param dts input decoding timestamp.
3256 * @param pos input byte position in stream.
3257 * @return the number of bytes of the input bitstream used.
3258 *
3259 * Example:
3260 * @code
3261 * while(in_len){
3262 * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
3263 * in_data, in_len,
3264 * pts, dts, pos);
3265 * in_data += len;
3266 * in_len -= len;
3267 *
3268 * if(size)
3269 * decode_frame(data, size);
3270 * }
3271 * @endcode
3272 */
3273 int av_parser_parse2(AVCodecParserContext *s,
3274 AVCodecContext *avctx,
3275 uint8_t **poutbuf, int *poutbuf_size,
3276 const uint8_t *buf, int buf_size,
3277 int64_t pts, int64_t dts,
3278 int64_t pos);
3279
3225 int av_parser_change(AVCodecParserContext *s, 3280 int av_parser_change(AVCodecParserContext *s,
3226 AVCodecContext *avctx, 3281 AVCodecContext *avctx,
3227 uint8_t **poutbuf, int *poutbuf_size, 3282 uint8_t **poutbuf, int *poutbuf_size,
3228 const uint8_t *buf, int buf_size, int keyframe); 3283 const uint8_t *buf, int buf_size, int keyframe);
3229 void av_parser_close(AVCodecParserContext *s); 3284 void av_parser_close(AVCodecParserContext *s);