comparison libmpdemux/demux_real.c @ 8094:b8a90a2af611

- realaudio ATRC (sony atrac3) codec support - fixed passing of codecdata from demuxer to codec patch by Fabian Franz <FabianFranz@gmx.de>
author arpi
date Mon, 04 Nov 2002 00:23:53 +0000
parents b9da278e4c92
children cb4c507c69aa
comparison
equal deleted inserted replaced
8093:916d8b7fa6ed 8094:b8a90a2af611
6 Based on FFmpeg's libav/rm.c. 6 Based on FFmpeg's libav/rm.c.
7 7
8 TODO: fix the whole syncing mechanism 8 TODO: fix the whole syncing mechanism
9 9
10 $Log$ 10 $Log$
11 Revision 1.30 2002/11/04 00:23:53 arpi
12 - realaudio ATRC (sony atrac3) codec support
13 - fixed passing of codecdata from demuxer to codec
14 patch by Fabian Franz <FabianFranz@gmx.de>
15
11 Revision 1.29 2002/11/01 17:46:43 arpi 16 Revision 1.29 2002/11/01 17:46:43 arpi
12 verbose can be negative 17 verbose can be negative
13 18
14 Revision 1.28 2002/10/10 23:24:15 arpi 19 Revision 1.28 2002/10/10 23:24:15 arpi
15 stream selection cleanup, fixed -nosound 20 stream selection cleanup, fixed -nosound
900 int frame_size; 905 int frame_size;
901 int sub_packet_size; 906 int sub_packet_size;
902 int sub_packet_h; 907 int sub_packet_h;
903 int version; 908 int version;
904 int flavor; 909 int flavor;
910 int coded_frame_size;
911 int codecdata_length;
905 912
906 mp_msg(MSGT_DEMUX,MSGL_V,"Found audio stream!\n"); 913 mp_msg(MSGT_DEMUX,MSGL_V,"Found audio stream!\n");
907 version = stream_read_word(demuxer->stream); 914 version = stream_read_word(demuxer->stream);
908 mp_msg(MSGT_DEMUX,MSGL_V,"version: %d\n", version); 915 mp_msg(MSGT_DEMUX,MSGL_V,"version: %d\n", version);
909 // stream_skip(demuxer->stream, 2); /* version (4 or 5) */ 916 // stream_skip(demuxer->stream, 2); /* version (4 or 5) */
911 stream_skip(demuxer->stream, 4); /* .ra4 or .ra5 */ 918 stream_skip(demuxer->stream, 4); /* .ra4 or .ra5 */
912 stream_skip(demuxer->stream, 4); // ??? 919 stream_skip(demuxer->stream, 4); // ???
913 stream_skip(demuxer->stream, 2); /* version (4 or 5) */ 920 stream_skip(demuxer->stream, 2); /* version (4 or 5) */
914 stream_skip(demuxer->stream, 4); // header size == 0x4E 921 stream_skip(demuxer->stream, 4); // header size == 0x4E
915 flavor = stream_read_word(demuxer->stream);/* codec flavor id */ 922 flavor = stream_read_word(demuxer->stream);/* codec flavor id */
916 stream_skip(demuxer->stream, 4); /* coded frame size */ 923 coded_frame_size = stream_read_dword(demuxer->stream);/* needed by codec */
924 //stream_skip(demuxer->stream, 4); /* coded frame size */
917 stream_skip(demuxer->stream, 4); // big number 925 stream_skip(demuxer->stream, 4); // big number
918 stream_skip(demuxer->stream, 4); // bigger number 926 stream_skip(demuxer->stream, 4); // bigger number
919 stream_skip(demuxer->stream, 4); // 2 || -''- 927 stream_skip(demuxer->stream, 4); // 2 || -''-
920 // stream_skip(demuxer->stream, 2); // 0x10 928 // stream_skip(demuxer->stream, 2); // 0x10
921 sub_packet_h = stream_read_word(demuxer->stream); 929 sub_packet_h = stream_read_word(demuxer->stream);
959 sh->wf->nAvgBytesPerSec = bitrate; 967 sh->wf->nAvgBytesPerSec = bitrate;
960 sh->wf->nBlockAlign = frame_size; 968 sh->wf->nBlockAlign = frame_size;
961 sh->wf->cbSize = 0; 969 sh->wf->cbSize = 0;
962 sh->format = MKTAG(buf[0], buf[1], buf[2], buf[3]); 970 sh->format = MKTAG(buf[0], buf[1], buf[2], buf[3]);
963 971
972 switch (sh->format){
973 case MKTAG('d', 'n', 'e', 't'):
974 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: DNET (AC3 with low-bitrate extension)\n");
975 break;
976 case MKTAG('s', 'i', 'p', 'r'):
977 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: SiproLab's ACELP.net\n");
978 break;
979 case MKTAG('c', 'o', 'o', 'k'):
980 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: Real's GeneralCooker (?) (RealAudio G2?) (unsupported)\n");
981 break;
982 case MKTAG('a', 't', 'r', 'c'):
983 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: Sony ATRAC3 (RealAudio 8) (unsupported)\n");
984 break;
985 default:
986 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: Unknown (%s)\n", buf);
987 }
988
964 switch (sh->format) 989 switch (sh->format)
965 { 990 {
966 case MKTAG('d', 'n', 'e', 't'): 991 case MKTAG('d', 'n', 'e', 't'):
967 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: DNET -> AC3\n"); 992 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: DNET -> AC3\n");
968 sh->format = 0x2000; 993 sh->format = 0x2000;
969 break; 994 break;
970 case MKTAG('s', 'i', 'p', 'r'): 995 case MKTAG('s', 'i', 'p', 'r'):
971 #if 0 996 #if 0
972 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: SiproLab's ACELP.net\n");
973 sh->format = 0x130; 997 sh->format = 0x130;
974 /* for buggy directshow loader */ 998 /* for buggy directshow loader */
975 sh->wf->cbSize = 4; 999 sh->wf->cbSize = 4;
976 sh->wf = realloc(sh->wf, sizeof(WAVEFORMATEX)+sh->wf->cbSize); 1000 sh->wf = realloc(sh->wf, sizeof(WAVEFORMATEX)+sh->wf->cbSize);
977 sh->wf->wBitsPerSample = 0; 1001 sh->wf->wBitsPerSample = 0;
987 // sh->wf[sizeof(WAVEFORMATEX)+2] = 1; 1011 // sh->wf[sizeof(WAVEFORMATEX)+2] = 1;
988 // sh->wf[sizeof(WAVEFORMATEX)+3] = 1; 1012 // sh->wf[sizeof(WAVEFORMATEX)+3] = 1;
989 // sh->wf[sizeof(WAVEFORMATEX)+4] = 0; 1013 // sh->wf[sizeof(WAVEFORMATEX)+4] = 0;
990 break; 1014 break;
991 #endif 1015 #endif
1016 case MKTAG('a', 't', 'r', 'c'):
1017 #if 0
1018 sh->format = 0x270;
1019 /* 14 bytes extra header needed ! */
1020 sh->wf->cbSize = 14;
1021 sh->wf = realloc(sh->wf, sizeof(WAVEFORMATEX)+sh->wf->cbSize);
1022 sh->wf->nAvgBytesPerSec = 16537; // 8268
1023 sh->wf->nBlockAlign = 384; // 192
1024 sh->wf->wBitsPerSample = 0; /* from AVI created by VirtualDub */
1025 break;
1026 #endif
992 case MKTAG('c', 'o', 'o', 'k'): 1027 case MKTAG('c', 'o', 'o', 'k'):
993 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: Real's GeneralCooker (?) (RealAudio G2?) (unsupported)\n"); 1028 // realaudio codec plugins - common:
994 sh->wf->cbSize = 4+2+24; 1029 // sh->wf->cbSize = 4+2+24;
1030 stream_skip(demuxer->stream,3); // Skip 3 unknown bytes
1031 if (version==5)
1032 stream_skip(demuxer->stream,1); // Skip 1 additional unknown byte
1033 codecdata_length=stream_read_dword(demuxer->stream);
1034 sh->wf->cbSize = 10+codecdata_length;
995 sh->wf = realloc(sh->wf, sizeof(WAVEFORMATEX)+sh->wf->cbSize); 1035 sh->wf = realloc(sh->wf, sizeof(WAVEFORMATEX)+sh->wf->cbSize);
996 ((short*)(sh->wf+1))[0]=sub_packet_size; 1036 ((short*)(sh->wf+1))[0]=sub_packet_size;
997 ((short*)(sh->wf+1))[1]=sub_packet_h; 1037 ((short*)(sh->wf+1))[1]=sub_packet_h;
998 ((short*)(sh->wf+1))[2]=flavor; 1038 ((short*)(sh->wf+1))[2]=flavor;
999 stream_read(demuxer->stream, ((char*)(sh->wf+1))+6, 24); // extras 1039 ((short*)(sh->wf+1))[3]=coded_frame_size;
1000 break; 1040 ((short*)(sh->wf+1))[4]=codecdata_length;
1001 case MKTAG('a', 't', 'r', 'c'): 1041 // stream_read(demuxer->stream, ((char*)(sh->wf+1))+6, 24); // extras
1002 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: Sony ATRAC3 (RealAudio 8) (unsupported)\n"); 1042 stream_read(demuxer->stream, ((char*)(sh->wf+1))+10, codecdata_length); // extras
1003 sh->format = 0x270;
1004 /* 14 bytes extra header needed ! */
1005 sh->wf->cbSize = 14;
1006 sh->wf = realloc(sh->wf, sizeof(WAVEFORMATEX)+sh->wf->cbSize);
1007
1008 sh->wf->nAvgBytesPerSec = 16537; // 8268
1009 sh->wf->nBlockAlign = 384; // 192
1010 sh->wf->wBitsPerSample = 0; /* from AVI created by VirtualDub */
1011 break; 1043 break;
1012 default: 1044 default:
1013 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: Unknown (%s)\n", buf); 1045 mp_msg(MSGT_DEMUX,MSGL_V,"Audio: Unknown (%s)\n", buf);
1014 } 1046 }
1015 1047