* Copy all stream parameters from source to destination stream, with the * exception of the index field, which is usually set by avformat_new_stream(). * * @param dst pointer to destination AVStream * @param src pointer to source AVStream * @return >=0 on success, AVERROR code on error */
| 204 | * @return >=0 on success, AVERROR code on error |
| 205 | */ |
| 206 | static int stream_params_copy(AVStream *dst, const AVStream *src) |
| 207 | { |
| 208 | int ret; |
| 209 | |
| 210 | dst->id = src->id; |
| 211 | dst->time_base = src->time_base; |
| 212 | dst->start_time = src->start_time; |
| 213 | dst->duration = src->duration; |
| 214 | dst->nb_frames = src->nb_frames; |
| 215 | dst->disposition = src->disposition; |
| 216 | dst->discard = src->discard; |
| 217 | dst->sample_aspect_ratio = src->sample_aspect_ratio; |
| 218 | dst->avg_frame_rate = src->avg_frame_rate; |
| 219 | dst->event_flags = src->event_flags; |
| 220 | dst->r_frame_rate = src->r_frame_rate; |
| 221 | dst->pts_wrap_bits = src->pts_wrap_bits; |
| 222 | |
| 223 | av_dict_free(&dst->metadata); |
| 224 | ret = av_dict_copy(&dst->metadata, src->metadata, 0); |
| 225 | if (ret < 0) |
| 226 | return ret; |
| 227 | |
| 228 | ret = avcodec_parameters_copy(dst->codecpar, src->codecpar); |
| 229 | if (ret < 0) |
| 230 | return ret; |
| 231 | |
| 232 | av_packet_unref(&dst->attached_pic); |
| 233 | if (src->attached_pic.data) { |
| 234 | ret = av_packet_ref(&dst->attached_pic, &src->attached_pic); |
| 235 | if (ret < 0) |
| 236 | return ret; |
| 237 | } |
| 238 | |
| 239 | return 0; |
| 240 | } |
| 241 | |
| 242 | AVStream *ff_stream_clone(AVFormatContext *dst_ctx, const AVStream *src) |
| 243 | { |
no test coverage detected