spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit fec011426884c5d7479fd8386c72b7786ab5bced
parent b9905f27e9b05712ef37a9ce10a2a5d120629708
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Tue, 10 Jul 2012 09:32:30 -0700

Don't use functions deprecated in ffmpeg-0.7.x

Diffstat:
Mconfigure.ac | 2+-
Msrc/spek-audio.c | 13++++++-------
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -16,7 +16,7 @@ AM_PROG_VALAC([0.12.0]) AC_PROG_INSTALL IT_PROG_INTLTOOL([0.35]) -pkg_modules="gtk+-2.0 >= 2.18.0 libavformat libavcodec >= 52.56.0 libavutil" +pkg_modules="gtk+-2.0 >= 2.18.0 libavformat >= 52.111 libavcodec >= 52.123 libavutil" PKG_CHECK_MODULES(SPEK, [$pkg_modules]) AC_SUBST(SPEK_CFLAGS) AC_SUBST(SPEK_LIBS) diff --git a/src/spek-audio.c b/src/spek-audio.c @@ -23,9 +23,8 @@ #include "spek-audio.h" void spek_audio_init () { - avcodec_init (); /* TODO: register only audio decoders */ - av_register_all (); + avcodec_register_all (); } SpekAudioContext * spek_audio_open (const gchar *file_name) { @@ -42,14 +41,14 @@ SpekAudioContext * spek_audio_open (const gchar *file_name) { cx->short_name = g_win32_locale_filename_from_utf8 (file_name); #endif - if (av_open_input_file (&cx->format_context, file_name, NULL, 0, NULL) != 0) { + if (avformat_open_input (&cx->format_context, file_name, NULL, NULL) != 0) { if (!cx->short_name || - av_open_input_file (&cx->format_context, cx->short_name, NULL, 0, NULL) != 0 ) { + avformat_open_input (&cx->format_context, cx->short_name, NULL, NULL) != 0 ) { cx->error = _("Cannot open input file"); return cx; } } - if (av_find_stream_info (cx->format_context) < 0) { + if (avformat_find_stream_info (cx->format_context, NULL) < 0) { /* 24-bit APE returns an error but parses the stream info just fine */ if (cx->format_context->nb_streams <= 0) { cx->error = _("Cannot find stream info"); @@ -96,7 +95,7 @@ SpekAudioContext * spek_audio_open (const gchar *file_name) { cx->error = _("No audio channels"); return cx; } - if (avcodec_open (cx->codec_context, cx->codec) < 0) { + if (avcodec_open2 (cx->codec_context, cx->codec, NULL) < 0) { cx->error = _("Cannot open decoder"); return cx; } @@ -211,7 +210,7 @@ void spek_audio_close (SpekAudioContext *cx) { avcodec_close (cx->codec_context); } if (cx->format_context != NULL) { - av_close_input_file (cx->format_context); + avformat_close_input (&cx->format_context); } g_free (cx); }