Ticket #2026: 0001-SAP-muxer-set-session-name-from-metadata.patch

File 0001-SAP-muxer-set-session-name-from-metadata.patch, 1.2 KB (added by mavrik, 4 years ago)
  • libavformat/sapenc.c

    From ab6492c0713be41c7be20991b5af51d0e1a7a429 Mon Sep 17 00:00:00 2001
    From: Jernej Virag <jernej@virag.si>
    Date: Thu, 13 Dec 2012 10:54:03 +0100
    Subject: [PATCH] SAP muxer set session name from metadata
    
    Pass "title" metadata field to av_sdp_create in SAP muxer for correct
    SDP session name.
    ---
     libavformat/sapenc.c |    6 ++++++
     1 file changed, 6 insertions(+)
    
    diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
    index 7abfd50..afe2533 100644
    a b  
    2525#include "libavutil/avstring.h" 
    2626#include "libavutil/intreadwrite.h" 
    2727#include "libavutil/time.h" 
     28#include "libavutil/dict.h" 
    2829#include "internal.h" 
    2930#include "network.h" 
    3031#include "os_support.h" 
    static int sap_write_header(AVFormatContext *s) 
    158159        av_strlcpy(contexts[i]->filename, url, sizeof(contexts[i]->filename)); 
    159160    } 
    160161 
     162    AVDictionaryEntry* title = av_dict_get(s->metadata, "title", NULL, 0); 
     163    if (s->nb_streams > 0 && title) { 
     164      av_dict_set(&contexts[0]->metadata, "title", title->value, 0); 
     165    } 
     166 
    161167    ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port, 
    162168                "?ttl=%d&connect=1", ttl); 
    163169    ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_WRITE,