]> git.sesse.net Git - vlc/blobdiff - projects/macosx/framework/Sources/VLCStreamOutput.m
Relicense VLCKit to LGPL
[vlc] / projects / macosx / framework / Sources / VLCStreamOutput.m
index d99c1c21870d7604ac4f5da1c0cdd2a76a2cb91e..85b331297bba5f3df9641a8b0eb4094243242951 100644 (file)
@@ -2,24 +2,24 @@
  * VLCStreamOutput.m: VLCKit.framework VLCStreamOutput implementation
  *****************************************************************************
  * Copyright (C) 2008 Pierre d'Herbemont
- * Copyright (C) 2008 the VideoLAN team
+ * Copyright (C) 2008 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #import "VLCStreamOutput.h"
 }
 + (id)rtpBroadcastStreamOutputWithSAPAnnounce:(NSString *)announceName
 {
-    return [self streamOutputWithOptionDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
+    NSString *name = [announceName copy];
+    id output = [self streamOutputWithOptionDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
                                             [NSDictionary dictionaryWithObjectsAndKeys:
                                                 @"ts", @"muxer",
                                                 @"file", @"access",
-                                                @"sap", @"sdp",
-                                                [announceName copy], @"name",
+                                                @"sdp", @"sdp",
+                                                @"sap", @"sap",
+                                                name, @"name",
                                                 @"239.255.1.1", @"destination", nil
                                             ], @"rtpOptions",
                                             nil
                                             ]
                                         ];
+    [name release];
+    return output;
 }
 
 + (id)rtpBroadcastStreamOutput
 {
     return [self streamOutputWithOptionDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
                                             [NSDictionary dictionaryWithObjectsAndKeys:
-                                                @"mp4v", @"videoCodec",
-                                                @"1024",  @"videoBitrate",
+                                                @"h264", @"videoCodec",
+                                                @"1024",  @"videoBitrate", // max by Apple: 1.5 mbps
                                                 @"mp4a", @"audioCodec",
-                                                @"192", @"audioBitrate",
+                                                @"128", @"audioBitrate", // max by Apple: 160 kbps
                                                 @"2",   @"channels",
-                                                @"320", @"width",
-                                                @"240", @"canvasHeight",
+                                                @"640", @"width", // max by Apple: do.
+                                                @"480", @"canvasHeight", // max by Apple: do.
                                                 @"Yes", @"audio-sync",
                                                 nil
                                             ], @"transcodingOptions",
                                             [NSDictionary dictionaryWithObjectsAndKeys:
                                                 @"mp4", @"muxer",
                                                 @"file", @"access",
-                                                [filePath copy], @"destination", nil
+                                                [[filePath copy] autorelease], @"destination", 
+                                                nil
                                             ], @"outputOptions",
                                             nil
                                             ]
                                             [NSDictionary dictionaryWithObjectsAndKeys:
                                                 @"mp4", @"muxer",
                                                 @"file", @"access",
-                                                [filePath copy], @"destination", nil
+                                                [[filePath copy] autorelease], @"destination", nil
                                             ], @"outputOptions",
                                             nil
                                             ]
                                             [NSDictionary dictionaryWithObjectsAndKeys:
                                                 @"ps", @"muxer",
                                                 @"file", @"access",
-                                                [filePath copy], @"destination", nil
+                                                [[filePath copy] autorelease], @"destination", nil
                                             ], @"outputOptions",
                                             nil
                                             ]
                                             [NSDictionary dictionaryWithObjectsAndKeys:
                                                 @"mp2v", @"videoCodec",
                                                 @"1024", @"videoBitrate",
-                                                @"mp2a",   @"audioCodec",
+                                                @"mpga",   @"audioCodec",
                                                 @"128",   @"audioBitrate",
                                                 @"Yes",   @"audio-sync",
                                                 nil
                                             ], @"transcodingOptions",
                                             [NSDictionary dictionaryWithObjectsAndKeys:
-                                                @"mpeg", @"muxer",
+                                                @"ps", @"muxer",
                                                 @"file", @"access",
-                                                [filePath copy], @"destination", nil
+                                                [[filePath copy] autorelease], @"destination", nil
                                             ], @"outputOptions",
                                             nil
                                             ]
         if( audioBitrate ) [subOptions addObject:[NSString stringWithFormat:@"ab=%@", audioBitrate]];
         if( channels ) [subOptions addObject:[NSString stringWithFormat:@"channels=%@", channels]];
         if( audioSync ) [subOptions addObject:[NSString stringWithFormat:@"audioSync", width]];
-        [optionsAsArray addObject: [NSString stringWithFormat:@"transcode{%@}", [subOptions componentsJoinedByString:@","]]];
+        [optionsAsArray addObject: [NSString stringWithFormat:@"#transcode{%@}", [subOptions componentsJoinedByString:@","]]];
         [subOptions removeAllObjects];
     }
     
         if( destination ) [subOptions addObject:[NSString stringWithFormat:@"dst=\"%@\"", [destination stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]]];
         if( url ) [subOptions addObject:[NSString stringWithFormat:@"url=\"%@\"", [url stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]]];
         if( access )      [subOptions addObject:[NSString stringWithFormat:@"access=%@", access]];
-        [optionsAsArray addObject:[NSString stringWithFormat:@"std{%@}", [subOptions componentsJoinedByString:@","]]];
+        NSString *std = [NSString stringWithFormat:@"std{%@}", [subOptions componentsJoinedByString:@","]];
+        if ( !transcodingOptions )
+            std = [NSString stringWithFormat:@"#%@", std];
+
+        [optionsAsArray addObject:std];
         [subOptions removeAllObjects];
     }
 
         NSString * destination = [rtpOptions objectForKey:@"destination"];
         NSString * sdp = [rtpOptions objectForKey:@"sdp"];
         NSString * name = [rtpOptions objectForKey:@"name"];
+        NSString * sap = [rtpOptions objectForKey:@"sap"];
         if( muxer )       [subOptions addObject:[NSString stringWithFormat:@"muxer=%@", muxer]];
         if( destination ) [subOptions addObject:[NSString stringWithFormat:@"dst=%@", destination]];
         if( sdp )      [subOptions addObject:[NSString stringWithFormat:@"sdp=%@", sdp]];
+        if( sap )      [subOptions addObject:@"sap"];
         if( name )      [subOptions addObject:[NSString stringWithFormat:@"name=\"%@\"", name]];
-        [optionsAsArray addObject:[NSString stringWithFormat:@"rtp{%@}", [subOptions componentsJoinedByString:@","]]];
+        NSString *rtp = [NSString stringWithFormat:@"#rtp{%@}", [subOptions componentsJoinedByString:@","]];
+        if ( !transcodingOptions )
+            rtp = [NSString stringWithFormat:@"#%@", rtp];
+
+        [optionsAsArray addObject:rtp];
         [subOptions removeAllObjects];
     }
     representedOptions = [optionsAsArray componentsJoinedByString:@":"];