]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/raw.c
Add a function rtsp_setup_output_streams for announcing the SDP
[ffmpeg] / libavformat / raw.c
index 3c118b36c2d7c6e00cb9322998808963a71a11c3..b2e3ae8aa8a1efbb37e14ab2969316e3a02adb5e 100644 (file)
@@ -66,7 +66,7 @@ static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     AVStream *st;
-    int id;
+    enum CodecID id;
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -120,9 +120,8 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
     ret= av_get_packet(s->pb, pkt, size);
 
     pkt->stream_index = 0;
-    if (ret <= 0) {
-        return AVERROR(EIO);
-    }
+    if (ret < 0)
+        return ret;
 
     bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id);
     assert(bps); // if false there IS a bug elsewhere (NOT in this function)
@@ -144,9 +143,9 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
     pkt->pos= url_ftell(s->pb);
     pkt->stream_index = 0;
     ret = get_partial_buffer(s->pb, pkt->data, size);
-    if (ret <= 0) {
+    if (ret < 0) {
         av_free_packet(pkt);
-        return AVERROR(EIO);
+        return ret;
     }
     pkt->size = ret;
     return ret;
@@ -171,11 +170,9 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
     pkt->dts= pkt->pos / packet_size;
 
     pkt->stream_index = 0;
-    if (ret != packet_size) {
-        return AVERROR(EIO);
-    } else {
-        return 0;
-    }
+    if (ret < 0)
+        return ret;
+    return 0;
 }
 #endif
 
@@ -208,9 +205,9 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
     pkt->pos = url_ftell(s->pb);
     pkt->stream_index = 0;
     ret = get_buffer(s->pb, pkt->data, size);
-    if (ret <= 0) {
+    if (ret < 0) {
         av_free_packet(pkt);
-        return AVERROR(EIO);
+        return ret;
     }
     pkt->size = ret;
     return ret;
@@ -222,8 +219,8 @@ int pcm_read_seek(AVFormatContext *s,
                   int stream_index, int64_t timestamp, int flags)
 {
     AVStream *st;
-    int block_align, byte_rate, ret;
-    int64_t pos;
+    int block_align, byte_rate;
+    int64_t pos, ret;
 
     st = s->streams[0];
 
@@ -285,6 +282,7 @@ static int video_read_header(AVFormatContext *s,
     } else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
                 st->codec->codec_id == CODEC_ID_MPEG4 ||
                 st->codec->codec_id == CODEC_ID_DIRAC ||
+                st->codec->codec_id == CODEC_ID_DNXHD ||
                 st->codec->codec_id == CODEC_ID_H264) {
         st->codec->time_base= (AVRational){1,25};
     }
@@ -475,7 +473,9 @@ static int h263_probe(AVProbeData *p)
             last_src_fmt= src_fmt;
         }
     }
-    if(valid_psc > 2*invalid_psc + 2*res_change + 2){
+//av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change);
+//h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg)
+    if(valid_psc > 2*invalid_psc + 2*res_change + 3){
         return 50;
     }else if(valid_psc > 2*invalid_psc)
         return 25;
@@ -497,7 +497,11 @@ static int h261_probe(AVProbeData *p)
     init_get_bits(&gb, p->buf, p->buf_size*8);
 
     for(i=0; i<p->buf_size*8; i++){
-        code = (code<<1) + get_bits1(&gb);
+        if ((code & 0x01ff0000) || !(code & 0xff00)) {
+            code = (code<<8) + get_bits(&gb, 8);
+            i += 7;
+        } else
+            code = (code<<1) + get_bits1(&gb);
         if ((code & 0xffff0000) == 0x10000) {
             int gn= (code>>12)&0xf;
             if(!gn)