Commit 6f74e3cd authored by Hendrik Leppkes's avatar Hendrik Leppkes

Merge commit 'beb62dac'

* commit 'beb62dac':
  Use AVFrame.pts instead of deprecated pkt_pts.
Merged-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parents 3f9137c5 beb62dac
...@@ -2108,8 +2108,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) ...@@ -2108,8 +2108,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
} }
} }
if (decoded_frame->pkt_pts != AV_NOPTS_VALUE) { if (decoded_frame->pts != AV_NOPTS_VALUE) {
decoded_frame->pts = decoded_frame->pkt_pts;
decoded_frame_tb = ist->st->time_base; decoded_frame_tb = ist->st->time_base;
} else if (pkt && pkt->pts != AV_NOPTS_VALUE) { } else if (pkt && pkt->pts != AV_NOPTS_VALUE) {
decoded_frame->pts = pkt->pts; decoded_frame->pts = pkt->pts;
......
...@@ -588,9 +588,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { ...@@ -588,9 +588,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
if (got_frame) { if (got_frame) {
if (decoder_reorder_pts == -1) { if (decoder_reorder_pts == -1) {
frame->pts = av_frame_get_best_effort_timestamp(frame); frame->pts = av_frame_get_best_effort_timestamp(frame);
} else if (decoder_reorder_pts) { } else if (!decoder_reorder_pts) {
frame->pts = frame->pkt_pts;
} else {
frame->pts = frame->pkt_dts; frame->pts = frame->pkt_dts;
} }
} }
...@@ -600,9 +598,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { ...@@ -600,9 +598,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
if (got_frame) { if (got_frame) {
AVRational tb = (AVRational){1, frame->sample_rate}; AVRational tb = (AVRational){1, frame->sample_rate};
if (frame->pts != AV_NOPTS_VALUE) if (frame->pts != AV_NOPTS_VALUE)
frame->pts = av_rescale_q(frame->pts, d->avctx->time_base, tb); frame->pts = av_rescale_q(frame->pts, av_codec_get_pkt_timebase(d->avctx), tb);
else if (frame->pkt_pts != AV_NOPTS_VALUE)
frame->pts = av_rescale_q(frame->pkt_pts, av_codec_get_pkt_timebase(d->avctx), tb);
else if (d->next_pts != AV_NOPTS_VALUE) else if (d->next_pts != AV_NOPTS_VALUE)
frame->pts = av_rescale_q(d->next_pts, d->next_pts_tb, tb); frame->pts = av_rescale_q(d->next_pts, d->next_pts_tb, tb);
if (frame->pts != AV_NOPTS_VALUE) { if (frame->pts != AV_NOPTS_VALUE) {
......
...@@ -1884,8 +1884,8 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, ...@@ -1884,8 +1884,8 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
else print_str_opt("media_type", "unknown"); else print_str_opt("media_type", "unknown");
print_int("stream_index", stream->index); print_int("stream_index", stream->index);
print_int("key_frame", frame->key_frame); print_int("key_frame", frame->key_frame);
print_ts ("pkt_pts", frame->pkt_pts); print_ts ("pkt_pts", frame->pts);
print_time("pkt_pts_time", frame->pkt_pts, &stream->time_base); print_time("pkt_pts_time", frame->pts, &stream->time_base);
print_ts ("pkt_dts", frame->pkt_dts); print_ts ("pkt_dts", frame->pkt_dts);
print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base); print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
print_ts ("best_effort_timestamp", av_frame_get_best_effort_timestamp(frame)); print_ts ("best_effort_timestamp", av_frame_get_best_effort_timestamp(frame));
......
...@@ -132,7 +132,7 @@ static int video_decode_example(const char *input_filename) ...@@ -132,7 +132,7 @@ static int video_decode_example(const char *input_filename)
return number_of_written_bytes; return number_of_written_bytes;
} }
printf("%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, 0x%08lx\n", video_stream, printf("%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, 0x%08lx\n", video_stream,
fr->pkt_pts, fr->pkt_dts, av_frame_get_pkt_duration(fr), fr->pts, fr->pkt_dts, av_frame_get_pkt_duration(fr),
number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes)); number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes));
} }
av_packet_unref(&pkt); av_packet_unref(&pkt);
......
...@@ -129,23 +129,23 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream, ...@@ -129,23 +129,23 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream,
av_log(NULL, AV_LOG_ERROR, "Can't copy image to buffer\n"); av_log(NULL, AV_LOG_ERROR, "Can't copy image to buffer\n");
return number_of_written_bytes; return number_of_written_bytes;
} }
if ((fr->pkt_pts > ts_end) && (!no_seeking)) if ((fr->pts > ts_end) && (!no_seeking))
break; break;
crc = av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes); crc = av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes);
printf("%10"PRId64", 0x%08lx\n", fr->pkt_pts, crc); printf("%10"PRId64", 0x%08lx\n", fr->pts, crc);
if (no_seeking) { if (no_seeking) {
if (add_crc_to_array(crc, fr->pkt_pts) < 0) if (add_crc_to_array(crc, fr->pts) < 0)
return -1; return -1;
} }
else { else {
if (compare_crc_in_array(crc, fr->pkt_pts) < 0) if (compare_crc_in_array(crc, fr->pts) < 0)
return -1; return -1;
} }
} }
} }
av_packet_unref(&pkt); av_packet_unref(&pkt);
av_init_packet(&pkt); av_init_packet(&pkt);
} while ((!end_of_stream || got_frame) && (no_seeking || (fr->pkt_pts + av_frame_get_pkt_duration(fr) <= ts_end))); } while ((!end_of_stream || got_frame) && (no_seeking || (fr->pts + av_frame_get_pkt_duration(fr) <= ts_end)));
av_packet_unref(&pkt); av_packet_unref(&pkt);
av_freep(&byte_buffer); av_freep(&byte_buffer);
......
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