Quoting Gyan Doshi (2023-02-18 05:49:46) > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > index 33ab0bc8ba..46b4d177c3 100644 > --- a/libavformat/avformat.h > +++ b/libavformat/avformat.h > @@ -1886,6 +1886,28 @@ uint8_t *av_stream_get_side_data(const AVStream > *stream, > > AVProgram *av_new_program(AVFormatContext *s, int id); > > +/** > + * Copy an AVProgram from one AVFormatContext to another. > + * > + * Streams in the destination context whose IDs match the IDs of the streams > in the > + * source AVProgram index are added to the stream index of the copied > AVProgram. > + * > + * If a new program has to be added, the function expects and requires any > existing buffer > + * holding the array of pointers to AVPrograms in the destination context to > have its size > + * be a power-of-two value. This should be the case if all earlier programs > were created > + * using av_new_program or this function. > + * > + * @param dst pointer to the target muxer context > + * @param src pointer to the source muxer context > + * @param progid ID of the program to be copied > + * @param overwrite whether to overwrite if target muxer already > + * contains a program with the same ID > + * > + * @return >= 0 in case of success, a negative AVERROR code in case of > + * failure > + */ > +int av_program_copy(AVFormatContext *dst, const AVFormatContext *src, int > progid, int overwrite);
Why identify source programs by id rather than the structure itself? Also, overwrite should really be a more generic flags field for future extension. Overall I remain uneasy about this being public - the semantics are rather tricky and fragile unless the streams between src and dst match exactly. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".