Commit 25b9eef4 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  cljr: K&R cosmetics
  cljr: return a more sensible value when encountering invalid headers
  cljr: drop unnecessary emms_c() calls without MMX code
  cljr: remove useless casts
  cljr: group encode/decode parts under single ifdefs
  cljr: remove stray semicolon
  cljr: add missing return statement in decode_end()
  doc: add pulseaudio to the input list
  avconv: remove unsubstantiated comment
  shorten: avoid abort() on unknown audio types
  cljr: add encoder
  build: merge lists of HTML documentation targets
  tests/examples: Mark some variables only used within their files as static.
  tests/tools/examples: Replace direct exit() calls by return.
  x86 cpuid: set vendor union members separately
  cljr: release picture at end of decoding
  rv40: NEON optimised rv40 qpel motion compensation

Conflicts:
	doc/examples/muxing.c
	libavcodec/cljr.c
	libavcodec/version.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents b229485f 6b60a4c9
......@@ -130,6 +130,7 @@ easier to use. The changes are:
- Microsoft Windows ICO demuxer
- life source
- PCM format support in OMA demuxer
- CLJR encoder
version 0.8:
......
......@@ -643,7 +643,7 @@ void exit_program(int ret)
exit (255);
}
exit(ret); /* not all OS-es handle main() return value */
exit(ret);
}
static void assert_avoptions(AVDictionary *m)
......
MANPAGES = $(PROGS-yes:%=doc/%.1)
PODPAGES = $(PROGS-yes:%=doc/%.pod)
HTMLPAGES = $(PROGS-yes:%=doc/%.html)
HTMLPAGES = $(PROGS-yes:%=doc/%.html) \
doc/developer.html \
doc/faq.html \
doc/general.html \
doc/libavfilter.html \
DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
DOCS = $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
all-$(CONFIG_DOC): documentation
......
......@@ -50,11 +50,11 @@ static int sws_flags = SWS_BICUBIC;
/**************************************************************/
/* audio output */
float t, tincr, tincr2;
int16_t *samples;
uint8_t *audio_outbuf;
int audio_outbuf_size;
int audio_input_frame_size;
static float t, tincr, tincr2;
static int16_t *samples;
static uint8_t *audio_outbuf;
static int audio_outbuf_size;
static int audio_input_frame_size;
/*
* add an audio output stream
......@@ -190,9 +190,9 @@ static void close_audio(AVFormatContext *oc, AVStream *st)
/**************************************************************/
/* video output */
AVFrame *picture, *tmp_picture;
uint8_t *video_outbuf;
int frame_count, video_outbuf_size;
static AVFrame *picture, *tmp_picture;
static uint8_t *video_outbuf;
static int frame_count, video_outbuf_size;
/* add a video output stream */
static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
......@@ -454,7 +454,7 @@ int main(int argc, char **argv)
"The output format is automatically guessed according to the file extension.\n"
"Raw images can also be output by using '%%d' in the filename\n"
"\n", argv[0]);
exit(1);
return 1;
}
filename = argv[1];
......@@ -466,7 +466,7 @@ int main(int argc, char **argv)
avformat_alloc_output_context2(&oc, NULL, "mpeg", filename);
}
if (!oc) {
exit(1);
return 1;
}
fmt = oc->oformat;
......@@ -494,7 +494,7 @@ int main(int argc, char **argv)
if (!(fmt->flags & AVFMT_NOFILE)) {
if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
fprintf(stderr, "Could not open '%s'\n", filename);
exit(1);
return 1;
}
}
......
......@@ -401,7 +401,7 @@ following image formats are supported:
@tab Codec used in Delphine Software International games.
@item Discworld II BMV Video @tab @tab X
@item Cinepak @tab @tab X
@item Cirrus Logic AccuPak @tab @tab X
@item Cirrus Logic AccuPak @tab X @tab X
@tab fourcc: CLJR
@item Creative YUV (CYUV) @tab @tab X
@item DFA @tab @tab X
......@@ -788,6 +788,7 @@ performance on systems without hardware floating point support).
@item JACK @tab X @tab
@item LIBDC1394 @tab X @tab
@item OSS @tab X @tab X
@item Pulseaudio @tab X @tab
@item Video4Linux @tab X @tab
@item Video4Linux2 @tab X @tab
@item VfW capture @tab X @tab
......
......@@ -89,7 +89,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (CAVS, cavs);
REGISTER_DECODER (CDGRAPHICS, cdgraphics);
REGISTER_DECODER (CINEPAK, cinepak);
REGISTER_DECODER (CLJR, cljr);
REGISTER_ENCDEC (CLJR, cljr);
REGISTER_DECODER (CSCD, cscd);
REGISTER_DECODER (CYUV, cyuv);
REGISTER_DECODER (DFA, dfa);
......
......@@ -23,6 +23,28 @@
#include "libavcodec/avcodec.h"
#include "libavcodec/rv34dsp.h"
#define DECL_QPEL3(type, w, pos) \
void ff_##type##_rv40_qpel##w##_mc##pos##_neon(uint8_t *dst, uint8_t *src,\
int stride)
#define DECL_QPEL2(w, pos) \
DECL_QPEL3(put, w, pos); \
DECL_QPEL3(avg, w, pos)
#define DECL_QPEL_XY(x, y) \
DECL_QPEL2(16, x ## y); \
DECL_QPEL2(8, x ## y)
#define DECL_QPEL_Y(y) \
DECL_QPEL_XY(0, y); \
DECL_QPEL_XY(1, y); \
DECL_QPEL_XY(2, y); \
DECL_QPEL_XY(3, y); \
DECL_QPEL_Y(0);
DECL_QPEL_Y(1);
DECL_QPEL_Y(2);
DECL_QPEL_Y(3);
void ff_put_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
void ff_put_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
......@@ -34,6 +56,59 @@ void ff_rv40_weight_func_8_neon(uint8_t *, uint8_t *, uint8_t *, int, int, int);
void ff_rv40dsp_init_neon(RV34DSPContext *c, DSPContext* dsp)
{
c->put_pixels_tab[0][ 1] = ff_put_rv40_qpel16_mc10_neon;
c->put_pixels_tab[0][ 3] = ff_put_rv40_qpel16_mc30_neon;
c->put_pixels_tab[0][ 4] = ff_put_rv40_qpel16_mc01_neon;
c->put_pixels_tab[0][ 5] = ff_put_rv40_qpel16_mc11_neon;
c->put_pixels_tab[0][ 6] = ff_put_rv40_qpel16_mc21_neon;
c->put_pixels_tab[0][ 7] = ff_put_rv40_qpel16_mc31_neon;
c->put_pixels_tab[0][ 9] = ff_put_rv40_qpel16_mc12_neon;
c->put_pixels_tab[0][10] = ff_put_rv40_qpel16_mc22_neon;
c->put_pixels_tab[0][11] = ff_put_rv40_qpel16_mc32_neon;
c->put_pixels_tab[0][12] = ff_put_rv40_qpel16_mc03_neon;
c->put_pixels_tab[0][13] = ff_put_rv40_qpel16_mc13_neon;
c->put_pixels_tab[0][14] = ff_put_rv40_qpel16_mc23_neon;
c->put_pixels_tab[0][15] = ff_put_rv40_qpel16_mc33_neon;
c->avg_pixels_tab[0][ 1] = ff_avg_rv40_qpel16_mc10_neon;
c->avg_pixels_tab[0][ 3] = ff_avg_rv40_qpel16_mc30_neon;
c->avg_pixels_tab[0][ 4] = ff_avg_rv40_qpel16_mc01_neon;
c->avg_pixels_tab[0][ 5] = ff_avg_rv40_qpel16_mc11_neon;
c->avg_pixels_tab[0][ 6] = ff_avg_rv40_qpel16_mc21_neon;
c->avg_pixels_tab[0][ 7] = ff_avg_rv40_qpel16_mc31_neon;
c->avg_pixels_tab[0][ 9] = ff_avg_rv40_qpel16_mc12_neon;
c->avg_pixels_tab[0][10] = ff_avg_rv40_qpel16_mc22_neon;
c->avg_pixels_tab[0][11] = ff_avg_rv40_qpel16_mc32_neon;
c->avg_pixels_tab[0][12] = ff_avg_rv40_qpel16_mc03_neon;
c->avg_pixels_tab[0][13] = ff_avg_rv40_qpel16_mc13_neon;
c->avg_pixels_tab[0][14] = ff_avg_rv40_qpel16_mc23_neon;
c->avg_pixels_tab[0][15] = ff_avg_rv40_qpel16_mc33_neon;
c->put_pixels_tab[1][ 1] = ff_put_rv40_qpel8_mc10_neon;
c->put_pixels_tab[1][ 3] = ff_put_rv40_qpel8_mc30_neon;
c->put_pixels_tab[1][ 4] = ff_put_rv40_qpel8_mc01_neon;
c->put_pixels_tab[1][ 5] = ff_put_rv40_qpel8_mc11_neon;
c->put_pixels_tab[1][ 6] = ff_put_rv40_qpel8_mc21_neon;
c->put_pixels_tab[1][ 7] = ff_put_rv40_qpel8_mc31_neon;
c->put_pixels_tab[1][ 9] = ff_put_rv40_qpel8_mc12_neon;
c->put_pixels_tab[1][10] = ff_put_rv40_qpel8_mc22_neon;
c->put_pixels_tab[1][11] = ff_put_rv40_qpel8_mc32_neon;
c->put_pixels_tab[1][12] = ff_put_rv40_qpel8_mc03_neon;
c->put_pixels_tab[1][13] = ff_put_rv40_qpel8_mc13_neon;
c->put_pixels_tab[1][14] = ff_put_rv40_qpel8_mc23_neon;
c->put_pixels_tab[1][15] = ff_put_rv40_qpel8_mc33_neon;
c->avg_pixels_tab[1][ 1] = ff_avg_rv40_qpel8_mc10_neon;
c->avg_pixels_tab[1][ 3] = ff_avg_rv40_qpel8_mc30_neon;
c->avg_pixels_tab[1][ 4] = ff_avg_rv40_qpel8_mc01_neon;
c->avg_pixels_tab[1][ 5] = ff_avg_rv40_qpel8_mc11_neon;
c->avg_pixels_tab[1][ 6] = ff_avg_rv40_qpel8_mc21_neon;
c->avg_pixels_tab[1][ 7] = ff_avg_rv40_qpel8_mc31_neon;
c->avg_pixels_tab[1][ 9] = ff_avg_rv40_qpel8_mc12_neon;
c->avg_pixels_tab[1][10] = ff_avg_rv40_qpel8_mc22_neon;
c->avg_pixels_tab[1][11] = ff_avg_rv40_qpel8_mc32_neon;
c->avg_pixels_tab[1][12] = ff_avg_rv40_qpel8_mc03_neon;
c->avg_pixels_tab[1][13] = ff_avg_rv40_qpel8_mc13_neon;
c->avg_pixels_tab[1][14] = ff_avg_rv40_qpel8_mc23_neon;
c->avg_pixels_tab[1][15] = ff_avg_rv40_qpel8_mc33_neon;
c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_neon;
c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_neon;
c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_neon;
......
This diff is collapsed.
......@@ -25,119 +25,92 @@
*/
#include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h"
#include "put_bits.h"
/* Disable the encoder. */
#undef CONFIG_CLJR_ENCODER
#define CONFIG_CLJR_ENCODER 0
typedef struct CLJRContext{
typedef struct CLJRContext {
AVCodecContext *avctx;
AVFrame picture;
AVFrame picture;
} CLJRContext;
static av_cold int common_init(AVCodecContext *avctx)
{
CLJRContext * const a = avctx->priv_data;
avcodec_get_frame_defaults(&a->picture);
avctx->coded_frame = &a->picture;
a->avctx = avctx;
return 0;
}
#if CONFIG_CLJR_DECODER
static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int buf_size = avpkt->size;
CLJRContext * const a = avctx->priv_data;
GetBitContext gb;
AVFrame *picture = data;
AVFrame * const p= (AVFrame*)&a->picture;
AVFrame * const p = &a->picture;
int x, y;
if(p->data[0])
if (p->data[0])
avctx->release_buffer(avctx, p);
if(buf_size/avctx->height < avctx->width) {
av_log(avctx, AV_LOG_ERROR, "Resolution larger than buffer size. Invalid header?\n");
return -1;
if (buf_size / avctx->height < avctx->width) {
av_log(avctx, AV_LOG_ERROR,
"Resolution larger than buffer size. Invalid header?\n");
return AVERROR_INVALIDDATA;
}
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
p->reference = 0;
if (avctx->get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
init_get_bits(&gb, buf, buf_size * 8);
for(y=0; y<avctx->height; y++){
uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
uint8_t *cb= &a->picture.data[1][ y*a->picture.linesize[1] ];
uint8_t *cr= &a->picture.data[2][ y*a->picture.linesize[2] ];
for(x=0; x<avctx->width; x+=4){
for (y = 0; y < avctx->height; y++) {
uint8_t *luma = &a->picture.data[0][y * a->picture.linesize[0]];
uint8_t *cb = &a->picture.data[1][y * a->picture.linesize[1]];
uint8_t *cr = &a->picture.data[2][y * a->picture.linesize[2]];
for (x = 0; x < avctx->width; x += 4) {
luma[3] = get_bits(&gb, 5) << 3;
luma[2] = get_bits(&gb, 5) << 3;
luma[1] = get_bits(&gb, 5) << 3;
luma[0] = get_bits(&gb, 5) << 3;
luma+= 4;
luma += 4;
*(cb++) = get_bits(&gb, 6) << 2;
*(cr++) = get_bits(&gb, 6) << 2;
}
}
*picture= *(AVFrame*)&a->picture;
*picture = a->picture;
*data_size = sizeof(AVPicture);
emms_c();
return buf_size;
}
#if CONFIG_CLJR_ENCODER
static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
CLJRContext * const a = avctx->priv_data;
AVFrame *pict = data;
AVFrame * const p= (AVFrame*)&a->picture;
int size;
*p = *pict;
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
emms_c();
avpriv_align_put_bits(&a->pb);
while(get_bit_count(&a->pb)&31)
put_bits(&a->pb, 8, 0);
size= get_bit_count(&a->pb)/32;
return size*4;
}
#endif
static av_cold void common_init(AVCodecContext *avctx){
CLJRContext * const a = avctx->priv_data;
avcodec_get_frame_defaults(&a->picture);
avctx->coded_frame= (AVFrame*)&a->picture;
a->avctx= avctx;
}
static av_cold int decode_init(AVCodecContext *avctx){
common_init(avctx);
avctx->pix_fmt= PIX_FMT_YUV411P;
return 0;
static av_cold int decode_init(AVCodecContext *avctx)
{
avctx->pix_fmt = PIX_FMT_YUV411P;
return common_init(avctx);
}
#if CONFIG_CLJR_ENCODER
static av_cold int encode_init(AVCodecContext *avctx){
common_init(avctx);
static av_cold int decode_end(AVCodecContext *avctx)
{
CLJRContext *a = avctx->priv_data;
if (a->picture.data[0])
avctx->release_buffer(avctx, &a->picture);
return 0;
}
#endif
AVCodec ff_cljr_decoder = {
.name = "cljr",
......@@ -145,19 +118,55 @@ AVCodec ff_cljr_decoder = {
.id = CODEC_ID_CLJR,
.priv_data_size = sizeof(CLJRContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
.long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
};
#endif
#if CONFIG_CLJR_ENCODER
static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
int buf_size, void *data)
{
PutBitContext pb;
AVFrame *p = data;
int x, y;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
init_put_bits(&pb, buf, buf_size / 8);
for (y = 0; y < avctx->height; y++) {
uint8_t *luma = &p->data[0][y * p->linesize[0]];
uint8_t *cb = &p->data[1][y * p->linesize[1]];
uint8_t *cr = &p->data[2][y * p->linesize[2]];
for (x = 0; x < avctx->width; x += 4) {
put_bits(&pb, 5, luma[3] >> 3);
put_bits(&pb, 5, luma[2] >> 3);
put_bits(&pb, 5, luma[1] >> 3);
put_bits(&pb, 5, luma[0] >> 3);
luma += 4;
put_bits(&pb, 6, *(cb++) >> 2);
put_bits(&pb, 6, *(cr++) >> 2);
}
}
flush_put_bits(&pb);
return put_bits_count(&pb) / 8;
}
AVCodec ff_cljr_encoder = {
.name = "cljr",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_CLJR,
.priv_data_size = sizeof(CLJRContext),
.init = encode_init,
.init = common_init,
.encode = encode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
.pix_fmts = (const enum PixelFormat[]) { PIX_FMT_YUV411P,
PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
};
#endif
......@@ -170,7 +170,7 @@ static const struct algo idct_tab[] = {
#define AANSCALE_BITS 12
uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
static uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
static int64_t gettime(void)
{
......
......@@ -37,8 +37,6 @@
#include <stdlib.h>
#include <string.h>
#undef exit
/* reference fft */
#define MUL16(a,b) ((a) * (b))
......@@ -228,7 +226,6 @@ static void help(void)
"-n b set the transform size to 2^b\n"
"-f x set scale factor for output data of (I)MDCT to x\n"
);
exit(1);
}
enum tf_transform {
......@@ -267,7 +264,7 @@ int main(int argc, char **argv)
switch(c) {
case 'h':
help();
break;
return 1;
case 's':
do_speed = 1;
break;
......
......@@ -33,14 +33,13 @@
#include "dsputil.h"
#include "libavutil/lfg.h"
#undef exit
#undef printf
#define WIDTH 64
#define HEIGHT 64
uint8_t img1[WIDTH * HEIGHT];
uint8_t img2[WIDTH * HEIGHT];
static uint8_t img1[WIDTH * HEIGHT];
static uint8_t img2[WIDTH * HEIGHT];
static void fill_random(uint8_t *tab, int size)
{
......@@ -61,7 +60,6 @@ static void help(void)
{
printf("motion-test [-h]\n"
"test motion implementations\n");
exit(1);
}
static int64_t gettime(void)
......@@ -138,7 +136,7 @@ int main(int argc, char **argv)
switch(c) {
case 'h':
help();
break;
return 1;
}
}
......
......@@ -176,7 +176,7 @@ static void fix_bitshift(ShortenContext *s, int32_t *buffer)
}
static void init_offset(ShortenContext *s)
static int init_offset(ShortenContext *s)
{
int32_t mean = 0;
int chan, i;
......@@ -190,12 +190,13 @@ static void init_offset(ShortenContext *s)
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "unknown audio type");
abort();
return AVERROR_INVALIDDATA;
}
for (chan = 0; chan < s->channels; chan++)
for (i = 0; i < nblock; i++)
s->offset[chan][i] = mean;
return 0;
}
static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
......@@ -367,7 +368,8 @@ static int read_header(ShortenContext *s)
if ((ret = allocate_buffers(s)) < 0)
return ret;
init_offset(s);
if ((ret = init_offset(s)) < 0)
return ret;
if (s->version > 1)
s->lpcqoffset = V2LPCQOFFSET;
......
......@@ -21,8 +21,8 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 41
#define LIBAVCODEC_VERSION_MICRO 2
#define LIBAVCODEC_VERSION_MINOR 42
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
......
......@@ -266,7 +266,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') },
{ CODEC_ID_PNG, MKTAG('M', 'P', 'N', 'G') },
{ CODEC_ID_PNG, MKTAG('P', 'N', 'G', '1') },
{ CODEC_ID_CLJR, MKTAG('c', 'l', 'j', 'r') },
{ CODEC_ID_CLJR, MKTAG('C', 'L', 'J', 'R') },
{ CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
{ CODEC_ID_RPZA, MKTAG('a', 'z', 'p', 'r') },
{ CODEC_ID_RPZA, MKTAG('R', 'P', 'Z', 'A') },
......
......@@ -28,7 +28,6 @@
#include "libavutil/mathematics.h"
#include "libavformat/avformat.h"
#undef exit
#undef printf
#undef fprintf
......@@ -75,7 +74,7 @@ int main(int argc, char **argv)
if (argc != 2) {
printf("usage: %s input_file\n"
"\n", argv[0]);
exit(1);
return 1;
}
filename = argv[1];
......@@ -84,13 +83,13 @@ int main(int argc, char **argv)
av_dict_free(&format_opts);
if (ret < 0) {
fprintf(stderr, "cannot open %s\n", filename);
exit(1);
return 1;
}
ret = avformat_find_stream_info(ic, NULL);
if (ret < 0) {
fprintf(stderr, "%s: could not find codec parameters\n", filename);
exit(1);
return 1;
}
for(i=0; ; i++){
......
......@@ -61,7 +61,9 @@ unsigned long av_adler32_update(unsigned long adler, const uint8_t * buf,
#include "log.h"
#include "timer.h"
#define LEN 7001
volatile int checksum;
static volatile int checksum;
int main(int argc, char **argv)
{
int i;
......
......@@ -74,7 +74,10 @@ int ff_get_cpu_flags_x86(void)
return 0; /* CPUID not supported */
#endif
cpuid(0, max_std_level, vendor.i[0], vendor.i[2], vendor.i[1]);
cpuid(0, max_std_level, ebx, ecx, edx);
vendor.i[0] = ebx;
vendor.i[1] = edx;
vendor.i[2] = ecx;
if(max_std_level >= 1){
cpuid(1, eax, ebx, ecx, std_caps);
......
......@@ -29,14 +29,14 @@ int main(int argc, char *argv[])
if (argc < 3)
{
printf("Usage: %s <infile.swf> <outfile.swf>\n", argv[0]);
exit(1);
return 1;
}
fd_in = open(argv[1], O_RDONLY);
if (fd_in < 0)
{
perror("Error opening input file");
exit(1);
return 1;
}
fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644);
......@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
{
perror("Error opening output file");
close(fd_in);
exit(1);
return 1;
}
if (read(fd_in, &buf_in, 8) != 8)
......@@ -52,13 +52,13 @@ int main(int argc, char *argv[])
printf("Header error\n");
close(fd_in);
close(fd_out);
exit(1);
return 1;
}
if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S')
{
printf("Not a compressed flash file\n");
exit(1);
return 1;
}
fstat(fd_in, &statbuf);
......@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
buf_in[0] = 'F';
if (write(fd_out, &buf_in, 8) < 8) {
perror("Error writing output file");
exit(1);
return 1;
}
zstream.zalloc = NULL;
......@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
{
printf("Error while decompressing: %d\n", ret);
inflateEnd(&zstream);
exit(1);
return 1;
}
dbgprintf("a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out\n",
......@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
if (write(fd_out, &buf_out, zstream.total_out - last_out) < zstream.total_out - last_out) {
perror("Error writing output file");
exit(1);
return 1;
}
i += len;
......@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
lseek(fd_out, 4, SEEK_SET);
if (write(fd_out, &buf_in, 4) < 4) {
perror("Error writing output file");
exit(1);
return 1;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment