Mercurial > mplayer.hg
comparison libmpdemux/mp3_hdr.c @ 4694:a21735031d6a
Audio file demuxer. Extended version for demuxer info.
genres.h come from id3edit of servex@servex.yi.org found
at http://id3edit.sourceforge.net/
author | albeu |
---|---|
date | Thu, 14 Feb 2002 13:04:35 +0000 |
parents | 67f2b1a92eb4 |
children | ef85f6de947c |
comparison
equal
deleted
inserted
replaced
4693:20d5cc87be20 | 4694:a21735031d6a |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 | 2 |
3 #include "config.h" | 3 #include "config.h" |
4 #include "../mp_msg.h" | |
4 | 5 |
5 //----------------------- mp3 audio frame header parser ----------------------- | 6 //----------------------- mp3 audio frame header parser ----------------------- |
6 | 7 |
7 static int tabsel_123[2][3][16] = { | 8 static int tabsel_123[2][3][16] = { |
8 { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,}, | 9 { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,}, |
30 | 31 |
31 #if 1 | 32 #if 1 |
32 // head_check: | 33 // head_check: |
33 if( (newhead & 0xffe00000) != 0xffe00000 || | 34 if( (newhead & 0xffe00000) != 0xffe00000 || |
34 (newhead & 0x0000fc00) == 0x0000fc00){ | 35 (newhead & 0x0000fc00) == 0x0000fc00){ |
35 printf("head_check failed\n"); | 36 mp_msg(MSGT_DEMUXER,MSGL_DBG2,"head_check failed\n"); |
36 return -1; | 37 return -1; |
37 } | 38 } |
38 #endif | 39 #endif |
39 | 40 |
40 if((4-((newhead>>17)&3))!=3){ printf("not layer-3\n"); return -1;} | 41 if((4-((newhead>>17)&3))!=3){ |
42 mp_msg(MSGT_DEMUXER,MSGL_DBG2,"not layer-3\n"); | |
43 return -1; | |
44 } | |
41 | 45 |
42 if( newhead & ((long)1<<20) ) { | 46 if( newhead & ((long)1<<20) ) { |
43 lsf = (newhead & ((long)1<<19)) ? 0x0 : 0x1; | 47 lsf = (newhead & ((long)1<<19)) ? 0x0 : 0x1; |
44 mpeg25 = 0; | 48 mpeg25 = 0; |
45 } else { | 49 } else { |
51 sampling_frequency = 6 + ((newhead>>10)&0x3); | 55 sampling_frequency = 6 + ((newhead>>10)&0x3); |
52 else | 56 else |
53 sampling_frequency = ((newhead>>10)&0x3) + (lsf*3); | 57 sampling_frequency = ((newhead>>10)&0x3) + (lsf*3); |
54 | 58 |
55 if(sampling_frequency>8){ | 59 if(sampling_frequency>8){ |
56 printf("invalid sampling_frequency\n"); | 60 mp_msg(MSGT_DEMUXER,MSGL_DBG2,"invalid sampling_frequency\n"); |
57 return -1; // valid: 0..8 | 61 return -1; // valid: 0..8 |
58 } | 62 } |
59 | 63 |
60 crc = ((newhead>>16)&0x1)^0x1; | 64 crc = ((newhead>>16)&0x1)^0x1; |
61 bitrate_index = ((newhead>>12)&0xf); | 65 bitrate_index = ((newhead>>12)&0xf); |
68 // fr->emphasis = newhead & 0x3; | 72 // fr->emphasis = newhead & 0x3; |
69 | 73 |
70 stereo = ( (((newhead>>6)&0x3)) == 3) ? 1 : 2; | 74 stereo = ( (((newhead>>6)&0x3)) == 3) ? 1 : 2; |
71 | 75 |
72 if(!bitrate_index){ | 76 if(!bitrate_index){ |
73 fprintf(stderr,"Free format not supported.\n"); | 77 mp_msg(MSGT_DEMUXER,MSGL_DBG2,"Free format not supported.\n"); |
74 return -1; | 78 return -1; |
75 } | 79 } |
76 | 80 |
77 if(lsf) | 81 if(lsf) |
78 ssize = (stereo == 1) ? 9 : 17; | 82 ssize = (stereo == 1) ? 9 : 17; |