summaryrefslogtreecommitdiffstats
path: root/src/mpeg.c
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-10-30 16:28:27 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-10-30 16:28:27 +0100
commit804fe1979f9ed7bef7badaf0aa08e35e09874772 (patch)
tree93ae4728de598391ce6e72712676260831b0ecb2 /src/mpeg.c
parent128768f7fd719eb455a946a0f716d7128b4ded63 (diff)
downloaddabmux-804fe1979f9ed7bef7badaf0aa08e35e09874772.tar.gz
dabmux-804fe1979f9ed7bef7badaf0aa08e35e09874772.tar.bz2
dabmux-804fe1979f9ed7bef7badaf0aa08e35e09874772.zip
Add rudimentary file input
No nonblock support yet
Diffstat (limited to 'src/mpeg.c')
-rw-r--r--src/mpeg.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mpeg.c b/src/mpeg.c
index f7aed34..fb6591a 100644
--- a/src/mpeg.c
+++ b/src/mpeg.c
@@ -219,3 +219,29 @@ int readMpegFrame(int file, void* data, int size)
}
return framelength;
}
+
+int checkDabMpegFrame(void* data) {
+ mpegHeader* header = (mpegHeader*)data;
+ unsigned long* headerData = (unsigned long*)data;
+ if ((*headerData & 0x0f0ffcff) == 0x0004fcff) return 0;
+ if ((*headerData & 0x0f0ffcff) == 0x0004f4ff) return 0;
+ if (getMpegFrequency(header) != 48000) {
+ if (getMpegFrequency(header) != 24000) {
+ return MPEG_FREQUENCY;
+ }
+ }
+ if (header->padding != 0) {
+ return MPEG_PADDING;
+ }
+ if (header->copyright != 0) {
+ return MPEG_COPYRIGHT;
+ }
+ if (header->original != 0) {
+ return MPEG_ORIGINAL;
+ }
+ if (header->emphasis != 0) {
+ return MPEG_EMPHASIS;
+ }
+ return -1;
+}
+