]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/psxstr.c
lavfi: rename vsrc_buffer.c to buffersrc.c
[ffmpeg] / libavformat / psxstr.c
index ac6104fced38cff48be7876ff056332cff75029d..6405c246bd70749658638db43100b21992b50444 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "internal.h"
 
 #define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
 #define CDXA_TAG MKTAG('C', 'D', 'X', 'A')
@@ -95,8 +96,7 @@ static int str_probe(AVProbeData *p)
     return 50;
 }
 
-static int str_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
+static int str_read_header(AVFormatContext *s)
 {
     AVIOContext *pb = s->pb;
     StrDemuxContext *str = s->priv_data;
@@ -162,10 +162,10 @@ static int str_read_packet(AVFormatContext *s,
 
                 if(str->channels[channel].video_stream_index < 0){
                     /* allocate a new AVStream */
-                    st = av_new_stream(s, 0);
+                    st = avformat_new_stream(s, NULL);
                     if (!st)
                         return AVERROR(ENOMEM);
-                    av_set_pts_info(st, 64, 1, 15);
+                    avpriv_set_pts_info(st, 64, 1, 15);
 
                     str->channels[channel].video_stream_index = st->index;
 
@@ -210,7 +210,7 @@ static int str_read_packet(AVFormatContext *s,
             if(str->channels[channel].audio_stream_index < 0){
                 int fmt = sector[0x13];
                 /* allocate a new AVStream */
-                st = av_new_stream(s, 0);
+                st = avformat_new_stream(s, NULL);
                 if (!st)
                     return AVERROR(ENOMEM);
 
@@ -224,7 +224,9 @@ static int str_read_packet(AVFormatContext *s,
             //    st->codec->bit_rate = 0; //FIXME;
                 st->codec->block_align = 128;
 
-                av_set_pts_info(st, 64, 128, st->codec->sample_rate);
+                avpriv_set_pts_info(st, 64, 18 * 224 / st->codec->channels,
+                                    st->codec->sample_rate);
+                st->start_time = 0;
             }
             pkt = ret_pkt;
             if (av_new_packet(pkt, 2304))
@@ -233,6 +235,7 @@ static int str_read_packet(AVFormatContext *s,
 
             pkt->stream_index =
                 str->channels[channel].audio_stream_index;
+            pkt->duration = 1;
             return 0;
         default:
             av_log(s, AV_LOG_WARNING, "Unknown sector type %02X\n", sector[0x12]);
@@ -265,4 +268,5 @@ AVInputFormat ff_str_demuxer = {
     .read_header    = str_read_header,
     .read_packet    = str_read_packet,
     .read_close     = str_read_close,
+    .flags          = AVFMT_NO_BYTE_SEEK,
 };