Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
d073d3be
Commit
d073d3be
authored
Nov 13, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: dash: log through libvlc
parent
5d7dc083
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
19 deletions
+107
-19
modules/stream_filter/Makefile.am
modules/stream_filter/Makefile.am
+2
-0
modules/stream_filter/dash/Logger.cpp
modules/stream_filter/dash/Logger.cpp
+42
-0
modules/stream_filter/dash/Logger.h
modules/stream_filter/dash/Logger.h
+40
-0
modules/stream_filter/dash/dash.cpp
modules/stream_filter/dash/dash.cpp
+2
-0
modules/stream_filter/dash/mpd/BasicCMParser.cpp
modules/stream_filter/dash/mpd/BasicCMParser.cpp
+19
-18
modules/stream_filter/dash/mpd/SegmentTemplate.cpp
modules/stream_filter/dash/mpd/SegmentTemplate.cpp
+2
-1
No files found.
modules/stream_filter/Makefile.am
View file @
d073d3be
...
...
@@ -90,6 +90,8 @@ libdash_plugin_la_SOURCES = \
stream_filter/dash/DASHDownloader.h
\
stream_filter/dash/DASHManager.cpp
\
stream_filter/dash/DASHManager.h
\
stream_filter/dash/Logger.cpp
\
stream_filter/dash/Logger.h
\
stream_filter/dash/Helper.cpp
\
stream_filter/dash/Helper.h
libdash_plugin_la_CXXFLAGS
=
$(AM_CFLAGS)
-I
$(srcdir)
/stream_filter/dash
...
...
modules/stream_filter/dash/Logger.cpp
0 → 100644
View file @
d073d3be
/*
* Logger.cpp
*****************************************************************************
* Copyright (C) 2014 - VideoLAN authors
*
* 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 Lesser General Public License for more details.
*
* 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.
*****************************************************************************/
#include "Logger.h"
#include <iostream>
using
namespace
dash
;
vlc_object_t
*
Logger
::
p_object
=
NULL
;
void
Logger
::
Debug
(
const
std
::
string
&
msg
)
{
if
(
Logger
::
p_object
)
msg_Dbg
(
Logger
::
p_object
,
"%s"
,
msg
.
c_str
()
);
else
std
::
cout
<<
msg
<<
std
::
endl
;
}
void
Logger
::
Error
(
const
std
::
string
&
msg
)
{
if
(
Logger
::
p_object
)
msg_Err
(
Logger
::
p_object
,
"%s"
,
msg
.
c_str
()
);
else
std
::
cerr
<<
msg
<<
std
::
endl
;
}
modules/stream_filter/dash/Logger.h
0 → 100644
View file @
d073d3be
/*
* Logger.h
*****************************************************************************
* Copyright (C) 2014 - VideoLAN authors
*
* 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 Lesser General Public License for more details.
*
* 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.
*****************************************************************************/
#ifndef LOGGER_H
#define LOGGER_H
#include <vlc_common.h>
#include <string>
namespace
dash
{
class
Logger
{
public:
static
void
Error
(
const
std
::
string
&
msg
);
static
void
Debug
(
const
std
::
string
&
msg
);
static
void
setObject
(
vlc_object_t
*
p_obj
)
{
Logger
::
p_object
=
p_obj
;
}
private:
static
vlc_object_t
*
p_object
;
};
}
#endif // LOGGER_H
modules/stream_filter/dash/dash.cpp
View file @
d073d3be
...
...
@@ -43,6 +43,7 @@
#include "http/HTTPConnectionManager.h"
#include "adaptationlogic/IAdaptationLogic.h"
#include "mpd/MPDFactory.h"
#include "Logger.h"
#define SEEK 0
...
...
@@ -94,6 +95,7 @@ static int Control (stream_t *p_stream, int i_query, va_list args);
static
int
Open
(
vlc_object_t
*
p_obj
)
{
stream_t
*
p_stream
=
(
stream_t
*
)
p_obj
;
dash
::
Logger
::
setObject
(
p_obj
);
if
(
!
dash
::
xml
::
DOMParser
::
isDash
(
p_stream
->
p_source
))
return
VLC_EGENERIC
;
...
...
modules/stream_filter/dash/mpd/BasicCMParser.cpp
View file @
d073d3be
...
...
@@ -30,6 +30,7 @@
#include "mpd/SegmentInfoDefault.h"
#include "mpd/SegmentTemplate.h"
#include "mpd/SegmentTimeline.h"
#include "Logger.h"
#include <cstdlib>
#include <sstream>
...
...
@@ -83,8 +84,8 @@ bool BasicCMParser::setMPD()
it
=
attr
.
find
(
"availabilityStartTime"
);
if
(
it
==
attr
.
end
()
&&
this
->
mpd
->
isLive
()
==
true
)
{
std
::
cerr
<<
"An @availabilityStartTime attribute must be specified when"
" the stream @type is Live"
<<
std
::
endl
;
Logger
::
Error
(
"An @availabilityStartTime attribute must be specified when"
" the stream @type is Live"
)
;
return
false
;
}
#ifdef HAVE_STRPTIME
...
...
@@ -96,8 +97,8 @@ bool BasicCMParser::setMPD()
{
if
(
this
->
mpd
->
isLive
()
==
true
)
{
std
::
cerr
<<
"An @availabilityStartTime attribute must be specified when"
" the stream @type is Live"
<<
std
::
endl
;
Logger
::
Error
(
"An @availabilityStartTime attribute must be specified when"
" the stream @type is Live"
)
;
return
false
;
}
}
...
...
@@ -178,7 +179,7 @@ void BasicCMParser::parseSegmentTimeline(Node *node, SegmentInfoCommon *segmentI
sIt
=
sAttr
.
find
(
"t"
);
if
(
sIt
==
sAttr
.
end
()
)
{
std
::
cerr
<<
"'t' attribute is mandatory for every SegmentTimeline/S element"
<<
std
::
endl
;
Logger
::
Error
(
"'t' attribute is mandatory for every SegmentTimeline/S element"
)
;
delete
s
;
++
it
;
continue
;
...
...
@@ -187,7 +188,7 @@ void BasicCMParser::parseSegmentTimeline(Node *node, SegmentInfoCommon *segmentI
sIt
=
sAttr
.
find
(
"d"
);
if
(
sIt
==
sAttr
.
end
()
)
{
std
::
cerr
<<
"'d' attribute is mandatory for every SegmentTimeline/S element"
<<
std
::
endl
;
Logger
::
Error
(
"'d' attribute is mandatory for every SegmentTimeline/S element"
)
;
delete
s
;
++
it
;
continue
;
...
...
@@ -274,7 +275,7 @@ void BasicCMParser::parseTrickMode(Node *node, Representation *repr)
if
(
trickModes
.
size
()
==
0
)
return
;
if
(
trickModes
.
size
()
>
1
)
std
::
cerr
<<
"More than 1 TrickMode element. Only the first one will be used."
<<
std
::
endl
;
Logger
::
Error
(
"More than 1 TrickMode element. Only the first one will be used."
)
;
Node
*
trickModeNode
=
trickModes
[
0
];
TrickModeType
*
trickMode
=
new
TrickModeType
;
...
...
@@ -306,14 +307,14 @@ void BasicCMParser::setRepresentations (Node *root, AdaptationSet *group)
it
=
attributes
.
find
(
"id"
);
if
(
it
==
attributes
.
end
()
)
std
::
cerr
<<
"Missing mandatory attribute for Representation: @id"
<<
std
::
endl
;
Logger
::
Error
(
"Missing mandatory attribute for Representation: @id"
)
;
else
rep
->
setId
(
it
->
second
);
it
=
attributes
.
find
(
"bandwidth"
);
if
(
it
==
attributes
.
end
()
)
{
std
::
cerr
<<
"Missing mandatory attribute for Representation: @bandwidth"
<<
std
::
endl
;
Logger
::
Error
(
"Missing mandatory attribute for Representation: @bandwidth"
)
;
delete
rep
;
continue
;
}
...
...
@@ -368,7 +369,7 @@ bool BasicCMParser::setSegmentInfo (Node *root, Representation *rep)
rep
->
setSegmentInfo
(
info
);
return
true
;
}
std
::
cerr
<<
"Missing mandatory element: Representation/SegmentInfo"
<<
std
::
endl
;
Logger
::
Error
(
"Missing mandatory element: Representation/SegmentInfo"
)
;
return
false
;
}
...
...
@@ -393,7 +394,7 @@ Segment* BasicCMParser::parseSegment( Node* node )
{
if
(
this
->
resolveUrlTemplates
(
url
,
runtimeToken
)
==
false
)
{
std
::
cerr
<<
"Failed to substitute URLTemplate identifier."
<<
std
::
endl
;
Logger
::
Error
(
"Failed to substitute URLTemplate identifier."
)
;
return
NULL
;
}
seg
=
new
SegmentTemplate
(
runtimeToken
,
this
->
currentRepresentation
);
...
...
@@ -435,8 +436,8 @@ void BasicCMParser::setInitSegment (Node *root, SegmentInfoCommon *info
const
std
::
vector
<
Node
*>
initSeg
=
DOMHelper
::
getChildElementByTagName
(
root
,
"InitialisationSegmentURL"
);
if
(
initSeg
.
size
()
>
1
)
std
::
cerr
<<
"There could be at most one InitialisationSegmentURL per SegmentInfo"
" other InitialisationSegmentURL will be dropped."
<<
std
::
endl
;
Logger
::
Error
(
"There could be at most one InitialisationSegmentURL per SegmentInfo"
" other InitialisationSegmentURL will be dropped."
)
;
if
(
initSeg
.
size
()
==
1
)
{
Segment
*
seg
=
parseSegment
(
initSeg
.
at
(
0
)
);
...
...
@@ -474,7 +475,7 @@ bool BasicCMParser::resolveUrlTemplates( std::string &url, bool &containRunti
size_t
closing
=
url
.
find
(
'$'
,
it
+
1
);
if
(
closing
==
std
::
string
::
npos
)
{
std
::
cerr
<<
"Unmatched '$' in url template: "
<<
url
<<
std
::
endl
;
Logger
::
Error
(
std
::
string
(
"Unmatched '$' in url template: "
).
append
(
url
))
;
return
false
;
}
std
::
string
token
=
std
::
string
(
url
,
it
,
closing
-
it
+
1
);
...
...
@@ -487,8 +488,8 @@ bool BasicCMParser::resolveUrlTemplates( std::string &url, bool &containRunti
{
if
(
this
->
currentRepresentation
->
getId
().
empty
()
==
false
)
{
std
::
cerr
<<
"Representation doesn't have an ID. Can't substitute"
" identifier $RepresentationID$"
<<
std
::
endl
;
Logger
::
Error
(
"Representation doesn't have an ID. Can't substitute"
" identifier $RepresentationID$"
)
;
return
false
;
}
url
.
replace
(
it
,
token
.
length
(),
this
->
currentRepresentation
->
getId
()
);
...
...
@@ -510,7 +511,7 @@ bool BasicCMParser::resolveUrlTemplates( std::string &url, bool &containRunti
}
else
{
std
::
cerr
<<
"Unhandled token "
<<
token
<<
std
::
endl
;
Logger
::
Error
(
std
::
string
(
"Unhandled token "
).
append
(
token
))
;
return
false
;
}
}
...
...
@@ -563,7 +564,7 @@ bool BasicCMParser::parseCommonAttributesElements( Node *node, CommonAttribut
common
->
setMimeType
(
parent
->
getMimeType
()
);
else
if
(
node
->
getName
().
find
(
"Representation"
)
!=
std
::
string
::
npos
)
{
std
::
cerr
<<
"Missing mandatory attribute: @mimeType"
<<
std
::
endl
;
Logger
::
Error
(
"Missing mandatory attribute: @mimeType"
)
;
return
false
;
}
}
...
...
modules/stream_filter/dash/mpd/SegmentTemplate.cpp
View file @
d073d3be
...
...
@@ -29,6 +29,7 @@
#include "Representation.h"
#include "AdaptationSet.h"
#include "SegmentInfoDefault.h"
#include "Logger.h"
#include <cassert>
#include <cstring>
...
...
@@ -55,7 +56,7 @@ std::string SegmentTemplate::getSourceUrl() const
return
Segment
::
getSourceUrl
();
if
(
this
->
beginIndex
!=
std
::
string
::
npos
)
std
::
cerr
<<
"Unhandled identifier
\"
$Index$
\"
"
<<
std
::
endl
;
Logger
::
Error
(
"Unhandled identifier
\"
$Index$
\"
"
)
;
if
(
this
->
beginTime
!=
std
::
string
::
npos
)
{
//FIXME: This should use the current representation SegmentInfo
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment