]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/flvenc.c
Make RTSP use the generic http authentication code
[ffmpeg] / libavformat / flvenc.c
index 183f137b4f2b4c4695d67a62b332e14450ce4792..cf6b1c566fe9d748a8333d6984aaac5d549de841 100644 (file)
@@ -29,6 +29,7 @@
 static const AVCodecTag flv_video_codec_ids[] = {
     {CODEC_ID_FLV1,    FLV_CODECID_H263  },
     {CODEC_ID_FLASHSV, FLV_CODECID_SCREEN},
+    {CODEC_ID_FLASHSV2, FLV_CODECID_SCREEN2},
     {CODEC_ID_VP6F,    FLV_CODECID_VP6   },
     {CODEC_ID_VP6,     FLV_CODECID_VP6   },
     {CODEC_ID_H264,    FLV_CODECID_H264  },
@@ -37,7 +38,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
 
 static const AVCodecTag flv_audio_codec_ids[] = {
     {CODEC_ID_MP3,       FLV_CODECID_MP3    >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_PCM_S8,    FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
+    {CODEC_ID_PCM_U8,    FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
     {CODEC_ID_PCM_S16BE, FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
     {CODEC_ID_PCM_S16LE, FLV_CODECID_PCM_LE >> FLV_AUDIO_CODECID_OFFSET},
     {CODEC_ID_ADPCM_SWF, FLV_CODECID_ADPCM  >> FLV_AUDIO_CODECID_OFFSET},
@@ -70,9 +71,9 @@ static int get_audio_flags(AVCodecContext *enc){
             return -1;
         }
         if (enc->frame_size / 320 > 8) {
-            av_log(enc, AV_LOG_WARNING, "Warning: Adobe Flash Player is known "
-                                        "to have trouble with Speex streams "
-                                        "with more than 8 frames per packet.\n");
+            av_log(enc, AV_LOG_WARNING, "Warning: Speex stream has more than "
+                                        "8 frames per packet. Adobe Flash "
+                                        "Player cannot handle this!\n");
         }
         return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;
     } else {
@@ -106,7 +107,7 @@ static int get_audio_flags(AVCodecContext *enc){
     case CODEC_ID_MP3:
         flags |= FLV_CODECID_MP3    | FLV_SAMPLESSIZE_16BIT;
         break;
-    case CODEC_ID_PCM_S8:
+    case CODEC_ID_PCM_U8:
         flags |= FLV_CODECID_PCM    | FLV_SAMPLESSIZE_8BIT;
         break;
     case CODEC_ID_PCM_S16BE:
@@ -220,7 +221,7 @@ static int flv_write_header(AVFormatContext *s)
 
     put_amf_string(pb, "duration");
     flv->duration_offset= url_ftell(pb);
-    put_amf_double(pb, 0); // delayed write
+    put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect
 
     if(video_enc){
         put_amf_string(pb, "width");
@@ -247,7 +248,7 @@ static int flv_write_header(AVFormatContext *s)
         put_amf_double(pb, audio_enc->sample_rate);
 
         put_amf_string(pb, "audiosamplesize");
-        put_amf_double(pb, audio_enc->codec_id == CODEC_ID_PCM_S8 ? 8 : 16);
+        put_amf_double(pb, audio_enc->codec_id == CODEC_ID_PCM_U8 ? 8 : 16);
 
         put_amf_string(pb, "stereo");
         put_amf_bool(pb, audio_enc->channels == 2);