summaryrefslogtreecommitdiff
path: root/libav/jpeg.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2002-05-20 16:31:13 +0000
committerFabrice Bellard <fabrice@bellard.org>2002-05-20 16:31:13 +0000
commitc9a65ca8c306071b3c359b56a384a1594cd505df (patch)
treea33c4b156673f2c1404042501c1cebaae6a35457 /libav/jpeg.c
parentdb7f1f95acc050bb5ddf62b0008eab8c8305d369 (diff)
converted to new API
Originally committed as revision 547 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/jpeg.c')
-rw-r--r--libav/jpeg.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/libav/jpeg.c b/libav/jpeg.c
index 732898252b..a017cbffb0 100644
--- a/libav/jpeg.c
+++ b/libav/jpeg.c
@@ -52,11 +52,12 @@ static int mpjpeg_write_trailer(AVFormatContext *s)
return 0;
}
-AVFormat mpjpeg_format = {
+static AVOutputFormat mpjpeg_format = {
"mpjpeg",
"Mime multipart JPEG format",
"multipart/x-mixed-replace;boundary=" BOUNDARY_TAG,
"mjpg",
+ 0,
CODEC_ID_NONE,
CODEC_ID_MJPEG,
mpjpeg_write_header,
@@ -86,11 +87,12 @@ static int single_jpeg_write_trailer(AVFormatContext *s)
return 0;
}
-AVFormat single_jpeg_format = {
+static AVOutputFormat single_jpeg_format = {
"singlejpeg",
"single JPEG image",
"image/jpeg",
"jpg,jpeg",
+ 0,
CODEC_ID_NONE,
CODEC_ID_MJPEG,
single_jpeg_write_header,
@@ -114,7 +116,7 @@ static int jpeg_write_header(AVFormatContext *s1)
if (!s)
return -1;
s1->priv_data = s;
- nstrcpy(s->path, sizeof(s->path), s1->filename);
+ pstrcpy(s->path, sizeof(s->path), s1->filename);
s->img_number = 1;
return 0;
}
@@ -162,7 +164,7 @@ static int jpeg_read_header(AVFormatContext *s1, AVFormatParameters *ap)
if (!s)
return -1;
s1->priv_data = s;
- nstrcpy(s->path, sizeof(s->path), s1->filename);
+ pstrcpy(s->path, sizeof(s->path), s1->filename);
s1->nb_streams = 1;
st = av_mallocz(sizeof(AVStream));
@@ -231,20 +233,38 @@ static int jpeg_read_close(AVFormatContext *s1)
return 0;
}
-AVFormat jpeg_format = {
+static AVInputFormat jpeg_iformat = {
+ "jpeg",
+ "JPEG image",
+ sizeof(JpegContext),
+ NULL,
+ jpeg_read_header,
+ jpeg_read_packet,
+ jpeg_read_close,
+ NULL,
+ flags: AVFMT_NOFILE | AVFMT_NEEDNUMBER,
+ extensions: "jpg,jpeg",
+};
+
+static AVOutputFormat jpeg_oformat = {
"jpeg",
"JPEG image",
"image/jpeg",
"jpg,jpeg",
+ sizeof(JpegContext),
CODEC_ID_NONE,
CODEC_ID_MJPEG,
jpeg_write_header,
jpeg_write_packet,
jpeg_write_trailer,
-
- jpeg_read_header,
- jpeg_read_packet,
- jpeg_read_close,
- NULL,
- AVFMT_NOFILE | AVFMT_NEEDNUMBER,
+ flags: AVFMT_NOFILE | AVFMT_NEEDNUMBER,
};
+
+int jpeg_init(void)
+{
+ av_register_output_format(&mpjpeg_format);
+ av_register_output_format(&single_jpeg_format);
+ av_register_input_format(&jpeg_iformat);
+ av_register_output_format(&jpeg_oformat);
+ return 0;
+}