1 ///////////////////////////////////////////////////////////////////////////////
3 /// \file raw_decoder.c
4 /// \brief Raw decoder initialization API
6 // Copyright (C) 2007 Lasse Collin
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
18 ///////////////////////////////////////////////////////////////////////////////
20 #include "raw_decoder.h"
21 #include "simple_coder.h"
22 #include "subblock_decoder.h"
23 #include "subblock_decoder_helper.h"
24 #include "delta_decoder.h"
25 #include "lzma_decoder.h"
28 static lzma_init_function
29 get_function(lzma_vli id)
32 #ifdef HAVE_FILTER_SUBBLOCK
33 case LZMA_FILTER_SUBBLOCK:
34 return &lzma_subblock_decoder_init;
37 #ifdef HAVE_FILTER_X86
39 return &lzma_simple_x86_decoder_init;
42 #ifdef HAVE_FILTER_POWERPC
43 case LZMA_FILTER_POWERPC:
44 return &lzma_simple_powerpc_decoder_init;
47 #ifdef HAVE_FILTER_IA64
48 case LZMA_FILTER_IA64:
49 return &lzma_simple_ia64_decoder_init;
52 #ifdef HAVE_FILTER_ARM
54 return &lzma_simple_arm_decoder_init;
57 #ifdef HAVE_FILTER_ARMTHUMB
58 case LZMA_FILTER_ARMTHUMB:
59 return &lzma_simple_armthumb_decoder_init;
62 #ifdef HAVE_FILTER_SPARC
63 case LZMA_FILTER_SPARC:
64 return &lzma_simple_sparc_decoder_init;
67 #ifdef HAVE_FILTER_DELTA
68 case LZMA_FILTER_DELTA:
69 return &lzma_delta_decoder_init;
72 #ifdef HAVE_FILTER_LZMA
73 case LZMA_FILTER_LZMA:
74 return &lzma_lzma_decoder_init;
77 #ifdef HAVE_FILTER_SUBBLOCK
78 case LZMA_FILTER_SUBBLOCK_HELPER:
79 return &lzma_subblock_decoder_helper_init;
88 lzma_raw_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
89 const lzma_options_filter *options)
91 const lzma_ret ret = lzma_raw_coder_init(next, allocator,
92 options, &get_function, false);
95 lzma_next_coder_end(next, allocator);
101 extern LZMA_API lzma_ret
102 lzma_raw_decoder(lzma_stream *strm, const lzma_options_filter *options)
104 return_if_error(lzma_strm_init(strm));
106 strm->internal->supported_actions[LZMA_RUN] = true;
107 strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
109 const lzma_ret ret = lzma_raw_coder_init(&strm->internal->next,
110 strm->allocator, options, &get_function, false);