Permalink
Browse files

Adding a program to show a dump of ebu stl files

  • Loading branch information...
1 parent a7875db commit 2d11d90c95e1d340a36bed030a70cb64a4286c6e Quentin committed Apr 10, 2012
Showing with 107 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +5 −1 makefile
  3. +5 −3 source/ebu.c
  4. +1 −1 source/ebu.h
  5. +95 −0 source/ebu_dump.c
View
@@ -1,3 +1,4 @@
*.exe
*.o
*.stl
+*.mxf
View
@@ -1,6 +1,10 @@
VPATH=src:source
-all: ebu_shift
+all: ebu_shift ebu_dump
+
+ebu_dump: ebu_dump.o ebu.o
+ mkdir -p bin
+ gcc -o bin/ebu_dump ebu_dump.o ebu.o
ebu_shift: ebu_shift.o ebu.o
mkdir -p bin
View
@@ -5,17 +5,19 @@
struct EBU* parseEBU(FILE* f){
- struct EBU* ebu;
+ struct EBU* ebu = malloc(sizeof(struct EBU));
fread(&(ebu->gsi), 1024, 1, f);
unsigned char TNB[6];
strncpy(TNB,ebu->gsi.TNB,5);
TNB[5] = '\0';
int nTNB = atoi(TNB);
-
+
+ //printf("TNB : : %d \n",nTNB);
+
ebu->tti = (struct EBU_TTI*) malloc(sizeof(struct EBU_TTI) * nTNB);
- fread(ebu->tti, 128, nTNB, f);
+ fread(ebu->tti, sizeof(struct EBU_TTI), nTNB, f);
return ebu;
}
View
@@ -20,7 +20,7 @@ struct EBU_GSI{
unsigned char TNG[3];
unsigned char MNC[2];
unsigned char MNR[2];
- unsigned char TCS[1];
+ unsigned char TCS;
unsigned char TCP[8]; //Timecode formatted as HHMMSSFF
unsigned char TCF[8]; //idem
unsigned char TND;
View
@@ -0,0 +1,95 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "ebu.h"
+
+void dumpTTI(const struct EBU_TTI* tti){
+ printf("SGN: %hX\n",tti->SGN);
+ printf("SN : %02hX%02hX\n",tti->SN[1],tti->SN[0]);
+ printf("EBN: %hX\n",tti->EBN);
+ printf("CS : %hX\n",tti->CS);
+ printf("TCI: %02d:%02d:%02d:%02d\n",tti->TCI.hours,tti->TCI.minutes,tti->TCI.seconds,tti->TCI.frames);
+ printf("TCO: %02d:%02d:%02d:%02d\n",tti->TCO.hours,tti->TCO.minutes,tti->TCO.seconds,tti->TCO.frames);
+ printf("VP : %hX\n",tti->VP);
+ printf("JC : %hX\n",tti->JC);
+ printf("CF : %hX\n",tti->CF);
+ printf("TF : %.112s\n",tti->TF);
+}
+
+int main(int argc, const char** argv) {
+ char * output = NULL;
+ int full = 0;
+ int i = 0;
+ for (i = 1; i < argc; ++i)
+ {
+ if(!strcmp(argv[i],"-f")){
+ full = 1;
+ }
+ else{
+ output = argv[i];
+ }
+ }
+
+ if(output == NULL){
+ if(output == NULL)
+ printf("no output set\n");
+ printf("Usage: %s input.stl",argv[0]);
+ return 0;
+ }
+
+ FILE* source = fopen(output,"r");
+ if(source == NULL){
+ printf("Error: Source not loaded\n");
+ fclose(source);
+ return 1;
+ }
+
+ struct EBU* ebu = parseEBU(source);
+ fclose(source);
+
+
+ printf("CPN: %.3s\n",ebu->gsi.CPN);
+ printf("DFC: %.8s\n",ebu->gsi.DFC);
+ printf("DSC: %c\n",ebu->gsi.DSC);
+ printf("CCT: %.2s\n",ebu->gsi.CCT);
+ printf("LC : %.2s\n",ebu->gsi.LC);
+ printf("OPT: %.32s\n",ebu->gsi.OPT);
+ printf("OET: %.32s\n",ebu->gsi.OET);
+ printf("TPT: %.32s\n",ebu->gsi.TPT);
+ printf("TET: %.32s\n",ebu->gsi.TET);
+ printf("TN : %.32s\n",ebu->gsi.TN);
+ printf("TCD: %.32s\n",ebu->gsi.TCD);
+ printf("SLR: %.16s\n",ebu->gsi.SLR);
+ printf("CD : %.6s\n",ebu->gsi.CD);
+ printf("RD : %.6s\n",ebu->gsi.RD);
+ printf("RN : %.2s\n",ebu->gsi.RN);
+ printf("TNB: %.6s\n",ebu->gsi.TNB);
+ printf("TNS: %.5s\n",ebu->gsi.TNS);
+ printf("TNG: %.3s\n",ebu->gsi.TNG);
+ printf("MNC: %.2s\n",ebu->gsi.MNC);
+ printf("MNR: %.2s\n",ebu->gsi.MNR);
+ printf("TCS: %hX\n",ebu->gsi.TCS);
+ printf("TCP: %.8s\n",ebu->gsi.TCP);
+ printf("TCF: %.8s\n",ebu->gsi.TCF);
+ printf("TND: %hX\n",ebu->gsi.TND);
+ printf("DSN: %hX\n",ebu->gsi.DSN);
+ printf("CO : %.3s\n",ebu->gsi.CO);
+ printf("PUB: %.32s\n",ebu->gsi.PUB);
+ printf("EN : %.32s\n",ebu->gsi.EN);
+ printf("ECD: %.32s\n",ebu->gsi.ECD);
+
+ if(full == 1){
+ char TNB[6];
+ strncpy(TNB,ebu->gsi.TNB,5);
+ TNB[5] = '\0';
+ int nTNB = atoi(TNB);
+ printf("%d\n",nTNB);
+ for(i = 0; i < nTNB; i++){
+ dumpTTI(&(ebu->tti[i]));
+ }
+ }
+
+ free(ebu);
+
+ return 0;
+}

0 comments on commit 2d11d90

Please sign in to comment.