openbsd-ports/multimedia/minidlna/patches/patch-metadata_c

52 lines
1.8 KiB
Plaintext

$OpenBSD: patch-metadata_c,v 1.2 2013/03/15 17:15:24 sthen Exp $
--- metadata.c.orig Fri Jun 29 22:11:29 2012
+++ metadata.c Fri Mar 15 16:53:09 2013
@@ -19,6 +19,7 @@
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
+#include <libgen.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -30,9 +31,7 @@
#include "image_utils.h"
#include <jpeglib.h>
#include <setjmp.h>
-#include <avutil.h>
-#include <avcodec.h>
-#include <avformat.h>
+#include "libav.h"
#include "tagutils/tagutils.h"
#include "upnpglobalvars.h"
@@ -117,14 +116,6 @@ lav_close(AVFormatContext *ctx)
#endif
}
-#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(31<<8)+0)
-# if LIBAVUTIL_VERSION_INT < ((51<<16)+(5<<8)+0)
-#define AV_DICT_IGNORE_SUFFIX AV_METADATA_IGNORE_SUFFIX
-#define av_dict_get av_metadata_get
-typedef AVMetadataTag AVDictionaryEntry;
-# endif
-#endif
-
/* This function shamelessly copied from libdlna */
#define MPEG_TS_SYNC_CODE 0x47
#define MPEG_TS_PACKET_LENGTH 188
@@ -1024,8 +1015,11 @@ GetVideoMetadata(const char * path, char * name)
vc->height * vc->sample_aspect_ratio.den,
1024*1024);
}
- fps = ctx->streams[video_stream]->r_frame_rate.num / ctx->streams[video_stream]->r_frame_rate.den;
- interlaced = (ctx->streams[video_stream]->r_frame_rate.num / vc->time_base.den);
+ if (ctx->streams[video_stream]->r_frame_rate.den)
+ fps = ctx->streams[video_stream]->r_frame_rate.num / ctx->streams[video_stream]->r_frame_rate.den;
+ else
+ fps = 0;
+ interlaced = vc->time_base.den ? (ctx->streams[video_stream]->r_frame_rate.num / vc->time_base.den) : 0;
if( ((((vc->width == 1920 || vc->width == 1440) && vc->height == 1080) ||
(vc->width == 720 && vc->height == 480)) && fps == 59 && interlaced) ||
((vc->width == 1280 && vc->height == 720) && fps == 59 && !interlaced) )