summaryrefslogtreecommitdiff
path: root/libavformat/img2enc.c
diff options
context:
space:
mode:
authortab <tab@0x09.net>2015-09-06 11:07:20 -0400
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-07 02:48:58 +0200
commitfb135139fd3992eb1f0eacc9cfd878e05b95ec46 (patch)
treec08840b331cd163c87f5dee44fb7cbf3a9db438e /libavformat/img2enc.c
parentb480f0e37a4297f19ab9e2244a232ba9d5baf499 (diff)
downloadffmpeg-fb135139fd3992eb1f0eacc9cfd878e05b95ec46.tar.gz
avformat: implement query_codec for the image2 muxer.
Allows avformat_query_codec to be used to check for valid image2 encoders. Reuses the existing ff_guess_image2_codec ID table. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/img2enc.c')
-rw-r--r--libavformat/img2enc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index f56c39e6d3..5dd4c77c37 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -30,6 +30,7 @@
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
+#include "img2.h"
typedef struct VideoMuxData {
const AVClass *class; /**< Class for private options. */
@@ -172,6 +173,17 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
+static int query_codec(enum AVCodecID id, int std_compliance)
+{
+ int i;
+ for (i = 0; ff_img_tags[i].id != AV_CODEC_ID_NONE; i++)
+ if (ff_img_tags[i].id == id)
+ return 1;
+
+ // Anything really can be stored in img2
+ return std_compliance < FF_COMPLIANCE_NORMAL;
+}
+
#define OFFSET(x) offsetof(VideoMuxData, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption muxoptions[] = {
@@ -200,6 +212,7 @@ AVOutputFormat ff_image2_muxer = {
.video_codec = AV_CODEC_ID_MJPEG,
.write_header = write_header,
.write_packet = write_packet,
+ .query_codec = query_codec,
.flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE,
.priv_class = &img2mux_class,
};
@@ -212,6 +225,7 @@ AVOutputFormat ff_image2pipe_muxer = {
.video_codec = AV_CODEC_ID_MJPEG,
.write_header = write_header,
.write_packet = write_packet,
+ .query_codec = query_codec,
.flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS
};
#endif