diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-04-29 12:28:44 +0200 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-01 13:09:58 +0200 |
commit | 1ba57272429fc6c86e39cd236e2b32ac545e1488 (patch) | |
tree | 6e8e29bf5b9c71420943d28cb383246f7a357270 /libavcodec | |
parent | aba0278e9fe8e66c078588efe66f6af4db432770 (diff) | |
download | ffmpeg-1ba57272429fc6c86e39cd236e2b32ac545e1488.tar.gz |
lavc: add a pkt_pos field to AVFrame
This is similar to what was done with pkt_pts. This simplifies the
operation of extracting the pos information from the AVPacket, and
allows further simplifications.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 7 | ||||
-rw-r--r-- | libavcodec/rawdec.c | 1 | ||||
-rw-r--r-- | libavcodec/utils.c | 11 | ||||
-rw-r--r-- | libavcodec/version.h | 4 |
4 files changed, 19 insertions, 4 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index b69230f6fe..251a038d2b 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1004,6 +1004,13 @@ typedef struct AVPanScan{ * - decoding: set by libavcodec, read by user.\ */\ int64_t best_effort_timestamp;\ +\ + /**\ + * reordered pos from the last AVPacket that has been input into the decoder\ + * - encoding: unused\ + * - decoding: Read by user.\ + */\ + int64_t pkt_pos;\ #define FF_QSCALE_TYPE_MPEG1 0 diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index d9993c038b..029bee21da 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -124,6 +124,7 @@ static int raw_decode(AVCodecContext *avctx, frame->top_field_first = avctx->coded_frame->top_field_first; frame->reordered_opaque = avctx->reordered_opaque; frame->pkt_pts = avctx->pkt->pts; + frame->pkt_pos = avctx->pkt->pos; //2bpp and 4bpp raw in avi and mov (yes this is ugly ...) if (context->buffer) { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ce33c4f5de..0993d52644 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -341,8 +341,13 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ } s->internal_buffer_count++; - if(s->pkt) pic->pkt_pts= s->pkt->pts; - else pic->pkt_pts= AV_NOPTS_VALUE; + if (s->pkt) { + pic->pkt_pts = s->pkt->pts; + pic->pkt_pos = s->pkt->pos; + } else { + pic->pkt_pts = AV_NOPTS_VALUE; + pic->pkt_pos = -1; + } pic->reordered_opaque= s->reordered_opaque; if(s->debug&FF_DEBUG_BUFFERS) @@ -448,6 +453,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){ memset(pic, 0, sizeof(AVFrame)); pic->pts = pic->best_effort_timestamp = AV_NOPTS_VALUE; + pic->pkt_pos = -1; pic->key_frame= 1; } @@ -730,6 +736,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi ret = avctx->codec->decode(avctx, picture, got_picture_ptr, avpkt); picture->pkt_dts= avpkt->dts; + picture->pkt_pos= avpkt->pos; } emms_c(); //needed to avoid an emms_c() call before every return; diff --git a/libavcodec/version.h b/libavcodec/version.h index 7eba7d2a3a..c7c7456e96 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,8 +21,8 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 53 -#define LIBAVCODEC_VERSION_MINOR 1 -#define LIBAVCODEC_VERSION_MICRO 2 +#define LIBAVCODEC_VERSION_MINOR 2 +#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ |