Dan Rossi a écrit :
> Ok yes I see, I dont have a need for that, we just archive to one main 
> archive dir. And for playback files are loaded over a network drive. 
> Does it generate the string properly, have you echoed it out to see. I 
> have a logger logging the path generated in mine also.
>   
I get a empty string i log getStreamDirectory(scope) inside
generateFilename(IScope scope, String name, String extension,
GenerationType type). Still don't know why scope instance is different
between DefaultStreamFilenameGenerator and my CustomFilenameGenerator.
Thanks Dan. ;)
> [EMAIL PROTECTED] wrote:
>   
>> Hi Dan,
>> If you look at
>> org.red5.server.stream.DefaultStreamFilenameGenerator.java you find that
>> it use getStreamDirectory function to to get full path scope :
>>
>>     private String getStreamDirectory(IScope scope) {
>>         final StringBuilder result = new StringBuilder();
>>         final IScope app = ScopeUtils.findApplication(scope);
>>         while (scope != null && scope != app) {
>>             result.insert(0, scope.getName() + "/");
>>             scope = scope.getParent();
>>         }
>>         return result.toString();
>>     }
>>
>>
>>
>> , I use the same in my CustomFilenameGenerator but apparently doesn't
>> work properly.
>> Any idea, why scope still empty when used with the service
>> IStreamFilenameGenerator  ?
>> Thanks
>>
>>
>> Dan Rossi a écrit :
>>   
>>     
>>> Here is what I have, maybe its not creating the room directory properly 
>>> anymore ? I havent tried it for a while.
>>>
>>> public String generateFilename(IScope scope, String name,
>>>             String extension, GenerationType type) {
>>>        
>>>         String filename;
>>>         if (type == GenerationType.RECORD)
>>>             filename = recordPath + formatRecordName(name);
>>>         else
>>>             filename = playbackPath + name;
>>>        
>>>         if (extension != null)
>>>             // Add extension
>>>             filename += extension;
>>>        
>>>         log.info("Generated FilePath: " + filename);
>>>        
>>>         return filename;
>>>    
>>>     }
>>>    
>>>     private String formatRecordName(String name)
>>>     {
>>>         if (!dateFormat.equals(""))
>>>         {
>>>             DateFormat date = new SimpleDateFormat(dateFormat);
>>>             String appendDate = date.format(new Date());
>>>             name += "_" + appendDate + "-" + streamBitrate;
>>>         }
>>>         return name;
>>>     }
>>>
>>>
>>> [EMAIL PROTECTED] wrote:
>>>   
>>>     
>>>       
>>>> Hi,
>>>> Dan Rossi a écrit :
>>>>   
>>>>     
>>>>       
>>>>         
>>>>>  public String recordPath = "file:/home/streams/"; ?
>>>>>   
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>> Hi Dan,
>>>> Inside the Bean definition  I set the path to file://... but the
>>>> absolute path is not the issue, the streams ares saved to 
>>>> '/home/streams/myvideo.flv' instead of
>>>> '/home/streams/room1/room2/myvideo.flv'.
>>>> :)
>>>> Thanks
>>>>
>>>> :)
>>>>   
>>>>     
>>>>       
>>>>         
>>>>> [EMAIL PROTECTED] wrote:
>>>>>   
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>>>> Hi,
>>>>>> I'm using CustomFilenameGenerator to create a custom record stream
>>>>>> (/home/streams/) and I try to keep a full path scope to for path.
>>>>>> For example if i'm record stream with this url :
>>>>>> rtmp://my_server/my_appliation/room1/room3/  i'll have
>>>>>> :/home/streams/room1/room2/myStream.flv.
>>>>>> Unfortunately it seems that it doesn't work, here is my
>>>>>> CustomFilenameGenerator class. Any idea ?
>>>>>>
>>>>>> package actusite.recorder;
>>>>>>
>>>>>> import org.red5.server.api.IScope;
>>>>>> import org.red5.server.api.ScopeUtils;
>>>>>> import org.red5.server.api.stream.IStreamFilenameGenerator;
>>>>>>
>>>>>>
>>>>>> public class CustomFilenameGenerator implements IStreamFilenameGenerator 
>>>>>> {
>>>>>>
>>>>>>        /** Path that will store recorded videos. */
>>>>>>     public String recordPath = "/home/streams/";
>>>>>>
>>>>>>     public void setRecordPath(String path) {
>>>>>>         recordPath = path;
>>>>>>     }
>>>>>>
>>>>>>     private String getStreamDirectory(IScope scope) {
>>>>>>         final StringBuilder result = new StringBuilder();
>>>>>>         final IScope app = ScopeUtils.findApplication(scope);
>>>>>>         while (scope != null && scope != app) {
>>>>>>             result.insert(0, scope.getName() + "/");
>>>>>>             scope = scope.getParent();
>>>>>>         }
>>>>>>         return result.toString();
>>>>>>     }
>>>>>>
>>>>>>     public String generateFilename(IScope scope, String name,
>>>>>>             GenerationType type) {
>>>>>>         // Generate filename without an extension.
>>>>>>         return generateFilename(scope, name, null, type);
>>>>>>     }
>>>>>>
>>>>>>     public String generateFilename(IScope scope, String name, String
>>>>>> extension, GenerationType type) {
>>>>>>         String filename;
>>>>>>             filename = recordPath + getStreamDirectory(scope) + name;
>>>>>>         if (extension != null)
>>>>>>             // Add extension
>>>>>>             filename += extension;
>>>>>>         return filename;
>>>>>>     }
>>>>>>
>>>>>> }
>>>>>>
>>>>>> Thanks
>>>>>>   
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>> _______________________________________________
>>>>>> Red5 mailing list
>>>>>> [email protected]
>>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>>   
>>>>>>     
>>>>>>       
>>>>>>         
>>>>>>           
>>>>>>             
>>>>> _______________________________________________
>>>>> Red5 mailing list
>>>>> [email protected]
>>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>>
>>>>>   
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>> _______________________________________________
>>>> Red5 mailing list
>>>> [email protected]
>>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>>
>>>>   
>>>>     
>>>>       
>>>>         
>>> _______________________________________________
>>> Red5 mailing list
>>> [email protected]
>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>
>>>   
>>>     
>>>       
>> _______________________________________________
>> Red5 mailing list
>> [email protected]
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>
>>   
>>     
>
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>   

_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to