]> git.sesse.net Git - nageru/commitdiff
Fix issues with newer ffmpeg.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 31 Mar 2016 18:57:35 +0000 (20:57 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 31 Mar 2016 18:57:35 +0000 (20:57 +0200)
h264encode.cpp
httpd.cpp
image_input.cpp

index a478c2a1a2459a2fa24d3ed06c34a598ea1bf8d1..913c8886ab52e22305d0cc0224887fac8365b38c 100644 (file)
@@ -1538,7 +1538,7 @@ void H264EncoderImpl::save_codeddata(storage_task task)
              pending_audio_frames.erase(it); 
         }
 
-        AVFrame *frame = avcodec_alloc_frame();
+        AVFrame *frame = av_frame_alloc();
         frame->nb_samples = audio.size() / 2;
         frame->format = AV_SAMPLE_FMT_S32;
         frame->channel_layout = AV_CH_LAYOUT_STEREO;
@@ -1570,7 +1570,7 @@ void H264EncoderImpl::save_codeddata(storage_task task)
             httpd->add_packet(pkt, audio_pts + global_delay, audio_pts + global_delay);
         }
         // TODO: Delayed frames.
-        avcodec_free_frame(&frame);
+        av_frame_unref(frame);
         av_free_packet(&pkt);
         if (audio_pts == task.pts) break;
     }
index 3eda2a1e34b5d9fc7e62479d6a53ffe9612e3679..4b24890aa687f53bc4fc8aaf3ae0f49744ae8e4e 100644 (file)
--- a/httpd.cpp
+++ b/httpd.cpp
@@ -115,6 +115,8 @@ HTTPD::Mux::Mux(AVFormatContext *avctx, int width, int height)
                exit(1);
        }
        avstream_video->time_base = AVRational{1, TIMEBASE};
+       avstream_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+       avstream_video->codec->codec_id = AV_CODEC_ID_H264;
        avstream_video->codec->width = width;
        avstream_video->codec->height = height;
        avstream_video->codec->time_base = AVRational{1, TIMEBASE};
index 2bd147d139ec9fbc6c5065f20484cfc3c16e01d5..ab1af285189f6099635ca2b83f77874af073f822 100644 (file)
@@ -85,10 +85,10 @@ const uint8_t *ImageInput::load_image(const string &filename)
 
        // TODO: Scale down if needed!
        AVPicture pic;
-       avpicture_alloc(&pic, PIX_FMT_RGBA, frame->width, frame->height);
+       avpicture_alloc(&pic, AV_PIX_FMT_RGBA, frame->width, frame->height);
        SwsContext *sws_ctx = sws_getContext(frame->width, frame->height,
-               (PixelFormat)frame->format, frame->width, frame->height,
-               PIX_FMT_RGBA, SWS_BICUBIC, nullptr, nullptr, nullptr);
+               (AVPixelFormat)frame->format, frame->width, frame->height,
+               AV_PIX_FMT_RGBA, SWS_BICUBIC, nullptr, nullptr, nullptr);
        if (sws_ctx == nullptr) {
                fprintf(stderr, "%s: Could not create scaler context\n", filename.c_str());
                exit(1);
@@ -98,7 +98,7 @@ const uint8_t *ImageInput::load_image(const string &filename)
 
        size_t len = frame->width * frame->height * 4;
        unique_ptr<uint8_t[]> image_data(new uint8_t[len]);
-       av_image_copy_to_buffer(image_data.get(), len, pic.data, pic.linesize, PIX_FMT_RGBA, frame->width, frame->height, 1);
+       av_image_copy_to_buffer(image_data.get(), len, pic.data, pic.linesize, AV_PIX_FMT_RGBA, frame->width, frame->height, 1);
 
        avpicture_free(&pic);
        av_frame_free(&frame);