ffmpeg: use GLib instead of log.h

This commit is contained in:
Max Kellermann 2008-11-21 20:13:41 +01:00
parent 4a3a621caf
commit f15fc4e99a
1 changed files with 11 additions and 8 deletions

View File

@ -17,7 +17,6 @@
*/ */
#include "../decoder_api.h" #include "../decoder_api.h"
#include "../log.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
@ -27,6 +26,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <glib.h>
#ifdef OLD_FFMPEG_INCLUDES #ifdef OLD_FFMPEG_INCLUDES
#include <avcodec.h> #include <avcodec.h>
@ -38,6 +38,9 @@
#include <libavformat/avio.h> #include <libavformat/avio.h>
#endif #endif
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "ffmpeg"
struct ffmpeg_context { struct ffmpeg_context {
int audio_stream; int audio_stream;
AVFormatContext *format_context; AVFormatContext *format_context;
@ -156,18 +159,18 @@ ffmpeg_helper(struct input_stream *input,
//ffmpeg works with ours "fileops" helper //ffmpeg works with ours "fileops" helper
if (av_open_input_file(&format_context, stream.url, NULL, 0, NULL) != 0) { if (av_open_input_file(&format_context, stream.url, NULL, 0, NULL) != 0) {
ERROR("Open failed!\n"); g_warning("Open failed\n");
return false; return false;
} }
if (av_find_stream_info(format_context)<0) { if (av_find_stream_info(format_context)<0) {
ERROR("Couldn't find stream info!\n"); g_warning("Couldn't find stream info\n");
return false; return false;
} }
audio_stream = ffmpeg_find_audio_stream(format_context); audio_stream = ffmpeg_find_audio_stream(format_context);
if (audio_stream == -1) { if (audio_stream == -1) {
ERROR("No audio stream inside!\n"); g_warning("No audio stream inside\n");
return false; return false;
} }
@ -175,12 +178,12 @@ ffmpeg_helper(struct input_stream *input,
codec = avcodec_find_decoder(codec_context->codec_id); codec = avcodec_find_decoder(codec_context->codec_id);
if (!codec) { if (!codec) {
ERROR("Unsupported audio codec!\n"); g_warning("Unsupported audio codec\n");
return false; return false;
} }
if (avcodec_open(codec_context, codec)<0) { if (avcodec_open(codec_context, codec)<0) {
ERROR("Could not open codec!\n"); g_warning("Could not open codec\n");
return false; return false;
} }
@ -219,7 +222,7 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
packet->data, packet->size); packet->data, packet->size);
if (len < 0) { if (len < 0) {
WARNING("skipping frame!\n"); g_message("skipping frame\n");
return decoder_get_command(decoder); return decoder_get_command(decoder);
} }
@ -330,7 +333,7 @@ static struct tag *ffmpeg_tag(const char *file)
bool ret; bool ret;
if (!input_stream_open(&input, file)) { if (!input_stream_open(&input, file)) {
ERROR("failed to open %s\n", file); g_warning("failed to open %s\n", file);
return NULL; return NULL;
} }