* Fix compiling issues with some ffmpeg/libav versions.

This commit is contained in:
Justin Maggard 2011-07-13 18:47:57 +00:00
parent eff8bf22db
commit 88b253968f
2 changed files with 12 additions and 9 deletions

View File

@ -53,11 +53,10 @@
#define FF_PROFILE_H264_HIGH 100 #define FF_PROFILE_H264_HIGH 100
#endif #endif
#define FF_PROFILE_SKIP -100 #define FF_PROFILE_SKIP -100
#ifndef CODEC_TYPE_AUDIO
#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO #if LIBAVCODEC_VERSION_MAJOR < 53
#endif #define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
#ifndef CODEC_TYPE_VIDEO #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO
#endif #endif
#define FLAG_TITLE 0x00000001 #define FLAG_TITLE 0x00000001
@ -663,7 +662,11 @@ GetVideoMetadata(const char * path, char * name)
//DEBUG DPRINTF(E_DEBUG, L_METADATA, " * size: %jd\n", file.st_size); //DEBUG DPRINTF(E_DEBUG, L_METADATA, " * size: %jd\n", file.st_size);
av_register_all(); av_register_all();
#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)
if( avformat_open_input(&ctx, path, NULL, NULL) != 0 )
#else
if( av_open_input_file(&ctx, path, NULL, 0, NULL) != 0 ) if( av_open_input_file(&ctx, path, NULL, 0, NULL) != 0 )
#endif
{ {
DPRINTF(E_WARN, L_METADATA, "Opening %s failed!\n", path); DPRINTF(E_WARN, L_METADATA, "Opening %s failed!\n", path);
return 0; return 0;
@ -673,14 +676,14 @@ GetVideoMetadata(const char * path, char * name)
for( i=0; i<ctx->nb_streams; i++) for( i=0; i<ctx->nb_streams; i++)
{ {
if( audio_stream == -1 && if( audio_stream == -1 &&
ctx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO ) ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO )
{ {
audio_stream = i; audio_stream = i;
ac = ctx->streams[audio_stream]->codec; ac = ctx->streams[audio_stream]->codec;
continue; continue;
} }
else if( video_stream == -1 && else if( video_stream == -1 &&
ctx->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO ) ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
{ {
video_stream = i; video_stream = i;
vc = ctx->streams[video_stream]->codec; vc = ctx->streams[video_stream]->codec;

View File

@ -36,7 +36,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
uint32_t len; uint32_t len;
unsigned char hdr[12]; unsigned char hdr[12];
unsigned char fmt[16]; unsigned char fmt[16];
uint32_t chunk_data_length; //uint32_t chunk_data_length;
uint32_t format_data_length = 0; uint32_t format_data_length = 0;
uint32_t compression_code = 0; uint32_t compression_code = 0;
uint32_t channel_count = 0; uint32_t channel_count = 0;
@ -75,7 +75,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
return -1; return -1;
} }
chunk_data_length = GET_WAV_INT32(hdr + 4); //chunk_data_length = GET_WAV_INT32(hdr + 4);
/* now, walk through the chunks */ /* now, walk through the chunks */
current_offset = 12; current_offset = 12;