1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-01 23:00:41 +00:00
mpv/stream/open.c
Uoti Urpala f518cf7ea9 Add option pointer to stream struct (at least temporarily)
The stream code does not access many option variables directly, but it
does access some such as audio_id and network_bandwidth (and does that
without including proper headers for them). Add option pointer to the
stream struct to allow access to those variables. Remove the unused
(always NULL) and clumsy-looking char** options parameter in the
open_stream call and replace it with the option pointer. The parameter
is currently only set in the main open_stream() call in MPlayer.c and
not in any other locations that can open a stream.

In the long term it might be better to pass a more limited set of
values somehow, but this should do for now.
2008-04-23 13:48:38 +03:00

50 lines
994 B
C

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#ifdef __FreeBSD__
#include <sys/cdrio.h>
#endif
#include "m_option.h"
#include "stream.h"
#include "libmpdemux/demuxer.h"
/// We keep these 2 for the gui atm, but they will be removed.
int vcd_track=0;
char* cdrom_device=NULL;
int dvd_chapter=1;
int dvd_last_chapter=0;
char* dvd_device=NULL;
int dvd_title=0;
// Open a new stream (stdin/file/vcd/url)
stream_t* open_stream(char* filename, struct MPOpts *options, int* file_format)
{
// Check if playlist or unknown
if (*file_format != DEMUXER_TYPE_PLAYLIST){
*file_format=DEMUXER_TYPE_UNKNOWN;
}
if(!filename) {
mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
return NULL;
}
//============ Open STDIN or plain FILE ============
return open_stream_full(filename,STREAM_READ,options,file_format);
}