diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-01 22:26:53 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-01 23:18:23 +0100 |
commit | cc38ca67482b651a82a1302ba367b76a1cbc0246 (patch) | |
tree | 49c27a3b8e9858c0c51a92758ba3501a688dab8e | |
parent | 30806ddcbc6d9057342e34f1e06cda4d47bad194 (diff) | |
download | ffmpeg-streaming-cc38ca67482b651a82a1302ba367b76a1cbc0246.zip ffmpeg-streaming-cc38ca67482b651a82a1302ba367b76a1cbc0246.tar.gz |
avcodec/utils: use AVFrame accessor functions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/utils.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 69aaf4d..d680f5a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -549,14 +549,14 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *frame) { if (s->pkt) { frame->pkt_pts = s->pkt->pts; - frame->pkt_pos = s->pkt->pos; - frame->pkt_duration = s->pkt->duration; - frame->pkt_size = s->pkt->size; + av_frame_set_pkt_pos (frame, s->pkt->pos); + av_frame_set_pkt_duration(frame, s->pkt->duration); + av_frame_set_pkt_size (frame, s->pkt->size); } else { frame->pkt_pts = AV_NOPTS_VALUE; - frame->pkt_pos = -1; - frame->pkt_duration = 0; - frame->pkt_size = -1; + av_frame_set_pkt_pos (frame, -1); + av_frame_set_pkt_duration(frame, 0); + av_frame_set_pkt_size (frame, -1); } frame->reordered_opaque = s->reordered_opaque; @@ -571,7 +571,7 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *frame) frame->sample_rate = s->sample_rate; frame->format = s->sample_fmt; frame->channel_layout = s->channel_layout; - frame->channels = s->channels; + av_frame_set_channels(frame, s->channels); break; } } @@ -714,11 +714,11 @@ void avcodec_get_frame_defaults(AVFrame *frame) frame->pts = frame->pkt_dts = - frame->pkt_pts = - frame->best_effort_timestamp = AV_NOPTS_VALUE; - frame->pkt_duration = 0; - frame->pkt_pos = -1; - frame->pkt_size = -1; + frame->pkt_pts = AV_NOPTS_VALUE; + av_frame_set_best_effort_timestamp(frame, AV_NOPTS_VALUE); + av_frame_set_pkt_duration (frame, 0); + av_frame_set_pkt_pos (frame, -1); + av_frame_set_pkt_size (frame, -1); frame->key_frame = 1; frame->sample_aspect_ratio = (AVRational) {0, 1 }; frame->format = -1; /* unknown */ @@ -1650,13 +1650,13 @@ static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame) while (side_metadata < end) { const uint8_t *key = side_metadata; const uint8_t *val = side_metadata + strlen(key) + 1; - int ret = av_dict_set(&frame->metadata, key, val, 0); + int ret = av_dict_set(ff_frame_get_metadatap(frame), key, val, 0); if (ret < 0) break; side_metadata = val + strlen(val) + 1; } end: - avctx->metadata = frame->metadata; + avctx->metadata = av_frame_get_metadata(frame); return ret; } @@ -1692,7 +1692,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi picture->pkt_dts = avpkt->dts; if(!avctx->has_b_frames){ - picture->pkt_pos = avpkt->pos; + av_frame_set_pkt_pos(picture, avpkt->pos); } //FIXME these should be under if(!avctx->has_b_frames) /* get_buffer is supposed to set frame parameters */ @@ -1716,9 +1716,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi if (*got_picture_ptr){ avctx->frame_number++; - picture->best_effort_timestamp = guess_correct_pts(avctx, - picture->pkt_pts, - picture->pkt_dts); + av_frame_set_best_effort_timestamp(picture, + guess_correct_pts(avctx, + picture->pkt_pts, + picture->pkt_dts)); } } else ret = 0; @@ -1813,15 +1814,16 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, if (ret >= 0 && *got_frame_ptr) { avctx->frame_number++; frame->pkt_dts = avpkt->dts; - frame->best_effort_timestamp = guess_correct_pts(avctx, - frame->pkt_pts, - frame->pkt_dts); + av_frame_set_best_effort_timestamp(frame, + guess_correct_pts(avctx, + frame->pkt_pts, + frame->pkt_dts)); if (frame->format == AV_SAMPLE_FMT_NONE) frame->format = avctx->sample_fmt; if (!frame->channel_layout) frame->channel_layout = avctx->channel_layout; - if (!frame->channels) - frame->channels = avctx->channels; + if (!av_frame_get_channels(frame)) + av_frame_set_channels(frame, avctx->channels); if (!frame->sample_rate) frame->sample_rate = avctx->sample_rate; } @@ -1850,8 +1852,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, frame->pkt_pts += diff_ts; if(frame->pkt_dts!=AV_NOPTS_VALUE) frame->pkt_dts += diff_ts; - if (frame->pkt_duration >= diff_ts) - frame->pkt_duration -= diff_ts; + if (av_frame_get_pkt_duration(frame) >= diff_ts) + av_frame_set_pkt_duration(frame, av_frame_get_pkt_duration(frame) - diff_ts); } else { av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for skipped samples.\n"); } @@ -1875,7 +1877,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, * extended_data are doing it correctly */ if (*got_frame_ptr) { planar = av_sample_fmt_is_planar(frame->format); - channels = frame->channels; + channels = av_frame_get_channels(frame); if (!(planar && channels > AV_NUM_DATA_POINTERS)) frame->extended_data = frame->data; } else { |