Commit 056d973a authored by nicodvb's avatar nicodvb

API extension: AVProgram now has an array (stream_index) containing the...

API extension: AVProgram now has an array (stream_index) containing the indexes of the streams in AVFormatContext

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10819 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 6d73ad1b
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#ifndef FFMPEG_AVFORMAT_H #ifndef FFMPEG_AVFORMAT_H
#define FFMPEG_AVFORMAT_H #define FFMPEG_AVFORMAT_H
#define LIBAVFORMAT_VERSION_INT ((51<<16)+(15<<8)+0) #define LIBAVFORMAT_VERSION_INT ((51<<16)+(16<<8)+0)
#define LIBAVFORMAT_VERSION 51.15.0 #define LIBAVFORMAT_VERSION 51.16.0
#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
...@@ -353,6 +353,8 @@ typedef struct AVProgram { ...@@ -353,6 +353,8 @@ typedef struct AVProgram {
char *name; ///< Service name for DVB streams char *name; ///< Service name for DVB streams
int flags; int flags;
enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller
unsigned int *stream_index;
unsigned int nb_stream_indexes;
} AVProgram; } AVProgram;
#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present #define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present
......
...@@ -2067,6 +2067,7 @@ void av_close_input_file(AVFormatContext *s) ...@@ -2067,6 +2067,7 @@ void av_close_input_file(AVFormatContext *s)
for(i=s->nb_programs-1; i>=0; i--) { for(i=s->nb_programs-1; i>=0; i--) {
av_freep(&s->programs[i]->provider_name); av_freep(&s->programs[i]->provider_name);
av_freep(&s->programs[i]->name); av_freep(&s->programs[i]->name);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]); av_freep(&s->programs[i]);
} }
flush_packet_queue(s); flush_packet_queue(s);
...@@ -2483,6 +2484,29 @@ fail: ...@@ -2483,6 +2484,29 @@ fail:
return ret; return ret;
} }
void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)
{
int i, j;
AVProgram *program=NULL;
void *tmp;
for(i=0; i<ac->nb_programs; i++){
if(ac->programs[i]->id != progid)
continue;
program = ac->programs[i];
for(j=0; j<program->nb_stream_indexes; j++)
if(program->stream_index[j] == idx)
return;
tmp = av_realloc(program->stream_index, sizeof(unsigned int)*(program->nb_stream_indexes+1));
if(!tmp)
return;
program->stream_index = tmp;
program->stream_index[program->nb_stream_indexes++] = idx;
return;
}
}
/* "user interface" functions */ /* "user interface" functions */
static void dump_stream_format(AVFormatContext *ic, int i, int index, char *buf, int is_output) static void dump_stream_format(AVFormatContext *ic, int i, int index, char *buf, int is_output)
{ {
...@@ -2554,6 +2578,16 @@ void dump_format(AVFormatContext *ic, ...@@ -2554,6 +2578,16 @@ void dump_format(AVFormatContext *ic,
} }
av_log(NULL, AV_LOG_INFO, "\n"); av_log(NULL, AV_LOG_INFO, "\n");
} }
if(ic->nb_programs) {
int j, k;
for(j=0; j<ic->nb_programs; j++) {
av_log(NULL, AV_LOG_INFO, " Program %d", ic->programs[j]->id);
if(ic->programs[j]->name)
av_log(NULL, AV_LOG_INFO, " \"%s\"\n", ic->programs[j]->name);
for(k=0; k<ic->programs[j]->nb_stream_indexes; k++)
dump_stream_format(ic, ic->programs[j]->stream_index[k], index, buf, is_output);
}
} else
for(i=0;i<ic->nb_streams;i++) for(i=0;i<ic->nb_streams;i++)
dump_stream_format(ic, i, index, buf, is_output); dump_stream_format(ic, i, index, buf, is_output);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment