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
298f0e46
Commit
298f0e46
authored
Mar 11, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* access_output: sout_buffer_t -> block_t.
parent
1007fd93
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
200 deletions
+123
-200
modules/access_output/dummy.c
modules/access_output/dummy.c
+23
-35
modules/access_output/file.c
modules/access_output/file.c
+29
-35
modules/access_output/http.c
modules/access_output/http.c
+20
-78
modules/access_output/udp.c
modules/access_output/udp.c
+51
-52
No files found.
modules/access_output/dummy.c
View file @
298f0e46
...
...
@@ -2,7 +2,7 @@
* dummy.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id
: dummy.c,v 1.3 2003/03/03 14:21:08 gbazin Exp
$
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
...
...
@@ -26,32 +26,16 @@
* Preamble
*****************************************************************************/
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc/sout.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
int
Write
(
sout_access_out_t
*
,
sout_buffer_t
*
);
static
int
Seek
(
sout_access_out_t
*
,
off_t
);
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
();
set_description
(
_
(
"Dummy stream ouput"
)
);
set_capability
(
"sout access"
,
0
);
...
...
@@ -60,6 +44,12 @@ vlc_module_begin();
vlc_module_end
();
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
int
Write
(
sout_access_out_t
*
,
block_t
*
);
static
int
Seek
(
sout_access_out_t
*
,
off_t
);
/*****************************************************************************
* Open: open the file
*****************************************************************************/
...
...
@@ -71,7 +61,7 @@ static int Open( vlc_object_t *p_this )
p_access
->
pf_write
=
Write
;
p_access
->
pf_seek
=
Seek
;
msg_
Info
(
p_access
,
"dummy stream output access launch
ed"
);
msg_
Dbg
(
p_access
,
"dummy stream output access open
ed"
);
return
VLC_SUCCESS
;
}
...
...
@@ -81,28 +71,27 @@ static int Open( vlc_object_t *p_this )
static
void
Close
(
vlc_object_t
*
p_this
)
{
sout_access_out_t
*
p_access
=
(
sout_access_out_t
*
)
p_this
;
msg_
Info
(
p_access
,
"Close
"
);
msg_
Dbg
(
p_access
,
"dummy stream output access closed
"
);
}
/*****************************************************************************
* Read: standard read on a file descriptor.
*****************************************************************************/
static
int
Write
(
sout_access_out_t
*
p_access
,
sout_buffer
_t
*
p_buffer
)
static
int
Write
(
sout_access_out_t
*
p_access
,
block
_t
*
p_buffer
)
{
size_t
i_write
=
0
;
int64_t
i_write
=
0
;
block_t
*
b
=
p_buffer
;
do
while
(
b
)
{
sout_buffer_t
*
p_next
;
i_write
+=
p_buffer
->
i_size
;
p_next
=
p_buffer
->
p_next
;
sout_BufferDelete
(
p_access
->
p_sout
,
p_buffer
);
p_buffer
=
p_next
;
}
while
(
p_buffer
);
i_write
+=
b
->
i_buffer
;
b
=
b
->
p_next
;
}
msg_Dbg
(
p_access
,
"Dummy Skipped: len:"
I64Fd
,
(
int64_t
)
i_write
);
block_ChainRelease
(
p_buffer
);
return
(
i_write
)
;
return
i_write
;
}
/*****************************************************************************
...
...
@@ -110,8 +99,7 @@ static int Write( sout_access_out_t *p_access, sout_buffer_t *p_buffer )
*****************************************************************************/
static
int
Seek
(
sout_access_out_t
*
p_access
,
off_t
i_pos
)
{
msg_Dbg
(
p_access
,
"Seek: pos:"
I64Fd
,
(
int64_t
)
i_pos
);
return
(
0
);
return
0
;
}
modules/access_output/file.c
View file @
298f0e46
...
...
@@ -2,7 +2,7 @@
* file.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id
: file.c,v 1.11 2004/01/23 17:56:14 gbazin Exp
$
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
...
...
@@ -29,11 +29,10 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <errno.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc/sout.h>
#ifdef HAVE_UNISTD_H
...
...
@@ -53,19 +52,12 @@
# define STDOUT_FILENO 1
#endif
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
int
Write
(
sout_access_out_t
*
,
sout_buffer_t
*
);
static
int
Seek
(
sout_access_out_t
*
,
off_t
);
static
int
Read
(
sout_access_out_t
*
,
sout_buffer_t
*
);
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
();
set_description
(
_
(
"File stream ouput"
)
);
set_capability
(
"sout access"
,
50
);
...
...
@@ -73,10 +65,17 @@ vlc_module_begin();
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
int
Write
(
sout_access_out_t
*
,
block_t
*
);
static
int
Seek
(
sout_access_out_t
*
,
off_t
);
static
int
Read
(
sout_access_out_t
*
,
block_t
*
);
struct
sout_access_out_sys_t
{
int
i_handle
;
};
/*****************************************************************************
...
...
@@ -125,7 +124,7 @@ static int Open( vlc_object_t *p_this )
p_access
->
pf_read
=
Read
;
p_access
->
pf_seek
=
Seek
;
msg_
Info
(
p_access
,
"Open: name:`%s'
"
,
p_access
->
psz_name
);
msg_
Dbg
(
p_access
,
"file access output opened (`%s')
"
,
p_access
->
psz_name
);
return
VLC_SUCCESS
;
}
...
...
@@ -145,46 +144,43 @@ static void Close( vlc_object_t * p_this )
}
free
(
p_access
->
p_sys
);
msg_
Info
(
p_access
,
"Close
"
);
msg_
Dbg
(
p_access
,
"file access output closed
"
);
}
/*****************************************************************************
* Read: standard read on a file descriptor.
*****************************************************************************/
static
int
Read
(
sout_access_out_t
*
p_access
,
sout_buffer
_t
*
p_buffer
)
static
int
Read
(
sout_access_out_t
*
p_access
,
block
_t
*
p_buffer
)
{
if
(
strcmp
(
p_access
->
psz_name
,
"-"
)
)
{
return
read
(
p_access
->
p_sys
->
i_handle
,
p_buffer
->
p_buffer
,
p_buffer
->
i_size
);
}
else
{
msg_Err
(
p_access
,
"cannot seek while using stdout"
);
return
VLC_EGENERIC
;
p_buffer
->
i_buffer
);
}
msg_Err
(
p_access
,
"cannot read while using stdout"
);
return
VLC_EGENERIC
;
}
/*****************************************************************************
* Write: standard write on a file descriptor.
*****************************************************************************/
static
int
Write
(
sout_access_out_t
*
p_access
,
sout_buffer
_t
*
p_buffer
)
static
int
Write
(
sout_access_out_t
*
p_access
,
block
_t
*
p_buffer
)
{
size_t
i_write
=
0
;
do
while
(
p_buffer
)
{
sout_buffer_t
*
p_next
;
block_t
*
p_next
=
p_buffer
->
p_next
;
;
i_write
+=
write
(
p_access
->
p_sys
->
i_handle
,
p_buffer
->
p_buffer
,
p_buffer
->
i_size
);
p_next
=
p_buffer
->
p_next
;
sout_BufferDelete
(
p_access
->
p_sout
,
p_buffer
);
p_buffer
=
p_next
;
i_write
+=
write
(
p_access
->
p_sys
->
i_handle
,
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
);
block_Release
(
p_buffer
);
}
while
(
p_buffer
);
p_buffer
=
p_next
;
}
return
(
i_write
)
;
return
i_write
;
}
/*****************************************************************************
...
...
@@ -192,8 +188,6 @@ static int Write( sout_access_out_t *p_access, sout_buffer_t *p_buffer )
*****************************************************************************/
static
int
Seek
(
sout_access_out_t
*
p_access
,
off_t
i_pos
)
{
//msg_Dbg( p_access, "Seek: pos:"I64Fd, (int64_t)i_pos );
if
(
strcmp
(
p_access
->
psz_name
,
"-"
)
)
{
#if defined( WIN32 ) && !defined( UNDER_CE )
...
...
modules/access_output/http.c
View file @
298f0e46
...
...
@@ -25,11 +25,8 @@
* Preamble
*****************************************************************************/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc/sout.h>
#include "vlc_httpd.h"
...
...
@@ -38,18 +35,12 @@
#define DEFAULT_PORT 8080
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
int
Write
(
sout_access_out_t
*
,
sout_buffer_t
*
);
static
int
Seek
(
sout_access_out_t
*
,
off_t
);
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
();
set_description
(
_
(
"HTTP stream ouput"
)
);
set_capability
(
"sout access"
,
0
);
...
...
@@ -58,6 +49,13 @@ vlc_module_begin();
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
int
Write
(
sout_access_out_t
*
,
block_t
*
);
static
int
Seek
(
sout_access_out_t
*
,
off_t
);
struct
sout_access_out_sys_t
{
/* host */
...
...
@@ -73,56 +71,6 @@ struct sout_access_out_sys_t
vlc_bool_t
b_header_complete
;
};
#if 0
static struct
{
char *psz_ext;
char *psz_mime;
} http_mime[] =
{
{ ".avi", "video/avi" },
{ ".asf", "video/x-ms-asf" },
{ ".m1a", "audio/mpeg" },
{ ".m2a", "audio/mpeg" },
{ ".m1v", "video/mpeg" },
{ ".m2v", "video/mpeg" },
{ ".mp2", "audio/mpeg" },
{ ".mp3", "audio/mpeg" },
{ ".mpa", "audio/mpeg" },
{ ".mpg", "video/mpeg" },
{ ".mpeg", "video/mpeg" },
{ ".mpe", "video/mpeg" },
{ ".mov", "video/quicktime" },
{ ".moov", "video/quicktime" },
{ ".ogg", "application/ogg" },
{ ".ogm", "application/ogg" },
{ ".wma", "audio/x-ms-wma" },
{ ".wmv", "video/x-ms-wmv" },
{ ".wav", "audio/wav" },
{ NULL, NULL }
};
static char *GetMime( char *psz_name )
{
char *psz_ext;
psz_ext = strrchr( psz_name, '.' );
if( psz_ext )
{
int i;
for( i = 0; http_mime[i].psz_ext != NULL ; i++ )
{
if( !strcmp( http_mime[i].psz_ext, psz_ext ) )
{
return( http_mime[i].psz_mime );
}
}
}
return( "application/octet-stream" );
}
#endif
/*****************************************************************************
* Open: open the file
*****************************************************************************/
...
...
@@ -272,16 +220,16 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Write:
*****************************************************************************/
static
int
Write
(
sout_access_out_t
*
p_access
,
sout_buffer
_t
*
p_buffer
)
static
int
Write
(
sout_access_out_t
*
p_access
,
block
_t
*
p_buffer
)
{
sout_access_out_sys_t
*
p_sys
=
p_access
->
p_sys
;
int
i_err
=
0
;
while
(
p_buffer
)
{
sout_buffer
_t
*
p_next
;
block
_t
*
p_next
;
if
(
p_buffer
->
i_flags
&
SOUT_BUFFER_FLAGS
_HEADER
)
if
(
p_buffer
->
i_flags
&
BLOCK_FLAG
_HEADER
)
{
/* gather header */
if
(
p_sys
->
b_header_complete
)
...
...
@@ -290,18 +238,18 @@ static int Write( sout_access_out_t *p_access, sout_buffer_t *p_buffer )
p_sys
->
i_header_size
=
0
;
p_sys
->
b_header_complete
=
VLC_FALSE
;
}
if
(
(
int
)(
p_buffer
->
i_
size
+
p_sys
->
i_header_size
)
>
if
(
(
int
)(
p_buffer
->
i_
buffer
+
p_sys
->
i_header_size
)
>
p_sys
->
i_header_allocated
)
{
p_sys
->
i_header_allocated
=
p_buffer
->
i_
size
+
p_sys
->
i_header_size
+
1024
;
p_buffer
->
i_
buffer
+
p_sys
->
i_header_size
+
1024
;
p_sys
->
p_header
=
realloc
(
p_sys
->
p_header
,
p_sys
->
i_header_allocated
);
}
memcpy
(
&
p_sys
->
p_header
[
p_sys
->
i_header_size
],
p_buffer
->
p_buffer
,
p_buffer
->
i_
size
);
p_sys
->
i_header_size
+=
p_buffer
->
i_
size
;
p_buffer
->
i_
buffer
);
p_sys
->
i_header_size
+=
p_buffer
->
i_
buffer
;
}
else
if
(
!
p_sys
->
b_header_complete
)
{
...
...
@@ -313,10 +261,10 @@ static int Write( sout_access_out_t *p_access, sout_buffer_t *p_buffer )
/* send data */
i_err
=
httpd_StreamSend
(
p_sys
->
p_httpd_stream
,
p_buffer
->
p_buffer
,
p_buffer
->
i_
size
);
p_buffer
->
i_
buffer
);
p_next
=
p_buffer
->
p_next
;
sout_BufferDelete
(
p_access
->
p_sout
,
p_buffer
);
block_Release
(
p_buffer
);
p_buffer
=
p_next
;
if
(
i_err
<
0
)
...
...
@@ -327,13 +275,7 @@ static int Write( sout_access_out_t *p_access, sout_buffer_t *p_buffer )
if
(
i_err
<
0
)
{
sout_buffer_t
*
p_next
;
while
(
p_buffer
)
{
p_next
=
p_buffer
->
p_next
;
sout_BufferDelete
(
p_access
->
p_sout
,
p_buffer
);
p_buffer
=
p_next
;
}
block_ChainRelease
(
p_buffer
);
}
return
(
i_err
<
0
?
VLC_EGENERIC
:
VLC_SUCCESS
);
...
...
modules/access_output/udp.c
View file @
298f0e46
This diff is collapsed.
Click to expand it.
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