changeset 2076:7b4df9e3b6fd libavformat

RoQ muxer, patch by Vitor, vitor1001 gmail com reference thread: Subject: [FFmpeg-devel] [PATCH] RoQ muxer Date: Wed, 09 May 2007 19:44:21 +0200
author diego
date Wed, 09 May 2007 23:07:40 +0000
parents f316c0daf0ad
children 4b07eb8709f2
files Makefile allformats.c allformats.h raw.c
diffstat 4 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Tue May 08 23:25:31 2007 +0000
+++ b/Makefile	Wed May 09 23:07:40 2007 +0000
@@ -116,6 +116,7 @@
 OBJS-$(CONFIG_RM_DEMUXER)                += rm.o
 OBJS-$(CONFIG_RM_MUXER)                  += rm.o
 OBJS-$(CONFIG_ROQ_DEMUXER)               += idroq.o
+OBJS-$(CONFIG_ROQ_MUXER)                 += raw.o
 OBJS-$(CONFIG_RTP_MUXER)                 += rtp.o rtp_h264.o
 OBJS-$(CONFIG_RTSP_DEMUXER)              += rtsp.o
 OBJS-$(CONFIG_SDP_DEMUXER)               += rtsp.o
--- a/allformats.c	Tue May 08 23:25:31 2007 +0000
+++ b/allformats.c	Wed May 09 23:07:40 2007 +0000
@@ -131,7 +131,7 @@
     REGISTER_MUXER   (PSP, psp);
     REGISTER_MUXDEMUX(RAWVIDEO, rawvideo);
     REGISTER_MUXDEMUX(RM, rm);
-    REGISTER_DEMUXER (ROQ, roq);
+    REGISTER_MUXDEMUX(ROQ, roq);
     REGISTER_DEMUXER (REDIR, redir);
     REGISTER_MUXER   (RTP, rtp);
     REGISTER_DEMUXER (RTSP, rtsp);
--- a/allformats.h	Tue May 08 23:25:31 2007 +0000
+++ b/allformats.h	Wed May 09 23:07:40 2007 +0000
@@ -169,6 +169,7 @@
 extern AVOutputFormat psp_muxer;
 extern AVOutputFormat rawvideo_muxer;
 extern AVOutputFormat rm_muxer;
+extern AVOutputFormat roq_muxer;
 extern AVOutputFormat swf_muxer;
 extern AVOutputFormat tg2_muxer;
 extern AVOutputFormat tgp_muxer;
--- a/raw.c	Tue May 08 23:25:31 2007 +0000
+++ b/raw.c	Wed May 09 23:07:40 2007 +0000
@@ -43,6 +43,19 @@
     return 0;
 }
 
+
+static int roq_write_header(struct AVFormatContext *s)
+{
+    static const uint8_t header[] = {
+        0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00
+    };
+
+    put_buffer(&s->pb, header, 8);
+    put_flush_packet(&s->pb);
+
+    return 0;
+}
+
 static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
     put_buffer(&s->pb, pkt->data, pkt->size);
@@ -527,6 +540,22 @@
     .extensions = "aac",
 };
 
+#ifdef CONFIG_ROQ_MUXER
+AVOutputFormat roq_muxer =
+{
+    "RoQ",
+    "Id RoQ format",
+    NULL,
+    "roq",
+    0,
+    CODEC_ID_ROQ_DPCM,
+    CODEC_ID_ROQ,
+    roq_write_header,
+    raw_write_packet,
+    raw_write_trailer,
+};
+#endif //CONFIG_ROQ_MUXER
+
 AVInputFormat h261_demuxer = {
     "h261",
     "raw h261",