Skip to content

Commit 4d9e2a6

Browse files
committed
Remove warnings from ffplay
1 parent 314fdd8 commit 4d9e2a6

File tree

1 file changed

+48
-36
lines changed

1 file changed

+48
-36
lines changed

Tools/video/ffplay.m

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@
310310
int last_video_stream, last_audio_stream, last_subtitle_stream;
311311

312312
SDL_cond *continue_read_thread;
313+
314+
// GNUstep additions..
315+
NSData *data;
316+
313317
} VideoState;
314318

315319
/* options specified by the user */
@@ -401,6 +405,7 @@
401405
{ AV_PIX_FMT_NONE, SDL_PIXELFORMAT_UNKNOWN },
402406
};
403407

408+
/*
404409
#if CONFIG_AVFILTER
405410
static int opt_add_vfilter(void *optctx, const char *opt, const char *arg)
406411
{
@@ -409,6 +414,7 @@ static int opt_add_vfilter(void *optctx, const char *opt, const char *arg)
409414
return 0;
410415
}
411416
#endif
417+
*/
412418

413419
static inline
414420
int cmp_audio_fmts(enum AVSampleFormat fmt1, int64_t channel_count1,
@@ -605,30 +611,33 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
605611
return -1;
606612

607613
switch (d->avctx->codec_type) {
608-
case AVMEDIA_TYPE_VIDEO:
609-
ret = avcodec_receive_frame(d->avctx, frame);
610-
if (ret >= 0) {
611-
if (decoder_reorder_pts == -1) {
612-
frame->pts = frame->best_effort_timestamp;
613-
} else if (!decoder_reorder_pts) {
614-
frame->pts = frame->pkt_dts;
615-
}
616-
}
617-
break;
618-
case AVMEDIA_TYPE_AUDIO:
619-
ret = avcodec_receive_frame(d->avctx, frame);
620-
if (ret >= 0) {
621-
AVRational tb = (AVRational){1, frame->sample_rate};
622-
if (frame->pts != AV_NOPTS_VALUE)
623-
frame->pts = av_rescale_q(frame->pts, d->avctx->pkt_timebase, tb);
624-
else if (d->next_pts != AV_NOPTS_VALUE)
625-
frame->pts = av_rescale_q(d->next_pts, d->next_pts_tb, tb);
626-
if (frame->pts != AV_NOPTS_VALUE) {
627-
d->next_pts = frame->pts + frame->nb_samples;
628-
d->next_pts_tb = tb;
629-
}
630-
}
631-
break;
614+
case AVMEDIA_TYPE_VIDEO:
615+
ret = avcodec_receive_frame(d->avctx, frame);
616+
if (ret >= 0) {
617+
if (decoder_reorder_pts == -1) {
618+
frame->pts = frame->best_effort_timestamp;
619+
} else if (!decoder_reorder_pts) {
620+
frame->pts = frame->pkt_dts;
621+
}
622+
}
623+
break;
624+
case AVMEDIA_TYPE_AUDIO:
625+
ret = avcodec_receive_frame(d->avctx, frame);
626+
if (ret >= 0) {
627+
AVRational tb = (AVRational){1, frame->sample_rate};
628+
if (frame->pts != AV_NOPTS_VALUE)
629+
frame->pts = av_rescale_q(frame->pts, d->avctx->pkt_timebase, tb);
630+
else if (d->next_pts != AV_NOPTS_VALUE)
631+
frame->pts = av_rescale_q(d->next_pts, d->next_pts_tb, tb);
632+
if (frame->pts != AV_NOPTS_VALUE) {
633+
d->next_pts = frame->pts + frame->nb_samples;
634+
d->next_pts_tb = tb;
635+
}
636+
}
637+
break;
638+
default:
639+
NSLog(@"Unknown codec type");
640+
break;
632641
}
633642
if (ret == AVERROR_EOF) {
634643
d->finished = d->pkt_serial;
@@ -1464,8 +1473,8 @@ static double get_master_clock(VideoState *is)
14641473
}
14651474

14661475
static void check_external_clock_speed(VideoState *is) {
1467-
if (is->video_stream >= 0 && is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES ||
1468-
is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) {
1476+
if ((is->video_stream >= 0 && is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) ||
1477+
(is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES)) {
14691478
set_clock_speed(&is->extclk, FFMAX(EXTERNAL_CLOCK_SPEED_MIN, is->extclk.speed - EXTERNAL_CLOCK_SPEED_STEP));
14701479
} else if ((is->video_stream < 0 || is->videoq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES) &&
14711480
(is->audio_stream < 0 || is->audioq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES)) {
@@ -2605,9 +2614,10 @@ static int stream_component_open(VideoState *is, int stream_index)
26052614
codec = avcodec_find_decoder(avctx->codec_id);
26062615

26072616
switch(avctx->codec_type){
2608-
case AVMEDIA_TYPE_AUDIO : is->last_audio_stream = stream_index; forced_codec_name = audio_codec_name; break;
2609-
case AVMEDIA_TYPE_SUBTITLE: is->last_subtitle_stream = stream_index; forced_codec_name = subtitle_codec_name; break;
2610-
case AVMEDIA_TYPE_VIDEO : is->last_video_stream = stream_index; forced_codec_name = video_codec_name; break;
2617+
case AVMEDIA_TYPE_AUDIO : is->last_audio_stream = stream_index; forced_codec_name = audio_codec_name; break;
2618+
case AVMEDIA_TYPE_SUBTITLE: is->last_subtitle_stream = stream_index; forced_codec_name = subtitle_codec_name; break;
2619+
case AVMEDIA_TYPE_VIDEO : is->last_video_stream = stream_index; forced_codec_name = video_codec_name; break;
2620+
default: NSLog(@"Unknown codec type"); break;
26112621
}
26122622
if (forced_codec_name)
26132623
codec = avcodec_find_decoder_by_name(forced_codec_name);
@@ -2736,10 +2746,10 @@ static int decode_interrupt_cb(void *ctx)
27362746
}
27372747

27382748
static int stream_has_enough_packets(AVStream *st, int stream_id, PacketQueue *queue) {
2739-
return stream_id < 0 ||
2740-
queue->abort_request ||
2741-
(st->disposition & AV_DISPOSITION_ATTACHED_PIC) ||
2742-
queue->nb_packets > MIN_FRAMES && (!queue->duration || av_q2d(st->time_base) * queue->duration > 1.0);
2749+
return stream_id < 0 ||
2750+
queue->abort_request ||
2751+
(st->disposition & AV_DISPOSITION_ATTACHED_PIC) ||
2752+
(queue->nb_packets > MIN_FRAMES && (!queue->duration || av_q2d(st->time_base) * queue->duration > 1.0));
27432753
}
27442754

27452755
static int is_realtime(AVFormatContext *s)
@@ -3226,7 +3236,7 @@ static void toggle_audio_display(VideoState *is)
32263236
int next = is->show_mode;
32273237
do {
32283238
next = (next + 1) % SHOW_MODE_NB;
3229-
} while (next != is->show_mode && (next == SHOW_MODE_VIDEO && !is->video_st || next != SHOW_MODE_VIDEO && !is->audio_st));
3239+
} while (next != is->show_mode && ((next == SHOW_MODE_VIDEO && !is->video_st) || (next != SHOW_MODE_VIDEO && !is->audio_st)));
32303240
if (is->show_mode != next) {
32313241
is->force_refresh = 1;
32323242
is->show_mode = next;
@@ -3477,6 +3487,7 @@ static void event_loop(VideoState *cur_stream)
34773487
}
34783488
}
34793489

3490+
/*
34803491
static int opt_frame_size(void *optctx, const char *opt, const char *arg)
34813492
{
34823493
av_log(NULL, AV_LOG_WARNING, "Option -s is deprecated, use -video_size.\n");
@@ -3681,6 +3692,7 @@ void show_help_default(const char *opt, const char *arg)
36813692
"left double-click toggle full screen\n"
36823693
);
36833694
}
3695+
*/
36843696

36853697
/* Called from the main */
36863698
int video_main(NSMovie *movie, NSMovieView *view) //(int argc, char **argv)
@@ -3707,9 +3719,9 @@ int video_main(NSMovie *movie, NSMovieView *view) //(int argc, char **argv)
37073719
// show_banner(argc, argv, options);
37083720

37093721
// parse_options(NULL, argc, argv, options, opt_input_file);
3710-
input_filename = [[[NSMovie URL] path] cString];
3722+
input_filename = [[[movie URL] path] cString];
37113723
if (!input_filename) {
3712-
show_usage();
3724+
// show_usage();
37133725
av_log(NULL, AV_LOG_FATAL, "An input file must be specified\n");
37143726
av_log(NULL, AV_LOG_FATAL,
37153727
"Use -h to get full help or, even better, run 'man %s'\n", program_name);

0 commit comments

Comments
 (0)