diff options
Diffstat (limited to 'src/plugins/previewopus_extractor.c')
-rw-r--r-- | src/plugins/previewopus_extractor.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/plugins/previewopus_extractor.c b/src/plugins/previewopus_extractor.c index 1387044..9cae71f 100644 --- a/src/plugins/previewopus_extractor.c +++ b/src/plugins/previewopus_extractor.c | |||
@@ -66,11 +66,10 @@ | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | //TODO: Check for ffmpeg | 68 | //TODO: Check for ffmpeg |
69 | #if HAVE_LIBAVRESAMPLE_AVRESAMPLE_H | ||
70 | #include <libavresample/avresample.h> | 69 | #include <libavresample/avresample.h> |
71 | #elif HAVE_FFMPEG_AVRESAMPLE_H | 70 | |
72 | #include <ffmpeg/avresample.h> | 71 | |
73 | #endif | 72 | |
74 | 73 | ||
75 | 74 | ||
76 | 75 | ||
@@ -202,19 +201,16 @@ static int open_output_file( | |||
202 | AVFormatContext **output_format_context, | 201 | AVFormatContext **output_format_context, |
203 | AVCodecContext **output_codec_context) | 202 | AVCodecContext **output_codec_context) |
204 | { | 203 | { |
205 | AVIOContext *output_io_context = NULL; | ||
206 | AVStream *stream = NULL; | 204 | AVStream *stream = NULL; |
207 | AVCodec *output_codec = NULL; | 205 | AVCodec *output_codec = NULL; |
208 | AVIOContext *io_ctx; | 206 | AVIOContext *io_ctx; |
209 | int error; | 207 | int error; |
210 | 208 | ||
211 | 209 | ||
212 | |||
213 | AVDictionary *options; | ||
214 | unsigned char *iob; | 210 | unsigned char *iob; |
215 | 211 | ||
216 | if (NULL == (iob = av_malloc (16 * 1024))) | 212 | if (NULL == (iob = av_malloc (16 * 1024))) |
217 | return; | 213 | return AVERROR_EXIT; |
218 | if (NULL == (io_ctx = avio_alloc_context (iob, 16 * 1024, | 214 | if (NULL == (io_ctx = avio_alloc_context (iob, 16 * 1024, |
219 | AVIO_FLAG_WRITE, NULL, | 215 | AVIO_FLAG_WRITE, NULL, |
220 | NULL, | 216 | NULL, |
@@ -222,12 +218,12 @@ static int open_output_file( | |||
222 | NULL))) | 218 | NULL))) |
223 | { | 219 | { |
224 | av_free (iob); | 220 | av_free (iob); |
225 | return; | 221 | return AVERROR_EXIT; |
226 | } | 222 | } |
227 | if (NULL == ((*output_format_context) = avformat_alloc_context ())) | 223 | if (NULL == ((*output_format_context) = avformat_alloc_context ())) |
228 | { | 224 | { |
229 | av_free (io_ctx); | 225 | av_free (io_ctx); |
230 | return; | 226 | return AVERROR_EXIT; |
231 | } | 227 | } |
232 | (*output_format_context)->pb = io_ctx; | 228 | (*output_format_context)->pb = io_ctx; |
233 | 229 | ||
@@ -825,7 +821,6 @@ static int write_output_file_trailer(AVFormatContext *output_format_context) | |||
825 | static void | 821 | static void |
826 | extract_audio (struct EXTRACTOR_ExtractContext *ec) | 822 | extract_audio (struct EXTRACTOR_ExtractContext *ec) |
827 | { | 823 | { |
828 | AVPacket packet; | ||
829 | AVIOContext *io_ctx; | 824 | AVIOContext *io_ctx; |
830 | struct AVFormatContext *format_ctx; | 825 | struct AVFormatContext *format_ctx; |
831 | AVCodecContext *codec_ctx; | 826 | AVCodecContext *codec_ctx; |
@@ -833,23 +828,18 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec) | |||
833 | AVCodec *codec; | 828 | AVCodec *codec; |
834 | AVDictionary *options; | 829 | AVDictionary *options; |
835 | AVFrame *frame; | 830 | AVFrame *frame; |
836 | |||
837 | AVCodecContext* output_codec_context = NULL; | 831 | AVCodecContext* output_codec_context = NULL; |
838 | |||
839 | |||
840 | AVAudioResampleContext *resample_context = NULL; | 832 | AVAudioResampleContext *resample_context = NULL; |
841 | AVAudioFifo *fifo = NULL; | 833 | AVAudioFifo *fifo = NULL; |
842 | 834 | ||
843 | 835 | ||
844 | int audio_stream_index; | 836 | int audio_stream_index; |
845 | int thumb_width; | ||
846 | int thumb_height; | ||
847 | int i; | 837 | int i; |
848 | int err; | 838 | int err; |
849 | int frame_finished; | ||
850 | int duration; | 839 | int duration; |
851 | unsigned char *iob; | 840 | unsigned char *iob; |
852 | 841 | ||
842 | |||
853 | totalSize =0; | 843 | totalSize =0; |
854 | 844 | ||
855 | if (NULL == (iob = av_malloc (16 * 1024))) | 845 | if (NULL == (iob = av_malloc (16 * 1024))) |
@@ -982,7 +972,6 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec) | |||
982 | 972 | ||
983 | if (err >= 0) | 973 | if (err >= 0) |
984 | avcodec_flush_buffers (codec_ctx); | 974 | avcodec_flush_buffers (codec_ctx); |
985 | frame_finished = 0; | ||
986 | 975 | ||
987 | 976 | ||
988 | /** | 977 | /** |
@@ -1120,7 +1109,6 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec) | |||
1120 | void | 1109 | void |
1121 | EXTRACTOR_previewopus_extract_method (struct EXTRACTOR_ExtractContext *ec) | 1110 | EXTRACTOR_previewopus_extract_method (struct EXTRACTOR_ExtractContext *ec) |
1122 | { | 1111 | { |
1123 | unsigned int i; | ||
1124 | ssize_t iret; | 1112 | ssize_t iret; |
1125 | void *data; | 1113 | void *data; |
1126 | 1114 | ||