diff options
Diffstat (limited to 'ffplay.c')
-rw-r--r-- | ffplay.c | 39 |
1 files changed, 27 insertions, 12 deletions
@@ -1,21 +1,21 @@ /* - * FFplay : Simple Media Player based on the Libav libraries + * FFplay : Simple Media Player based on the FFmpeg libraries * Copyright (c) 2003 Fabrice Bellard * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -31,6 +31,7 @@ #include "libavutil/imgutils.h" #include "libavutil/parseutils.h" #include "libavutil/samplefmt.h" +#include "libavutil/avassert.h" #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" @@ -208,8 +209,6 @@ typedef struct VideoState { char filename[1024]; int width, height, xleft, ytop; - PtsCorrectionContext pts_ctx; - #if CONFIG_AVFILTER AVFilterContext *out_video_filter; ///<the last filter in the video chain #endif @@ -1252,7 +1251,14 @@ retry: if (is->audio_st && is->video_st) av_diff = get_audio_clock(is) - get_video_clock(is); printf("%7.2f A-V:%7.3f s:%3.1f aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r", - get_master_clock(is), av_diff, FFMAX(is->skip_frames-1, 0), aqsize / 1024, vqsize / 1024, sqsize, is->pts_ctx.num_faulty_dts, is->pts_ctx.num_faulty_pts); + get_master_clock(is), + av_diff, + FFMAX(is->skip_frames-1, 0), + aqsize / 1024, + vqsize / 1024, + sqsize, + is->video_st ? is->video_st->codec->pts_correction_num_faulty_dts : 0, + is->video_st ? is->video_st->codec->pts_correction_num_faulty_pts : 0); fflush(stdout); last_time = cur_time; } @@ -1527,7 +1533,6 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke is->video_current_pos = -1; SDL_UnlockMutex(is->pictq_mutex); - init_pts_correction(&is->pts_ctx); is->frame_last_pts = AV_NOPTS_VALUE; is->frame_last_delay = 0; is->frame_timer = (double)av_gettime() / 1000000.0; @@ -1542,7 +1547,7 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke if (got_picture) { if (decoder_reorder_pts == -1) { - *pts = guess_correct_pts(&is->pts_ctx, frame->pkt_pts, frame->pkt_dts); + *pts = frame->best_effort_timestamp; } else if (decoder_reorder_pts) { *pts = frame->pkt_pts; } else { @@ -1578,6 +1583,8 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) int i, w, h, stride[4]; unsigned edge; + av_assert0(codec->flags & CODEC_FLAG_EMU_EDGE); + if (codec->codec->capabilities & CODEC_CAP_NEG_LINESIZES) perms |= AV_PERM_NEG_LINESIZES; @@ -1590,6 +1597,10 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) w = codec->width; h = codec->height; + + if(av_image_check_size(w, h, 0, codec)) + return -1; + avcodec_align_dimensions2(codec, &w, &h, stride); edge = codec->flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width(); w += edge << 1; @@ -1655,7 +1666,9 @@ static int input_init(AVFilterContext *ctx, const char *args, void *opaque) priv->is = opaque; codec = priv->is->video_st->codec; codec->opaque = ctx; - if(codec->codec->capabilities & CODEC_CAP_DR1) { + if((codec->codec->capabilities & CODEC_CAP_DR1) + ) { + codec->flags |= CODEC_FLAG_EMU_EDGE; priv->use_dr1 = 1; codec->get_buffer = input_get_buffer; codec->release_buffer = input_release_buffer; @@ -2564,11 +2577,12 @@ static int decode_thread(void *arg) goto fail; } } + eof=0; continue; } ret = av_read_frame(ic, pkt); if (ret < 0) { - if (ret == AVERROR_EOF || (ic->pb && ic->pb->eof_reached)) + if (ret == AVERROR_EOF || url_feof(ic->pb)) eof=1; if (ic->pb && ic->pb->error) break; @@ -3019,6 +3033,7 @@ static const OptionDef options[] = { #endif { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" }, { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, + { "i", OPT_DUMMY, {NULL}, "ffmpeg compatibility dummy option", ""}, { NULL, }, }; |