changeset 686:e2687b784c3a libavformat

shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
author michael
date Sat, 26 Feb 2005 03:36:04 +0000
parents 4b339414d338
children 561f27e36bc4
files raw.c utils.c
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/raw.c	Fri Feb 25 11:15:31 2005 +0000
+++ b/raw.c	Sat Feb 26 03:36:04 2005 +0000
@@ -188,6 +188,21 @@
     return 0;
 }
 
+static int shorten_read_header(AVFormatContext *s,
+                               AVFormatParameters *ap)
+{
+    AVStream *st;
+
+    st = av_new_stream(s, 0);
+    if (!st)
+        return AVERROR_NOMEM;
+    st->codec.codec_type = CODEC_TYPE_AUDIO;
+    st->codec.codec_id = CODEC_ID_SHORTEN;
+    st->need_parsing = 1;
+    /* the parameters will be extracted from the compressed bitstream */
+    return 0;
+}
+
 /* dts read */
 static int dts_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
@@ -295,6 +310,17 @@
     return 0;
 }
 
+AVInputFormat shorten_iformat = {
+    "shn",
+    "raw shn",
+    0,
+    NULL,
+    shorten_read_header,
+    raw_read_partial_packet,
+    raw_read_close,
+    .extensions = "shn",
+};
+
 AVInputFormat ac3_iformat = {
     "ac3",
     "raw ac3",
@@ -672,6 +698,9 @@
 
 int raw_init(void)
 {
+
+    av_register_input_format(&shorten_iformat);
+
     av_register_input_format(&ac3_iformat);
     av_register_output_format(&ac3_oformat);
 
--- a/utils.c	Fri Feb 25 11:15:31 2005 +0000
+++ b/utils.c	Sat Feb 26 03:36:04 2005 +0000
@@ -1845,6 +1845,7 @@
              st->codec.codec_id == CODEC_ID_PGMYUV ||
              st->codec.codec_id == CODEC_ID_PBM ||
              st->codec.codec_id == CODEC_ID_PPM ||
+             st->codec.codec_id == CODEC_ID_SHORTEN ||
              (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing)))
             try_decode_frame(st, pkt->data, pkt->size);