home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 2 / Macwelt DVD 2.cdr / Audio-Video-Multimedia / macosx / Media Pipe 0.7.6 / Example Pipe / MP3Encoder / MP3Encoder.cpp < prev    next >
MacBinary  |  2002-03-11  |  4.0 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
1% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Mon Mar 11 16:42:32 2002, modified Mon Mar 11 16:42:32 2002, creator 'CWIE', type ASCII, 3373 bytes "MP3Encoder.cpp" , at 0xdad 410 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% dearkID deark: macbinary default
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0e 4d 50 33 45 6e 63 | 6f 64 65 72 2e 63 70 70 |..MP3Enc|oder.cpp|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 00 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 0d 2d 00 | 00 01 9a b8 b2 d5 48 b8 |......-.|......H.|
|00000060| b2 d5 48 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..H.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 a9 e4 00 00 |........|........|
|00000080| 23 69 6e 63 6c 75 64 65 | 20 22 4d 50 33 45 6e 63 |#include| "MP3Enc|
|00000090| 6f 64 65 72 2e 68 22 0a | 23 69 6e 63 6c 75 64 65 |oder.h".|#include|
|000000a0| 20 22 46 69 6c 65 4f 62 | 6a 65 63 74 2e 68 22 0a | "FileOb|ject.h".|
|000000b0| 0a 23 64 65 66 69 6e 65 | 20 4d 50 5f 50 49 50 45 |.#define| MP_PIPE|
|000000c0| 5f 4e 41 4d 45 09 09 09 | 09 4d 50 33 45 6e 63 6f |_NAME...|.MP3Enco|
|000000d0| 64 65 72 50 69 70 65 0a | 0a 23 69 6e 63 6c 75 64 |derPipe.|.#includ|
|000000e0| 65 20 22 4d 50 50 69 70 | 65 44 69 73 70 61 74 63 |e "MPPip|eDispatc|
|000000f0| 68 48 65 6c 70 65 72 2e | 68 22 0a 0a 75 6e 73 69 |hHelper.|h"..unsi|
|00000100| 67 6e 65 64 20 63 68 61 | 72 20 67 50 69 70 65 4e |gned cha|r gPipeN|
|00000110| 61 6d 65 5b 5d 20 3d 20 | 22 5c 70 4d 50 33 20 45 |ame[] = |"\pMP3 E|
|00000120| 6e 63 6f 64 65 72 22 3b | 0a 0a 4d 50 46 6f 72 6d |ncoder";|..MPForm|
|00000130| 61 74 53 75 70 70 6f 72 | 74 09 67 49 6e 70 75 74 |atSuppor|t.gInput|
|00000140| 53 75 70 70 6f 72 74 5b | 5d 20 3d 20 0a 7b 0a 09 |Support[|] = .{..|
|00000150| 7b 09 6b 53 61 6d 70 6c | 65 4d 61 70 44 61 74 61 |{.kSampl|eMapData|
|00000160| 54 79 70 65 2c 20 6b 52 | 61 77 53 6f 75 6e 64 46 |Type, kR|awSoundF|
|00000170| 6f 72 6d 61 74 2c 09 31 | 2e 30 09 7d 0a 7d 3b 0a |ormat,.1|.0.}.};.|
|00000180| 0a 4d 50 46 6f 72 6d 61 | 74 53 75 70 70 6f 72 74 |.MPForma|tSupport|
|00000190| 4c 69 73 74 20 67 49 6e | 70 75 74 53 75 70 70 6f |List gIn|putSuppo|
|000001a0| 72 74 4c 69 73 74 20 3d | 20 7b 4e 55 4c 4c 2c 20 |rtList =| {NULL, |
|000001b0| 74 72 75 65 2c 20 67 49 | 6e 70 75 74 53 75 70 70 |true, gI|nputSupp|
|000001c0| 6f 72 74 2c 20 73 69 7a | 65 6f 66 28 67 49 6e 70 |ort, siz|eof(gInp|
|000001d0| 75 74 53 75 70 70 6f 72 | 74 29 2f 73 69 7a 65 6f |utSuppor|t)/sizeo|
|000001e0| 66 28 4d 50 46 6f 72 6d | 61 74 53 75 70 70 6f 72 |f(MPForm|atSuppor|
|000001f0| 74 29 7d 3b 0a 0a 4d 50 | 46 6f 72 6d 61 74 53 75 |t)};..MP|FormatSu|
|00000200| 70 70 6f 72 74 09 67 41 | 75 64 69 6f 53 74 61 6e |pport.gA|udioStan|
|00000210| 64 61 72 64 4f 75 74 70 | 75 74 5b 5d 20 3d 20 0a |dardOutp|ut[] = .|
|00000220| 7b 0a 09 7b 20 6b 46 69 | 6c 65 44 61 74 61 54 79 |{..{ kFi|leDataTy|
|00000230| 70 65 2c 20 27 4d 50 45 | 47 27 2c 20 20 31 2e 30 |pe, 'MPE|G', 1.0|
|00000240| 20 7d 0a 7d 3b 0a 0a 4d | 50 46 6f 72 6d 61 74 53 | }.};..M|PFormatS|
|00000250| 75 70 70 6f 72 74 4c 69 | 73 74 20 67 41 75 64 69 |upportLi|st gAudi|
|00000260| 6f 53 74 61 6e 64 61 72 | 64 4f 75 74 70 75 74 4c |oStandar|dOutputL|
|00000270| 69 73 74 5b 5d 20 3d 20 | 0a 7b 0a 09 7b 09 4e 55 |ist[] = |.{..{.NU|
|00000280| 4c 4c 2c 20 74 72 75 65 | 2c 20 67 41 75 64 69 6f |LL, true|, gAudio|
|00000290| 53 74 61 6e 64 61 72 64 | 4f 75 74 70 75 74 2c 20 |Standard|Output, |
|000002a0| 73 69 7a 65 6f 66 28 67 | 41 75 64 69 6f 53 74 61 |sizeof(g|AudioSta|
|000002b0| 6e 64 61 72 64 4f 75 74 | 70 75 74 29 2f 73 69 7a |ndardOut|put)/siz|
|000002c0| 65 6f 66 28 4d 50 46 6f | 72 6d 61 74 53 75 70 70 |eof(MPFo|rmatSupp|
|000002d0| 6f 72 74 29 09 7d 0a 7d | 3b 0a 0a 4f 53 53 74 61 |ort).}.}|;..OSSta|
|000002e0| 74 75 73 20 4d 50 33 45 | 6e 63 6f 64 65 72 50 69 |tus MP3E|ncoderPi|
|000002f0| 70 65 3a 3a 6e 65 77 49 | 6e 73 74 61 6e 63 65 28 |pe::newI|nstance(|
|00000300| 4d 50 50 69 70 65 49 6e | 74 65 72 66 61 63 65 48 |MPPipeIn|terfaceH|
|00000310| 64 6c 20 6f 75 74 49 6e | 73 74 61 6e 63 65 2c 20 |dl outIn|stance, |
|00000320| 76 6f 69 64 20 2a 69 6e | 50 69 70 65 6c 69 6e 65 |void *in|Pipeline|
|00000330| 49 44 29 0a 7b 0a 09 2a | 6f 75 74 49 6e 73 74 61 |ID).{..*|outInsta|
|00000340| 6e 63 65 20 3d 20 6e 65 | 77 20 4d 50 33 45 6e 63 |nce = ne|w MP3Enc|
|00000350| 6f 64 65 72 50 69 70 65 | 49 6e 73 74 61 6e 63 65 |oderPipe|Instance|
|00000360| 3b 0a 09 69 66 20 28 21 | 2a 6f 75 74 49 6e 73 74 |;..if (!|*outInst|
|00000370| 61 6e 63 65 29 09 72 65 | 74 75 72 6e 20 6d 65 6d |ance).re|turn mem|
|00000380| 46 75 6c 6c 45 72 72 3b | 0a 0a 09 72 65 74 75 72 |FullErr;|...retur|
|00000390| 6e 20 6e 6f 45 72 72 3b | 0a 7d 0a 0a 0a 4f 53 53 |n noErr;|.}...OSS|
|000003a0| 74 61 74 75 73 20 4d 50 | 33 45 6e 63 6f 64 65 72 |tatus MP|3Encoder|
|000003b0| 50 69 70 65 3a 3a 6f 70 | 65 6e 28 4d 50 50 69 70 |Pipe::op|en(MPPip|
|000003c0| 65 44 65 73 63 72 69 70 | 74 69 6f 6e 50 74 72 20 |eDescrip|tionPtr |
|000003d0| 6f 75 74 44 65 73 63 72 | 69 70 74 69 6f 6e 29 0a |outDescr|iption).|
|000003e0| 7b 0a 09 69 66 20 28 6f | 75 74 44 65 73 63 72 69 |{..if (o|utDescri|
|000003f0| 70 74 69 6f 6e 2d 3e 76 | 65 72 73 69 6f 6e 20 3c |ption->v|ersion <|
|00000400| 20 31 29 09 72 65 74 75 | 72 6e 20 70 61 72 61 6d | 1).retu|rn param|
|00000410| 45 72 72 3b 0a 09 0a 09 | 6f 75 74 44 65 73 63 72 |Err;....|outDescr|
|00000420| 69 70 74 69 6f 6e 2d 3e | 76 65 72 73 69 6f 6e 20 |iption->|version |
|00000430| 3d 20 31 3b 0a 09 50 4c | 73 74 72 63 70 79 28 6f |= 1;..PL|strcpy(o|
|00000440| 75 74 44 65 73 63 72 69 | 70 74 69 6f 6e 2d 3e 76 |utDescri|ption->v|
|00000450| 65 72 73 69 6f 6e 73 2e | 76 31 2e 6e 61 6d 65 2c |ersions.|v1.name,|
|00000460| 20 67 50 69 70 65 4e 61 | 6d 65 29 3b 0a 09 6f 75 | gPipeNa|me);..ou|
|00000470| 74 44 65 73 63 72 69 70 | 74 69 6f 6e 2d 3e 76 65 |tDescrip|tion->ve|
|00000480| 72 73 69 6f 6e 73 2e 76 | 31 2e 69 73 54 68 72 65 |rsions.v|1.isThre|
|00000490| 61 64 53 61 66 65 20 3d | 20 66 61 6c 73 65 3b 0a |adSafe =| false;.|
|000004a0| 0a 09 72 65 74 75 72 6e | 20 6e 6f 45 72 72 3b 0a |..return| noErr;.|
|000004b0| 7d 0a 0a 0a 4f 53 53 74 | 61 74 75 73 20 4d 50 33 |}...OSSt|atus MP3|
|000004c0| 45 6e 63 6f 64 65 72 50 | 69 70 65 3a 3a 67 65 74 |EncoderP|ipe::get|
|000004d0| 49 6e 70 75 74 53 75 70 | 70 6f 72 74 28 4d 50 46 |InputSup|port(MPF|
|000004e0| 6f 72 6d 61 74 53 75 70 | 70 6f 72 74 4c 69 73 74 |ormatSup|portList|
|000004f0| 48 64 6c 20 6f 75 74 53 | 75 70 70 6f 72 74 29 0a |Hdl outS|upport).|
|00000500| 7b 0a 09 2a 6f 75 74 53 | 75 70 70 6f 72 74 20 3d |{..*outS|upport =|
|00000510| 20 26 67 49 6e 70 75 74 | 53 75 70 70 6f 72 74 4c | &gInput|SupportL|
|00000520| 69 73 74 3b 0a 09 72 65 | 74 75 72 6e 20 6e 6f 45 |ist;..re|turn noE|
|00000530| 72 72 3b 0a 7d 0a 0a 0a | 0a 23 70 72 61 67 6d 61 |rr;.}...|.#pragma|
|00000540| 20 6d 61 72 6b 20 2d 0a | 0a 23 64 65 66 69 6e 65 | mark -.|.#define|
|00000550| 20 42 55 46 46 45 52 5f | 53 49 5a 45 20 36 35 35 | BUFFER_|SIZE 655|
|00000560| 33 36 0a 0a 4d 50 33 45 | 6e 63 6f 64 65 72 50 69 |36..MP3E|ncoderPi|
|00000570| 70 65 49 6e 73 74 61 6e | 63 65 3a 3a 4d 50 33 45 |peInstan|ce::MP3E|
|00000580| 6e 63 6f 64 65 72 50 69 | 70 65 49 6e 73 74 61 6e |ncoderPi|peInstan|
|00000590| 63 65 28 29 0a 3a 0a 20 | 20 20 20 6d 42 75 66 66 |ce().:. | mBuff|
|000005a0| 65 72 28 4e 55 4c 4c 29 | 0a 7b 0a 20 20 20 20 6d |er(NULL)|.{. m|
|000005b0| 42 75 66 66 65 72 20 3d | 20 28 75 6e 73 69 67 6e |Buffer =| (unsign|
|000005c0| 65 64 20 63 68 61 72 2a | 29 4e 65 77 50 74 72 28 |ed char*|)NewPtr(|
|000005d0| 42 55 46 46 45 52 5f 53 | 49 5a 45 29 3b 0a 20 20 |BUFFER_S|IZE);. |
|000005e0| 20 20 6d 4c 61 6d 65 47 | 6c 6f 62 61 6c 73 20 3d | mLameG|lobals =|
|000005f0| 20 6c 61 6d 65 5f 69 6e | 69 74 28 29 3b 20 0a 7d | lame_in|it(); .}|
|00000600| 0a 0a 0a 4d 50 33 45 6e | 63 6f 64 65 72 50 69 70 |...MP3En|coderPip|
|00000610| 65 49 6e 73 74 61 6e 63 | 65 3a 3a 7e 4d 50 33 45 |eInstanc|e::~MP3E|
|00000620| 6e 63 6f 64 65 72 50 69 | 70 65 49 6e 73 74 61 6e |ncoderPi|peInstan|
|00000630| 63 65 28 29 0a 7b 0a 20 | 20 20 20 69 66 20 28 6d |ce().{. | if (m|
|00000640| 42 75 66 66 65 72 29 09 | 09 09 44 69 73 70 6f 73 |Buffer).|..Dispos|
|00000650| 65 50 74 72 28 28 50 74 | 72 29 6d 42 75 66 66 65 |ePtr((Pt|r)mBuffe|
|00000660| 72 29 3b 0a 20 20 20 20 | 69 66 20 28 6d 46 72 61 |r);. |if (mFra|
|00000670| 6d 65 29 09 09 09 64 65 | 6c 65 74 65 20 6d 46 72 |me)...de|lete mFr|
|00000680| 61 6d 65 3b 0a 7d 0a 0a | 0a 4f 53 53 74 61 74 75 |ame;.}..|.OSStatu|
|00000690| 73 20 4d 50 33 45 6e 63 | 6f 64 65 72 50 69 70 65 |s MP3Enc|oderPipe|
|000006a0| 49 6e 73 74 61 6e 63 65 | 3a 3a 63 6f 6e 66 69 67 |Instance|::config|
|000006b0| 75 72 65 28 4d 50 46 72 | 61 6d 65 50 74 72 20 69 |ure(MPFr|amePtr i|
|000006c0| 6e 49 46 72 61 6d 65 2c | 20 4d 50 53 65 71 75 65 |nIFrame,| MPSeque|
|000006d0| 6e 63 65 49 6e 66 6f 50 | 74 72 20 69 6f 53 65 71 |nceInfoP|tr ioSeq|
|000006e0| 75 65 6e 63 65 49 6e 66 | 6f 29 0a 7b 0a 20 20 20 |uenceInf|o).{. |
|000006f0| 20 72 65 74 75 72 6e 20 | 6e 6f 45 72 72 3b 0a 7d | return |noErr;.}|
|00000700| 0a 0a 0a 4f 53 53 74 61 | 74 75 73 20 4d 50 33 45 |...OSSta|tus MP3E|
|00000710| 6e 63 6f 64 65 72 50 69 | 70 65 49 6e 73 74 61 6e |ncoderPi|peInstan|
|00000720| 63 65 3a 3a 67 65 74 4f | 75 74 70 75 74 53 75 70 |ce::getO|utputSup|
|00000730| 70 6f 72 74 28 4d 50 46 | 6f 72 6d 61 74 53 75 70 |port(MPF|ormatSup|
|00000740| 70 6f 72 74 4c 69 73 74 | 48 64 6c 20 6f 75 74 4f |portList|Hdl outO|
|00000750| 46 6f 72 6d 61 74 73 29 | 0a 7b 0a 20 20 20 20 2a |Formats)|.{. *|
|00000760| 6f 75 74 4f 46 6f 72 6d | 61 74 73 20 3d 20 67 41 |outOForm|ats = gA|
|00000770| 75 64 69 6f 53 74 61 6e | 64 61 72 64 4f 75 74 70 |udioStan|dardOutp|
|00000780| 75 74 4c 69 73 74 3b 0a | 20 20 20 20 72 65 74 75 |utList;.| retu|
|00000790| 72 6e 20 6e 6f 45 72 72 | 3b 0a 7d 0a 0a 4f 53 53 |rn noErr|;.}..OSS|
|000007a0| 74 61 74 75 73 20 4d 50 | 33 45 6e 63 6f 64 65 72 |tatus MP|3Encoder|
|000007b0| 50 69 70 65 49 6e 73 74 | 61 6e 63 65 3a 3a 62 65 |PipeInst|ance::be|
|000007c0| 67 69 6e 53 65 71 75 65 | 6e 63 65 28 4d 50 46 72 |ginSeque|nce(MPFr|
|000007d0| 61 6d 65 50 74 72 20 69 | 6e 49 46 72 61 6d 65 2c |amePtr i|nIFrame,|
|000007e0| 20 4d 50 46 72 61 6d 65 | 50 74 72 20 69 6f 4f 46 | MPFrame|Ptr ioOF|
|000007f0| 72 61 6d 65 2c 20 4d 50 | 53 65 71 75 65 6e 63 65 |rame, MP|Sequence|
|00000800| 49 6e 66 6f 50 74 72 20 | 69 6f 53 65 71 75 65 6e |InfoPtr |ioSequen|
|00000810| 63 65 49 6e 66 6f 29 0a | 7b 0a 20 20 20 20 4f 53 |ceInfo).|{. OS|
|00000820| 45 72 72 20 65 72 72 20 | 3d 20 6e 6f 45 72 72 3b |Err err |= noErr;|
|00000830| 0a 20 20 20 20 46 69 6c | 65 4f 62 6a 65 63 74 20 |. Fil|eObject |
|00000840| 66 69 6c 65 3b 0a 20 20 | 20 20 46 69 6c 65 4f 62 |file;. | FileOb|
|00000850| 6a 65 63 74 20 64 69 72 | 65 63 74 6f 72 79 3b 0a |ject dir|ectory;.|
|00000860| 20 20 20 20 0a 20 20 20 | 20 65 72 72 20 3d 20 64 | . | err = d|
|00000870| 69 72 65 63 74 6f 72 79 | 2e 73 65 6c 65 63 74 28 |irectory|.select(|
|00000880| 26 69 6f 4f 46 72 61 6d | 65 2d 3e 64 61 74 61 2d |&ioOFram|e->data-|
|00000890| 3e 74 79 70 65 2e 66 69 | 6c 65 2e 66 69 6c 65 53 |>type.fi|le.fileS|
|000008a0| 70 65 63 29 3b 0a 20 20 | 20 20 69 66 20 28 65 72 |pec);. | if (er|
|000008b0| 72 29 20 72 65 74 75 72 | 6e 20 65 72 72 3b 0a 0a |r) retur|n err;..|
|000008c0| 20 20 20 20 65 72 72 20 | 3d 20 64 69 72 65 63 74 | err |= direct|
|000008d0| 6f 72 79 2e 67 65 74 49 | 6e 64 65 78 46 69 6c 65 |ory.getI|ndexFile|
|000008e0| 28 69 6f 53 65 71 75 65 | 6e 63 65 49 6e 66 6f 2d |(ioSeque|nceInfo-|
|000008f0| 3e 6e 61 6d 65 2c 20 26 | 66 69 6c 65 29 3b 0a 20 |>name, &|file);. |
|00000900| 20 20 20 69 66 20 28 28 | 65 72 72 29 20 26 26 20 | if ((|err) && |
|00000910| 28 65 72 72 20 21 3d 20 | 66 6e 66 45 72 72 29 29 |(err != |fnfErr))|
|00000920| 09 72 65 74 75 72 6e 20 | 65 72 72 3b 0a 0a 20 20 |.return |err;.. |
|00000930| 20 20 66 69 6c 65 2e 73 | 65 74 45 78 74 65 6e 73 | file.s|etExtens|
|00000940| 69 6f 6e 28 22 5c 70 6d | 70 33 22 29 3b 0a 20 20 |ion("\pm|p3");. |
|00000950| 20 20 65 72 72 20 3d 20 | 66 69 6c 65 2e 73 65 74 | err = |file.set|
|00000960| 55 6e 69 71 75 65 4e 61 | 6d 65 28 29 3b 0a 20 20 |UniqueNa|me();. |
|00000970| 20 20 69 66 20 28 65 72 | 72 29 09 72 65 74 75 72 | if (er|r).retur|
|00000980| 6e 20 65 72 72 3b 0a 0a | 20 20 20 20 66 69 6c 65 |n err;..| file|
|00000990| 2e 73 65 74 43 72 65 61 | 74 6f 72 28 27 54 56 4f |.setCrea|tor('TVO|
|000009a0| 44 27 29 3b 0a 20 20 20 | 20 66 69 6c 65 2e 73 65 |D');. | file.se|
|000009b0| 74 54 79 70 65 28 27 4d | 50 45 47 27 29 3b 0a 0a |tType('M|PEG');..|
|000009c0| 20 20 20 20 65 72 72 20 | 3d 20 66 69 6c 65 2e 63 | err |= file.c|
|000009d0| 72 65 61 74 65 28 6b 46 | 69 6c 65 53 65 6c 65 63 |reate(kF|ileSelec|
|000009e0| 74 69 6f 6e 29 3b 0a 20 | 20 20 20 69 66 20 28 65 |tion);. | if (e|
|000009f0| 72 72 29 09 72 65 74 75 | 72 6e 20 65 72 72 3b 0a |rr).retu|rn err;.|
|00000a00| 20 20 20 20 0a 20 20 20 | 20 65 72 72 20 3d 20 66 | . | err = f|
|00000a10| 69 6c 65 2e 67 65 74 53 | 74 72 65 61 6d 28 26 6d |ile.getS|tream(&m|
|00000a20| 53 74 72 65 61 6d 29 3b | 0a 20 20 20 20 69 66 20 |Stream);|. if |
|00000a30| 28 65 72 72 29 09 72 65 | 74 75 72 6e 20 65 72 72 |(err).re|turn err|
|00000a40| 3b 0a 0a 20 20 20 20 6c | 61 6d 65 5f 73 65 74 5f |;.. l|ame_set_|
|00000a50| 69 6e 5f 73 61 6d 70 6c | 65 72 61 74 65 28 6d 4c |in_sampl|erate(mL|
|00000a60| 61 6d 65 47 6c 6f 62 61 | 6c 73 2c 20 69 6e 49 46 |ameGloba|ls, inIF|
|00000a70| 72 61 6d 65 2d 3e 64 61 | 74 61 2d 3e 74 79 70 65 |rame->da|ta->type|
|00000a80| 2e 73 61 6d 70 6c 65 4d | 61 70 2e 73 61 6d 70 6c |.sampleM|ap.sampl|
|00000a90| 65 52 61 74 65 29 3b 0a | 20 20 20 20 6c 61 6d 65 |eRate);.| lame|
|00000aa0| 5f 73 65 74 5f 6e 75 6d | 5f 63 68 61 6e 6e 65 6c |_set_num|_channel|
|00000ab0| 73 28 6d 4c 61 6d 65 47 | 6c 6f 62 61 6c 73 2c 20 |s(mLameG|lobals, |
|00000ac0| 69 6e 49 46 72 61 6d 65 | 2d 3e 64 61 74 61 2d 3e |inIFrame|->data->|
|00000ad0| 74 79 70 65 2e 73 61 6d | 70 6c 65 4d 61 70 2e 63 |type.sam|pleMap.c|
|00000ae0| 68 61 6e 6e 65 6c 73 29 | 3b 0a 20 20 20 20 0a 20 |hannels)|;. . |
|00000af0| 20 20 20 6c 61 6d 65 5f | 69 6e 69 74 5f 70 61 72 | lame_|init_par|
|00000b00| 61 6d 73 28 6d 4c 61 6d | 65 47 6c 6f 62 61 6c 73 |ams(mLam|eGlobals|
|00000b10| 29 3b 0a 0a 20 20 20 20 | 72 65 74 75 72 6e 20 6e |);.. |return n|
|00000b20| 6f 45 72 72 3b 0a 7d 0a | 0a 0a 4f 53 53 74 61 74 |oErr;.}.|..OSStat|
|00000b30| 75 73 20 4d 50 33 45 6e | 63 6f 64 65 72 50 69 70 |us MP3En|coderPip|
|00000b40| 65 49 6e 73 74 61 6e 63 | 65 3a 3a 70 72 6f 63 65 |eInstanc|e::proce|
|00000b50| 73 73 46 72 61 6d 65 28 | 4d 50 46 72 61 6d 65 50 |ssFrame(|MPFrameP|
|00000b60| 74 72 20 69 6e 49 46 72 | 61 6d 65 2c 20 4d 50 46 |tr inIFr|ame, MPF|
|00000b70| 72 61 6d 65 50 74 72 20 | 69 6f 4f 46 72 61 6d 65 |ramePtr |ioOFrame|
|00000b80| 2c 20 4d 50 53 65 71 75 | 65 6e 63 65 49 6e 66 6f |, MPSequ|enceInfo|
|00000b90| 50 74 72 20 69 6f 53 65 | 71 75 65 6e 63 65 49 6e |Ptr ioSe|quenceIn|
|00000ba0| 66 6f 29 0a 7b 0a 20 20 | 20 20 42 79 74 65 43 6f |fo).{. | ByteCo|
|00000bb0| 75 6e 74 20 6c 65 6e 67 | 74 68 3b 0a 0a 20 20 20 |unt leng|th;.. |
|00000bc0| 20 6c 65 6e 67 74 68 20 | 3d 20 6c 61 6d 65 5f 65 | length |= lame_e|
|00000bd0| 6e 63 6f 64 65 5f 62 75 | 66 66 65 72 5f 69 6e 74 |ncode_bu|ffer_int|
|00000be0| 65 72 6c 65 61 76 65 64 | 28 6d 4c 61 6d 65 47 6c |erleaved|(mLameGl|
|00000bf0| 6f 62 61 6c 73 2c 20 28 | 73 68 6f 72 74 2a 29 69 |obals, (|short*)i|
|00000c00| 6e 49 46 72 61 6d 65 2d | 3e 64 61 74 61 2d 3e 74 |nIFrame-|>data->t|
|00000c10| 79 70 65 2e 73 61 6d 70 | 6c 65 4d 61 70 2e 62 61 |ype.samp|leMap.ba|
|00000c20| 73 65 41 64 64 72 2c 20 | 4d 50 43 6f 75 6e 74 53 |seAddr, |MPCountS|
|00000c30| 61 6d 70 6c 65 73 49 6e | 53 61 6d 70 6c 65 4d 61 |amplesIn|SampleMa|
|00000c40| 70 28 26 69 6e 49 46 72 | 61 6d 65 2d 3e 64 61 74 |p(&inIFr|ame->dat|
|00000c50| 61 2d 3e 74 79 70 65 2e | 73 61 6d 70 6c 65 4d 61 |a->type.|sampleMa|
|00000c60| 70 29 2c 20 6d 42 75 66 | 66 65 72 2c 20 42 55 46 |p), mBuf|fer, BUF|
|00000c70| 46 45 52 5f 53 49 5a 45 | 29 3b 0a 20 20 20 20 6d |FER_SIZE|);. m|
|00000c80| 53 74 72 65 61 6d 2e 77 | 72 69 74 65 28 28 63 68 |Stream.w|rite((ch|
|00000c90| 61 72 2a 29 6d 42 75 66 | 66 65 72 2c 20 26 6c 65 |ar*)mBuf|fer, &le|
|00000ca0| 6e 67 74 68 29 3b 0a 20 | 20 20 20 0a 20 20 20 20 |ngth);. | . |
|00000cb0| 72 65 74 75 72 6e 20 6e | 6f 45 72 72 3b 0a 7d 0a |return n|oErr;.}.|
|00000cc0| 0a 4f 53 53 74 61 74 75 | 73 20 4d 50 33 45 6e 63 |.OSStatu|s MP3Enc|
|00000cd0| 6f 64 65 72 50 69 70 65 | 49 6e 73 74 61 6e 63 65 |oderPipe|Instance|
|00000ce0| 3a 3a 66 69 6e 69 73 68 | 53 65 71 75 65 6e 63 65 |::finish|Sequence|
|00000cf0| 28 29 0a 7b 0a 20 20 20 | 20 42 79 74 65 43 6f 75 |().{. | ByteCou|
|00000d00| 6e 74 20 6c 65 6e 67 74 | 68 3b 0a 0a 20 20 20 20 |nt lengt|h;.. |
|00000d10| 6c 65 6e 67 74 68 20 3d | 20 6c 61 6d 65 5f 65 6e |length =| lame_en|
|00000d20| 63 6f 64 65 5f 66 69 6e | 69 73 68 28 6d 4c 61 6d |code_fin|ish(mLam|
|00000d30| 65 47 6c 6f 62 61 6c 73 | 2c 20 6d 42 75 66 66 65 |eGlobals|, mBuffe|
|00000d40| 72 2c 20 42 55 46 46 45 | 52 5f 53 49 5a 45 29 3b |r, BUFFE|R_SIZE);|
|00000d50| 0a 20 20 20 20 6d 53 74 | 72 65 61 6d 2e 77 72 69 |. mSt|ream.wri|
|00000d60| 74 65 28 28 63 68 61 72 | 2a 29 6d 42 75 66 66 65 |te((char|*)mBuffe|
|00000d70| 72 2c 20 26 6c 65 6e 67 | 74 68 29 3b 0a 20 20 20 |r, &leng|th);. |
|00000d80| 20 0a 20 20 20 20 6d 53 | 74 72 65 61 6d 2e 63 6c | . mS|tream.cl|
|00000d90| 6f 73 65 28 29 3b 0a 20 | 20 20 20 72 65 74 75 72 |ose();. | retur|
|00000da0| 6e 20 6e 6f 45 72 72 3b | 0a 7d 0a 0a 0a 00 00 00 |n noErr;|.}......|
|00000db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e00| 00 00 01 00 00 00 01 54 | 00 00 00 54 00 00 00 46 |.......T|...T...F|
|00000e10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ea0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000eb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f00| 00 00 00 04 00 01 00 01 | 00 00 00 48 00 09 4d 6f |........|...H..Mo|
|00000f10| 6e 61 63 6f 00 00 00 00 | 00 00 00 00 00 00 00 00 |naco....|........|
|00000f20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 03 |........|........|
|00000f30| 00 04 00 30 00 04 01 ca | 02 7a 00 30 00 04 01 ca |...0....|.z.0....|
|00000f40| 02 7a b8 85 6b 1b 00 00 | 07 e5 00 00 09 80 00 00 |.z..k...|........|
|00000f50| 07 08 01 00 00 00 01 00 | 00 00 01 54 00 00 00 54 |........|...T...T|
|00000f60| 00 00 00 46 01 4e 24 7c | 01 79 00 00 00 1c 00 46 |...F.N$||.y.....F|
|00000f70| 00 01 4d 57 42 42 00 00 | 00 12 4d 50 53 52 00 00 |..MWBB..|..MPSR..|
|00000f80| 00 1e 03 f0 ff ff 00 00 | 00 00 00 00 00 00 03 ed |........|........|
|00000f90| ff ff 00 00 00 08 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+