]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sapenc.c
vqa: use 1/sample_rate as the audio stream time base
[ffmpeg] / libavformat / sapenc.c
index ad8cbac52f285adf4df8e407f75375f3db260724..d8ec465afa42445303ccbc9d99297b090989d04a 100644 (file)
@@ -146,7 +146,7 @@ static int sap_write_header(AVFormatContext *s)
                     "?ttl=%d", ttl);
         if (!same_port)
             base_port += 2;
-        ret = ffurl_open(&fd, url, URL_WRONLY);
+        ret = ffurl_open(&fd, url, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL);
         if (ret) {
             ret = AVERROR(EIO);
             goto fail;
@@ -158,13 +158,14 @@ static int sap_write_header(AVFormatContext *s)
 
     ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
                 "?ttl=%d&connect=1", ttl);
-    ret = ffurl_open(&sap->ann_fd, url, URL_WRONLY);
+    ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_WRITE,
+                     &s->interrupt_callback, NULL);
     if (ret) {
         ret = AVERROR(EIO);
         goto fail;
     }
 
-    udp_fd = url_get_file_handle(sap->ann_fd);
+    udp_fd = ffurl_get_file_handle(sap->ann_fd);
     if (getsockname(udp_fd, (struct sockaddr*) &localaddr, &addrlen)) {
         ret = AVERROR(EIO);
         goto fail;
@@ -208,7 +209,7 @@ static int sap_write_header(AVFormatContext *s)
     av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos);
     pos += strlen(&sap->ann[pos]) + 1;
 
-    if (avf_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
+    if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
                        sap->ann_size - pos)) {
         ret = AVERROR_INVALIDDATA;
         goto fail;
@@ -218,7 +219,7 @@ static int sap_write_header(AVFormatContext *s)
     pos += strlen(&sap->ann[pos]);
     sap->ann_size = pos;
 
-    if (sap->ann_size > url_get_max_packet_size(sap->ann_fd)) {
+    if (sap->ann_size > sap->ann_fd->max_packet_size) {
         av_log(s, AV_LOG_ERROR, "Announcement too large to send in one "
                                 "packet\n");
         goto fail;
@@ -250,16 +251,14 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt)
 }
 
 AVOutputFormat ff_sap_muxer = {
-    "sap",
-    NULL_IF_CONFIG_SMALL("SAP output format"),
-    NULL,
-    NULL,
-    sizeof(struct SAPState),
-    CODEC_ID_AAC,
-    CODEC_ID_MPEG4,
-    sap_write_header,
-    sap_write_packet,
-    sap_write_close,
+    .name              = "sap",
+    .long_name         = NULL_IF_CONFIG_SMALL("SAP output format"),
+    .priv_data_size    = sizeof(struct SAPState),
+    .audio_codec       = CODEC_ID_AAC,
+    .video_codec       = CODEC_ID_MPEG4,
+    .write_header      = sap_write_header,
+    .write_packet      = sap_write_packet,
+    .write_trailer     = sap_write_close,
     .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
 };