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
acdfa352
Commit
acdfa352
authored
Jan 31, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* asf: implemented DEMUX_GET_LENGTH and DEMUX_GET_META.
parent
e1e8b00b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
108 deletions
+60
-108
modules/demux/asf/asf.c
modules/demux/asf/asf.c
+60
-108
No files found.
modules/demux/asf/asf.c
View file @
acdfa352
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* asf.c : ASF demux module
* asf.c : ASF demux module
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* Copyright (C) 2002-2003 VideoLAN
* $Id: asf.c,v 1.5
0 2004/01/29 18:02:58 zorglub
Exp $
* $Id: asf.c,v 1.5
1 2004/01/31 05:27:02 fenrir
Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc/input.h>
#include "vlc_
playlist
.h"
#include "vlc_
meta
.h"
#include "codecs.h"
/* BITMAPINFOHEADER, WAVEFORMATEX */
#include "codecs.h"
/* BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h"
#include "libasf.h"
...
@@ -51,7 +51,8 @@ vlc_module_end();
...
@@ -51,7 +51,8 @@ vlc_module_end();
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
int
Demux
(
input_thread_t
*
);
static
int
Demux
(
input_thread_t
*
);
static
int
Control
(
input_thread_t
*
,
int
i_query
,
va_list
args
);
typedef
struct
asf_stream_s
typedef
struct
asf_stream_s
{
{
...
@@ -80,6 +81,8 @@ struct demux_sys_t
...
@@ -80,6 +81,8 @@ struct demux_sys_t
int64_t
i_data_begin
;
int64_t
i_data_begin
;
int64_t
i_data_end
;
int64_t
i_data_end
;
vlc_meta_t
*
meta
;
};
};
static
mtime_t
GetMoviePTS
(
demux_sys_t
*
);
static
mtime_t
GetMoviePTS
(
demux_sys_t
*
);
...
@@ -101,9 +104,6 @@ static int Open( vlc_object_t * p_this )
...
@@ -101,9 +104,6 @@ static int Open( vlc_object_t * p_this )
vlc_bool_t
b_seekable
;
vlc_bool_t
b_seekable
;
input_info_category_t
*
p_cat
;
playlist_item_t
*
p_item
=
NULL
;
/* a little test to see if it could be a asf stream */
/* a little test to see if it could be a asf stream */
if
(
input_Peek
(
p_input
,
&
p_peek
,
16
)
<
16
)
if
(
input_Peek
(
p_input
,
&
p_peek
,
16
)
<
16
)
{
{
...
@@ -119,7 +119,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -119,7 +119,7 @@ static int Open( vlc_object_t * p_this )
/* Set p_input field */
/* Set p_input field */
p_input
->
pf_demux
=
Demux
;
p_input
->
pf_demux
=
Demux
;
p_input
->
pf_demux_control
=
demux_vaControlDefault
;
p_input
->
pf_demux_control
=
Control
;
p_input
->
p_demux_data
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
p_input
->
p_demux_data
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
memset
(
p_sys
,
0
,
sizeof
(
demux_sys_t
)
);
memset
(
p_sys
,
0
,
sizeof
(
demux_sys_t
)
);
p_sys
->
i_time
=
-
1
;
p_sys
->
i_time
=
-
1
;
...
@@ -285,136 +285,61 @@ static int Open( vlc_object_t * p_this )
...
@@ -285,136 +285,61 @@ static int Open( vlc_object_t * p_this )
}
}
}
}
/* We add all info about this stream */
/* Create meta informations */
p_cat
=
input_InfoCategory
(
p_input
,
_
(
"Asf"
)
);
p_sys
->
meta
=
vlc_meta_New
();
playlist_t
*
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_input
,
VLC_OBJECT_PLAYLIST
,
FIND_PARENT
);
if
(
p_playlist
)
{
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
p_item
=
playlist_ItemGetByPos
(
p_playlist
,
-
1
);
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
}
if
(
p_item
)
{
vlc_mutex_lock
(
&
p_item
->
lock
);
}
if
(
p_sys
->
i_length
>
0
)
{
int64_t
i_second
=
p_sys
->
i_length
/
(
int64_t
)
1000000
;
input_AddInfo
(
p_cat
,
_
(
"Length"
),
"%d:%d:%d"
,
(
int
)(
i_second
/
36000
),
(
int
)((
i_second
/
60
)
%
60
),
(
int
)(
i_second
%
60
)
);
if
(
p_item
)
{
playlist_ItemAddInfo
(
p_item
,
_
(
"Asf"
),
_
(
"Length"
),
"%d:%d:%d"
,
(
int
)(
i_second
/
36000
),
(
int
)((
i_second
/
60
)
%
60
),
(
int
)(
i_second
%
60
)
);
}
}
input_AddInfo
(
p_cat
,
_
(
"Number of streams"
),
"%d"
,
p_sys
->
i_streams
);
if
(
p_item
)
{
playlist_ItemAddInfo
(
p_item
,
_
(
"Asf"
),
_
(
"Number of streams"
),
"%d"
,
p_sys
->
i_streams
);
}
if
(
(
p_cd
=
ASF_FindObject
(
p_sys
->
p_root
->
p_hdr
,
if
(
(
p_cd
=
ASF_FindObject
(
p_sys
->
p_root
->
p_hdr
,
&
asf_object_content_description_guid
,
0
)
)
)
&
asf_object_content_description_guid
,
0
)
)
)
{
{
if
(
*
p_cd
->
psz_title
)
if
(
p_cd
->
psz_title
&&
*
p_cd
->
psz_title
)
{
{
input_AddInfo
(
p_cat
,
_
(
"Title"
),
p_cd
->
psz_title
);
vlc_meta_Add
(
p_sys
->
meta
,
VLC_META_TITLE
,
p_cd
->
psz_title
);
if
(
p_item
)
{
playlist_ItemAddInfo
(
p_item
,
_
(
"Asf"
),
_
(
"Title"
),
p_cd
->
psz_title
);
playlist_ItemSetName
(
p_item
,
p_cd
->
psz_title
);
}
}
}
if
(
p_cd
->
psz_author
)
if
(
p_cd
->
psz_author
&&
*
p_cd
->
psz_author
)
{
{
input_AddInfo
(
p_cat
,
_
(
"Author"
),
p_cd
->
psz_author
);
vlc_meta_Add
(
p_sys
->
meta
,
VLC_META_AUTHOR
,
p_cd
->
psz_author
);
if
(
p_item
)
{
playlist_ItemAddInfo
(
p_item
,
_
(
"Asf"
),
_
(
"Author"
),
p_cd
->
psz_author
);
playlist_ItemAddInfo
(
p_item
,
_
(
"General"
),
_
(
"Author"
),
p_cd
->
psz_author
);
}
}
}
if
(
p_cd
->
psz_copyright
)
if
(
p_cd
->
psz_copyright
&&
*
p_cd
->
psz_copyright
)
{
{
input_AddInfo
(
p_cat
,
_
(
"Copyright"
),
p_cd
->
psz_copyright
);
vlc_meta_Add
(
p_sys
->
meta
,
VLC_META_COPYRIGHT
,
p_cd
->
psz_copyright
);
if
(
p_item
)
{
playlist_ItemAddInfo
(
p_item
,
_
(
"Asf"
),
_
(
"Copyright"
),
p_cd
->
psz_copyright
);
}
}
}
if
(
*
p_cd
->
psz_description
)
if
(
p_cd
->
psz_description
&&
*
p_cd
->
psz_description
)
{
{
input_AddInfo
(
p_cat
,
_
(
"Description"
),
p_cd
->
psz_description
);
vlc_meta_Add
(
p_sys
->
meta
,
VLC_META_DESCRIPTION
,
p_cd
->
psz_description
);
if
(
p_item
)
{
playlist_ItemAddInfo
(
p_item
,
_
(
"Asf"
),
_
(
"Description"
),
p_cd
->
psz_description
);
}
}
}
if
(
*
p_cd
->
psz_rating
)
if
(
p_cd
->
psz_rating
&&
*
p_cd
->
psz_rating
)
{
{
input_AddInfo
(
p_cat
,
_
(
"Rating"
),
p_cd
->
psz_rating
);
vlc_meta_Add
(
p_sys
->
meta
,
VLC_META_RATING
,
p_cd
->
psz_rating
);
if
(
p_item
)
{
playlist_ItemAddInfo
(
p_item
,
_
(
"Asf"
),
_
(
"Rating"
),
p_cd
->
psz_rating
);
}
}
}
}
}
/* FIXME to port to new way */
for
(
i_stream
=
0
,
i
=
0
;
i
<
128
;
i
++
)
for
(
i_stream
=
0
,
i
=
0
;
i
<
128
;
i
++
)
{
{
asf_object_codec_list_t
*
p_cl
=
asf_object_codec_list_t
*
p_cl
=
ASF_FindObject
(
p_sys
->
p_root
->
p_hdr
,
ASF_FindObject
(
p_sys
->
p_root
->
p_hdr
,
&
asf_object_codec_list_guid
,
0
);
&
asf_object_codec_list_guid
,
0
);
if
(
p_sys
->
stream
[
i
]
)
if
(
p_sys
->
stream
[
i
]
)
{
{
char
*
psz_cat
=
malloc
(
strlen
(
_
(
"Stream"
))
+
10
);
vlc_meta_t
*
tk
=
vlc_meta_New
();
sprintf
(
psz_cat
,
"%s %d"
,
_
(
"Stream"
),
i_stream
);
TAB_APPEND
(
p_sys
->
meta
->
i_track
,
p_sys
->
meta
->
track
,
tk
);
p_cat
=
input_InfoCategory
(
p_input
,
psz_cat
);
if
(
p_cl
&&
i_stream
<
p_cl
->
i_codec_entries_count
)
if
(
p_cl
&&
i_stream
<
p_cl
->
i_codec_entries_count
)
{
{
input_AddInfo
(
p_cat
,
_
(
"Codec name"
),
if
(
p_cl
->
codec
[
i_stream
].
psz_name
&&
p_cl
->
codec
[
i_stream
].
psz_name
);
*
p_cl
->
codec
[
i_stream
].
psz_name
)
input_AddInfo
(
p_cat
,
_
(
"Codec description"
),
{
p_cl
->
codec
[
i_stream
].
psz_description
);
vlc_meta_Add
(
tk
,
VLC_META_CODEC_NAME
,
if
(
p_item
)
p_cl
->
codec
[
i_stream
].
psz_name
);
}
if
(
p_cl
->
codec
[
i_stream
].
psz_description
&&
*
p_cl
->
codec
[
i_stream
].
psz_description
)
{
{
playlist_ItemAddInfo
(
p_item
,
psz_cat
,
_
(
"Codec name"
),
vlc_meta_Add
(
tk
,
VLC_META_CODEC_DESCRIPTION
,
p_cl
->
codec
[
i_stream
].
psz_name
);
p_cl
->
codec
[
i_stream
].
psz_description
);
playlist_ItemAddInfo
(
p_item
,
psz_cat
,
_
(
"Codec description"
),
p_cl
->
codec
[
i_stream
].
psz_description
);
}
}
}
}
free
(
psz_cat
);
i_stream
++
;
i_stream
++
;
}
}
}
}
if
(
p_item
)
{
vlc_mutex_unlock
(
&
p_item
->
lock
);
}
if
(
p_playlist
)
vlc_object_release
(
p_playlist
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
...
@@ -522,6 +447,8 @@ static void Close( vlc_object_t * p_this )
...
@@ -522,6 +447,8 @@ static void Close( vlc_object_t * p_this )
msg_Dbg
(
p_input
,
"freeing all memory"
);
msg_Dbg
(
p_input
,
"freeing all memory"
);
vlc_meta_Delete
(
p_sys
->
meta
);
ASF_FreeObjectRoot
(
p_input
->
s
,
p_sys
->
p_root
);
ASF_FreeObjectRoot
(
p_input
->
s
,
p_sys
->
p_root
);
for
(
i_stream
=
0
;
i_stream
<
128
;
i_stream
++
)
for
(
i_stream
=
0
;
i_stream
<
128
;
i_stream
++
)
{
{
...
@@ -539,6 +466,31 @@ static void Close( vlc_object_t * p_this )
...
@@ -539,6 +466,31 @@ static void Close( vlc_object_t * p_this )
free
(
p_sys
);
free
(
p_sys
);
}
}
/*****************************************************************************
* Control:
*****************************************************************************/
static
int
Control
(
input_thread_t
*
p_input
,
int
i_query
,
va_list
args
)
{
demux_sys_t
*
p_sys
=
p_input
->
p_demux_data
;
int64_t
*
pi64
;
vlc_meta_t
**
pp_meta
;
switch
(
i_query
)
{
case
DEMUX_GET_LENGTH
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi64
=
p_sys
->
i_length
;
return
VLC_SUCCESS
;
case
DEMUX_GET_META
:
pp_meta
=
(
vlc_meta_t
**
)
va_arg
(
args
,
vlc_meta_t
**
);
*
pp_meta
=
vlc_meta_Duplicate
(
p_sys
->
meta
);
return
VLC_SUCCESS
;
default:
return
demux_vaControlDefault
(
p_input
,
i_query
,
args
);
}
}
/*****************************************************************************
/*****************************************************************************
*
*
...
...
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