From 88be8505a9a61ed9de288dfbb486c815b440ef36 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Mon, 14 Jan 2013 10:22:10 -0800 Subject: [PATCH] vrplayer: fix for building with older ffmpeg --- xrdpvr/xrdpvr.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/xrdpvr/xrdpvr.c b/xrdpvr/xrdpvr.c index 8a63dbed..9c49979a 100644 --- a/xrdpvr/xrdpvr.c +++ b/xrdpvr/xrdpvr.c @@ -95,7 +95,8 @@ xrdpvr_deinit_player(void *channel, int stream_id) av_free(g_psi.frame); avcodec_close(g_psi.p_audio_codec_ctx); avcodec_close(g_psi.p_video_codec_ctx); - avformat_close_input(&g_psi.p_format_ctx); + //avformat_close_input(&g_psi.p_format_ctx); + av_close_input_file(g_psi.p_format_ctx); /* do remote cleanup */ @@ -141,14 +142,16 @@ xrdpvr_play_media(void *channel, int stream_id, char *filename) av_register_all(); /* open media file - this will read just the header */ - if (avformat_open_input(&g_psi.p_format_ctx, filename, NULL, NULL)) + //if (avformat_open_input(&g_psi.p_format_ctx, filename, NULL, NULL)) + if (av_open_input_file(&g_psi.p_format_ctx, filename, NULL, 0, NULL)) { printf("ERROR opening %s\n", filename); return -1; } /* now get the real stream info */ - if (avformat_find_stream_info(g_psi.p_format_ctx, NULL) < 0) + //if (avformat_find_stream_info(g_psi.p_format_ctx, NULL) < 0) + if (av_find_stream_info(g_psi.p_format_ctx) < 0) { printf("ERRRO reading stream info\n"); return -1; @@ -179,7 +182,8 @@ xrdpvr_play_media(void *channel, int stream_id, char *filename) { /* close file and return with error */ printf("ERROR: no audio/video stream found in %s\n", filename); - avformat_close_input(&g_psi.p_format_ctx); + //avformat_close_input(&g_psi.p_format_ctx); + av_close_input_file(g_psi.p_format_ctx); return -1; } @@ -207,16 +211,18 @@ xrdpvr_play_media(void *channel, int stream_id, char *filename) } /* open decoder for audio stream */ - if (avcodec_open2(g_psi.p_audio_codec_ctx, g_psi.p_audio_codec, - NULL) < 0) + //if (avcodec_open2(g_psi.p_audio_codec_ctx, g_psi.p_audio_codec, + // NULL) < 0) + if (avcodec_open(g_psi.p_audio_codec_ctx, g_psi.p_audio_codec) < 0) { printf("ERROR: could not open audio decoder\n"); return -1; } /* open decoder for video stream */ - if (avcodec_open2(g_psi.p_video_codec_ctx, g_psi.p_video_codec, - NULL) < 0) + //if (avcodec_open2(g_psi.p_video_codec_ctx, g_psi.p_video_codec, + // NULL) < 0) + if (avcodec_open(g_psi.p_video_codec_ctx, g_psi.p_video_codec) < 0) { printf("ERROR: could not open video decoder\n"); return -1;