multimedia/replex: Fix Abort on decoding mpeg with clang builds

This commit is contained in:
Dirk Meyer 2022-04-25 10:43:29 +02:00
parent 991245fbdc
commit 6ff68a8504
4 changed files with 57 additions and 5 deletions

View File

@ -1,5 +1,6 @@
PORTNAME= replex
PORTVERSION= 0.1.6.8
PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= multimedia
MASTER_SITES= LOCAL/dinoex
@ -21,8 +22,6 @@ PORTDOCS= CHANGES README TODO
.endif
post-patch:
@${GREP} -lR "<stdint\.h>" ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} -e \
's|<stdint\.h>|<inttypes.h>|g'
@${REINPLACE_CMD} -e 's|-m32||' -e \
's|-L. -lreplex|libreplex.a $${LIBS}|g' ${WRKSRC}/Makefile

View File

@ -0,0 +1,15 @@
--- mpg_common.c.orig 2007-06-19 09:30:08 UTC
+++ mpg_common.c
@@ -73,8 +73,10 @@ void show_buf(uint8_t *buf, int length)
else if (Data[i+2+offset]==0 && Data[i+3+offset]==1) \
return i+1+offset; \
} \
- else if (x==1 && Data[i-1+offset]==0 && Data[i+offset]==0 && (i+offset)>0) \
- return i-1+offset; \
+ else if (x==1 && (i+offset)>0) { \
+ if (Data[i-1+offset]==0 && Data[i+offset]==0) \
+ return i-1+offset; \
+ } \
}
int FindPacketHeader(const uint8_t *Data, int s, int l)

View File

@ -1,6 +1,6 @@
--- pes.c.orig Sun Dec 28 17:57:19 2003
+++ pes.c Tue Jan 20 05:15:09 2004
@@ -26,6 +26,7 @@
--- pes.c.orig 2007-06-19 09:30:08 UTC
+++ pes.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdio.h>

View File

@ -0,0 +1,38 @@
--- replex.c.orig 2007-06-19 09:30:08 UTC
+++ replex.c
@@ -442,7 +442,7 @@ static int analyze_audio_loop( pes_in_t *p, struct rep
}
if( iu->err!= JUMP_ERR && !rx->keep_pts && diff > 40*CLOCK_MS){
- if (!rx->allow_jump || abs((int)diff) > rx->allow_jump){
+ if (!rx->allow_jump || labs((int)diff) > rx->allow_jump){
fprintf(stderr,"audio PTS inconsistent: ");
printpts(dpts);
printpts(iu->pts);
@@ -698,7 +698,7 @@ void analyze_video( pes_in_t *p, struct replex *rx, in
+ newpts);
if (rx->allow_jump &&
- abs(diff) > rx->allow_jump)
+ labs(diff) > rx->allow_jump)
{
if (audio_jump(rx)){
fprintf(stderr,"AUDIO JUMPED\n");
@@ -716,7 +716,7 @@ void analyze_video( pes_in_t *p, struct replex *rx, in
}
if (!rx->keep_pts &&
- abs((int)(diff)) > 3*SEC_PER/2){
+ labs((int)(diff)) > 3*SEC_PER/2){
fprintf(stderr,"video PTS inconsistent: ");
printpts(trans_pts_dts(p->pts));
printpts(iu->pts);
@@ -735,7 +735,7 @@ void analyze_video( pes_in_t *p, struct replex *rx, in
newdts +
rx->first_vpts);
if (!rx->keep_pts && !keep_now &&
- abs((int)diff) > 3*SEC_PER/2){
+ labs((int)diff) > 3*SEC_PER/2){
fprintf(stderr,"video DTS inconsistent: ");
printpts(trans_pts_dts(p->dts));
printpts(iu->dts);