Ticket #3545: mythmusic_flac_decoder_state.diff

File mythmusic_flac_decoder_state.diff, 2.5 KB (added by stuartm, 19 years ago)

Patch which should work against 1.1.2

  • mythplugins/mythmusic/mythmusic/flacdecoder.cpp

     
    342342        flacok = decoder_process_single(decoder);
    343343        decoderstate = decoder_get_state(decoder);
    344344
    345         if (decoderstate == 0 || decoderstate == 1)
     345        if (decoderstate == STREAM_DECODER_SEARCH_FOR_METADATA ||
     346            decoderstate == STREAM_DECODER_READ_METADATA ||
     347            decoderstate == STREAM_DECODER_SEARCH_FOR_FRAME_SYNC ||
     348            decoderstate == STREAM_DECODER_READ_FRAME )
    346349        {
    347350            if (output())
    348351                flush();
    349         } 
    350         else 
     352        }
     353        else
    351354        {
     355            // some error condition occurred, so exit the loop
     356
    352357            flush(TRUE);
    353358
    354             if (output()) {
    355                 output()->Drain();
    356             }
     359            if (output())
     360                output()->Drain();
    357361
    358362            done = TRUE;
    359             if (!user_stop) {
     363            if (!user_stop)
    360364                finish = TRUE;
    361             }
    362365        }
    363366
    364367        unlock();
  • mythplugins/mythmusic/mythmusic/flacdecoder.h

     
    4242  #define decoder_process_single FLAC__seekable_stream_decoder_process_single
    4343  #define decoder_get_state FLAC__seekable_stream_decoder_get_state
    4444  #define bytesSize unsigned
     45  #define STREAM_DECODER_SEARCH_FOR_METADATA FLAC__SEEKABLE_STREAM_DECODER_OK
     46  #define STREAM_DECODER_READ_METADATA FLAC__SEEKABLE_STREAM_DECODER_OK
     47  #define STREAM_DECODER_SEARCH_FOR_FRAME_SYNC FLAC__SEEKABLE_STREAM_DECODER_OK
     48  #define STREAM_DECODER_READ_FRAME FLAC__SEEKABLE_STREAM_DECODER_OK
    4549#else
    4650  /* FLAC 1.1.3 and up */
    4751  #define NEWFLAC
     
    7175  #define decoder_process_single FLAC__stream_decoder_process_single
    7276  #define decoder_get_state FLAC__stream_decoder_get_state
    7377  #define bytesSize size_t
     78  #define STREAM_DECODER_SEARCH_FOR_METADATA FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
     79  #define STREAM_DECODER_READ_METADATA FLAC__STREAM_DECODER_READ_METADATA
     80  #define STREAM_DECODER_SEARCH_FOR_FRAME_SYNC FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
     81  #define STREAM_DECODER_READ_FRAME FLAC__STREAM_DECODER_READ_FRAME
    7482#endif
    7583
    7684#include "decoder.h"