ref: 079f7c650735d150aec2a00630b7958915815095
parent: af3ee88f832efb3a4e88101fa3e623108c575ff8
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Jan 21 05:14:20 EST 2021
h264: dump a chunk of frame that failed to decode
--- a/decoder_h264.c
+++ b/decoder_h264.c
@@ -212,8 +212,9 @@
lasttimestamp = 0;
start = nanosec();
for(res = 0, framenum = 0; res >= 0 && (res = Sread(d->s, &sf)) == 0 && sf.sz > 0; framenum++){
+ fprint(2, "%d %.*H\n", framenum, MIN(32, sf.sz), sf.buf);
if((res = WelsDecodeBs(&a->ctx, sf.buf, sf.sz, a->data, &a->info, nil)) != 0){
- werrstr("%s on frame %llud", err2s(res), framenum);
+ werrstr("%s on frame %llud: %.*H", err2s(res), framenum, MIN(32, sf.sz), sf.buf);
break;
}
if(a->info.iBufferStatus == 0)
--- a/main.c
+++ b/main.c
@@ -176,6 +176,9 @@
[Cnum] = { nil, nil, CHANEND },
};
+ quotefmtinstall();
+ fmtinstall('H', encodefmt);
+
debug = 0;
audio = nil;
ARGBEGIN{
--- a/misc.h
+++ b/misc.h
@@ -1,11 +1,10 @@
+#define MAX(a,b) ((a)>(b)?(a):(b))
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
int str2fmt(char *s);
char *fmt2str(int fmt);
uvlong nanosec(void);
-void yuv420_rgb24(
- int width, int height,
- u8int *y, u8int *u, u8int *v,
- u32int ystride, u32int uvstride,
- u8int *rgb, u32int rgbstride);
+void yuv420_rgb24(int width, int height, u8int *y, u8int *u, u8int *v, u32int ystride, u32int uvstride, u8int *rgb, u32int rgbstride);
extern int nproc;
extern int debug;