From c0c914effd94324362e4ca70204f1b08783f6121 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 23 Apr 2008 07:01:31 +0300 Subject: Move audio_id and video_id to options struct --- stream/asf_mmst_streaming.c | 3 ++- stream/asf_streaming.c | 18 +++++++++--------- stream/network.h | 3 +++ 3 files changed, 14 insertions(+), 10 deletions(-) (limited to 'stream') diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c index 31536a9dae..a0b4295102 100644 --- a/stream/asf_mmst_streaming.c +++ b/stream/asf_mmst_streaming.c @@ -35,7 +35,7 @@ #include #include "config.h" - +#include "options.h" #include "mp_msg.h" #include "help_mp.h" @@ -648,6 +648,7 @@ int asf_mmst_streaming_start(stream_t *stream) memset (data, 0, 40); + int audio_id = stream->opts->audio_id; if (audio_id > 0) { data[2] = 0xFF; data[3] = 0xFF; diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c index 448f41064d..1082ec374a 100644 --- a/stream/asf_streaming.c +++ b/stream/asf_streaming.c @@ -8,6 +8,7 @@ #include "config.h" #include "mp_msg.h" #include "help_mp.h" +#include "options.h" #ifndef HAVE_WINSOCK2 #define closesocket close @@ -146,9 +147,6 @@ printf("0x%02X\n", stream_chunck->type ); return stream_chunck->size+4; } -extern int audio_id; -extern int video_id; - static void close_s(stream_t *stream) { close(stream->fd); stream->fd=-1; @@ -364,24 +362,24 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) return -1; } - if (audio_id > 0) + if (*streaming_ctrl->audio_id_ptr > 0) // a audio stream was forced - asf_ctrl->audio_id = audio_id; + asf_ctrl->audio_id = *streaming_ctrl->audio_id_ptr; else if (a_idx >= 0) asf_ctrl->audio_id = asf_ctrl->audio_streams[a_idx]; else if (asf_ctrl->n_audio) { mp_msg(MSGT_NETWORK, MSGL_WARN, MSGTR_MPDEMUX_ASF_Bandwidth2SmallDeselectedAudio); - audio_id = -2; + *streaming_ctrl->audio_id_ptr = -2; } - if (video_id > 0) + if (*streaming_ctrl->video_id_ptr > 0) // a video stream was forced - asf_ctrl->video_id = video_id; + asf_ctrl->video_id = *streaming_ctrl->video_id_ptr; else if (v_idx >= 0) asf_ctrl->video_id = asf_ctrl->video_streams[v_idx]; else if (asf_ctrl->n_video) { mp_msg(MSGT_NETWORK, MSGL_WARN, MSGTR_MPDEMUX_ASF_Bandwidth2SmallDeselectedVideo); - video_id = -2; + *streaming_ctrl->video_id_ptr = -2; } return 1; @@ -817,6 +815,8 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { if( stream->streaming_ctrl==NULL ) { return STREAM_ERROR; } + stream->streaming_ctrl->audio_id_ptr = &stream->opts->audio_id; + stream->streaming_ctrl->video_id_ptr = &stream->opts->video_id; stream->streaming_ctrl->bandwidth = network_bandwidth; url = url_new(stream->url); stream->streaming_ctrl->url = check4proxies(url); diff --git a/stream/network.h b/stream/network.h index 6aa0457fb2..2d3b96166e 100644 --- a/stream/network.h +++ b/stream/network.h @@ -46,6 +46,9 @@ typedef struct streaming_control { int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl ); int (*streaming_seek)( int fd, off_t pos, struct streaming_control *stream_ctrl ); void *data; + // hacks for asf + int *audio_id_ptr; + int *video_id_ptr; } streaming_ctrl_t; //int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url ); -- cgit v1.2.3