]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/assdec.c
shorten: use bytestream functions to decode the embedded WAVE header
[ffmpeg] / libavformat / assdec.c
index 9f03b884910f0d24b2aba46eb06693a4befbf096..6b9c3dea95efac1afef0d3c6f4b09601fa3e21c7 100644 (file)
@@ -2,23 +2,24 @@
  * SSA/ASS demuxer
  * Copyright (c) 2008 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/mathematics.h"
 #include "avformat.h"
 #include "internal.h"
 
@@ -76,13 +77,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     int i, len, header_remaining;
     ASSContext *ass = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     int allocated[2]={0};
     uint8_t *p, **dst[2]={0};
     int pos[2]={0};
 
-    st = av_new_stream(s, 0);
+    st = avformat_new_stream(s, NULL);
     if (!st)
         return -1;
     av_set_pts_info(st, 64, 1, 100);
@@ -92,7 +93,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     header_remaining= INT_MAX;
     dst[0] = &st->codec->extradata;
     dst[1] = &ass->event_buffer;
-    while(!url_feof(pb)){
+    while(!pb->eof_reached){
         uint8_t line[MAX_LINESIZE];
 
         len = ff_get_line(pb, line, sizeof(line));
@@ -168,7 +169,7 @@ static int read_seek2(AVFormatContext *s, int stream_index,
     ASSContext *ass = s->priv_data;
 
     if (flags & AVSEEK_FLAG_BYTE) {
-        return AVERROR_NOTSUPP;
+        return AVERROR(ENOSYS);
     } else if (flags & AVSEEK_FLAG_FRAME) {
         if (ts < 0 || ts >= ass->event_count)
             return AVERROR(ERANGE);
@@ -202,13 +203,13 @@ static int read_seek2(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-AVInputFormat ass_demuxer = {
-    "ass",
-    NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle format"),
-    sizeof(ASSContext),
-    probe,
-    read_header,
-    read_packet,
-    read_close,
-    .read_seek2  = read_seek2,
+AVInputFormat ff_ass_demuxer = {
+    .name           = "ass",
+    .long_name      = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle format"),
+    .priv_data_size = sizeof(ASSContext),
+    .read_probe     = probe,
+    .read_header    = read_header,
+    .read_packet    = read_packet,
+    .read_close     = read_close,
+    .read_seek2     = read_seek2,
 };