Commit 393cbb96 authored by Michael Niedermayer's avatar Michael Niedermayer

Add AVFrame.pkt_pts that contains the correctly reordered AVPacket.pts

Originally committed as revision 26260 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 060ec0a8
...@@ -13,6 +13,9 @@ libavutil: 2009-03-08 ...@@ -13,6 +13,9 @@ libavutil: 2009-03-08
API changes, most recent first: API changes, most recent first:
2011-01-07 - r26260 - lavc 52.105.0 - pkt_pts
Add pkt_pts to AVFrame.
2011-01-XX - r26XXX - lavc 52.104.0 - av_get_profile_name() 2011-01-XX - r26XXX - lavc 52.104.0 - av_get_profile_name()
Add av_get_profile_name to libavcodec/avcodec.h. Add av_get_profile_name to libavcodec/avcodec.h.
......
...@@ -1652,6 +1652,8 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) ...@@ -1652,6 +1652,8 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
pic->age = INT_MAX; pic->age = INT_MAX;
pic->type = FF_BUFFER_TYPE_USER; pic->type = FF_BUFFER_TYPE_USER;
pic->reordered_opaque = codec->reordered_opaque; pic->reordered_opaque = codec->reordered_opaque;
if(codec->pkt) pic->pkt_pts = codec->pkt->pts;
else pic->pkt_pts = AV_NOPTS_VALUE;
return 0; return 0;
} }
...@@ -1677,6 +1679,8 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic) ...@@ -1677,6 +1679,8 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
} }
pic->reordered_opaque = codec->reordered_opaque; pic->reordered_opaque = codec->reordered_opaque;
if(codec->pkt) pic->pkt_pts = codec->pkt->pts;
else pic->pkt_pts = AV_NOPTS_VALUE;
return 0; return 0;
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 104 #define LIBAVCODEC_VERSION_MINOR 105
#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...@@ -1009,6 +1009,13 @@ typedef struct AVPanScan{ ...@@ -1009,6 +1009,13 @@ typedef struct AVPanScan{
* - decoding: Set by libavcodec\ * - decoding: Set by libavcodec\
*/\ */\
void *hwaccel_picture_private;\ void *hwaccel_picture_private;\
\
/**\
* reordered pts from the last AVPacket that has been input into the decoder\
* - encoding: unused\
* - decoding: Read by user.\
*/\
int64_t pkt_pts;\
#define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG1 0
...@@ -2791,6 +2798,15 @@ typedef struct AVCodecContext { ...@@ -2791,6 +2798,15 @@ typedef struct AVCodecContext {
*/ */
uint8_t *subtitle_header; uint8_t *subtitle_header;
int subtitle_header_size; int subtitle_header_size;
/**
* Current packet as passed into the decoder, to avoid having
* to pass the packet into every function. Currently only valid
* inside lavc and get/release_buffer callbacks.
* - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
* - encoding: unused
*/
AVPacket *pkt;
} AVCodecContext; } AVCodecContext;
/** /**
......
...@@ -344,6 +344,8 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ ...@@ -344,6 +344,8 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
} }
s->internal_buffer_count++; s->internal_buffer_count++;
if(s->pkt) pic->pkt_pts= s->pkt->pts;
else pic->pkt_pts= AV_NOPTS_VALUE;
pic->reordered_opaque= s->reordered_opaque; pic->reordered_opaque= s->reordered_opaque;
if(s->debug&FF_DEBUG_BUFFERS) if(s->debug&FF_DEBUG_BUFFERS)
...@@ -628,6 +630,9 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi ...@@ -628,6 +630,9 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
*got_picture_ptr= 0; *got_picture_ptr= 0;
if((avctx->coded_width||avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx)) if((avctx->coded_width||avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
return -1; return -1;
avctx->pkt = avpkt;
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){ if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
ret = avctx->codec->decode(avctx, picture, got_picture_ptr, ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
avpkt); avpkt);
...@@ -662,6 +667,8 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa ...@@ -662,6 +667,8 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
{ {
int ret; int ret;
avctx->pkt = avpkt;
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){ if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
//FIXME remove the check below _after_ ensuring that all audio check that the available space is enough //FIXME remove the check below _after_ ensuring that all audio check that the available space is enough
if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){ if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){
...@@ -703,6 +710,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, ...@@ -703,6 +710,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
{ {
int ret; int ret;
avctx->pkt = avpkt;
*got_sub_ptr = 0; *got_sub_ptr = 0;
ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt); ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt);
if (*got_sub_ptr) if (*got_sub_ptr)
......
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