Ticket #3233: mythtv-nolame.patch
File mythtv-nolame.patch, 14.1 KB (added by , 19 years ago) |
---|
-
configure
137 137 #echo " --disable-decoders disables all decoders" 138 138 #echo " --disable-muxers disables all muxers" 139 139 #echo " --disable-demuxers disables all demuxers" 140 echo " --disable-lame disable LAME MP3 support" 140 141 echo " --disable-lirc disable lirc support (Infrared Remotes)" 141 142 echo " --disable-joystick-menu disable joystick menu" 142 143 echo " --disable-firewire disable support for FireWire cable boxes" … … 670 671 ivtv="yes" 671 672 dvb="no" 672 673 dvb_path="/usr/include" 674 lamemp3="yes" 673 675 lirc="yes" 674 676 appleremote="no" 675 677 joystick_menu="no" … … 1392 1394 ;; 1393 1395 --disable-ivtv) ivtv="no" 1394 1396 ;; 1397 --enable-lame) lamemp3="yes" 1398 ;; 1399 --disable-lame) lamemp3="no" 1400 ;; 1395 1401 --enable-lirc) lirc="yes" 1396 1402 ;; 1397 1403 --disable-lirc) lirc="no" … … 2728 2734 fi 2729 2735 fi 2730 2736 2731 lamemp3="no" 2732 if has_library libmp3lame; then2733 if has_header lame/lame.h ; then2734 lamemp3="yes"2737 if test x"$lamemp3" = x"yes"; then 2738 if ! has_library libmp3lame || ! has_header lame/lame.h ; then 2739 echo "You must have the Lame MP3 encoding library installed to compile Myth." 2740 exit 255 2735 2741 fi 2742 else 2743 if ! has_library libmad || ! has_header mad.h ; then 2744 echo "You must have the libmad MP3 decoding library installed to compile" 2745 echo "Myth without Lame MP3 encoding support." 2746 exit 255 2747 else 2748 echo "Myth will be built without MP3 encoding support!" 2749 fi 2736 2750 fi 2737 2751 2738 if test x"$lamemp3" = x"no" ; then2739 echo "You must have the Lame MP3 encoding library installed to compile Myth."2740 exit 2552741 fi2742 2743 2752 #test for lirc client libraries 2744 2753 if test x"$lirc" = x"yes" ; then 2745 2754 lirc="no" … … 3413 3422 CCONFIG="$CCONFIG using_iptv using_live" 3414 3423 fi 3415 3424 3425 if test x"$lamemp3" = x"yes" ; then 3426 CCONFIG="$CCONFIG using_lame" 3427 echo "#define LAME 1" >> $TMPH 3428 echo "CONFIG_MP3_LIBS=-lmp3lame" >> $MYTH_CONFIG_MAK 3429 else 3430 CCONFIG="$CCONFIG using_mad" 3431 echo "CONFIG_MP3_LIBS=-lmad" >> $MYTH_CONFIG_MAK 3432 fi 3433 3416 3434 if test x"$lirc" = x"yes" ; then 3417 3435 CCONFIG="$CCONFIG using_lirc" 3418 3436 echo "CONFIG_LIRC_LIBS=-llirc_client" >> $MYTH_CONFIG_MAK -
libs/libmythtv/nuppeldecoder.cpp
30 30 31 31 NuppelDecoder::NuppelDecoder(NuppelVideoPlayer *parent, ProgramInfo *pginfo) 32 32 : DecoderBase(parent, pginfo), 33 gf(0), rtjd(0), video_width(0), video_height(0), video_size(0), 33 #ifdef LAME 34 gf(0), 35 #endif 36 rtjd(0), video_width(0), video_height(0), video_size(0), 34 37 video_frame_rate(0.0f), audio_samplerate(44100), 35 38 #ifdef WORDS_BIGENDIAN 36 39 audio_bits_per_sample(0), … … 56 59 getrawframes = false; 57 60 getrawvideo = false; 58 61 62 #ifdef LAME 59 63 gf = lame_init(); 60 64 lame_set_decode_only(gf, 1); 61 65 lame_decode_init(); 62 66 lame_init_params(gf); 67 #else 68 mad_stream_init(&madstream); 69 mad_frame_init(&madframe); 70 mad_synth_init(&madsynth); 71 /* large enough to hold two audio frames */ 72 #define MAD_BUFFER_SIZE (5*8192) 73 madbuffer = new unsigned char[MAD_BUFFER_SIZE]; 74 if (!madbuffer) 75 { 76 VERBOSE(VB_IMPORTANT, "NuppelDecoder: allocating mad buffer failed, " 77 "aborting"); 78 errored = true; 79 return; 80 } 81 #endif 63 82 64 83 rtjd = new RTjpeg(); 65 84 int format = RTJ_YUV420; … … 80 99 81 100 NuppelDecoder::~NuppelDecoder() 82 101 { 102 #ifdef LAME 83 103 if (gf) 84 104 lame_close(gf); 105 #else 106 mad_stream_finish(&madstream); 107 mad_frame_finish(&madframe); 108 mad_synth_finish(&madsynth); 109 if (madbuffer) 110 delete [] madbuffer; 111 #endif 85 112 if (rtjd) 86 113 delete rtjd; 87 114 if (ffmpeg_extradata) … … 916 943 } 917 944 } 918 945 946 #ifndef LAME 947 /* Libmad outputs 32bit samples instead of 16bit ones as expected by 948 AddAudioData(), so we have to scale. This is the simple scale() function 949 from the minimad.c example which is Copyright (C) 2000-2004 Underbit 950 Technologies, Inc. and licensed under GPL. */ 951 short int NuppelDecoder::MadScale(mad_fixed_t sample) 952 { 953 /* round */ 954 sample += (1L << (MAD_F_FRACBITS - 16)); 955 956 /* clip */ 957 if (sample >= MAD_F_ONE) 958 sample = MAD_F_ONE - 1; 959 else if (sample < -MAD_F_ONE) 960 sample = -MAD_F_ONE; 961 962 /* quantize */ 963 return sample >> (MAD_F_FRACBITS + 1 - 16); 964 } 965 #endif 966 919 967 // avignore = 0 : get audio and video 920 968 // = 1 : video only 921 969 // = -1 : neither, just parse … … 1117 1165 if (getrawframes) 1118 1166 StoreRawData(strm); 1119 1167 1120 int lameret = 0;1121 1168 short int pcmlbuffer[audio_samplerate * 4]; 1122 1169 short int pcmrbuffer[audio_samplerate * 4]; 1123 1170 int packetlen = frameheader.packetlength; 1124 1171 #ifdef LAME 1172 int lameret = 0; 1125 1173 do 1126 1174 { 1127 1175 lameret = lame_decode(strm, packetlen, pcmlbuffer, … … 1140 1188 } 1141 1189 packetlen = 0; 1142 1190 } while (lameret > 0); 1191 #else 1192 size_t madremain = 0; 1193 if (madstream.next_frame) 1194 { 1195 madremain = madstream.bufend - madstream.next_frame; 1196 memmove(madbuffer, madstream.next_frame, madremain); 1197 } 1198 1199 if (packetlen + madremain > MAD_BUFFER_SIZE) 1200 { 1201 VERBOSE(VB_IMPORTANT, QString("mad buffer too small (%1 " 1202 "vs. %2), exiting").arg(MAD_BUFFER_SIZE). 1203 arg(packetlen + madremain)); 1204 errored = true; 1205 return false; 1206 } 1207 1208 memcpy(madbuffer + madremain, strm, packetlen); 1209 mad_stream_buffer(&madstream, madbuffer, 1210 packetlen + madremain); 1211 1212 while (true) 1213 { 1214 if (mad_frame_decode(&madframe, &madstream)) 1215 { 1216 if (!MAD_RECOVERABLE(madstream.error)) 1217 break; 1218 continue; 1219 } 1220 mad_synth_frame(&madsynth, &madframe); 1221 1222 for (int samplenr = 0; samplenr < madsynth.pcm.length; 1223 samplenr++) 1224 { 1225 pcmlbuffer[samplenr] = 1226 MadScale(madsynth.pcm.samples[0][samplenr]); 1227 if (madsynth.pcm.channels == 2) 1228 pcmrbuffer[samplenr] = 1229 MadScale(madsynth.pcm.samples[1][samplenr]); 1230 else 1231 pcmrbuffer[samplenr] = pcmlbuffer[samplenr]; 1232 } 1233 1234 GetNVP()->AddAudioData(pcmlbuffer, pcmrbuffer, 1235 madsynth.pcm.length, frameheader.timecode); 1236 } 1237 #endif 1143 1238 } 1144 1239 else 1145 1240 { -
libs/libmythtv/NuppelVideoRecorder.cpp
64 64 pid = pid2 = 0; 65 65 inputchannel = 1; 66 66 compression = 1; 67 #ifdef LAME 67 68 compressaudio = 1; 69 #else 70 compressaudio = 0; 71 #endif 68 72 usebttv = 1; 69 73 w = 352; 70 74 h = 240; … … 76 80 framerate_multiplier = 1.0; 77 81 height_multiplier = 1.0; 78 82 83 #ifdef LAME 84 mp3buf = NULL; 79 85 mp3quality = 3; 80 86 gf = NULL; 87 #endif 88 81 89 rtjc = NULL; 82 90 strm = NULL; 83 mp3buf = NULL;84 91 85 92 transcoding = false; 86 93 … … 176 183 } 177 184 if (rtjc) 178 185 delete rtjc; 186 #ifdef LAME 179 187 if (mp3buf) 180 188 delete [] mp3buf; 181 189 if (gf) 182 190 lame_close(gf); 191 #endif 183 192 if (strm) 184 193 delete [] strm; 185 194 if (fd >= 0) … … 290 299 hmjpg_vdecimation = value; 291 300 else if (opt == "audiocompression") 292 301 compressaudio = value; 302 #ifdef LAME 293 303 else if (opt == "mp3quality") 294 304 mp3quality = value; 305 #endif 295 306 else if (opt == "samplerate") 296 307 audio_samplerate = value; 297 308 else if (opt == "audioframesize") … … 375 386 if ((tmp = profile->byName("audiocodec"))) 376 387 setting = tmp->getValue(); 377 388 389 #ifdef LAME 378 390 if (setting == "MP3") 379 391 { 380 392 SetOption("audiocompression", 1); 381 393 SetIntOption(profile, "mp3quality"); 382 394 SetIntOption(profile, "samplerate"); 383 395 } 384 else if (setting == "Uncompressed") 396 else 397 #endif 398 if (setting == "Uncompressed") 385 399 { 386 400 SetOption("audiocompression", 0); 387 401 SetIntOption(profile, "samplerate"); … … 697 711 698 712 if (compressaudio) 699 713 { 714 #ifdef LAME 700 715 gf = lame_init(); 701 716 lame_set_bWriteVbrTag(gf, 0); 702 717 lame_set_quality(gf, mp3quality); … … 717 732 "AudioInit(): lame support requires 16bit audio"); 718 733 compressaudio = false; 719 734 } 735 #else 736 VERBOSE(VB_IMPORTANT, "NVR: AudioInit(): support for LAME MP3 " 737 "compression not enabled, disabling"); 738 compressaudio = false; 739 #endif 720 740 } 741 742 #ifdef LAME 721 743 mp3buf_size = (int)(1.25 * 16384 + 7200); 722 744 mp3buf = new char[mp3buf_size]; 745 #endif 723 746 724 747 return 0; 725 748 } … … 1935 1958 moredata.rtjpeg_chroma_filter = M2; 1936 1959 } 1937 1960 1961 #ifdef LAME 1938 1962 if (compressaudio) 1939 1963 { 1940 1964 moredata.audio_fourcc = FOURCC_LAME; … … 1942 1966 moredata.audio_quality = mp3quality; 1943 1967 } 1944 1968 else 1969 #endif 1945 1970 { 1946 1971 moredata.audio_fourcc = FOURCC_RAWA; 1947 1972 } … … 3188 3213 } 3189 3214 } 3190 3215 3216 #ifdef LAME 3191 3217 if (compressaudio) 3192 3218 { 3193 3219 char mp3gapless[7200]; … … 3244 3270 audiobytes += audio_buffer_size; 3245 3271 } 3246 3272 else 3273 #endif 3247 3274 { 3248 3275 frameheader.comptype = '0'; // uncompressed audio 3249 3276 frameheader.packetlength = audio_buffer_size; -
libs/libmythtv/nuppeldecoder.h
8 8 #include "format.h" 9 9 #include "decoderbase.h" 10 10 11 #ifdef LAME 11 12 #ifdef MMX 12 13 #undef MMX 13 14 #define MMXBLAH … … 16 17 #ifdef MMXBLAH 17 18 #define MMX 18 19 #endif 20 #else 21 #include <mad.h> 22 #endif 19 23 20 24 #include "RTjpegN.h" 21 25 … … 73 77 void SeekReset(long long newKey = 0, uint skipFrames = 0, 74 78 bool needFlush = false, bool discardFrames = false); 75 79 80 #ifndef LAME 81 short int MadScale(mad_fixed_t sample); 82 #endif 83 76 84 friend int get_nuppel_buffer(struct AVCodecContext *c, AVFrame *pic); 77 85 friend void release_nuppel_buffer(struct AVCodecContext *c, AVFrame *pic); 78 86 79 87 struct rtfileheader fileheader; 80 88 struct rtframeheader frameheader; 81 89 90 #ifdef LAME 82 91 lame_global_flags *gf; 92 #else 93 struct mad_stream madstream; 94 struct mad_frame madframe; 95 struct mad_synth madsynth; 96 unsigned char *madbuffer; 97 #endif 83 98 RTjpeg *rtjd; 84 99 85 100 int video_width, video_height, video_size; -
libs/libmythtv/NuppelVideoRecorder.h
5 5 #include <sys/time.h> 6 6 #include <time.h> 7 7 #include <pthread.h> 8 9 #ifdef LAME 8 10 #ifdef MMX 9 11 #undef MMX 10 12 #define MMXBLAH … … 13 15 #ifdef MMXBLAH 14 16 #define MMX 15 17 #endif 18 #endif 16 19 17 20 #include "filter.h" 18 21 #include "minilzo.h" … … 166 169 167 170 bool transcoding; 168 171 172 #ifdef LAME 169 173 int mp3quality; 170 174 char *mp3buf; 171 175 int mp3buf_size; 172 176 lame_global_flags *gf; 177 #endif 173 178 174 179 RTjpeg *rtjc; 175 180 -
libs/libmythtv/recordingprofile.cpp
78 78 } 79 79 }; 80 80 81 #ifdef LAME 81 82 class MP3Quality : public SliderSetting, public CodecParamStorage 82 83 { 83 84 public: … … 92 93 "numbers) requires more CPU.")); 93 94 }; 94 95 }; 96 #endif 95 97 96 98 class BTTVVolume : public SliderSetting, public CodecParamStorage 97 99 { … … 363 365 addChild(codecName); 364 366 setTrigger(codecName); 365 367 366 ConfigurationGroup* params = new VerticalConfigurationGroup(false); 368 ConfigurationGroup* params; 369 370 #ifdef LAME 371 params = new VerticalConfigurationGroup(false); 367 372 params->setLabel("MP3"); 368 373 params->addChild(new SampleRate(parent)); 369 374 params->addChild(new MP3Quality(parent)); 370 375 params->addChild(new BTTVVolume(parent)); 371 376 addTarget("MP3", params); 377 #endif 372 378 373 379 params = new VerticalConfigurationGroup(false, false, true, true); 374 380 params->setLabel("MPEG-2 Hardware Encoder"); … … 395 401 else 396 402 { 397 403 // V4L, TRANSCODE (and any undefined types) 404 #ifdef LAME 398 405 codecName->addSelection("MP3"); 406 #endif 399 407 codecName->addSelection("Uncompressed"); 400 408 } 401 409 } 402 410 else 403 411 { 412 #ifdef LAME 404 413 codecName->addSelection("MP3"); 414 #endif 405 415 codecName->addSelection("Uncompressed"); 406 416 codecName->addSelection("MPEG-2 Hardware Encoder"); 407 417 } -
settings.pro
88 88 } 89 89 QMAKE_LIBDIR_OPENGL = 90 90 91 EXTRA_LIBS = $$FREETYPE_LIBS -lmp3lame 91 EXTRA_LIBS = $$FREETYPE_LIBS 92 EXTRA_LIBS += $$CONFIG_MP3_LIBS 92 93 EXTRA_LIBS += $$CONFIG_AUDIO_OSS_LIBS 93 94 EXTRA_LIBS += $$CONFIG_AUDIO_ALSA_LIBS 94 95 EXTRA_LIBS += $$CONFIG_AUDIO_ARTS_LIBS